[core, android, darwin] Move layer factories to separate files

This commit is contained in:
Mikhail Pozdnyakov
2018-12-10 17:21:08 +02:00
parent cbcd0875e3
commit ebd87a5442
76 changed files with 493 additions and 377 deletions

View File

@@ -0,0 +1,23 @@
#include <mbgl/layermanager/background_layer_factory.hpp>
#include <mbgl/renderer/layers/render_background_layer.hpp>
#include <mbgl/style/layers/background_layer.hpp>
#include <mbgl/style/layers/background_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* BackgroundLayerFactory::getTypeInfo() const noexcept {
return style::BackgroundLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> BackgroundLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
(void)value;
return std::unique_ptr<style::Layer>(new style::BackgroundLayer(id));
}
std::unique_ptr<RenderLayer> BackgroundLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderBackgroundLayer>(staticImmutableCast<style::BackgroundLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,31 @@
#include <mbgl/layermanager/circle_layer_factory.hpp>
#include <mbgl/renderer/layers/render_circle_layer.hpp>
#include <mbgl/style/layers/circle_layer.hpp>
#include <mbgl/style/layers/circle_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* CircleLayerFactory::getTypeInfo() const noexcept {
return style::CircleLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> CircleLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::CircleLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> CircleLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderCircleLayer>(staticImmutableCast<style::CircleLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,22 @@
#include <mbgl/layermanager/custom_layer_factory.hpp>
#include <mbgl/renderer/layers/render_custom_layer.hpp>
#include <mbgl/style/layers/custom_layer.hpp>
#include <mbgl/style/layers/custom_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* CustomLayerFactory::getTypeInfo() const noexcept {
return style::CustomLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> CustomLayerFactory::createLayer(const std::string&, const style::conversion::Convertible&) noexcept {
assert(false);
return nullptr;
}
std::unique_ptr<RenderLayer> CustomLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
return std::make_unique<RenderCustomLayer>(staticImmutableCast<style::CustomLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,31 @@
#include <mbgl/layermanager/fill_extrusion_layer_factory.hpp>
#include <mbgl/renderer/layers/render_fill_extrusion_layer.hpp>
#include <mbgl/style/layers/fill_extrusion_layer.hpp>
#include <mbgl/style/layers/fill_extrusion_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* FillExtrusionLayerFactory::getTypeInfo() const noexcept {
return style::FillExtrusionLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> FillExtrusionLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::FillExtrusionLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> FillExtrusionLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderFillExtrusionLayer>(staticImmutableCast<style::FillExtrusionLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,31 @@
#include <mbgl/layermanager/fill_layer_factory.hpp>
#include <mbgl/renderer/layers/render_fill_layer.hpp>
#include <mbgl/style/layers/fill_layer.hpp>
#include <mbgl/style/layers/fill_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* FillLayerFactory::getTypeInfo() const noexcept {
return style::FillLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> FillLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::FillLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> FillLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderFillLayer>(staticImmutableCast<style::FillLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,31 @@
#include <mbgl/layermanager/heatmap_layer_factory.hpp>
#include <mbgl/renderer/layers/render_heatmap_layer.hpp>
#include <mbgl/style/layers/heatmap_layer.hpp>
#include <mbgl/style/layers/heatmap_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* HeatmapLayerFactory::getTypeInfo() const noexcept {
return style::HeatmapLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> HeatmapLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::HeatmapLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> HeatmapLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderHeatmapLayer>(staticImmutableCast<style::HeatmapLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,28 @@
#include <mbgl/layermanager/hillshade_layer_factory.hpp>
#include <mbgl/renderer/layers/render_hillshade_layer.hpp>
#include <mbgl/style/layers/hillshade_layer.hpp>
#include <mbgl/style/layers/hillshade_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* HillshadeLayerFactory::getTypeInfo() const noexcept {
return style::HillshadeLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> HillshadeLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::HillshadeLayer(id, *source));
return layer;
}
std::unique_ptr<RenderLayer> HillshadeLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderHillshadeLayer>(staticImmutableCast<style::HillshadeLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,31 @@
#include <mbgl/layermanager/line_layer_factory.hpp>
#include <mbgl/renderer/layers/render_line_layer.hpp>
#include <mbgl/style/layers/line_layer.hpp>
#include <mbgl/style/layers/line_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* LineLayerFactory::getTypeInfo() const noexcept {
return style::LineLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> LineLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::LineLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> LineLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderLineLayer>(staticImmutableCast<style::LineLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,28 @@
#include <mbgl/layermanager/raster_layer_factory.hpp>
#include <mbgl/renderer/layers/render_raster_layer.hpp>
#include <mbgl/style/layers/raster_layer.hpp>
#include <mbgl/style/layers/raster_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* RasterLayerFactory::getTypeInfo() const noexcept {
return style::RasterLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> RasterLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::RasterLayer(id, *source));
return layer;
}
std::unique_ptr<RenderLayer> RasterLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderRasterLayer>(staticImmutableCast<style::RasterLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,31 @@
#include <mbgl/layermanager/symbol_layer_factory.hpp>
#include <mbgl/renderer/layers/render_symbol_layer.hpp>
#include <mbgl/style/layers/symbol_layer.hpp>
#include <mbgl/style/layers/symbol_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* SymbolLayerFactory::getTypeInfo() const noexcept {
return style::SymbolLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> SymbolLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::SymbolLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> SymbolLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderSymbolLayer>(staticImmutableCast<style::SymbolLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_background_layer.hpp>
namespace mbgl {
namespace style {
@@ -287,19 +285,4 @@ Mutable<Layer::Impl> BackgroundLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* BackgroundLayerFactory::getTypeInfo() const noexcept {
return style::BackgroundLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> BackgroundLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
(void)value;
return std::unique_ptr<style::Layer>(new style::BackgroundLayer(id));
}
std::unique_ptr<RenderLayer> BackgroundLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderBackgroundLayer>(staticImmutableCast<style::BackgroundLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_circle_layer.hpp>
namespace mbgl {
namespace style {
@@ -704,27 +702,4 @@ Mutable<Layer::Impl> CircleLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* CircleLayerFactory::getTypeInfo() const noexcept {
return style::CircleLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> CircleLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::CircleLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> CircleLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderCircleLayer>(staticImmutableCast<style::CircleLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -56,18 +56,4 @@ const LayerTypeInfo* CustomLayer::Impl::staticTypeInfo() noexcept {
}
} // namespace style
const style::LayerTypeInfo* CustomLayerFactory::getTypeInfo() const noexcept {
return &style::typeInfoCustom;
}
std::unique_ptr<style::Layer> CustomLayerFactory::createLayer(const std::string&, const style::conversion::Convertible&) noexcept {
assert(false);
return nullptr;
}
std::unique_ptr<RenderLayer> CustomLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
return std::make_unique<RenderCustomLayer>(staticImmutableCast<style::CustomLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_fill_extrusion_layer.hpp>
namespace mbgl {
namespace style {
@@ -562,27 +560,4 @@ Mutable<Layer::Impl> FillExtrusionLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* FillExtrusionLayerFactory::getTypeInfo() const noexcept {
return style::FillExtrusionLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> FillExtrusionLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::FillExtrusionLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> FillExtrusionLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderFillExtrusionLayer>(staticImmutableCast<style::FillExtrusionLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_fill_layer.hpp>
namespace mbgl {
namespace style {
@@ -506,27 +504,4 @@ Mutable<Layer::Impl> FillLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* FillLayerFactory::getTypeInfo() const noexcept {
return style::FillLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> FillLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::FillLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> FillLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderFillLayer>(staticImmutableCast<style::FillLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_heatmap_layer.hpp>
namespace mbgl {
namespace style {
@@ -391,27 +389,4 @@ Mutable<Layer::Impl> HeatmapLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* HeatmapLayerFactory::getTypeInfo() const noexcept {
return style::HeatmapLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> HeatmapLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::HeatmapLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> HeatmapLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderHeatmapLayer>(staticImmutableCast<style::HeatmapLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_hillshade_layer.hpp>
namespace mbgl {
namespace style {
@@ -438,24 +436,4 @@ Mutable<Layer::Impl> HillshadeLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* HillshadeLayerFactory::getTypeInfo() const noexcept {
return style::HillshadeLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> HillshadeLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::HillshadeLayer(id, *source));
return layer;
}
std::unique_ptr<RenderLayer> HillshadeLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderHillshadeLayer>(staticImmutableCast<style::HillshadeLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -16,8 +16,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_<%- type.replace('-', '_') %>_layer.hpp>
namespace mbgl {
namespace style {
@@ -314,34 +312,4 @@ Mutable<Layer::Impl> <%- camelize(type) %>Layer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* <%- camelize(type) %>LayerFactory::getTypeInfo() const noexcept {
return style::<%- camelize(type) %>Layer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> <%- camelize(type) %>LayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
<% if (type === 'background') { -%>
(void)value;
return std::unique_ptr<style::Layer>(new style::<%- camelize(type) %>Layer(id));
<% } else { -%>
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::<%- camelize(type) %>Layer(id, *source));
<% if (type !== 'raster' && type !== 'hillshade') { -%>
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
<% } -%>
return layer;
<% } -%>
}
std::unique_ptr<RenderLayer> <%- camelize(type) %>LayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<Render<%- camelize(type) %>Layer>(staticImmutableCast<style::<%- camelize(type) %>Layer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_line_layer.hpp>
namespace mbgl {
namespace style {
@@ -845,27 +843,4 @@ Mutable<Layer::Impl> LineLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* LineLayerFactory::getTypeInfo() const noexcept {
return style::LineLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> LineLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::LineLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> LineLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderLineLayer>(staticImmutableCast<style::LineLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_raster_layer.hpp>
namespace mbgl {
namespace style {
@@ -527,24 +525,4 @@ Mutable<Layer::Impl> RasterLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* RasterLayerFactory::getTypeInfo() const noexcept {
return style::RasterLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> RasterLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::RasterLayer(id, *source));
return layer;
}
std::unique_ptr<RenderLayer> RasterLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderRasterLayer>(staticImmutableCast<style::RasterLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_symbol_layer.hpp>
namespace mbgl {
namespace style {
@@ -1995,27 +1993,4 @@ Mutable<Layer::Impl> SymbolLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* SymbolLayerFactory::getTypeInfo() const noexcept {
return style::SymbolLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> SymbolLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::SymbolLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> SymbolLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderSymbolLayer>(staticImmutableCast<style::SymbolLayer::Impl>(std::move(impl)));
}
} // namespace mbgl