maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   [SFOS] Mapbox GL Native QML plugin (https://talk.maemo.org/showthread.php?t=99953)

rinigus 2018-01-31 20:17

Re: Mapbox GL Native QML plugin
 
Quote:

Originally Posted by m4r0v3r (Post 1540736)
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.

m4r0v3r 2018-01-31 20:33

Re: Mapbox GL Native QML plugin
 
Quote:

Originally Posted by rinigus (Post 1540737)
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?

rinigus 2018-01-31 20:40

Re: Mapbox GL Native QML plugin
 
Quote:

Originally Posted by m4r0v3r (Post 1540739)
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

m4r0v3r 2018-01-31 20:42

Re: Mapbox GL Native QML plugin
 
Quote:

Originally Posted by rinigus (Post 1540740)
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

jdrescher 2018-02-04 12:33

Re: Mapbox GL Native QML plugin
 
Quote:

Originally Posted by rinigus (Post 1540424)
@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! ;)

rinigus 2018-02-04 12:56

Re: Mapbox GL Native QML plugin
 
Quote:

Originally Posted by jdrescher (Post 1540845)
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!

jdrescher 2018-02-05 06:41

Re: Mapbox GL Native QML plugin
 
Quote:

Originally Posted by rinigus (Post 1540591)
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);


rinigus 2018-02-05 07:41

Re: Mapbox GL Native QML plugin
 
Quote:

Originally Posted by jdrescher (Post 1540879)
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);


rinigus 2018-03-04 11:56

Re: Mapbox GL Native QML plugin
 
The plugin has been updated to 1.2.0. Its still on the same QMapboxGL version, I am waiting for the next QMapboxGL release to update it.

Version 1.2.0 brings enhancements:

* allow fixing zoom levels to integers. Suggested and implemented by @otsaloma to provide better support for raster maps

* allow clearing cache (suggested by @otsaloma)

New version is out at OBS and OpenRepos.

olf 2018-03-09 17:02

Re: Mapbox GL Native QML plugin
 
Hello @ringius (and @jdrescher, @otsaloma, @MartinK),

Background:
I was surprised to find mapboxgl-qml installed on my Jolla 1 phone. While OSMscout server, PoorMaps, ModRana and Laufhelden are installed, PoorMaps GL and associated libraries were not installed (at least not manually and deliberately).
Looking for the reason, I found that Laufhelden's RPM Spec-file pulls in mapboxgl-qml unconditionally.

As supposedly mapboxgl-qml was already installed for some time and I did not experience any effects, I wonder:
  • May mapboxgl-qml cause any negative effects on Jolla 1 phones, besides the disk space used and having another RPM installed (plus eventual dependencies)?
  • Can mapboxgl-qml be of any use on Jolla 1 phones (i.e. albeit slow, is this technically feasible at all)?
  • If not, why does it install at all (in an unsupported environment)?
These questions are aiming in two directions:
  • How should authors of software handle a potential dependency on mapboxgl-qml, which varies with the environment (i.e. device / installed libraries)?
  • Is there any chance of enabling mapboxgl-qml to run on Jolla 1 phones (no matter how slow)?
Many thanks to you all for your marvelous work!


All times are GMT. The time now is 03:04.

vBulletin® Version 3.8.8