You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Automatically query point annotations in region when region changes #4694
Along the lines of #4384, mbgl should automatically call Map::getPointAnnotationsInBounds() within the visible region whenever the region changes and include the resulting annotation IDs in the region change notification. The query would only take place if client code registers for it somehow.
This additional context would greatly speed up tooltip and cursor rect calculations in the OS X SDK. It would also be important for implementing annotations as native views (#1784, #3276) while still relying on mbgl::AnnotationManager to manage the locations of those views.
Per #4693 (comment), it might also be desirable for the SDK to optionally expose this information in its delegate callbacks, to allow the developer to lazily load information related to the current viewport.
What's the advantage to including annotation IDs in the region change notification, versus calling getPointAnnotationsInBounds() from a change notification handler? I would prefer not to couple map notifications and annotations.
I just realized there would be no benefit to the iOS SDK, since AnnotationManager runs on the main thread rather than the Map thread. For the Android SDK, the advantage would be fewer trips across the JNI boundary, although I suppose jni.cpp could manage calling getPointAnnotationsInBounds() itself. @tobrun, does this sound feasible to you?
The performance hit I’ve been seeing in the OS X SDK with tooltip and cursor rects will manifest itself with native annotation views, but we’ll have to address that issue in other ways.
Per discussion, we can start out by relying on notification handlers to call getPointAnnotationsInBounds(), and optimize when profiling reveals that to be a bottleneck.
Activity
jfirebaugh commentedon Apr 13, 2016
What's the advantage to including annotation IDs in the region change notification, versus calling
getPointAnnotationsInBounds()from a change notification handler? I would prefer not to couple map notifications and annotations.1ec5 commentedon Apr 13, 2016
I just realized there would be no benefit to the iOS SDK, since
AnnotationManagerruns on the main thread rather than the Map thread. For the Android SDK, the advantage would be fewer trips across the JNI boundary, although I suppose jni.cpp could manage callinggetPointAnnotationsInBounds()itself. @tobrun, does this sound feasible to you?The performance hit I’ve been seeing in the OS X SDK with tooltip and cursor rects will manifest itself with native annotation views, but we’ll have to address that issue in other ways.
jfirebaugh commentedon Apr 19, 2016
Per discussion, we can start out by relying on notification handlers to call
getPointAnnotationsInBounds(), and optimize when profiling reveals that to be a bottleneck.