diff options
author | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2018-02-07 12:07:31 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-07 12:07:31 -0800 |
commit | 6c5e4575907c9c7ff73d327114f0c105e6684a4d (patch) | |
tree | 01564fefd1c3747ac176c0704d4ff56732ef9b14 /platform/darwin | |
parent | e03f7a4d1f067cd01eb3022811eddb0b1892801b (diff) | |
download | qtlocation-mapboxgl-6c5e4575907c9c7ff73d327114f0c105e6684a4d.tar.gz |
Add options for Custom Geometry Source types to enable clipping and wrapping geometry (#11041)
Diffstat (limited to 'platform/darwin')
-rw-r--r-- | platform/darwin/src/MGLAbstractShapeSource.h | 18 | ||||
-rw-r--r-- | platform/darwin/src/MGLAbstractShapeSource.mm | 19 |
2 files changed, 37 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLAbstractShapeSource.h b/platform/darwin/src/MGLAbstractShapeSource.h index 3b35986b3f..a0c6af36c5 100644 --- a/platform/darwin/src/MGLAbstractShapeSource.h +++ b/platform/darwin/src/MGLAbstractShapeSource.h @@ -82,6 +82,24 @@ extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionBuffer; extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance; /** + An `NSNumber` object containing a boolean; specifies whether the geometry for a + `MGLComputedShapeSource` needs to be wrapped to accomodate coordinates with longitudes outside the [-180,180] extents. The default is `false.` + + Setting this option to `true` affects performance. + */ +extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionWrapCoordinates; + +/** + An `NSNumber` object containing a boolean; specifies whether the geometry for a + `MGLComputedShapeSource` needs to be clipped at the tile boundaries. + The default is `false.` + + Setting this options to `true` affects performance. Use this option to clip + polygons and lines at tile boundaries without artefacts. + */ +extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionClipCoordinates; + +/** `MGLAbstractShapeSource` is an abstract base class for map content sources that supply vector shapes to be shown on the map. A shape source is added to an `MGLStyle` object along with an `MGLVectorStyleLayer` object. The vector style diff --git a/platform/darwin/src/MGLAbstractShapeSource.mm b/platform/darwin/src/MGLAbstractShapeSource.mm index 755d040387..80442e0e6d 100644 --- a/platform/darwin/src/MGLAbstractShapeSource.mm +++ b/platform/darwin/src/MGLAbstractShapeSource.mm @@ -8,6 +8,8 @@ const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevel = @"MGLShapeSour const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevelForClustering = @"MGLShapeSourceOptionMaximumZoomLevelForClustering"; const MGLShapeSourceOption MGLShapeSourceOptionMinimumZoomLevel = @"MGLShapeSourceOptionMinimumZoomLevel"; const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance = @"MGLShapeSourceOptionSimplificationTolerance"; +const MGLShapeSourceOption MGLShapeSourceOptionWrapCoordinates = @"MGLShapeSourceOptionWrapCoordinates"; +const MGLShapeSourceOption MGLShapeSourceOptionClipCoordinates = @"MGLShapeSourceOptionClipCoordinates"; @interface MGLAbstractShapeSource () @@ -113,5 +115,22 @@ mbgl::style::CustomGeometrySource::Options MBGLCustomGeometrySourceOptionsFromDi } sourceOptions.tileOptions.tolerance = value.doubleValue; } + + if (NSNumber *value = options[MGLShapeSourceOptionWrapCoordinates]) { + if (![value isKindOfClass:[NSNumber class]]) { + [NSException raise:NSInvalidArgumentException + format:@"MGLShapeSourceOptionWrapCoordinates must be an NSNumber."]; + } + sourceOptions.tileOptions.wrap = value.boolValue; + } + + if (NSNumber *value = options[MGLShapeSourceOptionClipCoordinates]) { + if (![value isKindOfClass:[NSNumber class]]) { + [NSException raise:NSInvalidArgumentException + format:@"MGLShapeSourceOptionClipCoordinates must be an NSNumber."]; + } + sourceOptions.tileOptions.clip = value.boolValue; + } + return sourceOptions; } |