Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can i update the line in Real time by adding more latlng #9

Open
thorizer opened this issue Aug 14, 2022 · 7 comments
Open

can i update the line in Real time by adding more latlng #9

thorizer opened this issue Aug 14, 2022 · 7 comments

Comments

@thorizer
Copy link

is updating the line in Real time by adding more latlng possible ?

@ibrierley
Copy link
Owner

I think so (if I understand correct), as it's doing that all the time anyway. Just remember to call setState on the whole thing to update.

@thorizer
Copy link
Author

will that animate the line from the start ou just then new update?

@ibrierley
Copy link
Owner

ah maybe I'm misunderstanding then...it will probably depend on your settings, if its mid-animation and you add some points, I'm not quite sure what will happen. Try it :).

@thorizer
Copy link
Author

will try and see how it works

@ibrierley
Copy link
Owner

I have a feeling it will probably just animate the original line (it kind of uses originalPoints to then build an interpolated state builtPoints, which probably won't be updated), as it duration won't really make sense, when bits get added on. So I think it would only work "properly" on a fresh set of data each time. Apologies if I confused you with that earlier as I misunderstood what you were after...

It sounds a bit like you want some slightly delayed animation based on real time information ? Just trying to think if there's a way around that, ie build the main line each time (non-animated as the time has passed), and just use the LineAnimator for each new delayed point, but it depends on the exact use case really.

@ibrierley
Copy link
Owner

Just to explain a bit clearer...
Have 2 Polylines

PolyLineLayerOptions( polylines: [
   alreadyCompletePolyline,  
   animatingPolyline //(which is the one LineAnimator updates)
])

As you get a new point, you create a new LineAnimator from the last point of alreadyCompletePolyline, to the new point, for a duration of 5 seconds for example.
Once that animation is complete, add that last point to the alreadyCompletePolyline, and then create a new animatingPolyline from that point to the new one again.
And so on...

@thorizer
Copy link
Author

@ibrierley thanks, I'm currently using flutter_map v3, i'll try it when this plugin gets updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants