summaryrefslogtreecommitdiff
path: root/platform/osx/src/MGLMapView.mm
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-06-05 00:37:42 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-06-06 15:40:52 -0700
commit62149410fa49b7ceb6ae3491a1fcde506e13669b (patch)
tree74edc8d1b6bc854a47c4c497c21cd65381b48264 /platform/osx/src/MGLMapView.mm
parent126f388fdbb3b9572aa1ccafaf27967da385ccdd (diff)
downloadqtlocation-mapboxgl-62149410fa49b7ceb6ae3491a1fcde506e13669b.tar.gz
[ios, osx] Ignore multipoints
Ignore multipoints (as opposed to polylines and polygons) when adding annotations, just like we ignore multipolylines, multipolygons, and shape collections. In osxapp, break multipoint features into points before adding them as annotations.
Diffstat (limited to 'platform/osx/src/MGLMapView.mm')
-rw-r--r--platform/osx/src/MGLMapView.mm14
1 files changed, 9 insertions, 5 deletions
diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm
index 03b94c25ba..ac4eae9d34 100644
--- a/platform/osx/src/MGLMapView.mm
+++ b/platform/osx/src/MGLMapView.mm
@@ -1608,6 +1608,12 @@ public:
NSAssert([annotation conformsToProtocol:@protocol(MGLAnnotation)], @"Annotation does not conform to MGLAnnotation");
if ([annotation isKindOfClass:[MGLMultiPoint class]]) {
+ // Actual multipoints aren’t supported as annotations.
+ if ([annotation isMemberOfClass:[MGLMultiPoint class]]
+ || [annotation isMemberOfClass:[MGLMultiPointFeature class]]) {
+ continue;
+ }
+
// The multipoint knows how to style itself (with the map view’s help).
MGLMultiPoint *multiPoint = (MGLMultiPoint *)annotation;
if (!multiPoint.pointCount) {
@@ -1618,11 +1624,9 @@ public:
MGLAnnotationContext context;
context.annotation = annotation;
_annotationContextsByAnnotationTag[annotationTag] = context;
- } else if ([annotation isKindOfClass:[MGLMultiPolyline class]]
- || [annotation isKindOfClass:[MGLMultiPolygon class]]
- || [annotation isKindOfClass:[MGLShapeCollection class]]) {
- continue;
- } else {
+ } else if (![annotation isKindOfClass:[MGLMultiPolyline class]]
+ || ![annotation isKindOfClass:[MGLMultiPolygon class]]
+ || ![annotation isKindOfClass:[MGLShapeCollection class]]) {
MGLAnnotationImage *annotationImage = nil;
if (delegateHasImagesForAnnotations) {
annotationImage = [self.delegate mapView:self imageForAnnotation:annotation];