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.
MGLMapView should map annotation IDs to annotation metadata #3159
MGLMapView holds an NSMapTable mapping MGLAnnotation objects to dictionaries containing IDs and other metadata. The problem is that IDs aren’t metadata; they’re the unique key. So many operations that should be simple lookups end up requiring expensive loops or are simply impossible. For example, this loop through all annotation metadata can be very expensive, and it isn’t possible to put a fix for #1504 in there because a) we’re iterating over all the annotations, not just the nearby ones, and b) the annotation ID is inaccessible.
I ran into this issue while working on #1496 and again while trying to port the fix for #1504 back from OS X to iOS. For the OS X version of MGLMapView in #3135, I started out with a mapping from annotation IDs (MGLAnnotationTag) to annotation context objects, and it has worked out very well. There are couple places where I need to get an ID from an annotation, and performance is fine in those places.
Activity
[ios] Refactored MGLMapView annotations
[ios] Refactored MGLMapView annotations
t-yoshii commentedon Jan 25, 2016
After this change, removeAnnotation() and removeAnnotations() of MGLMapView crashes when annotation has not been added, with following assertion.
NSAssert(annotationTag != MGLAnnotationTagNotFound, @"No ID for annotation %@", annotation);
I think removeAnnotation can be called whether the annotation is added or not.
[ios] Allow removing never-added annotations
1ec5 commentedon Jan 25, 2016
Thanks, @t-yoshii. Fixed in #3685.
t-yoshii commentedon Jan 25, 2016
Thank you for your quick response!