diff options
Diffstat (limited to 'platform/ios/src')
-rw-r--r-- | platform/ios/src/MGLMapView.h | 14 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 19 |
2 files changed, 19 insertions, 14 deletions
diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h index d02c3a93a9..63d799bda9 100644 --- a/platform/ios/src/MGLMapView.h +++ b/platform/ios/src/MGLMapView.h @@ -882,9 +882,10 @@ IB_DESIGNABLE Adds an annotation to the map view. @note `MGLMultiPolyline`, `MGLMultiPolygon`, and `MGLShapeCollection` objects - cannot be added to the map view at this time. Any multipolyline, - multipolygon, or shape collection object that is passed into this method is - silently ignored. + cannot be added to the map view at this time. Nor can `MGLMultiPoint` + objects that are not instances of `MGLPolyline` or `MGLPolygon`. Any + multipoint, multipolyline, multipolygon, or shape collection object that is + specified is silently ignored. @param annotation The annotation object to add to the receiver. This object must conform to the `MGLAnnotation` protocol. The map view retains the @@ -895,9 +896,10 @@ IB_DESIGNABLE Adds an array of annotations to the map view. @note `MGLMultiPolyline`, `MGLMultiPolygon`, and `MGLShapeCollection` objects - cannot be added to the map view at this time. Any multipolyline, - multipolygon, or shape collection objects that are passed in are silently - ignored. + cannot be added to the map view at this time. Nor can `MGLMultiPoint` + objects that are not instances of `MGLPolyline` or `MGLPolygon`. Any + multipoint, multipolyline, multipolygon, or shape collection objects that + are specified are silently ignored. @param annotations An array of annotation objects. Each object in the array must conform to the `MGLAnnotation` protocol. The map view retains each diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 1ad758dc77..b05c5e41d4 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -2835,7 +2835,14 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) if ([annotation isKindOfClass:[MGLMultiPoint class]]) { - // The multipoint knows how to style itself (with the map view’s help). + // Actual multipoints aren’t supported as annotations. + if ([annotation isMemberOfClass:[MGLMultiPoint class]] + || [annotation isMemberOfClass:[MGLMultiPointFeature class]]) + { + continue; + } + + // The polyline or polygon knows how to style itself (with the map view’s help). MGLMultiPoint *multiPoint = (MGLMultiPoint *)annotation; if (!multiPoint.pointCount) { continue; @@ -2846,13 +2853,9 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) 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]]) { MGLAnnotationView *annotationView; NSString *symbolName; |