wiedehopf / tar1090

Provides an improved webinterface for use with ADS-B decoders readsb / dump1090-fa
Other
1.27k stars 237 forks source link

[Feature] Ruler / Draw on Map #306

Open jwalatham opened 5 months ago

jwalatham commented 5 months ago

It would be great to utilise the Openlayers ruler code, to draw a line between two points on the map and measure the distance and bearing between them. For example, to measure how far an aircraft is from my location or another point, or the distance between two aircraft.

RundesBalli commented 5 months ago

Very nice idea, I support this feature request. :-)

mpentler commented 4 months ago

I've wanted to try and do this for a while but couldn't figure it out. It'd be like ATC staff have on their displays and would be cool for better situational awareness. I'd love to see this but foresee it being difficult to integrate with scrolling and map clicking. Maybe a button up top to enter that mode?

mpentler commented 4 months ago

Well, I started to learn how to make a layer and draw on it, and now I've added a ruler button that turns the layer on and off and draws a dot at 0,0.

Baby steps. This is helping me to learn the tar1090 flow too. I need to figure out where to add some click handlers to be able to draw on the map, though.

wiedehopf commented 4 months ago

Really one issue is where to put an extra button.

I suppose the extra button can be enabled from the settings menu ...

mpentler commented 4 months ago

You're right. I am not running globe mode on my local install, so I had no replay button and could stick it there. Otherwise it'd just have to go next to it, and then that's 5 buttons on the top row: U/H/T/Replay/Ruler

Other option is a button on the top left, somewhere untouched by other things right now. Although my ruler controls are currently displayed up there when you turn the ruler mode on, so that won't work for me during this testing.

Could make it a drop down thing - but the problem with the design side is that there's too many possibilities with it. I am trying to match the design of the map as-is right now.

Edit: Is this where the magic happens? I'll need to put in code to handle ruler mode here, and I expect I will need to modify the other clauses. Current idea I have right now is to disable everything else when in ruler mode (so selecting and deselecting planes, double click to follow etc) - not sure if you have opinions on this?

OLMap.on(['click', 'dblclick'], function(evt) {
  more here
  ...

Edit: Seemingly it is! I can click the map and have some coordinates put into my little window.

mpentler commented 4 months ago

Got a working prototype going, but I don't think my code is really up to scratch. I will probably put it in a branch on my own fork. It also respects your DisplayUnits choice.

Only issue is this looks awful on mobile and interferes with those buttons. Also 5 in a row doesn't look great on mobile (say, if Replay button is there).

image image

mpentler commented 3 months ago

Now up on my repo, ruler branch. It's very shit.