Comments (3)
I agree, there is a delay which, while short, is sometimes observable by the user. And it should be reduced as much as possible.
The delay is essentially caused by the fact that QMapboxGL "lives" in a thread (or threads) that is different from the GUI thread. So, wherever we want to get something out of Mapbox GL, we need to send signals between threads, one for request from GUI to OpenGL rendering and one back to the GUI.
In case of the bubbles with the WhoGo example:
-
On click, MapboxMapGestureArea requests queryCoordinateForPixel from the map object.
-
queryCoordinateForPixel
is a signal that is sent over queued connection toQSGMapboxGLTextureNode
and activates OpenGL rendering update to wakeup the thread where QSGMapboxGLTextureNode is. -
QSGMapboxGLTextureNode
calculates the result and emitsreplyCoordinateForPixel
back to GUI thread via queued connection. -
replyCoordinateForPixel
is received byMapboxMapGestureArea
and forwarded to the main code via emittedclickedGeo
. The latter signal should be direct (aka fast) since it is in the same thread. -
clickedGeo
is followed by WhoGo maps and, on receiving it, there is a loop that runs through all POIs to check if any of them was clicked.
As you could see, there is some processing involved and some of the delays could be induced due to
connections between threads. I am not sure whether I can significantly reduce for occasional click. But for POIs that we know beforehand, maybe its possible to figure out something.
We do have location tracking facility. However, I doubt that it maybe too expensive to keep an eye on all POIs at each frame refresh.
I'll think what I can do to reduce the delay.
from mapbox-gl-qml.
Sounds complicated. I figured it was due to the separation, but was hoping there was maybe something simple like a polling frequency. Have you checked how QtLocation's Mapbox GL plugin handles this?
We do have location tracking facility. However, I doubt that it maybe too expensive to keep an eye on all POIs at each frame refresh.
It could be done so that each frame refresh would just mark the map as changed and a timer would run e.g. every 500 ms and update the tracking cache if the map is changed. Then if the user waits that 500 ms between panning and tapping, which is likely to be the usual case, it would work fast, otherwise as currently. But, of course, that would likely require app-specific code, so it's probably more a workaround than a fix.
from mapbox-gl-qml.
Not much I can do about it; closing
from mapbox-gl-qml.
Related Issues (20)
- Mouse area: consider adapting Qt mouse area for maps HOT 1
- long hold event problems HOT 1
- add examples to fitView API description
- Background for raster sources HOT 3
- Updating source layer many times (7000) could lead to crash
- queryCoordinateForPixel returns inaccurate data HOT 3
- #include <QMapboxGL> not found HOT 2
- Allow clearing cache HOT 3
- Make a distinction between swipe and tap HOT 3
- running the project problem! (windows 10, 64 bit) HOT 3
- Crash at high zoom levels for RTL countries HOT 3
- Make linking with OpenSSL optional
- Runtime styling HOT 1
- Expose style JSON as it is used
- How to add images to the map at location HOT 11
- Fix zooming and movement for FBO case
- Add map to physical pixel ratio
- Consider adding default style
- Just informational note ...
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapbox-gl-qml.