maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Brainstorm (https://talk.maemo.org/forumdisplay.php?f=47)
-   -   App for vector renderer maps, using OpenGL ES 2.0 (https://talk.maemo.org/showthread.php?t=93358)

taixzo 2017-09-18 14:40

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Rinigus, how do you have it running on OnePlus X? I can't install as there are no OS updates past 2.0.2.51.

rinigus 2017-09-18 14:59

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by taixzo (Post 1534586)
Rinigus, how do you have it running on OnePlus X? I can't install as there are no OS updates past 2.0.2.51.

I have Oneplus X on 2.1.0.11. See https://wiki.merproject.org/wiki/Ada...ishOS_for_onyx for current release and http://images.devaamo.fi/sfe/onyx/beta-5/README.html for OTA instructions. Runs perfectly (SFOS and mapbox-sfos).

Zeta 2017-09-18 19:44

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by MartinK (Post 1534564)
I guess if there is no marker/polyline support in the widget itself I should be able to use the existing polyline & POI overlays in modRana by putting them on top of the widget and adjusting them accordingly (scale, rotation, offset, etc.). But it could be quite tricky if the widget supports non-90 degree view angles & fractional scrolling. Also synchronization with animations would have to be handled so that the overlay does not lag behind during animations. Coordinate transformations could also potentially by fun in some cases. :)

I followed in QtLocation 5.9 source code how they were handling the MapPolyline elements that can be added to the Map QML element.

So far, I found out that :
qgeomap.cpp adds all those items in a "m_mapItems" list as "QDeclarativeGeoMapItemBase"

As subclass called "QDeclarativePolylineMapItem" is in charge of the Polyline element, which is then drawn directly with OpenGL calls on top of the map.

This uses an internal "MapPolylineNode" class, which is doing the OpenGL call (things like "geometry_.setDrawingMode(QSGGeometry::DrawTriangl eStrip);" )., through the "geometry_" variable.

The QDeclarative*MapItems (polylines, polygons, ...) exist from Qt 5.0 from the documentation, so it may be possible to restore this functionality by making the MapboxMap a derivative of the GeoMap class, and adding some glue (if the one from 5.6 has enough) ?

The second way would be to code that behavior in a custom class, like MapboxMap, but keeping the raw GL way (to let the GPU handle the coordinates changes, and not computing them by hand which would be difficult).

And then, there is the solution rinigus presented, to add a layer through GeoJSon to do this in the MapBoxGL Engine.
I am not sure yet what the advantages and drawbacks of each solutions are, especially the overhead of adding a layer compared to a few direct GL calls.

Quote:

Originally Posted by rinigus (Post 1534572)
Edit: Looks like the same lib is used in J1. In my case (Oneplus X), I have libGLESv2_adreno.so (and others similar, without 200). Whether its an issue, don't know - I am not a specialist on OpenGL.

If stucked, we may ask somone of Jolla staff for that one (maybe during a community meeting, or through TJC) ? Having a high performances mapping/routing application is probably something they would like to have in their catalog, seeing how limited the default maps application they provide is. Not sure who is the OpenGL specialist there. Stskeeps obvioulsy comes in mind, and back in time, there was also w00teh. But I am sure there are others...

Zeta 2017-09-18 20:34

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by rinigus (Post 1534570)
Looking good. Would you mind to add debug info for qmapboxgl and mapbox-sfos. As far as I can see, its packages qmapboxgl-debugsource and mapbox-sfos-debuginfo .

Done.

Translating in commands, for future me (and other who could need to):
Quote:

Originally Posted by rinigus (Post 1534570)
Actually, you could add http://repo.merproject.org/obs/home:...mv7hl/armv7hl/ as a repo and then just use
Code:

pkcon install
. It will also allow you to upgrade in future, while we hunt for the bug.

=> (warning, the last "armv7hl" is not part of the repo name)
Code:

devel-su ssu addrepo mer_rinigus http://repo.merproject.org/obs/home:/rinigus:/maps/sailfish_latest_armv7hl/
ssu updaterepos
pkcon refresh
pkcon install mapbox-sfos-debuginfo qmapboxgl-debugsource

Quote:

Originally Posted by rinigus (Post 1534570)
If I can get these crash backtraces, we could open an issue for mapbox-gl-native and explain what has been done to make it run on SFOS. Maybe they can help.

Here are the backtraces for 3 consecutive runs : https://pastebin.com/QiPcKsfi

Is there another gdb command output you need ? (my gdb is a bit rusty...)

Quote:

Originally Posted by rinigus (Post 1534570)
As for crashes occurring for J1 and Photon Q: I wonder if its some OpenGL limitation of these devices. I haven't fiddled with OpenGL settings while compiling qmapboxgl, but maybe I should (have to look it up). But then not sure why it would crash on free/malloc calls...

Seeing as the last run crashed on QSslConfiguration, we are probably chasing a memory corruption bug. The kind that can corrupt stack or heap at some place in the code, and leaving its effects to something else later (like free and malloc that are using pointers) that is what gdb captures, and not the real thing that broke the stack.
It is usually one variable stored above in the memory that got out of its bounds, but can be more subtle. This can be "quite easy" to find in a small micro-controller, but I don't know how to show it in that case, as there are a lot of allocation/deallocation happening and so it can be difficult to know what was in memory before when the problem happened. Especially as valgrind doesn't run, from your tests.
Some basics tests could be done, like adding tests around all mallocs and pointers usage, leading to a qFatal() call to stop the application with a core dump and details. However, if the problem is on the GPU side (as only the adreno 200 shows it right now), it would not help that much..

otsaloma 2017-09-18 21:34

Re: App for vector renderer maps, using OpenGL ES 2.0
 
For me as well, with Jolla 1, it crashes, as soon as I interact with the map. I'll leave debugging to more capable hands. On the tablet, everything looks fine.

Device: Jolla Tablet
SFOS version: 2.1.1.26
Did it crash? No
Is the map displayed properly? Yes
Are the names rendered? Yes
Does movement work? Yes
Does zoom work? Yes
Does rotation work? Yes
Does tilting work? Yes

MartinK 2017-09-18 22:37

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by rinigus (Post 1534571)
As far as I remember, qmapboxgl does use some QtLocation structures, but I could be mistaken. If this will disqualify it from current Harbour - so be it. I am sure that Jolla will change the rules regarding QtLocation when they manage to get into working on QtLocation 5.6. There is surely a pressure from their customers to get it sorted, maybe just would take some time. In meanwhile, we can distribute via OpenRepos, if needed.

Yep, that sounds like a good plan. All the hacks one needs to do to get stuff to Jolla Store (modRana has a fair share of them as well) is really sad and one needs to draw a line somewhere.

Quote:

Originally Posted by rinigus (Post 1534571)
Mapbox GL Native allows you to add all these elements via GeoJSON and styling of the data. This should allow to add POIs, routes, any polygon... See https://github.com/mapbox/mapbox-gl-...window.cpp#L96 for the start of the example.

Interesting! That looks pretty powerful and useful. :)

