Notices


Reply
Thread Tools
Posts: 392 | Thanked: 1,744 times | Joined on Aug 2016 @ Estonia
#61
Originally Posted by jdrescher View Post
I already did this and it works. The startup issue is solved with this solution.

Thanks for looking into that. I will do no workarounds for the during workout issue and wait what you come up with.
Great! Thanks for reporting it.
 

The Following 2 Users Say Thank You to rinigus For This Useful Post:
Posts: 46 | Thanked: 175 times | Joined on Apr 2017 @ Germany
#62
I think I nailed the "during workout" problem.
The app calls the update function once every second. Normally this is no problem because the map is shown and the track is directly rendered.
But if the app is in background (phone is in standby), the update function is still called every second. And then when the app comes back to focus, the map plugin needs to render thousands of track points in a very short period of time.
This is all my fault. It does not make sense and is very unclean to do anything with the map if it's not viewed at all.
So I will modify the app so that only if the map is shown and active, things are done (update, center on current position, draw map icons).
 

The Following 2 Users Say Thank You to jdrescher For This Useful Post:
Posts: 392 | Thanked: 1,744 times | Joined on Aug 2016 @ Estonia
#63
Originally Posted by jdrescher View Post
I think I nailed the "during workout" problem.
The app calls the update function once every second. Normally this is no problem because the map is shown and the track is directly rendered.
But if the app is in background (phone is in standby), the update function is still called every second. And then when the app comes back to focus, the map plugin needs to render thousands of track points in a very short period of time.
This is all my fault. It does not make sense and is very unclean to do anything with the map if it's not viewed at all.
So I will modify the app so that only if the map is shown and active, things are done (update, center on current position, draw map icons).
Such scenario could lead to this effect, indeed. I doubt that openGL rendering functions are called while the app is minimized which could lead to accumulation of requests in the stack.

I think that I will still add a check when updating the source on whether the same source update is waiting in the stack. If it is, then the latest version will be used only. That should avoid these problems in future. But making an app a bit more conservative wouldn't hurt either.
 

The Following 2 Users Say Thank You to rinigus For This Useful Post:
Posts: 204 | Thanked: 362 times | Joined on Nov 2010
#64
@rinigus How can I add 'google encoded polyline' to the mapbox widget?
 

The Following User Says Thank You to piggz For This Useful Post:
Posts: 392 | Thanked: 1,744 times | Joined on Aug 2016 @ Estonia
#65
Originally Posted by piggz View Post
@rinigus How can I add 'google encoded polyline' to the mapbox widget?
@piggz, you would have to decode it first. Usually, you want to do something with the polyline in addition to showing it. So, I would expect that you would have to decode it anyway and there is no need to add support for decoding into the widget. Unless you have a good use-case where there is no need for decoding and you think that the functionality should be provided by the widget.

So, as soon as it is decoded (there are codes around), add it to the widget as a source using addSourceLine (example commented out at https://github.com/rinigus/mapbox-gl.../main.qml#L260), add layer using addLayer and set its properties (see https://github.com/rinigus/mapbox-gl.../main.qml#L262 and below)
 

The Following 2 Users Say Thank You to rinigus For This Useful Post:
Posts: 204 | Thanked: 362 times | Joined on Nov 2010
#66
@rinigus, im retrieving the data from a remote api (strava) and cant see why i woukd want to change it locally, however ill give your suggestion a go.
 

The Following User Says Thank You to piggz For This Useful Post:
Posts: 392 | Thanked: 1,744 times | Joined on Aug 2016 @ Estonia
#67
Originally Posted by piggz View Post
@rinigus, im retrieving the data from a remote api (strava) and cant see why i woukd want to change it locally, however ill give your suggestion a go.
Its quite common to get this encoded polyline from remote services (same for Valhalla, for example). However, if you want to calculate something from it (like length, or find specific location), you would need to decode it.

Let me know if you get into trouble.
 

The Following User Says Thank You to rinigus For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 01:34.