diff options
Diffstat (limited to 'platform/darwin/src')
23 files changed, 89 insertions, 86 deletions
diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h index aa2d07db26..926005b444 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.h +++ b/platform/darwin/src/MGLCircleStyleLayer.h @@ -62,8 +62,8 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslationAnchor) { circles on the map. Use a circle style layer to configure the visual appearance of point or point - collection features in vector tiles loaded by an `MGLVectorSource` object or - `MGLPointAnnotation`, `MGLPointFeature`, `MGLPointCollection`, or + collection features in vector tiles loaded by an `MGLVectorTileSource` object + or `MGLPointAnnotation`, `MGLPointFeature`, `MGLPointCollection`, or `MGLPointCollectionFeature` instances in an `MGLShapeSource` object. A circle style layer renders circles whose radii are measured in screen units. diff --git a/platform/darwin/src/MGLFeature.h b/platform/darwin/src/MGLFeature.h index a13821cf96..d0c9e26062 100644 --- a/platform/darwin/src/MGLFeature.h +++ b/platform/darwin/src/MGLFeature.h @@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN /** The `MGLFeature` protocol is used to provide details about geographic features - contained in an `MGLShapeSource` or `MGLVectorSource` object. Each concrete + contained in an `MGLShapeSource` or `MGLVectorTileSource` object. Each concrete subclass of `MGLShape` in turn has a subclass that conforms to this protocol. A feature object associates a shape with an optional identifier and attributes. @@ -23,8 +23,8 @@ NS_ASSUME_NONNULL_BEGIN In addition to adding data to the map, you can also extract data from the map: `-[MGLMapView visibleFeaturesAtPoint:]` and related methods return feature objects that correspond to features in the source. This enables you to inspect - the properties of features in vector tiles loaded by `MGLVectorSource` objects. - You also reuse these feature objects as overlay annotations. + the properties of features in vector tiles loaded by `MGLVectorTileSource` + objects. You also reuse these feature objects as overlay annotations. While it is possible to add `MGLFeature`-conforming objects to the map as annotations using `-[MGLMapView addAnnotations:]` and related methods, doing so @@ -43,12 +43,12 @@ NS_ASSUME_NONNULL_BEGIN source. You can configure an `MGLVectorStyleLayer` object to include or exclude a - specific feature in an `MGLShapeSource` or `MGLVectorSource`. In the + specific feature in an `MGLShapeSource` or `MGLVectorTileSource`. In the `MGLVectorStyleLayer.predicate` property, compare the special `$id` attribute to the feature’s identifier. - In vector tiles loaded by `MGLVectorSource` objects, the identifier corresponds - to the + In vector tiles loaded by `MGLVectorTileSource` objects, the identifier + corresponds to the <a href="https://github.com/mapbox/vector-tile-spec/tree/master/2.1#42-features">feature identifier</a> (`id`). If the source does not specify the feature’s identifier, the value of this property is `nil`. If specified, the identifier may be an integer, @@ -83,7 +83,7 @@ NS_ASSUME_NONNULL_BEGIN A dictionary of attributes for this feature. You can configure an `MGLVectorStyleLayer` object to include or exclude a - specific feature in an `MGLShapeSource` or `MGLVectorSource`. In the + specific feature in an `MGLShapeSource` or `MGLVectorTileSource`. In the `MGLVectorStyleLayer.predicate` property, compare a key of the attribute dictionary to the value you want to include. For example, if you want an `MGLLineStyleLayer` object to display only important features, you might assign @@ -107,7 +107,7 @@ NS_ASSUME_NONNULL_BEGIN `MGLSymbolStyleLayer.textField` to an `MGLStyleValue` object containing the raw string value `{name}`. - In vector tiles loaded by `MGLVectorSource` objects, the keys and values of + In vector tiles loaded by `MGLVectorTileSource` objects, the keys and values of each feature’s attribute dictionary are determined by the source. Each attribute name is a string, while each attribute value may be a null value, Boolean value, integer, floating-point number, or string. These data types are @@ -238,11 +238,12 @@ MGL_EXPORT An `MGLShapeCollectionFeature` object associates a shape collection with an optional identifier and attributes. - `MGLShapeCollectionFeature` is most commonly used to add multiple shapes to a single - `MGLShapeSource`. Configure the appearance of an `MGLSource`’s shape collection - collectively using an `MGLSymbolStyleLayer` object, or use multiple instances of - `MGLCircleStyleLayer`, `MGLFillStyleLayer`, and `MGLLineStyleLayer` to - configure the appearance of each kind of shape inside the collection. + `MGLShapeCollectionFeature` is most commonly used to add multiple shapes to a + single `MGLShapeSource`. Configure the appearance of an `MGLSource`’s shape + collection collectively using an `MGLSymbolStyleLayer` object, or use multiple + instances of `MGLCircleStyleLayer`, `MGLFillStyleLayer`, and + `MGLLineStyleLayer` to configure the appearance of each kind of shape inside + the collection. A shape collection feature is known as a <a href="https://tools.ietf.org/html/rfc7946#section-3.3">feature collection</a> diff --git a/platform/darwin/src/MGLFillExtrusionStyleLayer.h b/platform/darwin/src/MGLFillExtrusionStyleLayer.h index 2eb3174675..88c13a52d7 100644 --- a/platform/darwin/src/MGLFillExtrusionStyleLayer.h +++ b/platform/darwin/src/MGLFillExtrusionStyleLayer.h @@ -29,8 +29,8 @@ typedef NS_ENUM(NSUInteger, MGLFillExtrusionTranslationAnchor) { extruded polygons on the map. Use a fill-extrusion style layer to configure the visual appearance of polygon - or multipolygon features in vector tiles loaded by an `MGLVectorSource` object - or `MGLPolygon`, `MGLPolygonFeature`, `MGLMultiPolygon`, or + or multipolygon features in vector tiles loaded by an `MGLVectorTileSource` + object or `MGLPolygon`, `MGLPolygonFeature`, `MGLMultiPolygon`, or `MGLMultiPolygonFeature` instances in an `MGLShapeSource` object. You can access an existing fill-extrusion style layer using the diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h index 421813bbca..9cab084dd7 100644 --- a/platform/darwin/src/MGLFillStyleLayer.h +++ b/platform/darwin/src/MGLFillStyleLayer.h @@ -28,8 +28,8 @@ typedef NS_ENUM(NSUInteger, MGLFillTranslationAnchor) { optionally stroked) polygons on the map. Use a fill style layer to configure the visual appearance of polygon or - multipolygon features in vector tiles loaded by an `MGLVectorSource` object or - `MGLPolygon`, `MGLPolygonFeature`, `MGLMultiPolygon`, or + multipolygon features in vector tiles loaded by an `MGLVectorTileSource` object + or `MGLPolygon`, `MGLPolygonFeature`, `MGLMultiPolygon`, or `MGLMultiPolygonFeature` instances in an `MGLShapeSource` object. You can access an existing fill style layer using the diff --git a/platform/darwin/src/MGLHeatmapStyleLayer.h b/platform/darwin/src/MGLHeatmapStyleLayer.h index 1c68e2cae8..46fc13fb50 100644 --- a/platform/darwin/src/MGLHeatmapStyleLayer.h +++ b/platform/darwin/src/MGLHeatmapStyleLayer.h @@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN data, using color to avoid cluttering the map with individual points at low zoom levels. The points are weighted by an attribute you specify. Use a heatmap style layer in conjunction with point or point collection features in vector - tiles loaded by an `MGLVectorSource` object or `MGLPointAnnotation`, + tiles loaded by an `MGLVectorTileSource` object or `MGLPointAnnotation`, `MGLPointFeature`, `MGLPointCollection`, or `MGLPointCollectionFeature` instances in an `MGLShapeSource` object. diff --git a/platform/darwin/src/MGLHillshadeStyleLayer.h b/platform/darwin/src/MGLHillshadeStyleLayer.h index bc831c7f06..4c8e519572 100644 --- a/platform/darwin/src/MGLHillshadeStyleLayer.h +++ b/platform/darwin/src/MGLHillshadeStyleLayer.h @@ -36,7 +36,7 @@ typedef NS_ENUM(NSUInteger, MGLHillshadeIlluminationAnchor) { To display posterized hillshading based on vector shapes, as with the <a href="https://www.mapbox.com/vector-tiles/mapbox-terrain/">Mapbox Terrain</a> - source, use an `MGLVectorSource` object in conjunction with several + source, use an `MGLVectorTileSource` object in conjunction with several `MGLFillStyleLayer` objects. You can access an existing hillshade style layer using the diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index d8e109d559..4ee8735b34 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -78,8 +78,8 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslationAnchor) { polylines on the map. Use a line style layer to configure the visual appearance of polyline or - multipolyline features in vector tiles loaded by an `MGLVectorSource` object or - `MGLPolyline`, `MGLPolylineFeature`, `MGLMultiPolyline`, or + multipolyline features in vector tiles loaded by an `MGLVectorTileSource` + object or `MGLPolyline`, `MGLPolylineFeature`, `MGLMultiPolyline`, or `MGLMultiPolylineFeature` instances in an `MGLShapeSource` object. You can access an existing line style layer using the diff --git a/platform/darwin/src/MGLPointAnnotation.h b/platform/darwin/src/MGLPointAnnotation.h index 78b92f45ac..3dac7a969c 100644 --- a/platform/darwin/src/MGLPointAnnotation.h +++ b/platform/darwin/src/MGLPointAnnotation.h @@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN You can add point shapes to the map by adding them to an `MGLShapeSource` object. Configure the appearance of an `MGLShapeSource`’s or - `MGLVectorSource`’s point shapes collectively using an `MGLCircleStyleLayer` or + `MGLVectorTileSource`’s point shapes collectively using an `MGLCircleStyleLayer` or `MGLSymbolStyleLayer` object. For more interactivity, add a selectable point annotation to a map view using diff --git a/platform/darwin/src/MGLPointCollection.h b/platform/darwin/src/MGLPointCollection.h index 5aab580b4d..65ce95cb0f 100644 --- a/platform/darwin/src/MGLPointCollection.h +++ b/platform/darwin/src/MGLPointCollection.h @@ -14,7 +14,7 @@ You can add point collections to the map by adding them to an `MGLShapeSource` object. Configure the appearance of an `MGLShapeSource`’s or - `MGLVectorSource`’s point collections collectively using an + `MGLVectorTileSource`’s point collections collectively using an `MGLCircleStyleLayer` or `MGLSymbolStyleLayer` object. To access a point collection’s attributes, use an `MGLPointCollectionFeature` object. diff --git a/platform/darwin/src/MGLPolygon.h b/platform/darwin/src/MGLPolygon.h index bdd2e1eeab..190b6df9c5 100644 --- a/platform/darwin/src/MGLPolygon.h +++ b/platform/darwin/src/MGLPolygon.h @@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN You can add polygon shapes to the map by adding them to an `MGLShapeSource` object. Configure the appearance of an `MGLShapeSource`’s or - `MGLVectorSource`’s polygons collectively using an `MGLFillStyleLayer` or + `MGLVectorTileSource`’s polygons collectively using an `MGLFillStyleLayer` or `MGLSymbolStyleLayer` object. To access a polygon’s attributes, use an `MGLPolygonFeature` object. @@ -96,8 +96,8 @@ MGL_EXPORT You can add multipolygon shapes to the map by adding them to an `MGLShapeSource` object. Configure the appearance of an `MGLShapeSource`’s or - `MGLVectorSource`’s multipolygons collectively using an `MGLFillStyleLayer` or - `MGLSymbolStyleLayer` object. + `MGLVectorTileSource`’s multipolygons collectively using an `MGLFillStyleLayer` + or `MGLSymbolStyleLayer` object. You cannot add an `MGLMultiPolygon` object directly to a map view using `-[MGLMapView addAnnotation:]` or `-[MGLMapView addOverlay:]`. However, you can diff --git a/platform/darwin/src/MGLPolyline.h b/platform/darwin/src/MGLPolyline.h index 1ed3dd0b9f..b1fca5bf28 100644 --- a/platform/darwin/src/MGLPolyline.h +++ b/platform/darwin/src/MGLPolyline.h @@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN You can add polyline shapes to the map by adding them to an `MGLShapeSource` object. Configure the appearance of an `MGLShapeSource`’s or - `MGLVectorSource`’s polylines collectively using an `MGLLineStyleLayer` or + `MGLVectorTileSource`’s polylines collectively using an `MGLLineStyleLayer` or `MGLSymbolStyleLayer` object. To access a polyline’s attributes, use an `MGLPolylineFeature` object. @@ -75,8 +75,8 @@ MGL_EXPORT You can add multipolyline shapes to the map by adding them to an `MGLShapeSource` object. Configure the appearance of an `MGLShapeSource`’s or - `MGLVectorSource`’s multipolylines collectively using an `MGLLineStyleLayer` or - `MGLSymbolStyleLayer` object. + `MGLVectorTileSource`’s multipolylines collectively using an + `MGLLineStyleLayer` or `MGLSymbolStyleLayer` object. You cannot add an `MGLMultiPolyline` object directly to a map view using `-[MGLMapView addAnnotation:]` or `-[MGLMapView addOverlay:]`. However, you can diff --git a/platform/darwin/src/MGLRasterTileSource.h b/platform/darwin/src/MGLRasterTileSource.h index 6306ead5fb..fe71e8e6ad 100644 --- a/platform/darwin/src/MGLRasterTileSource.h +++ b/platform/darwin/src/MGLRasterTileSource.h @@ -17,8 +17,8 @@ NS_ASSUME_NONNULL_BEGIN requires a value of 256, as do many third-party tile servers, so consult your provider’s documentation for the correct value. - This option is only applicable to `MGLRasterTileSource` objects; it is ignored when - initializing `MGLVectorSource` objects. + This option is only applicable to `MGLRasterTileSource` objects; it is ignored + when initializing `MGLVectorTileSource` objects. */ extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionTileSize; diff --git a/platform/darwin/src/MGLShape.h b/platform/darwin/src/MGLShape.h index 4bab2b81c1..e0ef0999db 100644 --- a/platform/darwin/src/MGLShape.h +++ b/platform/darwin/src/MGLShape.h @@ -12,9 +12,10 @@ NS_ASSUME_NONNULL_BEGIN Create instances of `MGLPointAnnotation`, `MGLPointCollection`, `MGLPolyline`, `MGLMultiPolyline`, `MGLPolygon`, `MGLMultiPolygon`, or `MGLShapeCollection` in - order to use `MGLShape`'s methods. Do not create instances of `MGLShape` directly, - and do not create your own subclasses of this class. The shape classes correspond - to the <a href="https://tools.ietf.org/html/rfc7946#section-3.1">Geometry</a> object + order to use `MGLShape`'s methods. Do not create instances of `MGLShape` + directly, and do not create your own subclasses of this class. The shape + classes correspond to the + <a href="https://tools.ietf.org/html/rfc7946#section-3.1">Geometry</a> object types in the GeoJSON standard, but some have nonstandard names for backwards compatibility. @@ -24,10 +25,10 @@ NS_ASSUME_NONNULL_BEGIN shape’s attributes, use the corresponding `MGLFeature` class instead. You can add shapes to the map by adding them to an `MGLShapeSource` object. - Configure the appearance of an `MGLShapeSource`’s or `MGLVectorSource`’s shapes - collectively using a concrete instance of `MGLVectorStyleLayer`. Alternatively, - you can add some kinds of shapes directly to a map view as annotations or - overlays. + Configure the appearance of an `MGLShapeSource`’s or `MGLVectorTileSource`’s + shapes collectively using a concrete instance of `MGLVectorStyleLayer`. + Alternatively, you can add some kinds of shapes directly to a map view as + annotations or overlays. */ MGL_EXPORT @interface MGLShape : NSObject <MGLAnnotation, NSSecureCoding> diff --git a/platform/darwin/src/MGLShapeCollection.h b/platform/darwin/src/MGLShapeCollection.h index 094c630167..bec482ca61 100644 --- a/platform/darwin/src/MGLShapeCollection.h +++ b/platform/darwin/src/MGLShapeCollection.h @@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN `MGLShapeCollection` is most commonly used to add multiple shapes to a single `MGLShapeSource`. Configure the appearance of an `MGLShapeSource`’s or - `MGLVectorSource`’s shape collection collectively using an + `MGLVectorTileSource`’s shape collection collectively using an `MGLSymbolStyleLayer` object, or use multiple instances of `MGLCircleStyleLayer`, `MGLFillStyleLayer`, and `MGLLineStyleLayer` to configure the appearance of each kind of shape inside the collection. @@ -27,8 +27,8 @@ NS_ASSUME_NONNULL_BEGIN To represent a collection of point, polyline, or polygon shapes, it may be more convenient to use an `MGLPointCollection`, `MGLMultiPolyline`, or - `MGLMultiPolygon` object, respectively. To access a shape collection’s attributes, - use the corresponding `MGLFeature` object. + `MGLMultiPolygon` object, respectively. To access a shape collection’s + attributes, use the corresponding `MGLFeature` object. A shape collection is known as a <a href="https://tools.ietf.org/html/rfc7946#section-3.1.8">GeometryCollection</a> diff --git a/platform/darwin/src/MGLSource.h b/platform/darwin/src/MGLSource.h index e3e45faca8..9657f2f1eb 100644 --- a/platform/darwin/src/MGLSource.h +++ b/platform/darwin/src/MGLSource.h @@ -16,10 +16,10 @@ NS_ASSUME_NONNULL_BEGIN add and remove sources dynamically using methods such as `-[MGLStyle addSource:]` and `-[MGLStyle sourceWithIdentifier:]`. - Create instances of `MGLShapeSource`, `MGLImageSource` and the concrete subclasses of - `MGLTileSource` (`MGLVectorSource` and `MGLRasterTileSource`) in order to use - `MGLSource`'s properties and methods. Do not create instances of `MGLSource` - directly, and do not create your own subclasses of this class. + Create instances of `MGLShapeSource`, `MGLImageSource` and the concrete + subclasses of `MGLTileSource` (`MGLVectorTileSource` and `MGLRasterTileSource`) + in order to use `MGLSource`'s properties and methods. Do not create instances + of `MGLSource` directly, and do not create your own subclasses of this class. */ MGL_EXPORT @interface MGLSource : NSObject diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index 35db1b2118..66abf4391e 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -18,8 +18,7 @@ #import "MGLSource_Private.h" #import "MGLLight_Private.h" #import "MGLTileSource_Private.h" -#import "MGLVectorSource.h" -#import "MGLVectorSource_Private.h" +#import "MGLVectorTileSource_Private.h" #import "MGLRasterTileSource.h" #import "MGLRasterDEMSource.h" #import "MGLShapeSource.h" @@ -183,7 +182,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, // TODO: Fill in options specific to the respective source classes // https://github.com/mapbox/mapbox-gl-native/issues/6584 if (auto vectorSource = rawSource->as<mbgl::style::VectorSource>()) { - return [[MGLVectorSource alloc] initWithRawSource:vectorSource mapView:self.mapView]; + return [[MGLVectorTileSource alloc] initWithRawSource:vectorSource mapView:self.mapView]; } else if (auto geoJSONSource = rawSource->as<mbgl::style::GeoJSONSource>()) { return [[MGLShapeSource alloc] initWithRawSource:geoJSONSource mapView:self.mapView]; } else if (auto rasterSource = rawSource->as<mbgl::style::RasterSource>()) { @@ -578,15 +577,15 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, } if (_localizesLabels) { - NSString *preferredLanguage = [MGLVectorSource preferredMapboxStreetsLanguage]; + NSString *preferredLanguage = [MGLVectorTileSource preferredMapboxStreetsLanguage]; NSMutableDictionary *localizedKeysByKeyBySourceIdentifier = [NSMutableDictionary dictionary]; for (MGLSymbolStyleLayer *layer in self.layers) { if (![layer isKindOfClass:[MGLSymbolStyleLayer class]]) { continue; } - MGLVectorSource *source = (MGLVectorSource *)[self sourceWithIdentifier:layer.sourceIdentifier]; - if (![source isKindOfClass:[MGLVectorSource class]] || !source.mapboxStreets) { + MGLVectorTileSource *source = (MGLVectorTileSource *)[self sourceWithIdentifier:layer.sourceIdentifier]; + if (![source isKindOfClass:[MGLVectorTileSource class]] || !source.mapboxStreets) { continue; } @@ -639,9 +638,9 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, } } -- (NS_SET_OF(MGLVectorSource *) *)mapboxStreetsSources { - return [self.sources objectsPassingTest:^BOOL (__kindof MGLVectorSource * _Nonnull source, BOOL * _Nonnull stop) { - return [source isKindOfClass:[MGLVectorSource class]] && source.mapboxStreets; +- (NS_SET_OF(MGLVectorTileSource *) *)mapboxStreetsSources { + return [self.sources objectsPassingTest:^BOOL (__kindof MGLVectorTileSource * _Nonnull source, BOOL * _Nonnull stop) { + return [source isKindOfClass:[MGLVectorTileSource class]] && source.mapboxStreets; }]; } diff --git a/platform/darwin/src/MGLStyle_Private.h b/platform/darwin/src/MGLStyle_Private.h index 4cbe953a44..d7ad2975ef 100644 --- a/platform/darwin/src/MGLStyle_Private.h +++ b/platform/darwin/src/MGLStyle_Private.h @@ -14,7 +14,7 @@ namespace mbgl { @class MGLAttributionInfo; @class MGLMapView; @class MGLOpenGLStyleLayer; -@class MGLVectorSource; +@class MGLVectorTileSource; @class MGLVectorStyleLayer; @interface MGLStyle (Private) diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h index 2fd5ef2479..8f698ef1a0 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.h +++ b/platform/darwin/src/MGLSymbolStyleLayer.h @@ -320,8 +320,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslationAnchor) { points or along lines on the map. Use a symbol style layer to configure the visual appearance of labels for - features in vector tiles loaded by an `MGLVectorSource` object or `MGLShape` or - `MGLFeature` instances in an `MGLShapeSource` object. + features in vector tiles loaded by an `MGLVectorTileSource` object or + `MGLShape` or `MGLFeature` instances in an `MGLShapeSource` object. You can access an existing symbol style layer using the `-[MGLStyle layerWithIdentifier:]` method if you know its identifier; diff --git a/platform/darwin/src/MGLTileSource.h b/platform/darwin/src/MGLTileSource.h index c6e63179c9..4bf09026f2 100644 --- a/platform/darwin/src/MGLTileSource.h +++ b/platform/darwin/src/MGLTileSource.h @@ -184,9 +184,9 @@ typedef NS_ENUM(NSUInteger, MGLDEMEncoding) { Mapbox-hosted tile set, view it in <a href="https://www.mapbox.com/studio/tilesets/">Mapbox Studio’s Tilesets editor</a>. - Create instances of `MGLRasterTileSource` and `MGLVectorSource` in order to use - `MGLTileSource`'s properties and methods. Do not create instances of `MGLTileSource` - directly, and do not create your own subclasses of this class. + Create instances of `MGLRasterTileSource` and `MGLVectorTileSource` in order + to use `MGLTileSource`'s properties and methods. Do not create instances of + `MGLTileSource` directly, and do not create your own subclasses of this class. */ MGL_EXPORT @interface MGLTileSource : MGLSource diff --git a/platform/darwin/src/MGLVectorStyleLayer.h b/platform/darwin/src/MGLVectorStyleLayer.h index 177b1b70f0..b3c8fc2433 100644 --- a/platform/darwin/src/MGLVectorStyleLayer.h +++ b/platform/darwin/src/MGLVectorStyleLayer.h @@ -7,7 +7,7 @@ NS_ASSUME_NONNULL_BEGIN /** `MGLVectorStyleLayer` is an abstract superclass for style layers whose content - is defined by an `MGLShapeSource` or `MGLVectorSource` object. + is defined by an `MGLShapeSource` or `MGLVectorTileSource` object. Create instances of `MGLCircleStyleLayer`, `MGLFillStyleLayer`, `MGLFillExtrusionStyleLayer`, `MGLHeatmapStyleLayer`, `MGLLineStyleLayer`, and diff --git a/platform/darwin/src/MGLVectorSource.h b/platform/darwin/src/MGLVectorTileSource.h index 968be3c0e0..fbf29204c9 100644 --- a/platform/darwin/src/MGLVectorSource.h +++ b/platform/darwin/src/MGLVectorTileSource.h @@ -5,29 +5,30 @@ NS_ASSUME_NONNULL_BEGIN /** - `MGLVectorSource` is a map content source that supplies tiled vector data in - <a href="https://www.mapbox.com/vector-tiles/">Mapbox Vector Tile</a> format to - be shown on the map. The location of and metadata about the tiles are defined - either by an option dictionary or by an external file that conforms to the + `MGLVectorTileSource` is a map content source that supplies tiled vector data + in <a href="https://www.mapbox.com/vector-tiles/">Mapbox Vector Tile</a> format + to be shown on the map. The location of and metadata about the tiles are + defined either by an option dictionary or by an external file that conforms to + the <a href="https://github.com/mapbox/tilejson-spec/">TileJSON specification</a>. - A vector source is added to an `MGLStyle` object along with one or more + A vector tile source is added to an `MGLStyle` object along with one or more `MGLVectorStyleLayer` objects. A vector style layer defines the appearance of - any content supplied by the vector source. + any content supplied by the vector tile source. Each <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-vector"><code>vector</code></a> source defined by the style JSON file is represented at runtime by an - `MGLVectorSource` object that you can use to initialize new style layers. You - can also add and remove sources dynamically using methods such as + `MGLVectorTileSource` object that you can use to initialize new style layers. + You can also add and remove sources dynamically using methods such as `-[MGLStyle addSource:]` and `-[MGLStyle sourceWithIdentifier:]`. Within each vector tile, each geometric coordinate must lie between −1 × <var>extent</var> and (<var>extent</var> × 2) − 1, inclusive. Any vector style - layer initialized with a vector source must have a non-`nil` value in its + layer initialized with a vector tile source must have a non-`nil` value in its `sourceLayerIdentifier` property. - Commonly used vector sources include + Commonly used vector tile sources include <a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets</a>, <a href="https://www.mapbox.com/vector-tiles/mapbox-terrain/">Mapbox Terrain</a>, and @@ -36,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN ### Example ```swift - let source = MGLVectorSource(identifier: "pois", tileURLTemplates: ["https://example.com/vector-tiles/{z}/{x}/{y}.mvt"], options: [ + let source = MGLVectorTileSource(identifier: "pois", tileURLTemplates: ["https://example.com/vector-tiles/{z}/{x}/{y}.mvt"], options: [ .minimumZoomLevel: 9, .maximumZoomLevel: 16, .attributionInfos: [ @@ -47,12 +48,13 @@ NS_ASSUME_NONNULL_BEGIN ``` */ MGL_EXPORT -@interface MGLVectorSource : MGLTileSource +@interface MGLVectorTileSource : MGLTileSource #pragma mark Initializing a Source /** - Returns a vector source initialized with an identifier and configuration URL. + Returns a vector tile source initialized with an identifier and configuration + URL. After initializing and configuring the source, add it to a map view’s style using the `-[MGLStyle addSource:]` method. @@ -66,12 +68,12 @@ MGL_EXPORT which it is added. @param configurationURL A URL to a TileJSON configuration file describing the source’s contents and other metadata. - @return An initialized vector source. + @return An initialized vector tile source. */ - (instancetype)initWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL NS_DESIGNATED_INITIALIZER; /** - Returns a vector source initialized an identifier, tile URL templates, and + Returns a vector tile source initialized an identifier, tile URL templates, and options. Tile URL templates are strings that specify the URLs of the vector tiles to diff --git a/platform/darwin/src/MGLVectorSource.mm b/platform/darwin/src/MGLVectorTileSource.mm index 90ffe6f98b..5678d9c0bb 100644 --- a/platform/darwin/src/MGLVectorSource.mm +++ b/platform/darwin/src/MGLVectorTileSource.mm @@ -1,4 +1,4 @@ -#import "MGLVectorSource_Private.h" +#import "MGLVectorTileSource_Private.h" #import "MGLFeature_Private.h" #import "MGLSource_Private.h" @@ -13,13 +13,13 @@ #include <mbgl/style/sources/vector_source.hpp> #include <mbgl/renderer/renderer.hpp> -@interface MGLVectorSource () +@interface MGLVectorTileSource () @property (nonatomic, readonly) mbgl::style::VectorSource *rawSource; @end -@implementation MGLVectorSource +@implementation MGLVectorTileSource - (instancetype)initWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL { auto source = std::make_unique<mbgl::style::VectorSource>(identifier.UTF8String, @@ -73,7 +73,7 @@ @end -@implementation MGLVectorSource (Private) +@implementation MGLVectorTileSource (Private) + (NS_SET_OF(NSString *) *)mapboxStreetsLanguages { // https://www.mapbox.com/vector-tiles/mapbox-streets-v7/#overview @@ -87,7 +87,7 @@ } + (NSString *)preferredMapboxStreetsLanguage { - NSArray<NSString *> *supportedLanguages = [MGLVectorSource mapboxStreetsLanguages].allObjects; + NSArray<NSString *> *supportedLanguages = [MGLVectorTileSource mapboxStreetsLanguages].allObjects; NSArray<NSString *> *preferredLanguages = [NSBundle preferredLocalizationsFromArray:supportedLanguages forPreferences:[NSLocale preferredLanguages]]; NSString *mostSpecificLanguage; @@ -116,7 +116,7 @@ // Replace {name} and {name_*} with the matching localized name tag. NSString *localizedKey = preferredLanguage ? [NSString stringWithFormat:@"name_%@", preferredLanguage] : @"name"; NSMutableDictionary *localizedKeysByKey = [NSMutableDictionary dictionaryWithObject:localizedKey forKey:@"name"]; - for (NSString *languageCode in [MGLVectorSource mapboxStreetsLanguages]) { + for (NSString *languageCode in [MGLVectorTileSource mapboxStreetsLanguages]) { NSString *key = [NSString stringWithFormat:@"name_%@", languageCode]; localizedKeysByKey[key] = localizedKey; } diff --git a/platform/darwin/src/MGLVectorSource_Private.h b/platform/darwin/src/MGLVectorTileSource_Private.h index 7d19e03a99..41873b4ff6 100644 --- a/platform/darwin/src/MGLVectorSource_Private.h +++ b/platform/darwin/src/MGLVectorTileSource_Private.h @@ -1,8 +1,8 @@ -#import "MGLVectorSource.h" +#import "MGLVectorTileSource.h" NS_ASSUME_NONNULL_BEGIN -@interface MGLVectorSource (Private) +@interface MGLVectorTileSource (Private) @property (nonatomic, readonly, getter=isMapboxStreets) BOOL mapboxStreets; |