summaryrefslogtreecommitdiff
path: root/platform/darwin
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2018-10-29 14:29:16 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2018-10-30 16:23:31 +0200
commit99e1a8a3df1a08464d8529b6988c1665b87c7c8b (patch)
tree4d45675ef4b54d00d7ef2a4dccbc211522515dce /platform/darwin
parent2ef9580565e2125e07124d23c0bcf400c8736931 (diff)
downloadqtlocation-mapboxgl-upstream/mikhail_drop_style_layer_cast.tar.gz
Remove style::Layer::is()/as()upstream/mikhail_drop_style_layer_cast
Diffstat (limited to 'platform/darwin')
-rw-r--r--platform/darwin/src/MGLStyle.mm48
-rw-r--r--platform/darwin/test/MGLBackgroundStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLCircleStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLFillStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLHeatmapColorTests.mm2
-rw-r--r--platform/darwin/test/MGLHeatmapStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLHillshadeStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLLineStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLRasterStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLStyleLayerTests.mm.ejs4
-rw-r--r--platform/darwin/test/MGLSymbolStyleLayerTests.mm4
12 files changed, 45 insertions, 45 deletions
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm
index 88499cf9bb..7d79a06fb1 100644
--- a/platform/darwin/src/MGLStyle.mm
+++ b/platform/darwin/src/MGLStyle.mm
@@ -350,30 +350,30 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles,
if (MGLStyleLayer *layer = rawLayer->peer.has_value() ? rawLayer->peer.get<LayerWrapper>().layer : nil) {
return layer;
}
-
- if (auto fillLayer = rawLayer->as<mbgl::style::FillLayer>()) {
- return [[MGLFillStyleLayer alloc] initWithRawLayer:fillLayer];
- } else if (auto fillExtrusionLayer = rawLayer->as<mbgl::style::FillExtrusionLayer>()) {
- return [[MGLFillExtrusionStyleLayer alloc] initWithRawLayer:fillExtrusionLayer];
- } else if (auto lineLayer = rawLayer->as<mbgl::style::LineLayer>()) {
- return [[MGLLineStyleLayer alloc] initWithRawLayer:lineLayer];
- } else if (auto symbolLayer = rawLayer->as<mbgl::style::SymbolLayer>()) {
- return [[MGLSymbolStyleLayer alloc] initWithRawLayer:symbolLayer];
- } else if (auto rasterLayer = rawLayer->as<mbgl::style::RasterLayer>()) {
- return [[MGLRasterStyleLayer alloc] initWithRawLayer:rasterLayer];
- } else if (auto heatmapLayer = rawLayer->as<mbgl::style::HeatmapLayer>()) {
- return [[MGLHeatmapStyleLayer alloc] initWithRawLayer:heatmapLayer];
- } 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>()) {
- return [[MGLBackgroundStyleLayer alloc] initWithRawLayer:backgroundLayer];
- } else if (auto customLayer = rawLayer->as<mbgl::style::CustomLayer>()) {
- return [[MGLOpenGLStyleLayer alloc] initWithRawLayer:customLayer];
- } else {
- NSAssert(NO, @"Unrecognized layer type");
- return nil;
+ switch (rawLayer->getType()) {
+ case mbgl::style::LayerType::Fill:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::FillLayer*>(rawLayer)];
+ case mbgl::style::LayerType::FillExtrusion:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::FillExtrusionLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Line:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::LineLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Symbol:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::SymbolLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Raster:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::RasterLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Heatmap:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::HeatmapLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Hillshade:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::HillshadeLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Circle:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::CircleLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Background:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::BackgroundLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Custom:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::CustomLayer*>(rawLayer)];
+ default:
+ NSAssert(NO, @"Unrecognized layer type");
+ return nil;;
}
}
diff --git a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
index afd066df82..d76cd8cd6d 100644
--- a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
+++ b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
@@ -22,8 +22,8 @@
- (void)testProperties {
MGLBackgroundStyleLayer *layer = [[MGLBackgroundStyleLayer alloc] initWithIdentifier:@"layerID"];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::BackgroundLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::BackgroundLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Background);
+ auto rawLayer = static_cast<mbgl::style::BackgroundLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.mm b/platform/darwin/test/MGLCircleStyleLayerTests.mm
index 853ec67968..213416109c 100644
--- a/platform/darwin/test/MGLCircleStyleLayerTests.mm
+++ b/platform/darwin/test/MGLCircleStyleLayerTests.mm
@@ -43,8 +43,8 @@
MGLCircleStyleLayer *layer = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::CircleLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::CircleLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Circle);
+ auto rawLayer = static_cast<mbgl::style::CircleLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm b/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm
index eddf82eec8..7c4e147026 100644
--- a/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm
+++ b/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm
@@ -43,8 +43,8 @@
MGLFillExtrusionStyleLayer *layer = [[MGLFillExtrusionStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::FillExtrusionLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::FillExtrusionLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::FillExtrusion);
+ auto rawLayer = static_cast<mbgl::style::FillExtrusionLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLFillStyleLayerTests.mm b/platform/darwin/test/MGLFillStyleLayerTests.mm
index bae8779309..b8c39918c5 100644
--- a/platform/darwin/test/MGLFillStyleLayerTests.mm
+++ b/platform/darwin/test/MGLFillStyleLayerTests.mm
@@ -43,8 +43,8 @@
MGLFillStyleLayer *layer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::FillLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::FillLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Fill);
+ auto rawLayer = static_cast<mbgl::style::FillLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLHeatmapColorTests.mm b/platform/darwin/test/MGLHeatmapColorTests.mm
index bed777ae05..19f9b4e86e 100644
--- a/platform/darwin/test/MGLHeatmapColorTests.mm
+++ b/platform/darwin/test/MGLHeatmapColorTests.mm
@@ -15,7 +15,7 @@
MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil];
MGLHeatmapStyleLayer *layer = [[MGLHeatmapStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
- auto rawLayer = layer.rawLayer->as<mbgl::style::HeatmapLayer>();
+ auto rawLayer = static_cast<mbgl::style::HeatmapLayer*>(layer.rawLayer);
XCTAssertTrue(rawLayer->getHeatmapColor().isUndefined(),
@"heatmap-color should be unset initially.");
diff --git a/platform/darwin/test/MGLHeatmapStyleLayerTests.mm b/platform/darwin/test/MGLHeatmapStyleLayerTests.mm
index 76a2b0c87e..bde8a5b1c8 100644
--- a/platform/darwin/test/MGLHeatmapStyleLayerTests.mm
+++ b/platform/darwin/test/MGLHeatmapStyleLayerTests.mm
@@ -43,8 +43,8 @@
MGLHeatmapStyleLayer *layer = [[MGLHeatmapStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::HeatmapLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::HeatmapLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Heatmap);
+ auto rawLayer = static_cast<mbgl::style::HeatmapLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLHillshadeStyleLayerTests.mm b/platform/darwin/test/MGLHillshadeStyleLayerTests.mm
index 2e8795759f..5c8a45beab 100644
--- a/platform/darwin/test/MGLHillshadeStyleLayerTests.mm
+++ b/platform/darwin/test/MGLHillshadeStyleLayerTests.mm
@@ -25,8 +25,8 @@
MGLHillshadeStyleLayer *layer = [[MGLHillshadeStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::HillshadeLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::HillshadeLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Hillshade);
+ auto rawLayer = static_cast<mbgl::style::HillshadeLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLLineStyleLayerTests.mm b/platform/darwin/test/MGLLineStyleLayerTests.mm
index 7289debb94..c8868635ef 100644
--- a/platform/darwin/test/MGLLineStyleLayerTests.mm
+++ b/platform/darwin/test/MGLLineStyleLayerTests.mm
@@ -43,8 +43,8 @@
MGLLineStyleLayer *layer = [[MGLLineStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::LineLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::LineLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Line);
+ auto rawLayer = static_cast<mbgl::style::LineLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLRasterStyleLayerTests.mm b/platform/darwin/test/MGLRasterStyleLayerTests.mm
index 9325bb48f5..f0ce055b3a 100644
--- a/platform/darwin/test/MGLRasterStyleLayerTests.mm
+++ b/platform/darwin/test/MGLRasterStyleLayerTests.mm
@@ -25,8 +25,8 @@
MGLRasterStyleLayer *layer = [[MGLRasterStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::RasterLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::RasterLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Raster);
+ auto rawLayer = static_cast<mbgl::style::RasterLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLStyleLayerTests.mm.ejs b/platform/darwin/test/MGLStyleLayerTests.mm.ejs
index c97813eca2..68d61072f8 100644
--- a/platform/darwin/test/MGLStyleLayerTests.mm.ejs
+++ b/platform/darwin/test/MGLStyleLayerTests.mm.ejs
@@ -54,8 +54,8 @@
MGL<%- camelize(type) %>StyleLayer *layer = [[MGL<%- camelize(type) %>StyleLayer alloc] initWithIdentifier:@"layerID" source:source];
<% } -%>
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::<%- camelize(type) %>Layer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::<%- camelize(type) %>Layer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::<%- camelize(type) %>);
+ auto rawLayer = static_cast<mbgl::style::<%- camelize(type) %>Layer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.mm b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
index 42430940cd..daf63355e6 100644
--- a/platform/darwin/test/MGLSymbolStyleLayerTests.mm
+++ b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
@@ -43,8 +43,8 @@
MGLSymbolStyleLayer *layer = [[MGLSymbolStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::SymbolLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::SymbolLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Symbol);
+ auto rawLayer = static_cast<mbgl::style::SymbolLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);