Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
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

Closed

Description

@1ec5

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

Activity

  1. added
    performance
    Core
    on Apr 13, 2016
  2. added this to the ios-v3.3.0 milestone on Apr 13, 2016
  3. jfirebaugh commented on Apr 13, 2016

    @jfirebaugh
    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.

  4. 1ec5 commented on Apr 13, 2016

    @1ec5
    ContributorAuthor

    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.

  5. added
    Android
    and removed
    Core
    on Apr 13, 2016
  6. removed this from the ios-v3.3.0 milestone on Apr 14, 2016
  7. jfirebaugh commented on Apr 19, 2016

    @jfirebaugh
    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Androidperformance

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions