summaryrefslogtreecommitdiff
path: root/platform/darwin/src
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2017-03-10 14:27:21 -0800
committerMinh Nguyễn <mxn@1ec5.org>2017-03-10 15:08:00 -0800
commitb74d7bfdb48d2a1a301945a02e41c422c0198456 (patch)
tree9e8c528787e75cc286d5cbb62cc2ae444c46c22d /platform/darwin/src
parentffce46cae6cdc3a4b952a0aeca80b5d5f7304b6d (diff)
downloadqtlocation-mapboxgl-b74d7bfdb48d2a1a301945a02e41c422c0198456.tar.gz
[ios, macos] Corrected polyline equality
Now that annotation classes override -isEqual:, it’s no longer appropriate to rely on -isEqual: or -containsObject: to check for the preexistence of an annotation. Those methods become deep equality tests, which have worse performance. Checking for identity allows the developer to add a polyline and polygon with identical coordinates, title, etc. to the map. Implemented a missing -[MGLPolyline isEqual:]. Removed outdated comments about -annotationTagForAnnotation: being expensive.
Diffstat (limited to 'platform/darwin/src')
-rw-r--r--platform/darwin/src/MGLPolyline.mm4
1 files changed, 4 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLPolyline.mm b/platform/darwin/src/MGLPolyline.mm
index 454a1b964b..ae4fbe61de 100644
--- a/platform/darwin/src/MGLPolyline.mm
+++ b/platform/darwin/src/MGLPolyline.mm
@@ -48,6 +48,10 @@
@"coordinates": self.mgl_coordinates};
}
+- (BOOL)isEqual:(id)other {
+ return self == other || ([other isKindOfClass:[MGLPolyline class]] && [super isEqual:other]);
+}
+
@end
@interface MGLMultiPolyline ()