hydrocode-de / integra-frontend

React frontend for INTEGRA
0 stars 1 forks source link

Distance layer #143

Closed mmaelicke closed 1 month ago

mmaelicke commented 1 month ago

closes #139 and closes #137

Calculating the correct distances, from the correct distance features was kind of a brainf**k, but works now. There are two icons, one enables distance measurements between all tree lines that are closer than 100m, the other one calculates the distance to the closest 3 trees and the all lines within 150m.

This PR does not include distance warnings yet. That has to be handled in an extra issue, as this is already complex enough.

One downside is that the distance calculation is triggered by mapbox events. During dragging, the map is out of context and no map events are fired and, thus, the distances are not calculated during dropping, only during dragging. There is no technical way how this can be solved. The only solution I can think of is: listen to mouse events in the browser. check if the user is dragging (that is actually more complicated than I thought) and the measurements are enabled. then capture the viewport of the mouse, transform to screen pixel coordinates, shift by offset through scrollbars and headers, and check the map for a pixelLocation (if technical possible), then geo-reference that location to the map. This will be a major development, which would possibly take up all the time until the presentation. @JesJehle, I am open to suggestions, how to solve that, @karpaddel @noobla11, please have a look and assess how important the feature is.

github-actions[bot] commented 1 month ago

Visit the preview URL for this PR (updated for commit 3785b77):

https://integra-223bf--pr143-distance-layer-0r6u6ol9.web.app

(expires Sat, 25 May 2024 08:34:18 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: ccb6d271698eb667c2f8f1dbd17a4a78744476bc

mmaelicke commented 1 month ago

I'll close this in favor of #145