summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLShapeSource.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/MGLShapeSource.mm')
-rw-r--r--platform/darwin/src/MGLShapeSource.mm12
1 files changed, 10 insertions, 2 deletions
diff --git a/platform/darwin/src/MGLShapeSource.mm b/platform/darwin/src/MGLShapeSource.mm
index 434e6fcb1b..987306a228 100644
--- a/platform/darwin/src/MGLShapeSource.mm
+++ b/platform/darwin/src/MGLShapeSource.mm
@@ -3,6 +3,7 @@
#import "MGLMapView_Private.h"
#import "MGLSource_Private.h"
#import "MGLFeature_Private.h"
+#import "MGLShapeCollectionFeature_Private.h"
#import "MGLShape_Private.h"
#import "NSURL+MGLAdditions.h"
@@ -99,8 +100,15 @@ const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance = @"MGLSh
source->setGeoJSON(geojson);
_shape = MGLShapeFromGeoJSON(geojson);
} else {
- const auto geojson = mbgl::GeoJSON{self.shape.geometryObject};
- source->setGeoJSON(geojson);
+ if ([self.shape isKindOfClass:[MGLShapeCollectionFeature class]]) {
+ MGLShapeCollectionFeature *feature = (MGLShapeCollectionFeature *)self.shape;
+ source->setGeoJSON(mbgl::GeoJSON{[feature mbglFeatureCollection]});
+ } else if ([self.shape conformsToProtocol:@protocol(MGLFeature)]) {
+ id<MGLFeaturePrivate> feature = (id<MGLFeaturePrivate>)self.shape;
+ source->setGeoJSON(mbgl::GeoJSON{[feature mbglFeature]});
+ } else {
+ source->setGeoJSON(mbgl::GeoJSON{self.shape.geometryObject});
+ }
}
_pendingSource = std::move(source);