[ios, macos] Introduce MGLShapeSourceOptionLineDistanceMetrics
Exposes access to https://www.mapbox.com/mapbox-gl-js/style-spec/#sources-geojson-lineMetrics
This commit is contained in:
@@ -95,6 +95,18 @@ FOUNDATION_EXTERN MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionBuff
|
||||
*/
|
||||
FOUNDATION_EXTERN MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance;
|
||||
|
||||
/**
|
||||
An `NSNumber` object containing a Boolean enabling or disabling calculating line distance metrics.
|
||||
|
||||
Set this property to `YES` in order for the `MGLLineStyleLayer.lineGradient` property to have its intended effect.
|
||||
The default value is `NO`.
|
||||
|
||||
This option corresponds to the
|
||||
<a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#sources-geojson-lineMetrics"><code>lineMetrics</code></a>
|
||||
source property in the Mapbox Style Specification.
|
||||
*/
|
||||
FOUNDATION_EXTERN MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionLineDistanceMetrics;
|
||||
|
||||
/**
|
||||
`MGLShapeSource` is a map content source that supplies vector shapes to be
|
||||
shown on the map. The shapes may be instances of `MGLShape` or `MGLFeature`,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user