Thread
:
App for vector renderer maps, using OpenGL ES 2.0
View Single Post
rinigus
2017-09-25 , 07:20
Posts: 1,414 | Thanked: 7,547 times | Joined on Aug 2016 @ Estonia
#
69
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.
Quote & Reply
|
The Following 3 Users Say Thank You to rinigus For This Useful Post:
Amboss
,
taixzo
,
Zeta
rinigus
View Public Profile
Send a private message to rinigus
Find all posts by rinigus