diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2018-03-30 05:13:08 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2018-04-02 10:42:54 -0700 |
commit | 29a8efab26dfbdbe9b30b3913d397329be5edb95 (patch) | |
tree | b31dd004bfa2e74654376bacb56dd5f6821c7df6 /platform/darwin | |
parent | a2399a57a22aa453dbc5a9b16244bbc953e2d632 (diff) | |
download | qtlocation-mapboxgl-29a8efab26dfbdbe9b30b3913d397329be5edb95.tar.gz |
[ios, macos] Renamed MGLRasterSource to MGLRasterTileSource
Also updated various source class listings to reflect the addition of image and raster DEM sources.
Diffstat (limited to 'platform/darwin')
-rw-r--r-- | platform/darwin/docs/guides/For Style Authors.md.ejs | 9 | ||||
-rw-r--r-- | platform/darwin/docs/guides/Tile URL Templates.md.ejs | 14 | ||||
-rw-r--r-- | platform/darwin/scripts/style-spec-overrides-v8.json | 2 | ||||
-rw-r--r-- | platform/darwin/src/MGLRasterDEMSource.h | 4 | ||||
-rw-r--r-- | platform/darwin/src/MGLRasterDEMSource.mm | 2 | ||||
-rw-r--r-- | platform/darwin/src/MGLRasterStyleLayer.h | 2 | ||||
-rw-r--r-- | platform/darwin/src/MGLRasterTileSource.h (renamed from platform/darwin/src/MGLRasterSource.h) | 41 | ||||
-rw-r--r-- | platform/darwin/src/MGLRasterTileSource.mm (renamed from platform/darwin/src/MGLRasterSource.mm) | 14 | ||||
-rw-r--r-- | platform/darwin/src/MGLRasterTileSource_Private.h (renamed from platform/darwin/src/MGLRasterSource_Private.h) | 4 | ||||
-rw-r--r-- | platform/darwin/src/MGLSource.h | 2 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyle.mm | 4 | ||||
-rw-r--r-- | platform/darwin/src/MGLTileSource.h | 2 | ||||
-rw-r--r-- | platform/darwin/test/MGLDocumentationExampleTests.swift | 6 | ||||
-rw-r--r-- | platform/darwin/test/MGLStyleTests.mm | 48 |
14 files changed, 79 insertions, 75 deletions
diff --git a/platform/darwin/docs/guides/For Style Authors.md.ejs b/platform/darwin/docs/guides/For Style Authors.md.ejs index 45cfa105b8..8b9b4b06fc 100644 --- a/platform/darwin/docs/guides/For Style Authors.md.ejs +++ b/platform/darwin/docs/guides/For Style Authors.md.ejs @@ -178,17 +178,18 @@ source object is a member of one of the following subclasses of `MGLSource`: In style JSON | In the SDK --------------|----------- -`geojson` | `MGLShapeSource` -`raster` | `MGLRasterSource` `vector` | `MGLVectorSource` +`raster` | `MGLRasterTileSource` +`raster-dem` | `MGLRasterDEMSource` +`geojson` | `MGLShapeSource` `image` | `MGLImageSource` `canvas` and `video` sources are not supported. ### Tile sources -Raster and vector sources may be defined in TileJSON configuration files. This -SDK supports the properties defined in the style specification, which are a +Raster and vector tile sources may be defined in TileJSON configuration files. +This SDK supports the properties defined in the style specification, which are a subset of the keys defined in version 2.1.0 of the [TileJSON](https://github.com/mapbox/tilejson-spec/tree/master/2.1.0) specification. As an alternative to authoring a custom TileJSON file, you may diff --git a/platform/darwin/docs/guides/Tile URL Templates.md.ejs b/platform/darwin/docs/guides/Tile URL Templates.md.ejs index 78fb297138..558d5b451f 100644 --- a/platform/darwin/docs/guides/Tile URL Templates.md.ejs +++ b/platform/darwin/docs/guides/Tile URL Templates.md.ejs @@ -10,12 +10,12 @@ --> # Tile URL Templates -`MGLTileSource` objects, specifically `MGLRasterSource` and `MGLVectorSource` -objects, can be created using an initializer that accepts an array of tile URL -templates. Tile URL templates are strings that specify the URLs of the vector -tiles or raster tile images to load. A template resembles an absolute URL, but -with any number of placeholder strings that the source evaluates based on the -tile it needs to load. For example: +`MGLTileSource` objects, specifically `MGLRasterTileSource` and +`MGLVectorSource` objects, can be created using an initializer that accepts an +array of tile URL templates. Tile URL templates are strings that specify the +URLs of the vector tiles or raster tile images to load. A template resembles an +absolute URL, but with any number of placeholder strings that the source +evaluates based on the tile it needs to load. For example: * `http://www.example.com/tiles/{z}/{x}/{y}.pbf` could be evaluated as `http://www.example.com/tiles/14/6/9.pbf`. @@ -62,7 +62,7 @@ all of which are optional: <td>The tile’s zoom level. At zoom level 0, each tile covers the entire world map; at zoom level 1, it covers ¼ of the world; at zoom level 2, <sup>1</sup>⁄<sub>16</sub> of the world, and so on. For tiles loaded by - a <code>MGLRasterSource</code> object, whether the tile zoom level + a <code>MGLRasterTileSource</code> object, whether the tile zoom level matches the map’s current zoom level depends on the value of the source’s tile size as specified in the <code>MGLTileSourceOptionTileSize</code> key of the <code>options</code> diff --git a/platform/darwin/scripts/style-spec-overrides-v8.json b/platform/darwin/scripts/style-spec-overrides-v8.json index b0c50a06f8..be50be4e1a 100644 --- a/platform/darwin/scripts/style-spec-overrides-v8.json +++ b/platform/darwin/scripts/style-spec-overrides-v8.json @@ -27,7 +27,7 @@ "doc": "An `MGLHeatmapStyleLayer` is a style layer that renders a <a href=\"https://en.wikipedia.org/wiki/Heat_map\">heatmap</a>.\n\nA heatmap visualizes the spatial distribution of a large, dense set of point 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`, `MGLPointFeature`, `MGLPointCollection`, or `MGLPointCollectionFeature` instances in an `MGLShapeSource` object.\n\nConsider accompanying a heatmap style layer with an `MGLCircleStyleLayer` or `MGLSymbolStyleLayer` at high zoom levels. If you are unsure whether the point data in an `MGLShapeSource` is dense enough to warrant a heatmap, you can alternatively cluster the source using the `MGLShapeSourceOptionClustered` option and render the data using an `MGLCircleStyleLayer` or `MGLSymbolStyleLayer`." }, "raster": { - "doc": "An `MGLRasterStyleLayer` is a style layer that renders georeferenced raster imagery on the map, especially raster tiles.\n\nUse a raster style layer to configure the color parameters of raster tiles loaded by an `MGLRasterSource` object or raster images loaded by an `MGLImageSource` object. For example, you could use a raster style layer to render <a href=\"https://www.mapbox.com/satellite/\">Mapbox Satellite</a> imagery, a <a href=\"https://www.mapbox.com/help/define-tileset/#raster-tilesets\">raster tile set</a> uploaded to Mapbox Studio, or a raster map authored in <a href=\"https://tilemill-project.github.io/tilemill/\">TileMill</a>, the classic Mapbox Editor, or Mapbox Studio Classic.\n\nRaster images may also be used as icons or patterns in a style layer. To register an image for use as an icon or pattern, use the `-[MGLStyle setImage:forName:]` method. To configure a point annotation’s image, use the `MGLAnnotationImage` class." + "doc": "An `MGLRasterStyleLayer` is a style layer that renders georeferenced raster imagery on the map, especially raster tiles.\n\nUse a raster style layer to configure the color parameters of raster tiles loaded by an `MGLRasterTileSource` object or raster images loaded by an `MGLImageSource` object. For example, you could use a raster style layer to render <a href=\"https://www.mapbox.com/satellite/\">Mapbox Satellite</a> imagery, a <a href=\"https://www.mapbox.com/help/define-tileset/#raster-tilesets\">raster tile set</a> uploaded to Mapbox Studio, or a raster map authored in <a href=\"https://tilemill-project.github.io/tilemill/\">TileMill</a>, the classic Mapbox Editor, or Mapbox Studio Classic.\n\nRaster images may also be used as icons or patterns in a style layer. To register an image for use as an icon or pattern, use the `-[MGLStyle setImage:forName:]` method. To configure a point annotation’s image, use the `MGLAnnotationImage` class." }, "hillshade": { "doc": "An `MGLHillshadeStyleLayer` is a style layer that renders raster <a href=\"https://en.wikipedia.org/wiki/Digital_elevation_model\">digital elevation model</a> (DEM) tiles on the map.\n\nUse a hillshade style layer to configure the color parameters of raster tiles loaded by an `MGLRasterDEMSource` object. For example, you could use a hillshade style layer to render <a href=\"https://www.mapbox.com/help/access-elevation-data/#mapbox-terrain-rgb\">Mapbox Terrain-RGB</a> data.\n\nTo 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 `MGLFillStyleLayer` objects." diff --git a/platform/darwin/src/MGLRasterDEMSource.h b/platform/darwin/src/MGLRasterDEMSource.h index d00912ca79..c53ca9867d 100644 --- a/platform/darwin/src/MGLRasterDEMSource.h +++ b/platform/darwin/src/MGLRasterDEMSource.h @@ -1,6 +1,6 @@ #import "MGLFoundation.h" -#import "MGLRasterSource.h" +#import "MGLRasterTileSource.h" /** `MGLRasterDEMSource` is a map content source that supplies rasterized @@ -32,6 +32,6 @@ ``` */ MGL_EXPORT -@interface MGLRasterDEMSource : MGLRasterSource +@interface MGLRasterDEMSource : MGLRasterTileSource @end diff --git a/platform/darwin/src/MGLRasterDEMSource.mm b/platform/darwin/src/MGLRasterDEMSource.mm index d8639b70e3..27614b9ef4 100644 --- a/platform/darwin/src/MGLRasterDEMSource.mm +++ b/platform/darwin/src/MGLRasterDEMSource.mm @@ -1,6 +1,6 @@ #import "MGLRasterDEMSource.h" -#import "MGLRasterSource_Private.h" +#import "MGLRasterTileSource_Private.h" #import "NSURL+MGLAdditions.h" #import <mbgl/style/sources/raster_dem_source.hpp> diff --git a/platform/darwin/src/MGLRasterStyleLayer.h b/platform/darwin/src/MGLRasterStyleLayer.h index fd41f271ed..bca9649e5d 100644 --- a/platform/darwin/src/MGLRasterStyleLayer.h +++ b/platform/darwin/src/MGLRasterStyleLayer.h @@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN imagery on the map, especially raster tiles. Use a raster style layer to configure the color parameters of raster tiles - loaded by an `MGLRasterSource` object or raster images loaded by an + loaded by an `MGLRasterTileSource` object or raster images loaded by an `MGLImageSource` object. For example, you could use a raster style layer to render <a href="https://www.mapbox.com/satellite/">Mapbox Satellite</a> imagery, a <a diff --git a/platform/darwin/src/MGLRasterSource.h b/platform/darwin/src/MGLRasterTileSource.h index 4f4b7c96c3..6306ead5fb 100644 --- a/platform/darwin/src/MGLRasterSource.h +++ b/platform/darwin/src/MGLRasterTileSource.h @@ -8,39 +8,41 @@ NS_ASSUME_NONNULL_BEGIN /** An `NSNumber` object containing a floating-point number that specifies the width and height (measured in points) at which the map displays each raster - image tile when the map’s zoom level is an integer. The raster source scales - its images up or down when the map’s zoom level falls between two integers. + image tile when the map’s zoom level is an integer. The raster tile source + scales its images up or down when the map’s zoom level falls between two + integers. The default value for this option is 512. Version 4 of the <a href="https://www.mapbox.com/api-documentation/#maps">Mapbox Maps API</a> 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 `MGLRasterSource` objects; it is ignored when + This option is only applicable to `MGLRasterTileSource` objects; it is ignored when initializing `MGLVectorSource` objects. */ extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionTileSize; /** - `MGLRasterSource` is a map content source that supplies raster image tiles 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 + `MGLRasterTileSource` is a map content source that supplies raster image tiles + 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 raster source is added to an `MGLStyle` object along with one or more + A raster tile source is added to an `MGLStyle` object along with one or more `MGLRasterStyleLayer` objects. Use a raster style layer to control the - appearance of content supplied by the raster source. + appearance of content supplied by the raster tile source. Each <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-raster"><code>raster</code></a> source defined by the style JSON file is represented at runtime by an - `MGLRasterSource` object that you can use to initialize new style layers. You + `MGLRasterTileSource` 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:]`. ### Example ```swift - let source = MGLRasterSource(identifier: "clouds", tileURLTemplates: ["https://example.com/raster-tiles/{z}/{x}/{y}.png"], options: [ + let source = MGLRasterTileSource(identifier: "clouds", tileURLTemplates: ["https://example.com/raster-tiles/{z}/{x}/{y}.png"], options: [ .minimumZoomLevel: 9, .maximumZoomLevel: 16, .tileSize: 512, @@ -52,12 +54,13 @@ extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionTileSize; ``` */ MGL_EXPORT -@interface MGLRasterSource : MGLTileSource +@interface MGLRasterTileSource : MGLTileSource #pragma mark Initializing a Source /** - Returns a raster source initialized with an identifier and configuration URL. + Returns a raster 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. @@ -77,13 +80,13 @@ 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 raster source. + @return An initialized raster tile source. */ - (instancetype)initWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL; /** - Returns a raster source initialized with an identifier, configuration URL, and - tile size. + Returns a raster tile source initialized with an identifier, configuration URL, + and tile size. After initializing and configuring the source, add it to a map view’s style using the `-[MGLStyle addSource:]` method. @@ -98,14 +101,14 @@ MGL_EXPORT @param configurationURL A URL to a TileJSON configuration file describing the source’s contents and other metadata. @param tileSize The width and height (measured in points) of each tiled image - in the raster source. See the `MGLTileSourceOptionTileSize` documentation - for details. - @return An initialized raster source. + in the raster tile source. See the `MGLTileSourceOptionTileSize` + documentation for details. + @return An initialized raster tile source. */ - (instancetype)initWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL tileSize:(CGFloat)tileSize NS_DESIGNATED_INITIALIZER; /** - Returns a raster source initialized an identifier, tile URL templates, and + Returns a raster tile source initialized an identifier, tile URL templates, and options. Tile URL templates are strings that specify the URLs of the raster tile images diff --git a/platform/darwin/src/MGLRasterSource.mm b/platform/darwin/src/MGLRasterTileSource.mm index c47cc199eb..02cfef4ae8 100644 --- a/platform/darwin/src/MGLRasterSource.mm +++ b/platform/darwin/src/MGLRasterTileSource.mm @@ -1,4 +1,4 @@ -#import "MGLRasterSource_Private.h" +#import "MGLRasterTileSource_Private.h" #import "MGLMapView_Private.h" #import "MGLSource_Private.h" @@ -10,16 +10,16 @@ const MGLTileSourceOption MGLTileSourceOptionTileSize = @"MGLTileSourceOptionTileSize"; -static const CGFloat MGLRasterSourceClassicTileSize = 256; -static const CGFloat MGLRasterSourceRetinaTileSize = 512; +static const CGFloat MGLRasterTileSourceClassicTileSize = 256; +static const CGFloat MGLRasterTileSourceRetinaTileSize = 512; -@interface MGLRasterSource () +@interface MGLRasterTileSource () @property (nonatomic, readonly) mbgl::style::RasterSource *rawSource; @end -@implementation MGLRasterSource +@implementation MGLRasterTileSource - (instancetype)initWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL { // The style specification default is 512, but 256 is the expected value for @@ -28,7 +28,7 @@ static const CGFloat MGLRasterSourceRetinaTileSize = 512; BOOL isMapboxURL = ([configurationURL.scheme isEqualToString:@"mapbox"] && [configurationURL.host containsString:@"."] && (!configurationURL.path.length || [configurationURL.path isEqualToString:@"/"])); - CGFloat tileSize = isMapboxURL ? MGLRasterSourceClassicTileSize : MGLRasterSourceRetinaTileSize; + CGFloat tileSize = isMapboxURL ? MGLRasterTileSourceClassicTileSize : MGLRasterTileSourceRetinaTileSize; return [self initWithIdentifier:identifier configurationURL:configurationURL tileSize:tileSize]; } @@ -47,7 +47,7 @@ static const CGFloat MGLRasterSourceRetinaTileSize = 512; - (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NS_ARRAY_OF(NSString *) *)tileURLTemplates options:(nullable NS_DICTIONARY_OF(MGLTileSourceOption, id) *)options { mbgl::Tileset tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, options); - uint16_t tileSize = MGLRasterSourceRetinaTileSize; + uint16_t tileSize = MGLRasterTileSourceRetinaTileSize; if (NSNumber *tileSizeNumber = options[MGLTileSourceOptionTileSize]) { if (![tileSizeNumber isKindOfClass:[NSNumber class]]) { [NSException raise:NSInvalidArgumentException diff --git a/platform/darwin/src/MGLRasterSource_Private.h b/platform/darwin/src/MGLRasterTileSource_Private.h index 6f40fbc5a9..128dcb447d 100644 --- a/platform/darwin/src/MGLRasterSource_Private.h +++ b/platform/darwin/src/MGLRasterTileSource_Private.h @@ -1,4 +1,4 @@ -#import "MGLRasterSource.h" +#import "MGLRasterTileSource.h" #include <memory> @@ -10,7 +10,7 @@ namespace mbgl { NS_ASSUME_NONNULL_BEGIN -@interface MGLRasterSource (Private) +@interface MGLRasterTileSource (Private) @property (nonatomic, readonly) mbgl::style::RasterSource *rawSource; diff --git a/platform/darwin/src/MGLSource.h b/platform/darwin/src/MGLSource.h index 8d8c936833..e3e45faca8 100644 --- a/platform/darwin/src/MGLSource.h +++ b/platform/darwin/src/MGLSource.h @@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN `-[MGLStyle addSource:]` and `-[MGLStyle sourceWithIdentifier:]`. Create instances of `MGLShapeSource`, `MGLImageSource` and the concrete subclasses of - `MGLTileSource` (`MGLVectorSource` and `MGLRasterSource`) in order to use + `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. */ diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index 199f6c2e02..35db1b2118 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -20,7 +20,7 @@ #import "MGLTileSource_Private.h" #import "MGLVectorSource.h" #import "MGLVectorSource_Private.h" -#import "MGLRasterSource.h" +#import "MGLRasterTileSource.h" #import "MGLRasterDEMSource.h" #import "MGLShapeSource.h" #import "MGLImageSource.h" @@ -187,7 +187,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, } 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>()) { - return [[MGLRasterSource alloc] initWithRawSource:rasterSource mapView:self.mapView]; + return [[MGLRasterTileSource alloc] initWithRawSource:rasterSource mapView:self.mapView]; } else if (auto rasterDEMSource = rawSource->as<mbgl::style::RasterDEMSource>()) { return [[MGLRasterDEMSource alloc] initWithRawSource:rasterDEMSource mapView:self.mapView]; } else if (auto imageSource = rawSource->as<mbgl::style::ImageSource>()) { diff --git a/platform/darwin/src/MGLTileSource.h b/platform/darwin/src/MGLTileSource.h index 2d75fa14d8..c6e63179c9 100644 --- a/platform/darwin/src/MGLTileSource.h +++ b/platform/darwin/src/MGLTileSource.h @@ -184,7 +184,7 @@ 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 `MGLRasterSource` and `MGLVectorSource` in order to use + 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. */ diff --git a/platform/darwin/test/MGLDocumentationExampleTests.swift b/platform/darwin/test/MGLDocumentationExampleTests.swift index 5a112f07e2..08650e8647 100644 --- a/platform/darwin/test/MGLDocumentationExampleTests.swift +++ b/platform/darwin/test/MGLDocumentationExampleTests.swift @@ -73,9 +73,9 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { XCTAssertNotNil(mapView.style?.source(withIdentifier: "lines")) } - func testMGLRasterSource() { + func testMGLRasterTileSource() { //#-example-code - let source = MGLRasterSource(identifier: "clouds", tileURLTemplates: ["https://example.com/raster-tiles/{z}/{x}/{y}.png"], options: [ + let source = MGLRasterTileSource(identifier: "clouds", tileURLTemplates: ["https://example.com/raster-tiles/{z}/{x}/{y}.png"], options: [ .minimumZoomLevel: 9, .maximumZoomLevel: 16, .tileSize: 512, @@ -275,7 +275,7 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { } func testMGLRasterStyleLayer() { - let source = MGLRasterSource(identifier: "clouds", tileURLTemplates: ["https://example.com/raster-tiles/{z}/{x}/{y}.png"], options: [ + let source = MGLRasterTileSource(identifier: "clouds", tileURLTemplates: ["https://example.com/raster-tiles/{z}/{x}/{y}.png"], options: [ .minimumZoomLevel: 9, .maximumZoomLevel: 16, .tileSize: 512, diff --git a/platform/darwin/test/MGLStyleTests.mm b/platform/darwin/test/MGLStyleTests.mm index 95051cfae0..b9fbe1cfd4 100644 --- a/platform/darwin/test/MGLStyleTests.mm +++ b/platform/darwin/test/MGLStyleTests.mm @@ -157,9 +157,9 @@ [self.style addSource:shapeSource]; XCTAssertThrowsSpecificNamed([self.style addSource:shapeSource], NSException, @"MGLRedundantSourceException"); - MGLRasterSource *rasterSource = [[MGLRasterSource alloc] initWithIdentifier:@"rasterSource" configurationURL:[NSURL URLWithString:@".json"] tileSize:42]; - [self.style addSource:rasterSource]; - XCTAssertThrowsSpecificNamed([self.style addSource:rasterSource], NSException, @"MGLRedundantSourceException"); + MGLRasterTileSource *rasterTileSource = [[MGLRasterTileSource alloc] initWithIdentifier:@"rasterTileSource" configurationURL:[NSURL URLWithString:@".json"] tileSize:42]; + [self.style addSource:rasterTileSource]; + XCTAssertThrowsSpecificNamed([self.style addSource:rasterTileSource], NSException, @"MGLRedundantSourceException"); MGLVectorSource *vectorSource = [[MGLVectorSource alloc] initWithIdentifier:@"vectorSource" configurationURL:[NSURL URLWithString:@".json"]]; [self.style addSource:vectorSource]; @@ -175,10 +175,10 @@ } - (void)testRemovingSourcesBeforeAddingThem { - MGLRasterSource *rasterSource = [[MGLRasterSource alloc] initWithIdentifier:@"raster-source" tileURLTemplates:@[] options:nil]; - [self.style removeSource:rasterSource]; - [self.style addSource:rasterSource]; - XCTAssertNotNil([self.style sourceWithIdentifier:rasterSource.identifier]); + MGLRasterTileSource *rasterTileSource = [[MGLRasterTileSource alloc] initWithIdentifier:@"raster-tile-source" tileURLTemplates:@[] options:nil]; + [self.style removeSource:rasterTileSource]; + [self.style addSource:rasterTileSource]; + XCTAssertNotNil([self.style sourceWithIdentifier:rasterTileSource.identifier]); MGLShapeSource *shapeSource = [[MGLShapeSource alloc] initWithIdentifier:@"shape-source" shape:nil options:nil]; [self.style removeSource:shapeSource]; @@ -192,18 +192,18 @@ } - (void)testAddingSourceOfTypeABeforeSourceOfTypeBWithSameIdentifier { - // Add a raster source - MGLRasterSource *rasterSource = [[MGLRasterSource alloc] initWithIdentifier:@"some-identifier" tileURLTemplates:@[] options:nil]; - [self.style addSource:rasterSource]; + // Add a raster tile source + MGLRasterTileSource *rasterTileSource = [[MGLRasterTileSource alloc] initWithIdentifier:@"some-identifier" tileURLTemplates:@[] options:nil]; + [self.style addSource:rasterTileSource]; - // Attempt to remove an image source with the same identifier as the raster source + // Attempt to remove an image source with the same identifier as the raster tile source MGLImageSource *imageSource = [[MGLImageSource alloc] initWithIdentifier:@"some-identifier" coordinateQuad: { } URL:[NSURL URLWithString:@"http://host/image.png"]]; [self.style removeSource:imageSource]; - // The raster source should still be added - XCTAssertTrue([[self.style sourceWithIdentifier:rasterSource.identifier] isMemberOfClass:[MGLRasterSource class]]); + // The raster tile source should still be added + XCTAssertTrue([[self.style sourceWithIdentifier:rasterTileSource.identifier] isMemberOfClass:[MGLRasterTileSource class]]); - // Remove the raster source - [self.style removeSource:rasterSource]; + // Remove the raster tile source + [self.style removeSource:rasterTileSource]; // Add the shape source [self.style addSource:imageSource]; @@ -220,26 +220,26 @@ // Add the vector source [self.style addSource:vectorSource]; - // Attempt to remove the previously created raster source that has the same identifer as the shape source - [self.style removeSource:rasterSource]; + // Attempt to remove the previously created raster tile source that has the same identifer as the shape source + [self.style removeSource:rasterTileSource]; // The vector source should still be added XCTAssertTrue([[self.style sourceWithIdentifier:imageSource.identifier] isMemberOfClass:[MGLVectorSource class]]); } - (void)testRemovingSourceInUse { - // Add a raster source - MGLRasterSource *rasterSource = [[MGLRasterSource alloc] initWithIdentifier:@"some-identifier" tileURLTemplates:@[] options:nil]; - [self.style addSource:rasterSource]; + // Add a raster tile source + MGLRasterTileSource *rasterTileSource = [[MGLRasterTileSource alloc] initWithIdentifier:@"some-identifier" tileURLTemplates:@[] options:nil]; + [self.style addSource:rasterTileSource]; // Add a layer using it - MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"fillLayer" source:rasterSource]; + MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"fillLayer" source:rasterTileSource]; [self.style addLayer:fillLayer]; - // Attempt to remove the raster source - [self.style removeSource:rasterSource]; + // Attempt to remove the raster tile source + [self.style removeSource:rasterTileSource]; // Ensure it is still there - XCTAssertTrue([[self.style sourceWithIdentifier:rasterSource.identifier] isMemberOfClass:[MGLRasterSource class]]); + XCTAssertTrue([[self.style sourceWithIdentifier:rasterTileSource.identifier] isMemberOfClass:[MGLRasterTileSource class]]); } - (void)testLayers { |