Quote:

Originally Posted by rinigus (Post 1534571)
I am planning to expose similar API as well as write a small wrapper allowing you to add routes/POIs/location icon easier. So, you would not have to draw anything above it, just regular widgets as you do for interaction. Let's see where I can get in a week.

That definitely sounds like a good idea - to provide a general purpose "add/remove" POI marker/route API while still allowing to use the lower-level GeoJSON as well for more advanced stuff.

BTW, any idea if the markers could be made clickable ? Some generic "marker <id> clicked, with id set/provided at marker creation would be enough. Otherwise it would be tricky to resolve which marker the user has clicked on due to rotation/animation/camera angle, etc. Not are a blocker though as there are ways to address the markers even when they are not clickable, by eq. showing a list, etc. Still would be nice to have & is IIRC already possible with current solutions in Poor Maps and in modRana. :)

Quote:

Originally Posted by rinigus (Post 1534571)
We would probably need tile-based widgets, as you all have already, as well to support sources that are not compatible with the mapbox-gl. So, you would probably end up having two alternative ways to show the maps that you would have to switch in between in the application.

Yeah, supporting to map views/widgets is certainly the way to go for the time being.

On the other hand I wonder - how hard it would be to also support map tiles in the Open GL widget ? That way you could use specialized tiled map layers (traffic, weather, OSM bugs, etc.) on top of the rendered map layer or even just use tiled maps directly with all the benefits of an Open GL based map widget. It would also mean mapping apps could eventually drop their solutions for tiled maps as the Open GL map widget would cover that as well.

As an example of an Open GL based tiled map widget, Cloud GPS had that oh so many years ago back on the good old N900:

https://talk.maemo.org/showthread.php?t=58402
https://vimeo.com/16748976

But in any case no pressure - this is just a nice to have feature while the widget already provides a lot of pretty cool stuff & there is certainly much more things that need to be solved. :)

Quote:

Originally Posted by rinigus (Post 1534571)
Widget seems to be locked. Its actually possible to use other data sources, as done for https://openmaptiles.org/ . Right now I am developing against Mapbox data sources, since it easiest. Already now it should be possible to use other sources, but I have not tried.

Nice - good to know it's already possible to use alternative data source. :)

Quote:

Originally Posted by rinigus (Post 1534571)
As for offline, as soon as widget is ready, I am planning to add offline support for it via OSM Scout Server. We should be able to squeeze in additional datapack for mapbox gl, I presume it will be of similar size to mapnik datapack. Hopefully, data.modrana.org will be fine to host it :) .

Yep, no problem at all - there should definitely be enough space for that. :)

Quote:

Originally Posted by rinigus (Post 1534571)
So, the plan is to go all the way with the full online and offline support. And I don't think there are any major roadblocks on the way.

Nice! :)

rinigus 2017-09-19 06:17

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by Zeta (Post 1534603)
I followed in QtLocation 5.9 source code how they were handling the MapPolyline elements that can be added to the Map QML element.

So far, I found out that :
qgeomap.cpp adds all those items in a "m_mapItems" list as "QDeclarativeGeoMapItemBase"

As subclass called "QDeclarativePolylineMapItem" is in charge of the Polyline element, which is then drawn directly with OpenGL calls on top of the map.

This uses an internal "MapPolylineNode" class, which is doing the OpenGL call (things like "geometry_.setDrawingMode(QSGGeometry::DrawTriangl eStrip);" )., through the "geometry_" variable.

The QDeclarative*MapItems (polylines, polygons, ...) exist from Qt 5.0 from the documentation, so it may be possible to restore this functionality by making the MapboxMap a derivative of the GeoMap class, and adding some glue (if the one from 5.6 has enough) ?

The second way would be to code that behavior in a custom class, like MapboxMap, but keeping the raw GL way (to let the GPU handle the coordinates changes, and not computing them by hand which would be difficult).

And then, there is the solution rinigus presented, to add a layer through GeoJSon to do this in the MapBoxGL Engine.
I am not sure yet what the advantages and drawbacks of each solutions are, especially the overhead of adding a layer compared to a few direct GL calls.

When compared to QtLocation, we don't have to be compatible with the other modules. This makes it significantly easier. My reasoning for going with GeoJSON is that
  • originally supported by Mapbox GL Native (same as for Mapbox GL JS)
  • simple to implement since it directly interfaces with QMapboxGL

As for comparison in terms of features: using GeoJSON we can position the added features in between the map layers. As far as I could understand, you style the added features using the same styling as you do for the map. For example, its possible to add calculated road as a layer after the road on the map but before road names layer. As a result, your calculated road is visible, but does not cover road names. As a limitation, it was mentioned that MapboxGL added layers don't support transparency. However, with the ability of positioning the layer accordingly, I don't think its a problem.

There is one complication that has to be taken into account while writing a widget - QMapboxGL object lives in the rendering thread, not main thread. We can have an access via update method of the widget when you are allowed to sync, but otherwise its "no touch" condition. The second complication is that, in SFOS, when you minimize the application, the corresponding OpenGL scene is destroyed. So, when the application is restored, the widget is constructed again and we have to add all the layers/sources/paint properties.

I am writing now the part that will keep track on sources/layers/ and other properties and would patch or play back all the needed (non-removed) features on construction. It would probably take few evenings to implement it, but nothing really major. When ready, I'll make a new demo.

Quote:

Originally Posted by Zeta (Post 1534603)
If stucked, we may ask somone of Jolla staff for that one (maybe during a community meeting, or through TJC) ? Having a high performances mapping/routing application is probably something they would like to have in their catalog, seeing how limited the default maps application they provide is. Not sure who is the OpenGL specialist there. Stskeeps obvioulsy comes in mind, and back in time, there was also w00teh. But I am sure there are others...

If we have a good program to show, the interest will be there, I am sure :) .

rinigus 2017-09-19 06:20

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by Zeta (Post 1534608)
Done.

Translating in commands, for future me (and other who could need to):

