From a19ce69455cd5230567d833ebbf1666fb8470295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Thu, 26 Jan 2017 23:51:29 -0800 Subject: [PATCH] [macos] Flatten point collections, not multipoints --- platform/macos/app/MapDocument.m | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m index 64833a856..a72eb42de 100644 --- a/platform/macos/app/MapDocument.m +++ b/platform/macos/app/MapDocument.m @@ -22,10 +22,13 @@ NS_ARRAY_OF(id ) *MBXFlattenedShapes(NS_ARRAY_OF(id 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 ) *MBXFlattenedShapes(NS_ARRAY_OF(id