Active Topics

 



Notices


Reply
Thread Tools
Posts: 275 | Thanked: 1,239 times | Joined on Oct 2013 @ France
#91
Originally Posted by rinigus View Post
Zeta, thank you very much for the podcast and the code! Note that we now have an access to the map style editors that are quite good and simple to use. So, it should be simple to make new styles - much easier than it was with the Mapnik solution used by OSM Scout Server.
I think you are mistaken, my problem is only a lack of design skills, not missing tools like the map style editor which in fact I used (Mapbox studio)
When I have something functional, I'll try to ask a friend who is a designer to help me pick a better color palette !
 

The Following 2 Users Say Thank You to Zeta For This Useful Post:
Posts: 467 | Thanked: 2,199 times | Joined on Aug 2016 @ Estonia
#92
The QML plugin is available at https://build.merproject.org/package...s/mapboxgl-qml . All you have to do is to install it from this repository and you'll get access to

Code:
import MapboxMap 1.0
and MapboxMap type in QML.

Plugin has been compiled using rpm spec in https://github.com/rinigus/mapbox-gl-qml . If you wish to use these bindings in C++ application, just clone as a submodule the repository and include mapbox-gl-qml.pri into your project, as before.

As far as I tested, the plugin worked with the trivial QML application that had MapboxMap filling Page. This should allow to use this plugin for python-based SFOS apps.

If someone has a better idea on naming the plugin or its distribution, please let me know.
 

The Following 5 Users Say Thank You to rinigus For This Useful Post:
Posts: 467 | Thanked: 2,199 times | Joined on Aug 2016 @ Estonia
#93
As a warning regarding API stability:

I am going through Poor Maps source and adjusting API (mainly by adding methods) to make it easy to use in practice. Already now some methods have been added and I expect that more are needed while porting. So, give me few days to work on it and make the API better.

When done, what you should expect when porting the app to MapboxMap is a major reduction in the app code. For example, all tiles (vector and raster) are downloaded by QMapboxGL and there is no code expected for handling these downloads on the app side - just define the style and let MapboxMap do its magic
 

The Following 4 Users Say Thank You to rinigus For This Useful Post:
Posts: 4 | Thanked: 9 times | Joined on Sep 2017
#94
Originally Posted by rinigus View Post
The QML plugin is available at https://build.merproject.org/package...s/mapboxgl-qml . All you have to do is to install it from this repository and you'll get access to

Code:
import MapboxMap 1.0
and MapboxMap type in QML.

Plugin has been compiled using rpm spec in https://github.com/rinigus/mapbox-gl-qml . If you wish to use these bindings in C++ application, just clone as a submodule the repository and include mapbox-gl-qml.pri into your project, as before.

As far as I tested, the plugin worked with the trivial QML application that had MapboxMap filling Page. This should allow to use this plugin for python-based SFOS apps.

If someone has a better idea on naming the plugin or its distribution, please let me know.
Link isn't working for me?
 
Posts: 467 | Thanked: 2,199 times | Joined on Aug 2016 @ Estonia
#95
I would like to ask for help from QML experts. For interaction with the widget, we need mouse interaction area that would support:
  • panning
  • pinch to zoom
  • flicking
  • report single click
  • report double click

I have composed something on the basis of demo code that was given by Nokia (if I am not mistaken) which uses PinchArea/MouseArea combination. This is lacking flicking support. In addition, I get "false positive" clicks sometimes when panning and (probably always) when double clicking.

If there is a brave soul that could look into current implementation at https://github.com/rinigus/mapbox-de...pMouseArea.qml and improve it, it will be very much appreciated. Ideally, I would like to have this code MIT-licensed, so everyone could just reuse it in their projects regardless of their license. Don't know the original license of Nokia-based demo code though ...

Other than mouse interaction, I am making steady progress with porting Poor Maps over to this map widget. The widget's API is developed to make this and future ports easier, as was expected.
 

The Following 3 Users Say Thank You to rinigus For This Useful Post:
Posts: 1,448 | Thanked: 6,851 times | Joined on Apr 2010 @ Czech Republic
#96
Originally Posted by rinigus View Post
I would like to ask for help from QML experts. For interaction with the widget, we need mouse interaction area that would support:
  • panning
  • pinch to zoom
  • flicking
  • report single click
  • report double click

I have composed something on the basis of demo code that was given by Nokia (if I am not mistaken) which uses PinchArea/MouseArea combination.
This is how modRana does it - seems to be the same principle:
https://github.com/M4rtinK/modrana/b...chMap.qml#L691

Originally Posted by rinigus View Post
This is lacking flicking support.
I *think* that if you want flick support in your custom widget and the use case does not fit a built-in container (Flickable, ListView, etc.) you are supposed to implement that yourself.

The general idea is to detect the velocity of the pan (generally in pixels/second) and move the widget accordingly, using an animation (NumberAnimation, SmoothedAnimation, CoordinateAnimation, etc.).