=> (warning, the last "armv7hl" is not part of the repo name)
Code:

devel-su ssu addrepo mer_rinigus http://repo.merproject.org/obs/home:/rinigus:/maps/sailfish_latest_armv7hl/
ssu updaterepos
pkcon refresh
pkcon install mapbox-sfos-debuginfo qmapboxgl-debugsource


Here are the backtraces for 3 consecutive runs : https://pastebin.com/QiPcKsfi

Is there another gdb command output you need ? (my gdb is a bit rusty...)


Seeing as the last run crashed on QSslConfiguration, we are probably chasing a memory corruption bug. The kind that can corrupt stack or heap at some place in the code, and leaving its effects to something else later (like free and malloc that are using pointers) that is what gdb captures, and not the real thing that broke the stack.
It is usually one variable stored above in the memory that got out of its bounds, but can be more subtle. This can be "quite easy" to find in a small micro-controller, but I don't know how to show it in that case, as there are a lot of allocation/deallocation happening and so it can be difficult to know what was in memory before when the problem happened. Especially as valgrind doesn't run, from your tests.
Some basics tests could be done, like adding tests around all mallocs and pointers usage, leading to a qFatal() call to stop the application with a core dump and details. However, if the problem is on the GPU side (as only the adreno 200 shows it right now), it would not help that much..

For some reason, we still don't have debug symbols for the qmapboxgl classes. Future me will look into it and I should probably make a separate debug build for it. Would have to look into it. I can try to submit the issue as we are now and see if there is something obvious that I missed. I'll CC you in github with your other-github-name when I get to submit the crash issue.

rinigus 2017-09-19 06:31

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by MartinK (Post 1534614)
That definitely sounds like a good idea - to provide a general purpose "add/remove" POI marker/route API while still allowing to use the lower-level GeoJSON as well for more advanced stuff.

BTW, any idea if the markers could be made clickable ? Some generic "marker <id> clicked, with id set/provided at marker creation would be enough. Otherwise it would be tricky to resolve which marker the user has clicked on due to rotation/animation/camera angle, etc. Not are a blocker though as there are ways to address the markers even when they are not clickable, by eq. showing a list, etc. Still would be nice to have & is IIRC already possible with current solutions in Poor Maps and in modRana. :)

Its possible to provide location for a click since we can calculate lat/lon for any pixel. However, due to the map object living in another thread, the communication would be via request and signal back:

onClickEvent: you ask for coordinate via async mechanism. Something like "map.getCoordinates(my_tag_as_string, qpoint)

you get reply via signal:

onCoordinatesRequest: point

Then you could implement adding of other widgets on the top which will allow you to interact. Tricky with panning/rotating/tilting though. Maybe the map programs would just remove widget on rotation,tilting and follow panning signals to move it around.

I would prefer to keep out from GeoJSON parsing and figuring out what did you add there. Maybe widget-added POIs could get extra support, but let's see when we get there (later this week?).

Quote:

Originally Posted by MartinK (Post 1534614)
Yeah, supporting to map views/widgets is certainly the way to go for the time being.

On the other hand I wonder - how hard it would be to also support map tiles in the Open GL widget ? That way you could use specialized tiled map layers (traffic, weather, OSM bugs, etc.) on top of the rendered map layer or even just use tiled maps directly with all the benefits of an Open GL based map widget. It would also mean mapping apps could eventually drop their solutions for tiled maps as the Open GL map widget would cover that as well.

...

But in any case no pressure - this is just a nice to have feature while the widget already provides a lot of pretty cool stuff & there is certainly much more things that need to be solved. :)

I suspect that by the time we will get to adding tiles into the widget, noone will want to use them. Except checking traffic in google maps layer :) . Probably easier to keep the tiled versions around for old hardware (if we cannot make it work on J1 and similar) or other occasional use and focus on getting vector maps supported the best.

rinigus 2017-09-19 10:56

Re: App for vector renderer maps, using OpenGL ES 2.0
 
I will be updating test results in this post as they come along. Only SFOS with Qt 5.6 is supported (2.1.x.y and higher), hence I am not reporting issues with the earlier SFOS versions.

All works:
  • Oneplus X, SFOS 2.1.0.11
  • Oneplus One, SFOS 2.1.1.24
  • Jolla C, SFOS 2.1.1.26
  • Sony X, SFOS 2.1.1.26
  • Jolla Tablet, SFOS 2.1.1.26

Failed

tmi 2017-09-19 14:22

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by rinigus (Post 1534648)
Failed
  • Jolla 1, SFOS 2.1.0.11, n=2
    • Crashed during interaction
    • comment: noticed a black square (a few pixels wide) on the top left of the screen

I can verify also similar/same results with Jolla 1 running SFOS 2.1.1.26.

m4r0v3r 2017-09-19 16:17

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by rinigus (Post 1534648)
I will be updating test results in this post as they come along. Only SFOS with Qt 5.6 is supported (2.1.x.y and higher), hence I am not reporting issues with the earlier SFOS versions.

All works:
  • Oneplus X, SFOS 2.1.0.11
  • Oneplus One, SFOS 2.1.1.24
  • Jolla C, SFOS 2.1.1.26
  • Sony X, unknown version
  • Jolla Tablet, SFOS 2.1.1.26

Failed

It was very 2.1.1.26 on the Sony X

atlochowski 2017-09-19 22:33

Re: App for vector renderer maps, using OpenGL ES 2.0
 
When I open your app on Jolla 1 without access to internet everything is ok but after enabling internet connection, map loading and output of journalctl starts to look like this:
Quote:

wrz 20 00:30:29 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| GPU PAGE FAULT: addr = 0 pid = 1442
wrz 20 00:30:30 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| context = 0 FSR = 4000000A
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| GPU PAGE FAULT: addr = 40 pid = 1442
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| context = 0 FSR = 4000000A
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| GPU PAGE FAULT: addr = 80 pid = 1442
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| context = 0 FSR = 4000000A
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| GPU PAGE FAULT: addr = C0 pid = 1442
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| context = 0 FSR = 4000000A
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| GPU PAGE FAULT: addr = 100 pid = 1442
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| context = 0 FSR = 4000000A
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| GPU PAGE FAULT: addr = 140 pid = 1442
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| context = 0 FSR = 4000000A
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| GPU PAGE FAULT: addr = 180 pid = 1442
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| context = 0 FSR = 4000000A
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| GPU PAGE FAULT: addr = 1C0 pid = 1442
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| context = 0 FSR = 4000000A
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| GPU PAGE FAULT: addr = 200 pid = 1442
wrz 20 00:30:31 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| context = 0 FSR = 4000000A

Zeta 2017-09-19 23:12

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by atlochowski (Post 1534697)
When I open your app on Jolla 1 without access to internet everything is ok but after enabling internet connection, map loading and output of journalctl starts to look like this:

well spotted !
note : when launch as nemo journalctl gives the misleading message that no jiurnal is found, not that it has no rights to open it. it have to be opened as devel-su.
options -f allows to keep it displaying only new messages (like tail) , and -l allows to output full line otherwise it cuts them when too long.


so, with devel-su journalctl -fl, I get :
Code:

sept. 20 01:02:47 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| context = 0 FSR = 4000000A
sept. 20 01:02:47 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| GPU PAGE FAULT: addr = 1C40 p
id = 17865
sept. 20 01:02:47 Sailfish kernel: kgsl kgsl-3d0: |kgsl_iommu_fault_handler| context = 0 FSR = 4000000A
sept. 20 01:02:47 Sailfish kernel: QSGRenderThread: unhandled page fault (11) at 0x0000004d, code 0x005
sept. 20 01:02:47 Sailfish kernel: pgd = c46c4000
sept. 20 01:02:47 Sailfish kernel: [0000004d] *pgd=00000000
sept. 20 01:02:47 Sailfish kernel: sept. 20 01:02:47 Sailfish kernel: Pid: 18028, comm:      QSGRenderThre
ad
sept. 20 01:02:47 Sailfish kernel: CPU: 1    Tainted: P        W  O  (3.4.108.20161101.1 #1)
sept. 20 01:02:47 Sailfish kernel: PC is at 0x40090ea8
sept. 20 01:02:47 Sailfish kernel: LR is at 0x40090eb1
sept. 20 01:02:47 Sailfish kernel: pc : [<40090ea8>]    lr : [<40090eb1>]    psr: 600d0030
sp : 4852f8b0  ip : 41b41510  fp : 49ce1544
sept. 20 01:02:47 Sailfish kernel: r10: 4a798d68  r9 : 4a7a9bd0  r8 : 4852f8f4
sept. 20 01:02:47 Sailfish kernel: r7 : 403357a8  r6 : 49c5b6e8  r5 : 4aaa8cf8  r4 : 00000041
sept. 20 01:02:47 Sailfish kernel: r3 : 00000000  r2 : 00000fec  r1 : 00000041  r0 : 49c5b6e8
sept. 20 01:02:47 Sailfish kernel: Flags: nZCv  IRQs on  FIQs on  Mode USER_32  ISA Thumb  Segment user
sept. 20 01:02:47 Sailfish kernel: Control: 10c5787d  Table: 848c406a  DAC: 00000015
sept. 20 01:02:47 Sailfish kernel: [<c010b73c>] (unwind_backtrace+0x0/0x118) from [<c010f658>] (__do_user_
fault+0x6c/0xb4)
sept. 20 01:02:47 Sailfish kernel: [<c010f658>] (__do_user_fault+0x6c/0xb4) from [<c08a3364>] (do_page_fau
lt+0x358/0x3e8)
sept. 20 01:02:47 Sailfish kernel: [<c08a3364>] (do_page_fault+0x358/0x3e8) from [<c01002f8>] (do_DataAbor
t+0x134/0x1a8)
sept. 20 01:02:47 Sailfish kernel: [<c01002f8>] (do_DataAbort+0x134/0x1a8) from [<c08a1bd4>] (__dabt_usr+0
x34/0x40)
sept. 20 01:02:47 Sailfish kernel: Exception stack(0xdb1d1fb0 to 0xdb1d1ff8)
sept. 20 01:02:47 Sailfish kernel: 1fa0:                                    49c5b6e8 00000041 00000fec 00
000000
sept. 20 01:02:47 Sailfish kernel: 1fc0: 00000041 4aaa8cf8 49c5b6e8 403357a8 4852f8f4 4a7a9bd0 4a798d68 49
ce1544
sept. 20 01:02:47 Sailfish kernel: 1fe0: 41b41510 4852f8b0 40090eb1 40090ea8 600d0030 ffffffff
sept. 20 01:02:47 Sailfish kernel: QSGRenderThread(17865) send signal 11 to QSGRenderThread(17865)
sept. 20 01:02:47 Sailfish kernel: booster-generic(845) send signal 11 to invoker(18015)
sept. 20 01:02:47 Sailfish kernel: invoker(18015) send signal 11 to invoker(18015)
sept. 20 01:02:48 Sailfish invoker[1134]: WARNING: An inactive plugin is misbehaving - tried to show a win
dow!
sept. 20 01:02:48 Sailfish invoker[1134]: WARNING: requestActivate() called for  QQuickView(0x1f22c58)  wh
ich has Qt::WindowDoesNotAcceptFocus set.
sept. 20 01:02:49 Sailfish kernel: [TSL277X_P][Before] raw=115, status=0, far=390, near=677
sept. 20 01:02:49 Sailfish kernel: [TSL277X_P][After] far=365, near=677, from=114, to=677
sept. 20 01:02:52 Sailfish fingerterm[13901]: [D] unknown:0 - unknown special key:  67108864

I'm on the phone without computer at end, so can't search much right now, but hope it will help and complete the previous answer.

rinigus 2017-09-20 06:29

Re: App for vector renderer maps, using OpenGL ES 2.0
 
I submitted the issue at mapbox-gl-native repository, let's see if they can guide us. Used the kernel messages in the description, hopefully they contain most of the info.

Zeta 2017-09-20 21:50

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by rinigus (Post 1534703)
I submitted the issue at mapbox-gl-native repository, let's see if they can guide us. Used the kernel messages in the description, hopefully they contain most of the info.

Thanks!
I will follow it closely to see if they need some other tests/traces.

For references for other who would want to follow it too, here is the issue link: https://github.com/mapbox/mapbox-gl-native/issues/10029

rinigus 2017-09-21 07:00

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by Zeta (Post 1534767)
Thanks!
I will follow it closely to see if they need some other tests/traces.

For references for other who would want to follow it too, here is the issue link: https://github.com/mapbox/mapbox-gl-native/issues/10029

I have not been successful with the filling issues so far at mapbox-gl-native. They all got lovely stickers (Qt) and stayed unanswered. Maybe Qt backend coder is on vacation, maybe he just doesn't have too much time. In short, let's not put too much hopes on getting it magically resolved.

I'll continue coding the widget and work on testing it. When we start getting map client(s) adopting it, the exposure to the problem will increase and maybe someone skilled in GL ES will look into it. J1 is rather old and non-support for J1-type hardware will disappear eventually :)

Zeta 2017-09-21 18:43

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by rinigus (Post 1534794)
I have not been successful with the filling issues so far at mapbox-gl-native. They all got lovely stickers (Qt) and stayed unanswered.

That's only one day. I didn't expect much in less than a week. We'll see.

Quote:

Originally Posted by rinigus (Post 1534794)
I'll continue coding the widget and work on testing it. When we start getting map client(s) adopting it, the exposure to the problem will increase and maybe someone skilled in GL ES will look into it. J1 is rather old and non-support for J1-type hardware will disappear eventually :)

Yes, you shouldn't lose too much time on that. If you can get it working on the other devices, that's good !
I can still help a bit with the desktop version then (and can still test with the J1, but I have no other Sailfish phone).

Do you have some kind of roadmap or task list, to see how we could "share" tasks (taking into account you work 100 times faster than me...) ?

MartinK 2017-09-22 00:20

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by rinigus (Post 1534634)
Its possible to provide location for a click since we can calculate lat/lon for any pixel. However, due to the map object living in another thread, the communication would be via request and signal back:

onClickEvent: you ask for coordinate via async mechanism. Something like "map.getCoordinates(my_tag_as_string, qpoint)

you get reply via signal:

onCoordinatesRequest: point

Then you could implement adding of other widgets on the top which will allow you to interact. Tricky with panning/rotating/tilting though. Maybe the map programs would just remove widget on rotation,tilting and follow panning signals to move it around.

Yeah, that's what I've been thinking as well - hide all the elements you put on top when user starts interacting with the map itself (drag, pinch, rotation) or if the map widget animates (switching to a new center, induced zoom/rotation/pitch change).
Still might not be always doable, for example if centering is enabled & centering is animated. That way there would basically be no time as which to show the custom widgets as the Open GL widget would be animating & asynchronously changing to arbitrary coordinates all the time.

There could still be workaround but I'll likely just try to use the polyline/polygon/marker API where possible. :)


Quote:

Originally Posted by rinigus (Post 1534634)
I would prefer to keep out from GeoJSON parsing and figuring out what did you add there. Maybe widget-added POIs could get extra support, but let's see when we get there (later this week?).

That's a good point - it should be fine to just handle the GeoJSON internally as long as there is an API that can be used to add/remove objects from the map.

A rough outline what would enable modRana support it's current map overlay feature set:

* position indicator API
- show current position & the direction of travel
- turn position display on/off

This is how the modRana position indicator looks like:
http://modrana.org/images/modrana_po..._indicator.png


* POI marker API
usecase: show POI on the map
- add/remove markers given as a lat/lon coordinate with a label
- each marker should likely have an unique id (app provided/returned by function call ?)
- would it be possible to make the marker label clickable ? (eq. a markerClicked signal returning the id of the marker if callback registration would be too complicated)
- in general the markers & labels should be drawn on top of any polylines or polygons if possible

BTW, this is how modRana created POI markers look at the moment:
http://modrana.org/images/modrana_poi_marker.png


* polyline API
usecases: show tracklogs, navigation routes, live logging trace
- add/remove polylines given as ordered lists of lat/lon coordinates
- again they should have unique IDs
- for drawing routes it would he handy to be able to supply also a second list of points that would be highlighted on top of the polyline (turn points)
- alternatively this could be emulated by drawing POIs without labels for the turn points, requiring a bit extra map object management code on the application side
- for the specific use case of drawing on map trace/live logging trace (eq. basically a live trail of last visited points) an appendable polyline would be nice, if possible, as removing/adding a new polyline every location update would likely not work very well
- or there could be a special built-in "trail" polyline that would automatically track current location and could be turned on/off - that way it should be possible to avoid the trail lagging behind the position indicator

ModRana currently draws routes like this:
http://modrana.org/images/modrana_route_display.png
The yellow points are turn points and the red/green circles are start/destination designators. Tracklogs & logging traces look similar, but don't have the turn points and start/destination designators.


* polygon API
use cases: show areas of interest, map area selection
- add/remove polygons given as ordered lists of lat/lon coordinates
- again they should have unique IDs
- color selection would likely by handy to tell polygons apart
- labels are likely not needed - one can just place a labeled marker inside the polygon

ModRana currently does not draw polygons on the map. :)

