diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2018-10-29 14:29:16 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2018-10-31 11:22:46 +0200 |
commit | 56808731b699d7750726cd88dd06516c63d7f2f0 (patch) | |
tree | 7839dffdd0eec33f6ebd2cfa9195f7408ac6c289 /platform/darwin/src | |
parent | 3f314682fa2f2701c0d1c7e863013ce254a23afd (diff) | |
download | qtlocation-mapboxgl-56808731b699d7750726cd88dd06516c63d7f2f0.tar.gz |
Remove style::Layer::is()/as()
Diffstat (limited to 'platform/darwin/src')
-rw-r--r-- | platform/darwin/src/MGLStyle.mm | 48 |
1 files changed, 24 insertions, 24 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;; } } |