The velocity is the absolute position change in an axis between the start and end of the pan, divided by pan duration. Looks like using a MultiTouchPointArea might give you the velocity for free (just read the value at end of pan).

Let's say (an arbitrary number example) the user panned for 500 pixels at 200 pixels/second in each axis (a perfect diagonal flick I guess ?). We can arbitrarily decide we want the flick to continue for another 500 pixels at the same speed, which can be achieved by using two SmoothedAnimations (grouped in ParallelAnimation), one for X and the other for Y with the detected velocity set to move the map 500 pixels in each direction.

You can use an appropriate easing so that the flick does not come to an abrupt halt but rather gradually slows down. Also if another pan is detected, the animation should be stopped, so that the user can drag the map as expected and restarted with a new set of values once the pan ends.

Originally Posted by rinigus View Post
In addition, I get "false positive" clicks sometimes when panning and (probably always) when double clicking.
You need to filter out clicks from pans by comparing the position change against a threshold.

This is how modRana does it:
https://github.com/M4rtinK/modrana/b...chMap.qml#L792

There is a threshold of 100 pixels, multiplied by a hi-DPI multiplier (standard-DPI == 1, hi-DPI = 2) that the position changes is compared to. Once the position change is over the threshold, the even is classified as a pan and will no longer be considered a click once the user lifts their finger. The same thing for a pan - it's not recognized as a pan until the threshold is crossed. This prevents the map from "jumping" when the user clicks/double-clicks it.

Also, one thing to watch for is that the mouse event coordinates are floats and you should convert them to integers as soon as possible before using them for other things. Otherwise bad things will happen - for example if you use them to move two different elements/layers during the pan by adding he position difference to x/y coordinates, the two elements/layers will gradually "float apart" due to floating point errors. All should be fine if you convert the mouse event numbers to integers first.

Originally Posted by rinigus View Post
If there is a brave soul that could look into current implementation at https://github.com/rinigus/mapbox-de...pMouseArea.qml and improve it, it will be very much appreciated.
How do I build & run the demo app on desktop (Fedora 26 in my case)? Just load it to a recent QtCreator or is there more ? Don't really want to promise anything just now though - I'm already working on quite many things in modRana at the same time (routing overlay, making it possible to switch between different map element implementations, general stabilization so that a new modRana release can be made in a reasonably near future, etc.).

Originally Posted by rinigus View Post
Ideally, I would like to have this code MIT-licensed, so everyone could just reuse it in their projects regardless of their license. Don't know the original license of Nokia-based demo code though ...
Sounds like a good idea & could be pretty useful.

Originally Posted by rinigus View Post
Other than mouse interaction, I am making steady progress with porting Poor Maps over to this map widget. The widget's API is developed to make this and future ports easier, as was expected.
Sounds good!
__________________
modRana: a flexible GPS navigation system
Mieru: a flexible manga and comic book reader
Universal Components - a solution for native looking yet component set independent QML appliactions (QtQuick Controls 2 & Silica supported as backends)
 

The Following 4 Users Say Thank You to MartinK For This Useful Post:
Posts: 467 | Thanked: 2,199 times | Joined on Aug 2016 @ Estonia
#97
Originally Posted by MartinK View Post
[...]

I *think* that if you want flick support in your custom widget and the use case does not fit a built-in container (Flickable, ListView, etc.) you are supposed to implement that yourself.

[...]
Your proposed implementation should work, as far as I can see. Seems like current code in modRana and in the demo are similar and the both lack flicking support.

Originally Posted by MartinK View Post
Also, one thing to watch for is that the mouse event coordinates are floats and you should convert them to integers as soon as possible before using them for other things. Otherwise bad things will happen - for example if you use them to move two different elements/layers during the pan by adding he position difference to x/y coordinates, the two elements/layers will gradually "float apart" due to floating point errors. All should be fine if you convert the mouse event numbers to integers first.
In the case of MapboxMap widget, there should be no issue with the floating point errors. Namely, you either plot by defining the map objects (points, roads, ...) or you paint widgets that are moving around according to the map signals (signals tell widgets exact new location in pixels). As such, we have only one center of the map and everything else is relative to that. This prevents different layers to get differently adjusted and works great, as far as I have tested.


Originally Posted by MartinK View Post
How do I build & run the demo app on desktop (Fedora 26 in my case)? Just load it to a recent QtCreator or is there more ? Don't really want to promise anything just now though - I'm already working on quite many things in modRana at the same time (routing overlay, making it possible to switch between different map element implementations, general stabilization so that a new modRana release can be made in a reasonably near future, etc.).
Very-very simple (instructions have not been tested in real life, correct as needed):

* clone recursively https://github.com/rinigus/pkg-mapbox-gl-native

* make subdir build

* copy mapbox-gl-native-lib.pro to mapbox-gl-native subdir

* in build subdir, qmake5 ../mapbox-gl-native/mapbox-gl-native-lib.pro

* make -jXX

* clone https://github.com/rinigus/mapbox-gl-qml

* open in QtCreator mapbox-gl-qml/app/mapbox-qml.pro

* Adjust mapbox-qml.pro (https://github.com/rinigus/mapbox-gl...ox-qml.pro#L12 ) INCLUDEPATH and LIBS to point to pkg-mapbox-gl-native/build and pkg-mapbox-gl-native/mapbox-gl-native location accordingly.

* Should compile and run from the creator. To run outside, adjust LD_LIBRARY_PATH if needed.

To run in modRana, you would have to install the QML extension. This is done via https://github.com/rinigus/mapbox-gl...box-gl-qml.pro - here you probably can just comment out QMAKE_XXX vars.

NB! I don't know what's gcc is on Fedora - you need decent c++14 support. Probably gcc 4.9 is fine, but I am not 100% sure. If the support is insufficient, pkg-mapbox-gl-native build will fail.
 

The Following 3 Users Say Thank You to rinigus For This Useful Post:
Posts: 1,448 | Thanked: 6,851 times | Joined on Apr 2010 @ Czech Republic
#98
Originally Posted by rinigus View Post
Your proposed implementation should work, as far as I can see. Seems like current code in modRana and in the demo are similar and the both lack flicking support.
That's true - I guess it would not be that hard to add it now that I have though a bit about how it should actually work.

Originally Posted by rinigus View Post
In the case of MapboxMap widget, there should be no issue with the floating point errors. Namely, you either plot by defining the map objects (points, roads, ...) or you paint widgets that are moving around according to the map signals (signals tell widgets exact new location in pixels). As such, we have only one center of the map and everything else is relative to that. This prevents different layers to get differently adjusted and works great, as far as I have tested.
Interesting - that makes sense.

Originally Posted by rinigus View Post
Very-very simple (instructions have not been tested in real life, correct as needed):

* clone recursively https://github.com/rinigus/pkg-mapbox-gl-native

* make subdir build

* copy mapbox-gl-native-lib.pro to mapbox-gl-native subdir

* in build subdir, qmake5 ../mapbox-gl-native/mapbox-gl-native-lib.pro

* make -jXX

* clone https://github.com/rinigus/mapbox-gl-qml

* open in QtCreator mapbox-gl-qml/app/mapbox-qml.pro

* Adjust mapbox-qml.pro (https://github.com/rinigus/mapbox-gl...ox-qml.pro#L12 ) INCLUDEPATH and LIBS to point to pkg-mapbox-gl-native/build and pkg-mapbox-gl-native/mapbox-gl-native location accordingly.

* Should compile and run from the creator. To run outside, adjust LD_LIBRARY_PATH if needed.

To run in modRana, you would have to install the QML extension. This is done via https://github.com/rinigus/mapbox-gl...box-gl-qml.pro - here you probably can just comment out QMAKE_XXX vars.
Yeah, that looks doable, thanks! I'll try to do this once I have some time - I'll need the plugin anyway for on-desktop modRana development. I guess the i486 package from OBS might work as well but this seem cleaner & makes is easier to pull in fixes or custom changes if needed.

Originally Posted by rinigus View Post
NB! I don't know what's gcc is on Fedora - you need decent c++14 support. Probably gcc 4.9 is fine, but I am not 100% sure. If the support is insufficient, pkg-mapbox-gl-native build will fail.
Well, we have GCC 7.2.1 in Fedora 26, so I think we are covered. ;-)
__________________
modRana: a flexible GPS navigation system
Mieru: a flexible manga and comic book reader
Universal Components - a solution for native looking yet component set independent QML appliactions (QtQuick Controls 2 & Silica supported as backends)
 

The Following 3 Users Say Thank You to MartinK For This Useful Post:
Posts: 467 | Thanked: 2,199 times | Joined on Aug 2016 @ Estonia
#99
Originally Posted by MartinK View Post
Well, we have GCC 7.2.1 in Fedora 26, so I think we are covered. ;-)
The reason I went for 6.4 was https://github.com/mapbox/mapbox-gl-native/issues/9794 . While fixed, I decided to compile gcc that is not bleeding edge and let Fedora users complain/fix all the bugs while we do some other things
 
Posts: 275 | Thanked: 1,239 times | Joined on Oct 2013 @ France
#100
Probably too late and maybe not that useful, I found that Qt has a dedicated C++ class to handle the "panning, flicking and pinch-to-zoom" gestures in their map object : http://doc.qt.io/qt-5/qml-qtlocation...sturearea.html

It is said to be available since QtLocation 5.0, but the minimal include is related to a 5.3 version (so maybe not available on Sailfish with its 5.2 QtLocation...).

Anyway, the code can be looked at here for the latest Qt5.9 and seems not that easy :
http://code.qt.io/cgit/qt/qtlocation...area.cpp?h=5.9

For older version, the path was a bit different :
http://code.qt.io/cgit/qt/qtlocation...area.cpp?h=5.3


Maybe some ideas in that code can help you...
 

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

Thread Tools

 
Forum Jump


All times are GMT. The time now is 12:13.