Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Automatically query point annotations in region when region changes #4694

Closed
1ec5 opened this issue Apr 13, 2016 · 3 comments
Closed

Automatically query point annotations in region when region changes #4694

1ec5 opened this issue Apr 13, 2016 · 3 comments
Assignees
Labels
Android Mapbox Maps SDK for Android performance Speed, stability, CPU usage, memory usage, or power usage

Comments

@1ec5
Copy link
Contributor

1ec5 commented Apr 13, 2016

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.

/cc @tobrun @boundsj

@1ec5 1ec5 added performance Speed, stability, CPU usage, memory usage, or power usage Core The cross-platform C++ core, aka mbgl labels Apr 13, 2016
@1ec5 1ec5 added this to the ios-v3.3.0 milestone Apr 13, 2016
@jfirebaugh
Copy link
Contributor

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
Copy link
Contributor Author

1ec5 commented Apr 13, 2016

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.

@1ec5 1ec5 added Android Mapbox Maps SDK for Android and removed Core The cross-platform C++ core, aka mbgl labels Apr 13, 2016
@1ec5 1ec5 removed this from the ios-v3.3.0 milestone Apr 14, 2016
@jfirebaugh
Copy link
Contributor

Per discussion, we can start out by relying on notification handlers to call getPointAnnotationsInBounds(), and optimize when profiling reveals that to be a bottleneck.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android performance Speed, stability, CPU usage, memory usage, or power usage
Projects
None yet
Development

No branches or pull requests

3 participants