This is just a rough outline and feedback from other potential users of the widget is certainly welcome! :)


Quote:

Originally Posted by rinigus (Post 1534634)
I suspect that by the time we will get to adding tiles into the widget, noone will want to use them. Except checking traffic in google maps layer :) . Probably easier to keep the tiled versions around for old hardware (if we cannot make it work on J1 and similar) or other occasional use and focus on getting vector maps supported the best.

Definitely! I guess it would be different if there were some widely available aerial/satellite map layers as that's something one can't really render from map data. But that's unfortunately not the case (unless some of the emerging small-sat constellations help with that) and we should be basically able to draw anything else. :)

rinigus 2017-09-22 06:20

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by Zeta (Post 1534857)
That's only one day. I didn't expect much in less than a week. We'll see.

Yes, you shouldn't lose too much time on that. If you can get it working on the other devices, that's good !
I can still help a bit with the desktop version then (and can still test with the J1, but I have no other Sailfish phone).

Do you have some kind of roadmap or task list, to see how we could "share" tasks (taking into account you work 100 times faster than me...) ?

I am working on getting GeoJSON (and probably any other supported type) support into the widget. As soon as I get some elementary example working, it would be great if we can start testing the code. I do expect bugs in handling adding/updating/removing items. That would be great if you could test on desktop and we can address issues one-by-one. But to get there, I need to finish the code that we can test and write documentation for each method that needs it.

Additional help would be reading what is actually possible. I am new to Mapbox GL and I am learning by doing this interface. I wouldn't be surprised if many of MartinK requests are already supported via Mapbox GL. Not that you have to rewrite the docs, but help when we get requests on whether one or another thing is possible and help to write simple-to-use wrappers that map applications can use (add route, position marker, pois, ...)

rinigus 2017-09-22 06:22

Re: App for vector renderer maps, using OpenGL ES 2.0
 
MartinK: I guess we'll get back to your post when the elementary support for adding objects is there :)

MartinK 2017-09-22 08:04

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by rinigus (Post 1534881)
MartinK: I guess we'll get back to your post when the elementary support for adding objects is there :)

