diff options
Diffstat (limited to 'platform/darwin/src/MGLShapeSource.mm')
-rw-r--r-- | platform/darwin/src/MGLShapeSource.mm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLShapeSource.mm b/platform/darwin/src/MGLShapeSource.mm index 1425269012..c960f2a4a7 100644 --- a/platform/darwin/src/MGLShapeSource.mm +++ b/platform/darwin/src/MGLShapeSource.mm @@ -20,6 +20,7 @@ const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevel = @"MGLShapeSour const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevelForClustering = @"MGLShapeSourceOptionMaximumZoomLevelForClustering"; const MGLShapeSourceOption MGLShapeSourceOptionMinimumZoomLevel = @"MGLShapeSourceOptionMinimumZoomLevel"; const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance = @"MGLShapeSourceOptionSimplificationTolerance"; +const MGLShapeSourceOption MGLShapeSourceOptionLineDistanceMetrics = @"MGLShapeSourceOptionLineDistanceMetrics"; mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NSDictionary<MGLShapeSourceOption, id> *options) { auto geoJSONOptions = mbgl::style::GeoJSONOptions(); @@ -80,6 +81,14 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NSDictionary<MGLShap geoJSONOptions.cluster = value.boolValue; } + if (NSNumber *value = options[MGLShapeSourceOptionLineDistanceMetrics]) { + if (![value isKindOfClass:[NSNumber class]]) { + [NSException raise:NSInvalidArgumentException + format:@"MGLShapeSourceOptionLineDistanceMetrics must be an NSNumber."]; + } + geoJSONOptions.lineMetrics = value.boolValue; + } + return geoJSONOptions; } @@ -105,6 +114,14 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NSDictionary<MGLShap auto geoJSONOptions = MGLGeoJSONOptionsFromDictionary(options); auto source = std::make_unique<mbgl::style::GeoJSONSource>(identifier.UTF8String, geoJSONOptions); if (self = [super initWithPendingSource:std::move(source)]) { + if ([shape isMemberOfClass:[MGLShapeCollection class]]) { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + NSLog(@"MGLShapeCollection initialized with MGLFeatures will not retain attributes." + @"Use MGLShapeCollectionFeature to retain attributes instead." + @"This will be logged only once."); + }); + } self.shape = shape; } return self; |