hallahan / LeafletPlayback

This is a Leaflet plug-in that plays back points that have a time stamp synchronized to a clock.
http://leafletplayback.theoutpost.io
Other
482 stars 165 forks source link

Multiple tracks: Hide/show individually #66

Open SFSailor opened 6 years ago

SFSailor commented 6 years ago

The plugin is working great, but I want to add the ability to show or hide markers and their tracks individually.

Marker part works easily: I put each member of playback._trackController._tracks into an indexed array, then I can manipulate the .marker property of that to add or remove.

How can I grab the track line also?

Thanks!

britoyenci commented 6 years ago

Hi...

I've the same question... I need to show/hide tracks individually on the map, but I haven't found the solution. Did you find any solution? If so, can you share it please?

Thank's..

SFSailor commented 6 years ago

I did find a solution which was to hid all the tracks and then, on a track-by-track basis, replicate them as individual polylines.

I believe this is the code that does it. Elsewhere, I had set the native track color to 0 to make it invisible.

teams[ix] = {}; teams[ix].marker = marker; teams[ix].title = marker.options.title; teams[ix].ix = ix; teams[ix].color = marker.options.icon.options.fillColor;

var mytrack = L.geoJSON(playback._trackController._tracks[i]._geoJSON, { style:{ color:teams[ix].color, dashArray:dashPatterns[ix%5], weight:2, } }).addTo(map); teams[ix].track = mytrack;

On Thu, Aug 30, 2018 at 8:41 AM, britoyenci notifications@github.com wrote:

Hi...

I've the same question... I need to show/hide tracks individually on the map, but I haven't found the solution. Did you find any solution? If so, can you share it please?

Thank's..

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hallahan/LeafletPlayback/issues/66#issuecomment-417365993, or mute the thread https://github.com/notifications/unsubscribe-auth/Af9OqA4Ec6dZ1IMXH4tOFGGxqNf_hKMwks5uWAe0gaJpZM4VMD_j .

britoyenci commented 6 years ago

Ok...

I'm going to try based on that ...

Thank you...

SFSailor commented 6 years ago

It works on mine. You need to work out a scheme for addressing the track you want to show/hide. I maintain an array with an index....

On Thu, Aug 30, 2018 at 11:33 AM, britoyenci notifications@github.com wrote:

Ok...

I'm going to try based on that ...

Thank you...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hallahan/LeafletPlayback/issues/66#issuecomment-417422688, or mute the thread https://github.com/notifications/unsubscribe-auth/Af9OqOaDyBegkZki6M2txMdTl5aVqhLfks5uWC_sgaJpZM4VMD_j .

SFSailor commented 9 months ago

I will need to dig up the code....

On Fri, Dec 8, 2023 at 12:25 AM Aycaa @.***> wrote:

Hello, I'm trying to do something similar to your example. However, I was not successful. Can you share a similar example? Thanks in advance :)

— Reply to this email directly, view it on GitHub https://github.com/hallahan/LeafletPlayback/issues/66#issuecomment-1846753740, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH7U5KALG2DRWAJ6VKQSSRDYILFHNAVCNFSM4FJQH7R2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBUGY3TKMZXGQYA . You are receiving this because you authored the thread.Message ID: @.***>