diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2018-01-25 10:46:27 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-25 10:46:27 -0800 |
commit | b6747a84f4ba6bd48ab2d461e04cffa7fc8d5348 (patch) | |
tree | e01efa0e57e6dc5a0a55db2f68bc964cb6fb1606 /platform/darwin | |
parent | a4546a84de28cfddfcb1e5a4ba8b0516a4b4dfa4 (diff) | |
download | qtlocation-mapboxgl-b6747a84f4ba6bd48ab2d461e04cffa7fc8d5348.tar.gz |
[ios, macos] Hook up hillshade style layers, raster DEM sources to iOS/macOS (#11036)
* [ios, macos] Finished implementing MGLHillshadeStyleLayer
* [macos] Added icon for hillshade layer
Also set the background layer icon to mirror in right-to-left locales.
* [ios, macos] Implemented raster DEM source
* [macos] Added Enhance Terrain debugging command
* [ios, macos] Simplified raster DEM source example
Diffstat (limited to 'platform/darwin')
-rw-r--r-- | platform/darwin/scripts/style-spec-overrides-v8.json | 3 | ||||
-rw-r--r-- | platform/darwin/src/MGLForegroundStyleLayer.h | 9 | ||||
-rw-r--r-- | platform/darwin/src/MGLHillshadeStyleLayer.h | 25 | ||||
-rw-r--r-- | platform/darwin/src/MGLHillshadeStyleLayer.mm | 29 | ||||
-rw-r--r-- | platform/darwin/src/MGLRasterDEMSource.h | 37 | ||||
-rw-r--r-- | platform/darwin/src/MGLRasterDEMSource.mm | 17 | ||||
-rw-r--r-- | platform/darwin/src/MGLRasterSource.mm | 11 | ||||
-rw-r--r-- | platform/darwin/src/MGLRasterSource_Private.h | 13 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyle.mm | 8 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyleLayer.h.ejs | 4 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyleLayer.mm.ejs | 2 | ||||
-rw-r--r-- | platform/darwin/test/MGLDocumentationExampleTests.swift | 47 | ||||
-rw-r--r-- | platform/darwin/test/MGLHillshadeStyleLayerTests.mm | 18 | ||||
-rw-r--r-- | platform/darwin/test/MGLStyleLayerTests.mm.ejs | 2 |
14 files changed, 163 insertions, 62 deletions
diff --git a/platform/darwin/scripts/style-spec-overrides-v8.json b/platform/darwin/scripts/style-spec-overrides-v8.json index 3da2443096..12cfa31575 100644 --- a/platform/darwin/scripts/style-spec-overrides-v8.json +++ b/platform/darwin/scripts/style-spec-overrides-v8.json @@ -26,6 +26,9 @@ "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." }, + "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." + }, "background": { "doc": "An `MGLBackgroundStyleLayer` is a style layer that covers the entire map. Use a background style layer to configure a color or pattern to show below all other map content. If the style’s other layers use the Mapbox Streets source, the background style layer is responsible for drawing land, whereas the oceans and other bodies of water are drawn by `MGLFillStyleLayer` objects.\n\nA background style layer is typically the bottommost layer in a style, because it covers the entire map and can occlude any layers below it. You can therefore access it by getting the last item in the `MGLStyle.layers` array.\n\nIf the background style layer is transparent or omitted from the style, any portion of the map view that does not show another style layer is transparent." } diff --git a/platform/darwin/src/MGLForegroundStyleLayer.h b/platform/darwin/src/MGLForegroundStyleLayer.h index bcd323fb99..7e05023ef1 100644 --- a/platform/darwin/src/MGLForegroundStyleLayer.h +++ b/platform/darwin/src/MGLForegroundStyleLayer.h @@ -11,10 +11,11 @@ NS_ASSUME_NONNULL_BEGIN `MGLForegroundStyleLayer` is an abstract superclass for style layers whose content is defined by an `MGLSource` object. - Create instances of `MGLRasterStyleLayer` and the concrete subclasses of - `MGLVectorStyleLayer` in order to use `MGLForegroundStyleLayer`'s methods. - Do not create instances of `MGLForegroundStyleLayer` directly, and do not - create your own subclasses of this class. + Create instances of `MGLRasterStyleLayer`, `MGLHillshadeStyleLayer`, and the + concrete subclasses of `MGLVectorStyleLayer` in order to use + `MGLForegroundStyleLayer`'s methods. Do not create instances of + `MGLForegroundStyleLayer` directly, and do not create your own subclasses of + this class. */ MGL_EXPORT @interface MGLForegroundStyleLayer : MGLStyleLayer diff --git a/platform/darwin/src/MGLHillshadeStyleLayer.h b/platform/darwin/src/MGLHillshadeStyleLayer.h index 199bf214c2..b2eeb59aba 100644 --- a/platform/darwin/src/MGLHillshadeStyleLayer.h +++ b/platform/darwin/src/MGLHillshadeStyleLayer.h @@ -2,7 +2,7 @@ // Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`. #import "MGLFoundation.h" -#import "MGLVectorStyleLayer.h" +#import "MGLForegroundStyleLayer.h" NS_ASSUME_NONNULL_BEGIN @@ -24,8 +24,20 @@ typedef NS_ENUM(NSUInteger, MGLHillshadeIlluminationAnchor) { }; /** - Client-side hillshading visualization based on DEM data. Currently, the - implementation only supports Mapbox Terrain RGB tiles + 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. + + Use 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. + + 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 + `MGLFillStyleLayer` objects. You can access an existing hillshade style layer using the `-[MGLStyle layerWithIdentifier:]` method if you know its identifier; @@ -36,10 +48,15 @@ typedef NS_ENUM(NSUInteger, MGLHillshadeIlluminationAnchor) { ### Example ```swift + let layer = MGLHillshadeStyleLayer(identifier: "hills", source: source) + layer.hillshadeExaggeration = NSExpression(forConstantValue: 0.6) + if let canalShadowLayer = mapView.style?.layer(withIdentifier: "waterway-river-canal-shadow") { + mapView.style?.insertLayer(layer, below: canalShadowLayer) + } ``` */ MGL_EXPORT -@interface MGLHillshadeStyleLayer : MGLVectorStyleLayer +@interface MGLHillshadeStyleLayer : MGLForegroundStyleLayer /** Returns a hillshade style layer initialized with an identifier and source. diff --git a/platform/darwin/src/MGLHillshadeStyleLayer.mm b/platform/darwin/src/MGLHillshadeStyleLayer.mm index 538a99daf6..2383c1ce26 100644 --- a/platform/darwin/src/MGLHillshadeStyleLayer.mm +++ b/platform/darwin/src/MGLHillshadeStyleLayer.mm @@ -46,35 +46,6 @@ namespace mbgl { return @(self.rawLayer->getSourceID().c_str()); } -- (NSString *)sourceLayerIdentifier -{ - MGLAssertStyleLayerIsValid(); - - auto layerID = self.rawLayer->getSourceLayer(); - return layerID.empty() ? nil : @(layerID.c_str()); -} - -- (void)setSourceLayerIdentifier:(NSString *)sourceLayerIdentifier -{ - MGLAssertStyleLayerIsValid(); - - self.rawLayer->setSourceLayer(sourceLayerIdentifier.UTF8String ?: ""); -} - -- (void)setPredicate:(NSPredicate *)predicate -{ - MGLAssertStyleLayerIsValid(); - - self.rawLayer->setFilter(predicate ? predicate.mgl_filter : mbgl::style::NullFilter()); -} - -- (NSPredicate *)predicate -{ - MGLAssertStyleLayerIsValid(); - - return [NSPredicate mgl_predicateWithFilter:self.rawLayer->getFilter()]; -} - #pragma mark - Accessing the Paint Attributes - (void)setHillshadeAccentColor:(NSExpression *)hillshadeAccentColor { diff --git a/platform/darwin/src/MGLRasterDEMSource.h b/platform/darwin/src/MGLRasterDEMSource.h new file mode 100644 index 0000000000..d00912ca79 --- /dev/null +++ b/platform/darwin/src/MGLRasterDEMSource.h @@ -0,0 +1,37 @@ +#import "MGLFoundation.h" + +#import "MGLRasterSource.h" + +/** + `MGLRasterDEMSource` is a map content source that supplies rasterized + <a href="https://en.wikipedia.org/wiki/Digital_elevation_model">digital elevation model</a> + (DEM) 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 DEM source is added to an `MGLStyle` object along with one or more + `MGLHillshadeStyleLayer` objects. Use a hillshade style layer to control the + appearance of content supplied by the raster DEM source. + + Each + <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-raster-dem"><code>raster-dem</code></a> + source defined by the style JSON file is represented at runtime by an + `MGLRasterDEMSource` 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:]`. + + Currently, raster DEM sources only support the format used by + <a href="https://www.mapbox.com/help/access-elevation-data/#mapbox-terrain-rgb">Mapbox Terrain-RGB</a>. + + ### Example + + ```swift + let terrainRGBURL = URL(string: "mapbox://mapbox.terrain-rgb")! + let source = MGLRasterDEMSource(identifier: "hills", configurationURL: terrainRGBURL) + mapView.style?.addSource(source) + ``` + */ +MGL_EXPORT +@interface MGLRasterDEMSource : MGLRasterSource + +@end diff --git a/platform/darwin/src/MGLRasterDEMSource.mm b/platform/darwin/src/MGLRasterDEMSource.mm new file mode 100644 index 0000000000..d8639b70e3 --- /dev/null +++ b/platform/darwin/src/MGLRasterDEMSource.mm @@ -0,0 +1,17 @@ +#import "MGLRasterDEMSource.h" + +#import "MGLRasterSource_Private.h" +#import "NSURL+MGLAdditions.h" + +#import <mbgl/style/sources/raster_dem_source.hpp> + +@implementation MGLRasterDEMSource + +- (std::unique_ptr<mbgl::style::RasterSource>)pendingSourceWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL tileSize:(CGFloat)tileSize { + NSString *configurationURLString = configurationURL.mgl_URLByStandardizingScheme.absoluteString; + return std::make_unique<mbgl::style::RasterDEMSource>(identifier.UTF8String, + configurationURLString.UTF8String, + uint16_t(round(tileSize))); +} + +@end diff --git a/platform/darwin/src/MGLRasterSource.mm b/platform/darwin/src/MGLRasterSource.mm index 8fc18ba69d..c47cc199eb 100644 --- a/platform/darwin/src/MGLRasterSource.mm +++ b/platform/darwin/src/MGLRasterSource.mm @@ -33,12 +33,17 @@ static const CGFloat MGLRasterSourceRetinaTileSize = 512; } - (instancetype)initWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL tileSize:(CGFloat)tileSize { - auto source = std::make_unique<mbgl::style::RasterSource>(identifier.UTF8String, - configurationURL.mgl_URLByStandardizingScheme.absoluteString.UTF8String, - uint16_t(round(tileSize))); + auto source = [self pendingSourceWithIdentifier:identifier configurationURL:configurationURL tileSize:tileSize]; return self = [super initWithPendingSource:std::move(source)]; } +- (std::unique_ptr<mbgl::style::RasterSource>)pendingSourceWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL tileSize:(CGFloat)tileSize { + NSString *configurationURLString = configurationURL.mgl_URLByStandardizingScheme.absoluteString; + return std::make_unique<mbgl::style::RasterSource>(identifier.UTF8String, + configurationURLString.UTF8String, + uint16_t(round(tileSize))); +} + - (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NS_ARRAY_OF(NSString *) *)tileURLTemplates options:(nullable NS_DICTIONARY_OF(MGLTileSourceOption, id) *)options { mbgl::Tileset tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, options); diff --git a/platform/darwin/src/MGLRasterSource_Private.h b/platform/darwin/src/MGLRasterSource_Private.h index 76790bd053..6f40fbc5a9 100644 --- a/platform/darwin/src/MGLRasterSource_Private.h +++ b/platform/darwin/src/MGLRasterSource_Private.h @@ -1,8 +1,21 @@ #import "MGLRasterSource.h" +#include <memory> + +namespace mbgl { + namespace style { + class RasterSource; + } +} + NS_ASSUME_NONNULL_BEGIN @interface MGLRasterSource (Private) + +@property (nonatomic, readonly) mbgl::style::RasterSource *rawSource; + +- (std::unique_ptr<mbgl::style::RasterSource>)pendingSourceWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL tileSize:(CGFloat)tileSize; + @end NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index fefd8fcf37..5128944312 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -8,6 +8,7 @@ #import "MGLLineStyleLayer.h" #import "MGLCircleStyleLayer.h" #import "MGLSymbolStyleLayer.h" +#import "MGLHillshadeStyleLayer.h" #import "MGLRasterStyleLayer.h" #import "MGLBackgroundStyleLayer.h" #import "MGLOpenGLStyleLayer.h" @@ -19,6 +20,7 @@ #import "MGLVectorSource.h" #import "MGLVectorSource_Private.h" #import "MGLRasterSource.h" +#import "MGLRasterDEMSource.h" #import "MGLShapeSource.h" #import "MGLImageSource.h" @@ -34,12 +36,14 @@ #include <mbgl/style/layers/line_layer.hpp> #include <mbgl/style/layers/symbol_layer.hpp> #include <mbgl/style/layers/raster_layer.hpp> +#include <mbgl/style/layers/hillshade_layer.hpp> #include <mbgl/style/layers/circle_layer.hpp> #include <mbgl/style/layers/background_layer.hpp> #include <mbgl/style/layers/custom_layer.hpp> #include <mbgl/style/sources/geojson_source.hpp> #include <mbgl/style/sources/vector_source.hpp> #include <mbgl/style/sources/raster_source.hpp> +#include <mbgl/style/sources/raster_dem_source.hpp> #include <mbgl/style/sources/image_source.hpp> #import "NSDate+MGLAdditions.h" @@ -231,6 +235,8 @@ static NSURL *MGLStyleURL_trafficNight; 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]; + } 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>()) { return [[MGLImageSource alloc] initWithRawSource:imageSource mapView:self.mapView]; } else { @@ -395,6 +401,8 @@ static NSURL *MGLStyleURL_trafficNight; return [[MGLSymbolStyleLayer alloc] initWithRawLayer:symbolLayer]; } else if (auto rasterLayer = rawLayer->as<mbgl::style::RasterLayer>()) { return [[MGLRasterStyleLayer alloc] initWithRawLayer:rasterLayer]; + } else if (auto hillshadeLayer = rawLayer->as<mbgl::style::HillshadeLayer>()) { + return [[MGLHillshadeStyleLayer alloc] initWithRawLayer:hillshadeLayer]; } else if (auto circleLayer = rawLayer->as<mbgl::style::CircleLayer>()) { return [[MGLCircleStyleLayer alloc] initWithRawLayer:circleLayer]; } else if (auto backgroundLayer = rawLayer->as<mbgl::style::BackgroundLayer>()) { diff --git a/platform/darwin/src/MGLStyleLayer.h.ejs b/platform/darwin/src/MGLStyleLayer.h.ejs index db16df3de5..05f450a4f8 100644 --- a/platform/darwin/src/MGLStyleLayer.h.ejs +++ b/platform/darwin/src/MGLStyleLayer.h.ejs @@ -11,7 +11,7 @@ #import "MGLFoundation.h" #import "MGL<%- (type === 'background' ? '' : - (type === 'raster' ? 'Foreground' : + (type === 'raster' || type === 'hillshade' ? 'Foreground' : 'Vector')) %>StyleLayer.h" @@ -78,7 +78,7 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) { MGL_EXPORT @interface MGL<%- camelize(type) %>StyleLayer : MGL<%- (type === 'background' ? '' : - (type === 'raster' ? 'Foreground' : + (type === 'raster' || type === 'hillshade' ? 'Foreground' : 'Vector')) %>StyleLayer <% if (type === 'background') { -%> diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs index 8101c1f463..41b029791f 100644 --- a/platform/darwin/src/MGLStyleLayer.mm.ejs +++ b/platform/darwin/src/MGLStyleLayer.mm.ejs @@ -83,7 +83,7 @@ namespace mbgl { return @(self.rawLayer->getSourceID().c_str()); } -<% if (type !== 'raster') { -%> +<% if (type !== 'raster' && type !== 'hillshade') { -%> - (NSString *)sourceLayerIdentifier { MGLAssertStyleLayerIsValid(); diff --git a/platform/darwin/test/MGLDocumentationExampleTests.swift b/platform/darwin/test/MGLDocumentationExampleTests.swift index d3e2bf91f2..9bf9924869 100644 --- a/platform/darwin/test/MGLDocumentationExampleTests.swift +++ b/platform/darwin/test/MGLDocumentationExampleTests.swift @@ -88,6 +88,26 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { XCTAssertNotNil(mapView.style?.source(withIdentifier: "clouds")) } + + func testMGLRasterDEMSource() { + // We want to use mapbox.terrain-rgb in the example, but using a mapbox: + // URL requires setting an access token. So this identically named + // subclass of MGLRasterDEMSource swaps in a nonexistent URL. + class MGLRasterDEMSource: Mapbox.MGLRasterDEMSource { + override init(identifier: String, configurationURL: URL, tileSize: CGFloat = 256) { + let bogusURL = URL(string: "https://example.com/raster-rgb.json")! + super.init(identifier: identifier, configurationURL: bogusURL, tileSize: tileSize) + } + } + + //#-example-code + let terrainRGBURL = URL(string: "mapbox://mapbox.terrain-rgb")! + let source = MGLRasterDEMSource(identifier: "hills", configurationURL: terrainRGBURL) + mapView.style?.addSource(source) + //#-end-example-code + + XCTAssertNotNil(mapView.style?.source(withIdentifier: "hills")) + } func testMGLVectorSource() { //#-example-code @@ -256,6 +276,33 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { XCTAssertNotNil(mapView.style?.layer(withIdentifier: "clouds")) } + func testMGLHillshadeStyleLayer() { + let source = MGLRasterDEMSource(identifier: "dem", tileURLTemplates: ["https://example.com/raster-rgb/{z}/{x}/{y}.png"], options: [ + .minimumZoomLevel: 9, + .maximumZoomLevel: 16, + .tileSize: 256, + .attributionInfos: [ + MGLAttributionInfo(title: NSAttributedString(string: "© Mapbox"), url: URL(string: "http://mapbox.com")) + ] + ]) + mapView.style?.addSource(source) + + let canals = MGLVectorSource(identifier: "canals", configurationURL: URL(string: "https://example.com/style.json")!) + mapView.style?.addSource(canals) + let canalShadowLayer = MGLLineStyleLayer(identifier: "waterway-river-canal-shadow", source: canals) + mapView.style?.addLayer(canalShadowLayer) + + //#-example-code + let layer = MGLHillshadeStyleLayer(identifier: "hills", source: source) + layer.hillshadeExaggeration = NSExpression(forConstantValue: 0.6) + if let canalShadowLayer = mapView.style?.layer(withIdentifier: "waterway-river-canal-shadow") { + mapView.style?.insertLayer(layer, below: canalShadowLayer) + } + //#-end-example-code + + XCTAssertNotNil(mapView.style?.layer(withIdentifier: "hills")) + } + func testMGLVectorStyleLayer$predicate() { let terrain = MGLVectorSource(identifier: "terrain", configurationURL: URL(string: "https://example.com/style.json")!) mapView.style?.addSource(terrain) diff --git a/platform/darwin/test/MGLHillshadeStyleLayerTests.mm b/platform/darwin/test/MGLHillshadeStyleLayerTests.mm index 8f37b52790..b0b7ddd5ee 100644 --- a/platform/darwin/test/MGLHillshadeStyleLayerTests.mm +++ b/platform/darwin/test/MGLHillshadeStyleLayerTests.mm @@ -18,24 +18,6 @@ return @"hillshade"; } -- (void)testPredicates { - MGLPointFeature *feature = [[MGLPointFeature alloc] init]; - MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil]; - MGLHillshadeStyleLayer *layer = [[MGLHillshadeStyleLayer alloc] initWithIdentifier:@"layerID" source:source]; - - XCTAssertNil(layer.sourceLayerIdentifier); - layer.sourceLayerIdentifier = @"layerID"; - XCTAssertEqualObjects(layer.sourceLayerIdentifier, @"layerID"); - layer.sourceLayerIdentifier = nil; - XCTAssertNil(layer.sourceLayerIdentifier); - - XCTAssertNil(layer.predicate); - layer.predicate = [NSPredicate predicateWithValue:NO]; - XCTAssertEqualObjects(layer.predicate, [NSPredicate predicateWithValue:NO]); - layer.predicate = nil; - XCTAssertNil(layer.predicate); -} - - (void)testProperties { MGLPointFeature *feature = [[MGLPointFeature alloc] init]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil]; diff --git a/platform/darwin/test/MGLStyleLayerTests.mm.ejs b/platform/darwin/test/MGLStyleLayerTests.mm.ejs index 0487066255..e26c63e662 100644 --- a/platform/darwin/test/MGLStyleLayerTests.mm.ejs +++ b/platform/darwin/test/MGLStyleLayerTests.mm.ejs @@ -23,7 +23,7 @@ return @"<%- type %>"; } -<% if (type !== 'background' && type !== 'raster') { -%> +<% if (type !== 'background' && type !== 'raster' && type !== 'hillshade') { -%> - (void)testPredicates { MGLPointFeature *feature = [[MGLPointFeature alloc] init]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil]; |