diff options
author | Jesse Bounds <jesse@rebounds.net> | 2016-11-01 11:48:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-01 11:48:09 -0700 |
commit | 2901bc0f6825f426cbcfd2a9ed78648dc81ab665 (patch) | |
tree | d3a050b065d3184db70c5726b4b1c5568c239624 /platform/macos | |
parent | 8ffd1f69252d28bf501d5464ac9e5f6ff8942c89 (diff) | |
download | qtlocation-mapboxgl-2901bc0f6825f426cbcfd2a9ed78648dc81ab665.tar.gz |
Optimize annotation view updates (#5987)
Use queryPointAnnotations to drive annotation view updates
- Get sets of visible and offscreen annotations using the mbgl query
mechanism and updates and enqueues as required
- Query viewport adjusted if tilted (avoid apparent issue with
queryPointAnnotations when the query box is larger than the actual
viewport)
- Add a small debugging display in iOS app to see annotations going in
and out of the reuse queue
This also works around a performance issue that made getting an annotation
context expensive by implementing a map of annotations to tags. It works
around another issue with the underlying mbgl query so that even if it (rarely)
returns an incorrect result, the correct visual effect still occurs and the reuse
queue is added to and drained as expected.
Finally, this refactors MGLMapView viewForAnnotation: to use the maps to
access the requested annotation context and view. This avoids a more
expensive lookup done previously.
Along for the ride: sync up the ios and macos names (and types) for
MGLAnnotationTagContextMap
Diffstat (limited to 'platform/macos')
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 4d1f00359d..4df365378a 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -108,7 +108,7 @@ enum { MGLAnnotationTagNotFound = UINT32_MAX }; /// Mapping from an annotation tag to metadata about that annotation, including /// the annotation itself. -typedef std::unordered_map<MGLAnnotationTag, MGLAnnotationContext> MGLAnnotationContextMap; +typedef std::unordered_map<MGLAnnotationTag, MGLAnnotationContext> MGLAnnotationTagContextMap; /// Returns an NSImage for the default marker image. NSImage *MGLDefaultMarkerImage() { @@ -171,7 +171,7 @@ public: CGFloat _pitchAtBeginningOfGesture; BOOL _didHideCursorDuringGesture; - MGLAnnotationContextMap _annotationContextsByAnnotationTag; + MGLAnnotationTagContextMap _annotationContextsByAnnotationTag; MGLAnnotationTag _selectedAnnotationTag; MGLAnnotationTag _lastSelectedAnnotationTag; /// Size of the rectangle formed by unioning the maximum slop area around every annotation image. |