Sounds good! :)

rinigus 2017-09-22 17:45

Re: App for vector renderer maps, using OpenGL ES 2.0
 
@Zeta: the first version with the support for updating the map with the sources, layers, ... is out in github repo. You are very welcome to test it, I haven't had a chance to do it myself. Current interface is at qquickitemmapboxgl.h - I will continue adding missing methods and then would be able to test as well.

deprecated 2017-09-22 22:38

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Watching this thread intently, and will lend aid/test wherever needed.

Very exciting stuff!

Zeta 2017-09-22 23:25

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by rinigus (Post 1534937)
@Zeta: the first version with the support for updating the map with the sources, layers, ... is out in github repo. You are very welcome to test it, I haven't had a chance to do it myself. Current interface is at qquickitemmapboxgl.h - I will continue adding missing methods and then would be able to test as well.

Looking good!
I can see some polyline drawn over helsinki, in a white dash-dot pattern, if that was what you expected.

I tried some changes, and I succeeded in generating this polyline data from C++ (as a QVariantMap with the geojson data), then adding it on the map layer on the QML side.

I will try to do it with a real route, as would be generated by OSRM or another routing engine, to have something more complex than what I have done by hand and see if it breaks at some level. And then make the connections so that changes on the route are updated on the map.

rinigus 2017-09-23 18:06

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by Zeta (Post 1534959)
Looking good!
I can see some polyline drawn over helsinki, in a white dash-dot pattern, if that was what you expected.

I tried some changes, and I succeeded in generating this polyline data from C++ (as a QVariantMap with the geojson data), then adding it on the map layer on the QML side.

I will try to do it with a real route, as would be generated by OSRM or another routing engine, to have something more complex than what I have done by hand and see if it breaks at some level. And then make the connections so that changes on the route are updated on the map.

Zeta, just updated demo program for desktop. I'll add some simper API for adding and altering points as well as look on how to get integration between other widgets and the map (have some ideas already)

Zeta 2017-09-24 17:12

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by rinigus (Post 1534990)
Zeta, just updated demo program for desktop. I'll add some simper API for adding and altering points as well as look on how to get integration between other widgets and the map (have some ideas already)

Really good so far !

So far, I had only be playing with your demo app, making some changes here and there to so see what it could do, but I have now started to work on a real use case of the qml map. I will push it later on Github.

So, some quick comments:
I have easily taken OSRM route output (as GeoJson) and added it as a new layer on the fly.
Adding a geoJson route of 1800 points (corresponding to the "full" output option of OSRM for a route of a bit more than 100 km), doesn't introduce visible slowdown on PC. I am downloading the full France PBF to make tests with longer routes (a thousand km is possible through France).

Behaviors on zoom and pitch properties are working great !
Adding those lines allows to switch from a route overview to a car-like navigation view seemlessly:
Code:

Behavior on zoomLevel { NumberAnimation { duration: 1000 } }
Behavior on pitch { NumberAnimation { duration: 1000 }  }

While testing the map dynamic behavior, In the timer that update the location source, I added:
Code:

map.center = QtPositioning.coordinate(60.16 +  0.01*Math.sin(angle), 24.94 + 0.01*Math.cos(angle))
That way the map follows the location point, but I noticed that at high zoom levels, we can see the location point being updated before the map is centered on it, which then put back the location circle in the center. I am not sure how that glitch could/should be avoided, but maybe something to block map redraw while updating a bunch of properties and enabling it later would be the correct way ? There maybe already something in place ?

My next step is to allow OSRM to update the route it added previously, which shouldn't be too hard.

rinigus 2017-09-24 18:35

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by Zeta (Post 1535034)
Really good so far !

So, some quick comments:
I have easily taken OSRM route output (as GeoJson) and added it as a new layer on the fly.
Adding a geoJson route of 1800 points (corresponding to the "full" output option of OSRM for a route of a bit more than 100 km), doesn't introduce visible slowdown on PC. I am downloading the full France PBF to make tests with longer routes (a thousand km is possible through France).

Behaviors on zoom and pitch properties are working great !
Adding those lines allows to switch from a route overview to a car-like navigation view seemlessly:
Code:

Behavior on zoomLevel { NumberAnimation { duration: 1000 } }
Behavior on pitch { NumberAnimation { duration: 1000 }  }

While testing the map dynamic behavior, In the timer that update the location source, I added:
Code:

map.center = QtPositioning.coordinate(60.16 +  0.01*Math.sin(angle), 24.94 + 0.01*Math.cos(angle))
That way the map follows the location point, but I noticed that at high zoom levels, we can see the location point being updated before the map is centered on it, which then put back the location circle in the center. I am not sure how that glitch could/should be avoided, but maybe something to block map redraw while updating a bunch of properties and enabling it later would be the correct way ? There maybe already something in place ?

My next step is to allow OSRM to update the route it added previously, which shouldn't be too hard.

Great to know that real roads are not an issue :). Same with animations.

I have seen the same flickering when I moved the center in accordance with the dot. Same flickering is visible when you drive around and set gps location to be on the center (but it seem that the gps coordinates are updated not that frequently).

I did some testing and couldn't see improvements when I set the center and position of the dot at the same time. However, I might have done something wrong during it, would have to recheck.

I have started to use issues as some crude todo list. Added this flickering to it as well.

rinigus 2017-09-25 07:20

Re: App for vector renderer maps, using OpenGL ES 2.0
 
I think that large chunk of API is ready. Its not stress-tested, but can be used as a solid starting point for it.

The missing piece is an API that would allow to add interactive elements on top of the map. I have an idea on how to make it and will probably implement in the next couple of evenings.

