summaryrefslogtreecommitdiff
path: root/platform/macos/app/MapDocument.m
diff options
context:
space:
mode:
Diffstat (limited to 'platform/macos/app/MapDocument.m')
-rw-r--r--platform/macos/app/MapDocument.m15
1 files changed, 7 insertions, 8 deletions
diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m
index 2de189c856..39055d7447 100644
--- a/platform/macos/app/MapDocument.m
+++ b/platform/macos/app/MapDocument.m
@@ -22,10 +22,13 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
NSMutableArray *flattenedShapes = [NSMutableArray arrayWithCapacity:shapes.count];
for (id <MGLAnnotation> shape in shapes) {
NSArray *subshapes;
- // Flatten multipoints but not polylines or polygons.
- if ([shape isMemberOfClass:[MGLMultiPoint class]]) {
- NSUInteger pointCount = [(MGLMultiPoint *)shape pointCount];
- CLLocationCoordinate2D *coordinates = [(MGLMultiPoint *)shape coordinates];
+ if ([shape isKindOfClass:[MGLMultiPolyline class]]) {
+ subshapes = [(MGLMultiPolyline *)shape polylines];
+ } else if ([shape isKindOfClass:[MGLMultiPolygon class]]) {
+ subshapes = [(MGLMultiPolygon *)shape polygons];
+ } else if ([shape isKindOfClass:[MGLPointCollection class]]) {
+ NSUInteger pointCount = [(MGLPointCollection *)shape pointCount];
+ CLLocationCoordinate2D *coordinates = [(MGLPointCollection *)shape coordinates];
NSMutableArray *pointAnnotations = [NSMutableArray arrayWithCapacity:pointCount];
for (NSUInteger i = 0; i < pointCount; i++) {
MGLPointAnnotation *pointAnnotation = [[MGLPointAnnotation alloc] init];
@@ -33,10 +36,6 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
[pointAnnotations addObject:pointAnnotation];
}
subshapes = pointAnnotations;
- } else if ([shape isKindOfClass:[MGLMultiPolyline class]]) {
- subshapes = [(MGLMultiPolyline *)shape polylines];
- } else if ([shape isKindOfClass:[MGLMultiPolygon class]]) {
- subshapes = [(MGLMultiPolygon *)shape polygons];
} else if ([shape isKindOfClass:[MGLShapeCollection class]]) {
subshapes = MBXFlattenedShapes([(MGLShapeCollection *)shape shapes]);
}