Notices


Reply
Thread Tools
Posts: 415 | Thanked: 1,861 times | Joined on Aug 2016 @ Estonia
#71
Originally Posted by m4r0v3r View Post
i was wondering how I could get the center point on the map after I finish scrolling
Depends on the app that you use. For Poor Maps GL, double click anywhere on the map should center you at the current location.
 

The Following User Says Thank You to rinigus For This Useful Post:
Posts: 1,734 | Thanked: 1,789 times | Joined on Dec 2010
#72
Originally Posted by rinigus View Post
Depends on the app that you use. For Poor Maps GL, double click anywhere on the map should center you at the current location.
sorry I mean how do I get the centre coords. I have a pin in the center of the screen, I move the map underneath the pin so lat and lng will change. how can I get the lat lng the pin is now at?
 

The Following User Says Thank You to m4r0v3r For This Useful Post:
Posts: 415 | Thanked: 1,861 times | Joined on Aug 2016 @ Estonia
#73
Originally Posted by m4r0v3r View Post
sorry I mean how do I get the centre coords. I have a pin in the center of the screen, I move the map underneath the pin so lat and lng will change. how can I get the lat lng the pin is now at?
Sorry, I misunderstood. I assume that you write an app and want to know API, right?

To get coordinate of any pixel, you call method

Code:
queryCoordinateForPixel(const QPointF p, const QVariant &tag = QVariant())
This method will return immediately and the reply you will get somewhat later (has to go through to other thread and so on) via signal

Code:
replyCoordinateForPixel(const QPointF pixel, QGeoCoordinate geocoordinate, qreal degLatPerPixel, qreal degLonPerPixel, const QVariant &tag)

The signal will carry correct geocoordinate as well as its derivative per pixel (if you wish to apply some sensitivity analysis to the result).

See query example at https://github.com/rinigus/mapbox-gl...es-and-signals

So, in your case, find pixel coordinates of the pin and ask for its geolocation using queryCoordinateForPixel
 

The Following User Says Thank You to rinigus For This Useful Post:
Posts: 1,734 | Thanked: 1,789 times | Joined on Dec 2010
#74
Originally Posted by rinigus View Post
Sorry, I misunderstood. I assume that you write an app and want to know API, right?

To get coordinate of any pixel, you call method

Code:
queryCoordinateForPixel(const QPointF p, const QVariant &tag = QVariant())
This method will return immediately and the reply you will get somewhat later (has to go through to other thread and so on) via signal

Code:
replyCoordinateForPixel(const QPointF pixel, QGeoCoordinate geocoordinate, qreal degLatPerPixel, qreal degLonPerPixel, const QVariant &tag)

The signal will carry correct geocoordinate as well as its derivative per pixel (if you wish to apply some sensitivity analysis to the result).

See query example at https://github.com/rinigus/mapbox-gl...es-and-signals

So, in your case, find pixel coordinates of the pin and ask for its geolocation using queryCoordinateForPixel
ahhh okay thanks and yeahh making an app here


https://github.com/ghosalmartin/harbour-uber
 

The Following 2 Users Say Thank You to m4r0v3r For This Useful Post:
Posts: 48 | Thanked: 180 times | Joined on Apr 2017 @ Germany
#75
Originally Posted by rinigus View Post
@jdrescher, would you mind to test whether it fixed also the issues woth longer workouts?
Hi rinigus, I have tested your bugfix release.
First I setup an environment to reproduce the problem. For that I used Laufhelden 0.9.8-9 and mapboxgl-qml-1.1.1-10.29.1. Then I put an autosave file of a large workout into the /Laufelden directory and then started the app.
Then while loading the autosave the app crashed.

Then I just switched to your new release mapboxgl-qml-1.1.2-10.31.1. everything else I left untouched. When I now start the app, it still freezes for about 30 seconds, but then it recoveres and starts working normally.

So I can say: bug fixed, good job!
 

The Following 3 Users Say Thank You to jdrescher For This Useful Post:
Posts: 415 | Thanked: 1,861 times | Joined on Aug 2016 @ Estonia
#76
Originally Posted by jdrescher View Post
Hi rinigus, I have tested your bugfix release.
First I setup an environment to reproduce the problem. For that I used Laufhelden 0.9.8-9 and mapboxgl-qml-1.1.1-10.29.1. Then I put an autosave file of a large workout into the /Laufelden directory and then started the app.
Then while loading the autosave the app crashed.

Then I just switched to your new release mapboxgl-qml-1.1.2-10.31.1. everything else I left untouched. When I now start the app, it still freezes for about 30 seconds, but then it recoveres and starts working normally.

So I can say: bug fixed, good job!
Thank you for testing!
 

The Following 2 Users Say Thank You to rinigus For This Useful Post:
Posts: 48 | Thanked: 180 times | Joined on Apr 2017 @ Germany
#77
Originally Posted by rinigus View Post
When this happens, the client programs would have to enable layout properties for the symbols that they wish to keep always visible
I am working on making my app compatible to the new requirements. Just to make sure that I do it right, here is an example:
Code:
//This is the first data point, draw the start icon
map.addSourcePoint("pointStartImage",  trackLoader.trackPointAt(i));
map.addImagePath("imageStartImage", Qt.resolvedUrl("../img/map_play.png"));
map.addLayer("layerStartLayer", {"type": "symbol", "source": "pointStartImage"});
map.setLayoutProperty("layerStartLayer", "icon-image", "imageStartImage");
map.setLayoutProperty("layerStartLayer", "icon-size", 1.0 / map.pixelRatio);
map.setLayoutProperty("layerStartLayer", "visibility", "visible");
map.setLayoutProperty("layerStartLayer", "icon-allow-overlap", true);
 

The Following 2 Users Say Thank You to jdrescher For This Useful Post:
Posts: 415 | Thanked: 1,861 times | Joined on Aug 2016 @ Estonia
#78
Originally Posted by jdrescher View Post
I am working on making my app compatible to the new requirements. Just to make sure that I do it right, here is an example:
It looks fine. You don't need to specify "visibility" since its visible by default anyway
(https://www.mapbox.com/mapbox-gl-js/...bol-visibility). However, its a good idea to allow overlap in this case, since you change the default (https://www.mapbox.com/mapbox-gl-js/...-allow-overlap). So, the code would be:

Code:
//This is the first data point, draw the start icon
map.addSourcePoint("pointStartImage",  trackLoader.trackPointAt(i));
map.addImagePath("imageStartImage", Qt.resolvedUrl("../img/map_play.png"));
map.addLayer("layerStartLayer", {"type": "symbol", "source": "pointStartImage"});
map.setLayoutProperty("layerStartLayer", "icon-image", "imageStartImage");
map.setLayoutProperty("layerStartLayer", "icon-size", 1.0 / map.pixelRatio);
map.setLayoutProperty("layerStartLayer", "icon-allow-overlap", true);
 

The Following 3 Users Say Thank You to rinigus For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 00:06.