Present API follows the logic of map drawing by Mapbox GL and is somewhat different from what we used so far (before we couldn't draw within the map, just on top). So, few terms and what's supported:

* you can rotate, pan, zoom, and tilt

* you can set the "center" of map into any position of the widget. For example, get the center in the middle (when just looking where you are) or in the lower bit of the screen (when you drive). This is supported via margins

* To add anything to the map (and here the magic comes), you need to add source and layer. Multiple layers can use the same source.

* Sources supported by QMapboxGL are GeoJSON and probably few others, but this has to be researched if needed. I think you could add tiles as well, but I haven't looked into it.

* Sources in GeoJSON can be fed as QString (https://github.com/rinigus/mapbox-gl...l/main.qml#L82), QVariantMap (https://github.com/rinigus/mapbox-gl.../main.qml#L140), and using simpler API for point(s) https://github.com/rinigus/mapbox-gl...apboxgl.h#L166 and lines
https://github.com/rinigus/mapbox-gl...apboxgl.h#L172 . Note that adding and updating is the same for QMapboxGL.

* Layers are responsible for rendering sources and can be added/removed. See https://www.mapbox.com/mapbox-gl-js/style-spec/#layers for available properties. As you could see, layers customization is rather extensive and I am not planning to write any crippled API for it. It seems to be simple API already and allows the required flexibility. Let's use it as it is.

* Examples for route rendering at https://github.com/rinigus/mapbox-gl.../main.qml#L122 ; current location at https://github.com/rinigus/mapbox-gl.../main.qml#L138 ; points at https://github.com/rinigus/mapbox-gl.../main.qml#L175

* More examples on how to use image-based markers are at https://github.com/mapbox/mapbox-gl-...indow.cpp#L135

* Via queries, you could ask current scale, whether source exists, and which location does the widget point corresponds to. How to ask is shown at https://github.com/rinigus/mapbox-gl...l/main.qml#L63 with the response at https://github.com/rinigus/mapbox-gl.../main.qml#L218 .

* API header at https://github.com/rinigus/mapbox-gl...itemmapboxgl.h

With the exception of interactive widgets (to be added), it should cover what was suggested by MartinK. Generation of IDs for sources and layers are responsibility of the caller, but that should be OK.

As soon as the support for interacting widgets will be ready, I'll start proper testing of the widget by porting Poor Maps over it (the source I am a bit familiar with). This and the tests by others should show us what is missing and if/what should be changed.

otsaloma 2017-09-25 19:32

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by rinigus (Post 1535073)
I think that large chunk of API is ready.

Things move such fast, that I can't quite keep up. Could you explain in high-level terms, how this API relates to QtLocation 5.2/5.6 or the Mapbox GL plugin API in QtLocation 5.9? I'm wondering if people writing map apps for SFOS will along with this new component have three different APIs for routes, POIs, position icons, etc.? And not just functions, but also data structures (QtPositioning coordinates, MapQuickItems, JSON etc.) given as arguments?

Quote:

Originally Posted by rinigus (Post 1535073)
As soon as the support for interacting widgets will be ready, I'll start proper testing of the widget by porting Poor Maps over it (the source I am a bit familiar with).

Please file an issue about that and suggest a high-level outline for discussion, assuming it's likely to end up being more than just testing.

rinigus 2017-09-25 20:36

Re: App for vector renderer maps, using OpenGL ES 2.0
 
An API allowing to add widgets to the map and associate it with the position in the widget has been added. In short, you need just to specify which location do you want to track and then follow signals to change widget location on the screen accordingly. Tested on desktop demo app and it worked quite nicely (you can add/remove single location and remove all tracked locations as well). See demo app for details:

Main: https://github.com/rinigus/mapbox-gl...p/qml/main.qml

Widget that tracks position, hides when out of the screen, and destroys itself when tracking is removed: https://github.com/rinigus/mapbox-gl...l/location.qml

I think that its complete now in the sense that I can start testing it further by porting a proper map application over it and see if I hit some problems.

Replies to the questions below:

Quote:

Originally Posted by otsaloma (Post 1535142)
Things move such fast, that I can't quite keep up. Could you explain in high-level terms, how this API relates to QtLocation 5.2/5.6 or the Mapbox GL plugin API in QtLocation 5.9? I'm wondering if people writing map apps for SFOS will along with this new component have three different APIs for routes, POIs, position icons, etc.? And not just functions, but also data structures (QtPositioning coordinates, MapQuickItems, JSON etc.) given as arguments?

Its a new API. To put into perspective:

QtLocation 5.6 - assuming it will come to SFOS - has three main plugins - HERE, Mapbox, OpenStreetMap (http://doc.qt.io/qt-5.6/qtlocation-index.html). All these plugins use tiled maps.

QtLocation 5.9 - introduced the first "vector" plugin in the form of Mapbox GL. Mapbox GL Native (https://github.com/mapbox/mapbox-gl-native) has Qt interface (called platform in their project) that was further integrated into QtLocation by providing corresponding QtQuick components and interfaces with the other QtLocation classes.

This API: Based on the bits from QtLocation/Mapbox GL plugin (rendering of the map on QtQuick widget); interface to QMapboxGL that provides Mapbox GL functionality for Qt C++; and my understanding of what's needed from application perspective. This API compiles and runs against Qt 5.6 using QtLocation 5.2 (SFOS) and Qt 5.7 / QtLocation 5.7 (desktop), as far as I tested.

So, for people writing map apps, this API allows you to have probably one of the best renderings of the map available now, on any platform. In the background, it will communicate with the vector tile server and keep the cache with the minimal effort from the map application writer.

APIs for routes, POIs, and position icons are different. Data structures, for most part, are compatible with the QtPositioning coordinates used to provide points, routes (list of coordinates). For more complicated cases, we can see what's the reasonable approach.

Now, I don't know how much would take an effort to port an existing application to such API. In my understanding, it shouldn't be too difficult. However, it maybe that the devil is in the details and I underestimate the task. Hence my idea to port Poor Maps over and see how much time does it take in practice as well as whether we can cover all the cases as exposed by complete map application.

Edit: I hope I did reply to all questions / please ask again if I missed anything

Quote:

Originally Posted by otsaloma (Post 1535142)
Please file an issue about that and suggest a high-level outline for discussion, assuming it's likely to end up being more than just testing.

Sure, I will. I'll have to read the code of Poor Maps again and then I'll be able to suggest something. Probably would test few things first to get some feel about possible solutions.

otsaloma 2017-09-25 20:57

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by rinigus (Post 1535147)
Sure, I will. I'll have to read the code of Poor Maps again and then I'll be able to suggest something. Probably would test few things first to get some feel about possible solutions.

All right. To clarify, my main concern is whether we can support both raster and vector maps in the same codebase. Considering the experimental nature of Mapbox GL and crashes on Jolla 1 and Jolla store rules, we might need to support raster tiles for quite a while still. That would favor a single codebase, but if it looks seriously complicated, then rather a fork, and new features only in the fork.

Zeta 2017-09-25 22:39

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Hello rinigus,

First of all, hats down for the work you did/are doing there !

I can confirm the demo app works really good on Desktop, and it is quite easy to build something around the Qml component in a custom application.
Updating a geojson source live seems to work without quirks. I got it working with OSRM when it computes a new route to the latest clicked point.
I will need a bit more time in the week to clean this a bit before I start pushing it on GitHub, if other can find inspiration in it.

Working with it, I have a couple of minor questions/remarks:

* margins have a setter, but are not a "real" property. Is this by design or was it a shortcut ? Having them as properties would allow adding them a "Behavior", to smooth switching from one view to another

* when trying to find the coordinates for a pixel on the screen, the answer can only be asynchronously obtained as it goes through internal signal/slots :
Code:

connect(n, &QSGMapboxGLTextureNode::replyCoordinateForPixel, this, &QQuickItemMapboxGL::replyCoordinateForPixel, Qt::QueuedConnection);
connect(this, &QQuickItemMapboxGL::queryCoordinateForPixel, n, &QSGMapboxGLTextureNode::queryCoordinateForPixel, Qt::QueuedConnection);

It is not as easy to use as a simple function call as you need to keep some state of what you wanted to get this point coordinates, for when the answer comes back (like if you use right click for route start, and left click for route end, you need to store which click was the one that triggered the request. The more complex the interaction with the map, the more it will be visible).
I imagine the reason behind this is that the 2 objects live in different threads ? If so, there is not much that could be done to change it.


Thanks again !

rinigus 2017-09-26 06:39

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by otsaloma (Post 1535149)
All right. To clarify, my main concern is whether we can support both raster and vector maps in the same codebase. Considering the experimental nature of Mapbox GL and crashes on Jolla 1 and Jolla store rules, we might need to support raster tiles for quite a while still. That would favor a single codebase, but if it looks seriously complicated, then rather a fork, and new features only in the fork.

I suspect that raster tiles are supported, but haven't had time to test it. See https://www.mapbox.com/mapbox-gl-js/example/map-tiles/ .

If true and we can use raster tiles, it leaves us with J1 and JStore issues. While JStore is political and probably induced by QtLocation version available for us, J1 (and Photon Q) is a technical one that we should be able to look into. I may make a small app to test whether this issue is for some arbitrary OpenGL code as well. Would be easier to debug if we can get crashes with the small codebase.

rinigus 2017-09-26 06:45

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by Zeta (Post 1535155)
Hello rinigus,

First of all, hats down for the work you did/are doing there !

I can confirm the demo app works really good on Desktop, and it is quite easy to build something around the Qml component in a custom application.
Updating a geojson source live seems to work without quirks. I got it working with OSRM when it computes a new route to the latest clicked point.
I will need a bit more time in the week to clean this a bit before I start pushing it on GitHub, if other can find inspiration in it.

Working with it, I have a couple of minor questions/remarks:

* margins have a setter, but are not a "real" property. Is this by design or was it a shortcut ? Having them as properties would allow adding them a "Behavior", to smooth switching from one view to another

* when trying to find the coordinates for a pixel on the screen, the answer can only be asynchronously obtained as it goes through internal signal/slots :
Code:

connect(n, &QSGMapboxGLTextureNode::replyCoordinateForPixel, this, &QQuickItemMapboxGL::replyCoordinateForPixel, Qt::QueuedConnection);
connect(this, &QQuickItemMapboxGL::queryCoordinateForPixel, n, &QSGMapboxGLTextureNode::queryCoordinateForPixel, Qt::QueuedConnection);

It is not as easy to use as a simple function call as you need to keep some state of what you wanted to get this point coordinates, for when the answer comes back (like if you use right click for route start, and left click for route end, you need to store which click was the one that triggered the request. The more complex the interaction with the map, the more it will be visible).
I imagine the reason behind this is that the 2 objects live in different threads ? If so, there is not much that could be done to change it.


Thanks again !

Hi Zeta, thanks for testing and working on it!

Re margins: its oversight. I'll fix it tonight

Re coordinates/pixel: yes, map renderer lives in rendering thread and we have access through main gui thread. I have access to map object either via update method or via signals. What we can do is to add a tag as an additional argument for query (QVariant). Then, when you get a reply, you'll have the same tag delivered. This should allow you to keep all housekeeping info in that tag and simplify your code. I'll add it later tonight, unless someone has a better idea.

otsaloma 2017-09-26 16:59

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by rinigus (Post 1535174)
I suspect that raster tiles are supported, but haven't had time to test it. See https://www.mapbox.com/mapbox-gl-js/example/map-tiles/ .

I have used Mapbox GL JS for web apps and at least that does support raster tiles. Tiles are blurry though, since there's a smoothing filter, which can't be turned off. If doing custom packages for SFOS, I expect the smoothing can be resolved too.

rinigus 2017-09-26 18:43

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Quote:

Originally Posted by otsaloma (Post 1535221)
I have used Mapbox GL JS for web apps and at least that does support raster tiles. Tiles are blurry though, since there's a smoothing filter, which can't be turned off. If doing custom packages for SFOS, I expect the smoothing can be resolved too.

Raster tiles are supported, just tested, and easy to use. They are blurry and it seems to me that the library loads tiles which are just one z level higher than the expected one. Would have to see if there is a knob I can turn to fix it.

Edit: looks like the zoom level depends on the tile size. So, I can get blurry images even when the correct level is loaded.

rinigus 2017-09-26 19:29

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Zeta, I have added a tag for pixel to location conversion. That should simplify your code.

As for margins, not sure how to make them a property. We have 4 margins in the setter. Should I cover them as RectF? It would make it a bit more convolved for the app writer, but maybe its OK.

rinigus 2017-09-27 17:30

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Blurry rendering issue has been open at https://github.com/mapbox/mapbox-gl-native/issues/10076 . Similar to an issue reported for JS version of the library about 6 month ago.

rinigus 2017-09-27 19:45

Re: App for vector renderer maps, using OpenGL ES 2.0
 
Now the question from my side: how to make it simple to use the developed QML extension?

For C++ - based projects, its all trivial. We could just include corresponding library as a subproject in git and merge with the C++ project build system. As soon as QtLocation is allowed, all these projects are also Harbour-proof.

For Python-based map applications (Poor Maps and modRana), situation is not that simple. Its either I have to somehow make QML type available as a library or these applications would have to be converted to C++ in small parts (probably just to register type and define main). I presume that having extra lib requirement would make the application non-Harbour proof. The library has a small chance to be integrated into device either, since its LGPL3 (I used parts of the code from current QtLocation, hence the license).

Any ideas? If we go with the library approach, how do I register it in the QML to make it available?


PS: Zeta, margins are now a property through QRectF class.


All times are GMT. The time now is 20:51.

vBulletin® Version 3.8.8