From ebd87a5442772e9e840cd5c00be56cccfddb5c68 Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Mon, 10 Dec 2018 17:21:08 +0200 Subject: [PATCH] [core, android, darwin] Move layer factories to separate files --- cmake/core-files.txt | 20 ++++++++++++ .../layermanager/background_layer_factory.hpp | 14 ++++++++ .../layermanager/circle_layer_factory.hpp | 14 ++++++++ .../layermanager/custom_layer_factory.hpp | 17 ++++++++++ .../fill_extrusion_layer_factory.hpp | 14 ++++++++ .../mbgl/layermanager/fill_layer_factory.hpp | 14 ++++++++ .../layermanager/heatmap_layer_factory.hpp | 14 ++++++++ .../layermanager/hillshade_layer_factory.hpp | 14 ++++++++ .../mbgl/layermanager/line_layer_factory.hpp | 14 ++++++++ .../layermanager/raster_layer_factory.hpp | 14 ++++++++ .../layermanager/symbol_layer_factory.hpp | 14 ++++++++ .../mbgl/style/layers/background_layer.hpp | 9 ------ include/mbgl/style/layers/circle_layer.hpp | 9 ------ include/mbgl/style/layers/custom_layer.hpp | 9 ------ .../style/layers/fill_extrusion_layer.hpp | 9 ------ include/mbgl/style/layers/fill_layer.hpp | 9 ------ include/mbgl/style/layers/heatmap_layer.hpp | 9 ------ include/mbgl/style/layers/hillshade_layer.hpp | 9 ------ include/mbgl/style/layers/layer.hpp.ejs | 9 ------ include/mbgl/style/layers/line_layer.hpp | 9 ------ include/mbgl/style/layers/raster_layer.hpp | 9 ------ include/mbgl/style/layers/symbol_layer.hpp | 9 ------ .../src/style/layers/background_layer.hpp | 1 + .../android/src/style/layers/circle_layer.hpp | 1 + .../android/src/style/layers/custom_layer.hpp | 1 + .../src/style/layers/fill_extrusion_layer.hpp | 1 + .../android/src/style/layers/fill_layer.hpp | 1 + .../src/style/layers/heatmap_layer.hpp | 1 + .../src/style/layers/hillshade_layer.hpp | 1 + .../android/src/style/layers/layer.hpp.ejs | 1 + .../android/src/style/layers/line_layer.hpp | 1 + .../android/src/style/layers/raster_layer.hpp | 1 + .../android/src/style/layers/symbol_layer.hpp | 1 + .../darwin/src/MGLBackgroundStyleLayer.mm | 1 + .../src/MGLBackgroundStyleLayer_Private.h | 2 +- platform/darwin/src/MGLCircleStyleLayer.mm | 1 + .../darwin/src/MGLCircleStyleLayer_Private.h | 2 +- .../darwin/src/MGLFillExtrusionStyleLayer.mm | 1 + .../src/MGLFillExtrusionStyleLayer_Private.h | 2 +- platform/darwin/src/MGLFillStyleLayer.mm | 1 + .../darwin/src/MGLFillStyleLayer_Private.h | 2 +- platform/darwin/src/MGLHeatmapStyleLayer.mm | 1 + .../darwin/src/MGLHeatmapStyleLayer_Private.h | 2 +- platform/darwin/src/MGLHillshadeStyleLayer.mm | 1 + .../src/MGLHillshadeStyleLayer_Private.h | 2 +- platform/darwin/src/MGLLineStyleLayer.mm | 1 + .../darwin/src/MGLLineStyleLayer_Private.h | 2 +- .../darwin/src/MGLOpenGLStyleLayer_Private.h | 2 +- platform/darwin/src/MGLRasterStyleLayer.mm | 1 + .../darwin/src/MGLRasterStyleLayer_Private.h | 2 +- platform/darwin/src/MGLStyleLayer.mm.ejs | 1 + .../darwin/src/MGLStyleLayer_Private.h.ejs | 2 +- platform/darwin/src/MGLSymbolStyleLayer.mm | 1 + .../darwin/src/MGLSymbolStyleLayer_Private.h | 2 +- platform/default/layer_manager.cpp | 21 ++++++------ .../layermanager/background_layer_factory.cpp | 23 +++++++++++++ .../layermanager/circle_layer_factory.cpp | 31 ++++++++++++++++++ .../layermanager/custom_layer_factory.cpp | 22 +++++++++++++ .../fill_extrusion_layer_factory.cpp | 31 ++++++++++++++++++ src/mbgl/layermanager/fill_layer_factory.cpp | 31 ++++++++++++++++++ .../layermanager/heatmap_layer_factory.cpp | 31 ++++++++++++++++++ .../layermanager/hillshade_layer_factory.cpp | 28 ++++++++++++++++ src/mbgl/layermanager/line_layer_factory.cpp | 31 ++++++++++++++++++ .../layermanager/raster_layer_factory.cpp | 28 ++++++++++++++++ .../layermanager/symbol_layer_factory.cpp | 31 ++++++++++++++++++ src/mbgl/style/layers/background_layer.cpp | 17 ---------- src/mbgl/style/layers/circle_layer.cpp | 25 --------------- src/mbgl/style/layers/custom_layer.cpp | 14 -------- .../style/layers/fill_extrusion_layer.cpp | 25 --------------- src/mbgl/style/layers/fill_layer.cpp | 25 --------------- src/mbgl/style/layers/heatmap_layer.cpp | 25 --------------- src/mbgl/style/layers/hillshade_layer.cpp | 22 ------------- src/mbgl/style/layers/layer.cpp.ejs | 32 ------------------- src/mbgl/style/layers/line_layer.cpp | 25 --------------- src/mbgl/style/layers/raster_layer.cpp | 22 ------------- src/mbgl/style/layers/symbol_layer.cpp | 25 --------------- 76 files changed, 493 insertions(+), 377 deletions(-) create mode 100644 include/mbgl/layermanager/background_layer_factory.hpp create mode 100644 include/mbgl/layermanager/circle_layer_factory.hpp create mode 100644 include/mbgl/layermanager/custom_layer_factory.hpp create mode 100644 include/mbgl/layermanager/fill_extrusion_layer_factory.hpp create mode 100644 include/mbgl/layermanager/fill_layer_factory.hpp create mode 100644 include/mbgl/layermanager/heatmap_layer_factory.hpp create mode 100644 include/mbgl/layermanager/hillshade_layer_factory.hpp create mode 100644 include/mbgl/layermanager/line_layer_factory.hpp create mode 100644 include/mbgl/layermanager/raster_layer_factory.hpp create mode 100644 include/mbgl/layermanager/symbol_layer_factory.hpp create mode 100644 src/mbgl/layermanager/background_layer_factory.cpp create mode 100644 src/mbgl/layermanager/circle_layer_factory.cpp create mode 100644 src/mbgl/layermanager/custom_layer_factory.cpp create mode 100644 src/mbgl/layermanager/fill_extrusion_layer_factory.cpp create mode 100644 src/mbgl/layermanager/fill_layer_factory.cpp create mode 100644 src/mbgl/layermanager/heatmap_layer_factory.cpp create mode 100644 src/mbgl/layermanager/hillshade_layer_factory.cpp create mode 100644 src/mbgl/layermanager/line_layer_factory.cpp create mode 100644 src/mbgl/layermanager/raster_layer_factory.cpp create mode 100644 src/mbgl/layermanager/symbol_layer_factory.cpp diff --git a/cmake/core-files.txt b/cmake/core-files.txt index bccdc2706..5712db9f1 100644 --- a/cmake/core-files.txt +++ b/cmake/core-files.txt @@ -95,10 +95,30 @@ src/mbgl/gl/vertex_array_extension.hpp src/mbgl/gl/vertex_buffer.hpp # layermanager +include/mbgl/layermanager/background_layer_factory.hpp +include/mbgl/layermanager/circle_layer_factory.hpp +include/mbgl/layermanager/custom_layer_factory.hpp +include/mbgl/layermanager/fill_extrusion_layer_factory.hpp +include/mbgl/layermanager/fill_layer_factory.hpp +include/mbgl/layermanager/heatmap_layer_factory.hpp +include/mbgl/layermanager/hillshade_layer_factory.hpp include/mbgl/layermanager/layer_factory.hpp include/mbgl/layermanager/layer_manager.hpp +include/mbgl/layermanager/line_layer_factory.hpp +include/mbgl/layermanager/raster_layer_factory.hpp +include/mbgl/layermanager/symbol_layer_factory.hpp +src/mbgl/layermanager/background_layer_factory.cpp +src/mbgl/layermanager/circle_layer_factory.cpp +src/mbgl/layermanager/custom_layer_factory.cpp +src/mbgl/layermanager/fill_extrusion_layer_factory.cpp +src/mbgl/layermanager/fill_layer_factory.cpp +src/mbgl/layermanager/heatmap_layer_factory.cpp +src/mbgl/layermanager/hillshade_layer_factory.cpp src/mbgl/layermanager/layer_factory.cpp src/mbgl/layermanager/layer_manager.cpp +src/mbgl/layermanager/line_layer_factory.cpp +src/mbgl/layermanager/raster_layer_factory.cpp +src/mbgl/layermanager/symbol_layer_factory.cpp # layout src/mbgl/layout/clip_lines.cpp diff --git a/include/mbgl/layermanager/background_layer_factory.hpp b/include/mbgl/layermanager/background_layer_factory.hpp new file mode 100644 index 000000000..f2fa2f7a5 --- /dev/null +++ b/include/mbgl/layermanager/background_layer_factory.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include + +namespace mbgl { + +class BackgroundLayerFactory : public LayerFactory { +protected: + const style::LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr createRenderLayer(Immutable) noexcept final; +}; + +} // namespace mbgl diff --git a/include/mbgl/layermanager/circle_layer_factory.hpp b/include/mbgl/layermanager/circle_layer_factory.hpp new file mode 100644 index 000000000..b632d892f --- /dev/null +++ b/include/mbgl/layermanager/circle_layer_factory.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include + +namespace mbgl { + +class CircleLayerFactory : public LayerFactory { +protected: + const style::LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr createRenderLayer(Immutable) noexcept final; +}; + +} // namespace mbgl diff --git a/include/mbgl/layermanager/custom_layer_factory.hpp b/include/mbgl/layermanager/custom_layer_factory.hpp new file mode 100644 index 000000000..963a3dc2f --- /dev/null +++ b/include/mbgl/layermanager/custom_layer_factory.hpp @@ -0,0 +1,17 @@ +#pragma once + +#include +#include + +#include + +namespace mbgl { + +class CustomLayerFactory : public LayerFactory { +protected: + const style::LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr createRenderLayer(Immutable) noexcept final; +}; + +} // namespace mbgl diff --git a/include/mbgl/layermanager/fill_extrusion_layer_factory.hpp b/include/mbgl/layermanager/fill_extrusion_layer_factory.hpp new file mode 100644 index 000000000..c524f6195 --- /dev/null +++ b/include/mbgl/layermanager/fill_extrusion_layer_factory.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include + +namespace mbgl { + +class FillExtrusionLayerFactory : public LayerFactory { +protected: + const style::LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr createRenderLayer(Immutable) noexcept final; +}; + +} // namespace mbgl diff --git a/include/mbgl/layermanager/fill_layer_factory.hpp b/include/mbgl/layermanager/fill_layer_factory.hpp new file mode 100644 index 000000000..eec7d0e7a --- /dev/null +++ b/include/mbgl/layermanager/fill_layer_factory.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include + +namespace mbgl { + +class FillLayerFactory : public LayerFactory { +protected: + const style::LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr createRenderLayer(Immutable) noexcept final; +}; + +} // namespace mbgl diff --git a/include/mbgl/layermanager/heatmap_layer_factory.hpp b/include/mbgl/layermanager/heatmap_layer_factory.hpp new file mode 100644 index 000000000..b375dc9eb --- /dev/null +++ b/include/mbgl/layermanager/heatmap_layer_factory.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include + +namespace mbgl { + +class HeatmapLayerFactory : public LayerFactory { +protected: + const style::LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr createRenderLayer(Immutable) noexcept final; +}; + +} // namespace mbgl diff --git a/include/mbgl/layermanager/hillshade_layer_factory.hpp b/include/mbgl/layermanager/hillshade_layer_factory.hpp new file mode 100644 index 000000000..25b4f6c2c --- /dev/null +++ b/include/mbgl/layermanager/hillshade_layer_factory.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include + +namespace mbgl { + +class HillshadeLayerFactory : public LayerFactory { +protected: + const style::LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr createRenderLayer(Immutable) noexcept final; +}; + +} // namespace mbgl diff --git a/include/mbgl/layermanager/line_layer_factory.hpp b/include/mbgl/layermanager/line_layer_factory.hpp new file mode 100644 index 000000000..8aa7e5105 --- /dev/null +++ b/include/mbgl/layermanager/line_layer_factory.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include + +namespace mbgl { + +class LineLayerFactory : public LayerFactory { +protected: + const style::LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr createRenderLayer(Immutable) noexcept final; +}; + +} // namespace mbgl diff --git a/include/mbgl/layermanager/raster_layer_factory.hpp b/include/mbgl/layermanager/raster_layer_factory.hpp new file mode 100644 index 000000000..d82137ee8 --- /dev/null +++ b/include/mbgl/layermanager/raster_layer_factory.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include + +namespace mbgl { + +class RasterLayerFactory : public LayerFactory { +protected: + const style::LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr createRenderLayer(Immutable) noexcept final; +}; + +} // namespace mbgl diff --git a/include/mbgl/layermanager/symbol_layer_factory.hpp b/include/mbgl/layermanager/symbol_layer_factory.hpp new file mode 100644 index 000000000..c10b100af --- /dev/null +++ b/include/mbgl/layermanager/symbol_layer_factory.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include + +namespace mbgl { + +class SymbolLayerFactory : public LayerFactory { +protected: + const style::LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr createRenderLayer(Immutable) noexcept final; +}; + +} // namespace mbgl diff --git a/include/mbgl/style/layers/background_layer.hpp b/include/mbgl/style/layers/background_layer.hpp index e50195462..f0efa7acb 100644 --- a/include/mbgl/style/layers/background_layer.hpp +++ b/include/mbgl/style/layers/background_layer.hpp @@ -2,7 +2,6 @@ #pragma once -#include #include #include #include @@ -57,12 +56,4 @@ protected: }; } // namespace style - -class BackgroundLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - } // namespace mbgl diff --git a/include/mbgl/style/layers/circle_layer.hpp b/include/mbgl/style/layers/circle_layer.hpp index 6d8969e83..08ec686ff 100644 --- a/include/mbgl/style/layers/circle_layer.hpp +++ b/include/mbgl/style/layers/circle_layer.hpp @@ -2,7 +2,6 @@ #pragma once -#include #include #include #include @@ -105,12 +104,4 @@ protected: }; } // namespace style - -class CircleLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - } // namespace mbgl diff --git a/include/mbgl/style/layers/custom_layer.hpp b/include/mbgl/style/layers/custom_layer.hpp index 27c16fbbc..4ae59dfae 100644 --- a/include/mbgl/style/layers/custom_layer.hpp +++ b/include/mbgl/style/layers/custom_layer.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include #include @@ -87,12 +86,4 @@ public: }; } // namespace style - -class CustomLayerFactory : public LayerFactory { - // LayerFactory overrides. - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - } // namespace mbgl diff --git a/include/mbgl/style/layers/fill_extrusion_layer.hpp b/include/mbgl/style/layers/fill_extrusion_layer.hpp index fd0888c1e..c4b7ecfcd 100644 --- a/include/mbgl/style/layers/fill_extrusion_layer.hpp +++ b/include/mbgl/style/layers/fill_extrusion_layer.hpp @@ -2,7 +2,6 @@ #pragma once -#include #include #include #include @@ -87,12 +86,4 @@ protected: }; } // namespace style - -class FillExtrusionLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - } // namespace mbgl diff --git a/include/mbgl/style/layers/fill_layer.hpp b/include/mbgl/style/layers/fill_layer.hpp index 6c235b6ab..6a402f28f 100644 --- a/include/mbgl/style/layers/fill_layer.hpp +++ b/include/mbgl/style/layers/fill_layer.hpp @@ -2,7 +2,6 @@ #pragma once -#include #include #include #include @@ -81,12 +80,4 @@ protected: }; } // namespace style - -class FillLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - } // namespace mbgl diff --git a/include/mbgl/style/layers/heatmap_layer.hpp b/include/mbgl/style/layers/heatmap_layer.hpp index 6ff377cf8..4c3ae0daf 100644 --- a/include/mbgl/style/layers/heatmap_layer.hpp +++ b/include/mbgl/style/layers/heatmap_layer.hpp @@ -2,7 +2,6 @@ #pragma once -#include #include #include #include @@ -70,12 +69,4 @@ protected: }; } // namespace style - -class HeatmapLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - } // namespace mbgl diff --git a/include/mbgl/style/layers/hillshade_layer.hpp b/include/mbgl/style/layers/hillshade_layer.hpp index 0c1843af7..760e70aa7 100644 --- a/include/mbgl/style/layers/hillshade_layer.hpp +++ b/include/mbgl/style/layers/hillshade_layer.hpp @@ -2,7 +2,6 @@ #pragma once -#include #include #include #include @@ -75,12 +74,4 @@ protected: }; } // namespace style - -class HillshadeLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - } // namespace mbgl diff --git a/include/mbgl/style/layers/layer.hpp.ejs b/include/mbgl/style/layers/layer.hpp.ejs index e4c9d69db..a7a8ff35c 100644 --- a/include/mbgl/style/layers/layer.hpp.ejs +++ b/include/mbgl/style/layers/layer.hpp.ejs @@ -7,7 +7,6 @@ #pragma once -#include <% if (type === 'heatmap' || type === 'line') { -%> #include <% } -%> @@ -73,12 +72,4 @@ protected: }; } // namespace style - -class <%- camelize(type) %>LayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - } // namespace mbgl diff --git a/include/mbgl/style/layers/line_layer.hpp b/include/mbgl/style/layers/line_layer.hpp index 083bac6b9..5993ac873 100644 --- a/include/mbgl/style/layers/line_layer.hpp +++ b/include/mbgl/style/layers/line_layer.hpp @@ -2,7 +2,6 @@ #pragma once -#include #include #include #include @@ -126,12 +125,4 @@ protected: }; } // namespace style - -class LineLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - } // namespace mbgl diff --git a/include/mbgl/style/layers/raster_layer.hpp b/include/mbgl/style/layers/raster_layer.hpp index ef84ee569..f4736c9dc 100644 --- a/include/mbgl/style/layers/raster_layer.hpp +++ b/include/mbgl/style/layers/raster_layer.hpp @@ -2,7 +2,6 @@ #pragma once -#include #include #include #include @@ -87,12 +86,4 @@ protected: }; } // namespace style - -class RasterLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - } // namespace mbgl diff --git a/include/mbgl/style/layers/symbol_layer.hpp b/include/mbgl/style/layers/symbol_layer.hpp index 3d2312055..764f1585f 100644 --- a/include/mbgl/style/layers/symbol_layer.hpp +++ b/include/mbgl/style/layers/symbol_layer.hpp @@ -2,7 +2,6 @@ #pragma once -#include #include #include #include @@ -275,12 +274,4 @@ protected: }; } // namespace style - -class SymbolLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - } // namespace mbgl diff --git a/platform/android/src/style/layers/background_layer.hpp b/platform/android/src/style/layers/background_layer.hpp index c1b25b41b..654031c6f 100644 --- a/platform/android/src/style/layers/background_layer.hpp +++ b/platform/android/src/style/layers/background_layer.hpp @@ -4,6 +4,7 @@ #include "layer.hpp" #include "../transition_options.hpp" +#include #include #include diff --git a/platform/android/src/style/layers/circle_layer.hpp b/platform/android/src/style/layers/circle_layer.hpp index 6db97127c..191b3924f 100644 --- a/platform/android/src/style/layers/circle_layer.hpp +++ b/platform/android/src/style/layers/circle_layer.hpp @@ -4,6 +4,7 @@ #include "layer.hpp" #include "../transition_options.hpp" +#include #include #include diff --git a/platform/android/src/style/layers/custom_layer.hpp b/platform/android/src/style/layers/custom_layer.hpp index 814cfea3c..0d6f4a408 100644 --- a/platform/android/src/style/layers/custom_layer.hpp +++ b/platform/android/src/style/layers/custom_layer.hpp @@ -1,6 +1,7 @@ #pragma once #include "layer.hpp" +#include #include #include diff --git a/platform/android/src/style/layers/fill_extrusion_layer.hpp b/platform/android/src/style/layers/fill_extrusion_layer.hpp index 2d41a189a..15dad67b0 100644 --- a/platform/android/src/style/layers/fill_extrusion_layer.hpp +++ b/platform/android/src/style/layers/fill_extrusion_layer.hpp @@ -4,6 +4,7 @@ #include "layer.hpp" #include "../transition_options.hpp" +#include #include #include diff --git a/platform/android/src/style/layers/fill_layer.hpp b/platform/android/src/style/layers/fill_layer.hpp index 776f2c3a8..b021ddca1 100644 --- a/platform/android/src/style/layers/fill_layer.hpp +++ b/platform/android/src/style/layers/fill_layer.hpp @@ -4,6 +4,7 @@ #include "layer.hpp" #include "../transition_options.hpp" +#include #include #include diff --git a/platform/android/src/style/layers/heatmap_layer.hpp b/platform/android/src/style/layers/heatmap_layer.hpp index 51966ec93..9e3db0c89 100644 --- a/platform/android/src/style/layers/heatmap_layer.hpp +++ b/platform/android/src/style/layers/heatmap_layer.hpp @@ -4,6 +4,7 @@ #include "layer.hpp" #include "../transition_options.hpp" +#include #include #include diff --git a/platform/android/src/style/layers/hillshade_layer.hpp b/platform/android/src/style/layers/hillshade_layer.hpp index b63f85e36..2f4ea30c2 100644 --- a/platform/android/src/style/layers/hillshade_layer.hpp +++ b/platform/android/src/style/layers/hillshade_layer.hpp @@ -4,6 +4,7 @@ #include "layer.hpp" #include "../transition_options.hpp" +#include #include #include diff --git a/platform/android/src/style/layers/layer.hpp.ejs b/platform/android/src/style/layers/layer.hpp.ejs index e82470e27..28e00b273 100644 --- a/platform/android/src/style/layers/layer.hpp.ejs +++ b/platform/android/src/style/layers/layer.hpp.ejs @@ -8,6 +8,7 @@ #include "layer.hpp" #include "../transition_options.hpp" +#include _layer_factory.hpp> #include _layer.hpp> #include diff --git a/platform/android/src/style/layers/line_layer.hpp b/platform/android/src/style/layers/line_layer.hpp index 7c16822ef..75a367ab7 100644 --- a/platform/android/src/style/layers/line_layer.hpp +++ b/platform/android/src/style/layers/line_layer.hpp @@ -4,6 +4,7 @@ #include "layer.hpp" #include "../transition_options.hpp" +#include #include #include diff --git a/platform/android/src/style/layers/raster_layer.hpp b/platform/android/src/style/layers/raster_layer.hpp index 6be679277..53bee85e2 100644 --- a/platform/android/src/style/layers/raster_layer.hpp +++ b/platform/android/src/style/layers/raster_layer.hpp @@ -4,6 +4,7 @@ #include "layer.hpp" #include "../transition_options.hpp" +#include #include #include diff --git a/platform/android/src/style/layers/symbol_layer.hpp b/platform/android/src/style/layers/symbol_layer.hpp index b38a659b0..f52597ef6 100644 --- a/platform/android/src/style/layers/symbol_layer.hpp +++ b/platform/android/src/style/layers/symbol_layer.hpp @@ -4,6 +4,7 @@ #include "layer.hpp" #include "../transition_options.hpp" +#include #include #include diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm index 5ddfff553..c754de43c 100644 --- a/platform/darwin/src/MGLBackgroundStyleLayer.mm +++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm @@ -10,6 +10,7 @@ #import "MGLLoggingConfiguration_Private.h" #import "MGLBackgroundStyleLayer_Private.h" +#include #include diff --git a/platform/darwin/src/MGLBackgroundStyleLayer_Private.h b/platform/darwin/src/MGLBackgroundStyleLayer_Private.h index a6295a7c5..b50a681b4 100644 --- a/platform/darwin/src/MGLBackgroundStyleLayer_Private.h +++ b/platform/darwin/src/MGLBackgroundStyleLayer_Private.h @@ -4,7 +4,7 @@ #include "MGLStyleLayer_Private.h" -#include +#include namespace mbgl { diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm index 0562414b0..83113d602 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.mm +++ b/platform/darwin/src/MGLCircleStyleLayer.mm @@ -10,6 +10,7 @@ #import "MGLLoggingConfiguration_Private.h" #import "MGLCircleStyleLayer_Private.h" +#include #include diff --git a/platform/darwin/src/MGLCircleStyleLayer_Private.h b/platform/darwin/src/MGLCircleStyleLayer_Private.h index a023e2a88..788de6274 100644 --- a/platform/darwin/src/MGLCircleStyleLayer_Private.h +++ b/platform/darwin/src/MGLCircleStyleLayer_Private.h @@ -4,7 +4,7 @@ #include "MGLStyleLayer_Private.h" -#include +#include namespace mbgl { diff --git a/platform/darwin/src/MGLFillExtrusionStyleLayer.mm b/platform/darwin/src/MGLFillExtrusionStyleLayer.mm index e4e9c707e..8ec6000ea 100644 --- a/platform/darwin/src/MGLFillExtrusionStyleLayer.mm +++ b/platform/darwin/src/MGLFillExtrusionStyleLayer.mm @@ -10,6 +10,7 @@ #import "MGLLoggingConfiguration_Private.h" #import "MGLFillExtrusionStyleLayer_Private.h" +#include #include diff --git a/platform/darwin/src/MGLFillExtrusionStyleLayer_Private.h b/platform/darwin/src/MGLFillExtrusionStyleLayer_Private.h index fdd99d74f..2525b044a 100644 --- a/platform/darwin/src/MGLFillExtrusionStyleLayer_Private.h +++ b/platform/darwin/src/MGLFillExtrusionStyleLayer_Private.h @@ -4,7 +4,7 @@ #include "MGLStyleLayer_Private.h" -#include +#include namespace mbgl { diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm index f5dc62cd5..69de3e7d6 100644 --- a/platform/darwin/src/MGLFillStyleLayer.mm +++ b/platform/darwin/src/MGLFillStyleLayer.mm @@ -10,6 +10,7 @@ #import "MGLLoggingConfiguration_Private.h" #import "MGLFillStyleLayer_Private.h" +#include #include diff --git a/platform/darwin/src/MGLFillStyleLayer_Private.h b/platform/darwin/src/MGLFillStyleLayer_Private.h index 28f24f056..01f8b16f3 100644 --- a/platform/darwin/src/MGLFillStyleLayer_Private.h +++ b/platform/darwin/src/MGLFillStyleLayer_Private.h @@ -4,7 +4,7 @@ #include "MGLStyleLayer_Private.h" -#include +#include namespace mbgl { diff --git a/platform/darwin/src/MGLHeatmapStyleLayer.mm b/platform/darwin/src/MGLHeatmapStyleLayer.mm index a3816c0fd..ec6fdbde7 100644 --- a/platform/darwin/src/MGLHeatmapStyleLayer.mm +++ b/platform/darwin/src/MGLHeatmapStyleLayer.mm @@ -10,6 +10,7 @@ #import "MGLLoggingConfiguration_Private.h" #import "MGLHeatmapStyleLayer_Private.h" +#include #include diff --git a/platform/darwin/src/MGLHeatmapStyleLayer_Private.h b/platform/darwin/src/MGLHeatmapStyleLayer_Private.h index e81920ae3..407036ced 100644 --- a/platform/darwin/src/MGLHeatmapStyleLayer_Private.h +++ b/platform/darwin/src/MGLHeatmapStyleLayer_Private.h @@ -4,7 +4,7 @@ #include "MGLStyleLayer_Private.h" -#include +#include namespace mbgl { diff --git a/platform/darwin/src/MGLHillshadeStyleLayer.mm b/platform/darwin/src/MGLHillshadeStyleLayer.mm index c1f47b0b6..95620b139 100644 --- a/platform/darwin/src/MGLHillshadeStyleLayer.mm +++ b/platform/darwin/src/MGLHillshadeStyleLayer.mm @@ -10,6 +10,7 @@ #import "MGLLoggingConfiguration_Private.h" #import "MGLHillshadeStyleLayer_Private.h" +#include #include diff --git a/platform/darwin/src/MGLHillshadeStyleLayer_Private.h b/platform/darwin/src/MGLHillshadeStyleLayer_Private.h index e92cc7f3e..4c427f213 100644 --- a/platform/darwin/src/MGLHillshadeStyleLayer_Private.h +++ b/platform/darwin/src/MGLHillshadeStyleLayer_Private.h @@ -4,7 +4,7 @@ #include "MGLStyleLayer_Private.h" -#include +#include namespace mbgl { diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm index 8fdd9a0bc..f227ed0bb 100644 --- a/platform/darwin/src/MGLLineStyleLayer.mm +++ b/platform/darwin/src/MGLLineStyleLayer.mm @@ -10,6 +10,7 @@ #import "MGLLoggingConfiguration_Private.h" #import "MGLLineStyleLayer_Private.h" +#include #include diff --git a/platform/darwin/src/MGLLineStyleLayer_Private.h b/platform/darwin/src/MGLLineStyleLayer_Private.h index 85dbffb8c..b4c7b3ee7 100644 --- a/platform/darwin/src/MGLLineStyleLayer_Private.h +++ b/platform/darwin/src/MGLLineStyleLayer_Private.h @@ -4,7 +4,7 @@ #include "MGLStyleLayer_Private.h" -#include +#include namespace mbgl { diff --git a/platform/darwin/src/MGLOpenGLStyleLayer_Private.h b/platform/darwin/src/MGLOpenGLStyleLayer_Private.h index cce062b53..27a536c60 100644 --- a/platform/darwin/src/MGLOpenGLStyleLayer_Private.h +++ b/platform/darwin/src/MGLOpenGLStyleLayer_Private.h @@ -2,7 +2,7 @@ #include "MGLStyleLayer_Private.h" -#include +#include namespace mbgl { diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm index bcaffe1c4..cf1b8da84 100644 --- a/platform/darwin/src/MGLRasterStyleLayer.mm +++ b/platform/darwin/src/MGLRasterStyleLayer.mm @@ -10,6 +10,7 @@ #import "MGLLoggingConfiguration_Private.h" #import "MGLRasterStyleLayer_Private.h" +#include #include diff --git a/platform/darwin/src/MGLRasterStyleLayer_Private.h b/platform/darwin/src/MGLRasterStyleLayer_Private.h index 5388d6430..7b123ed88 100644 --- a/platform/darwin/src/MGLRasterStyleLayer_Private.h +++ b/platform/darwin/src/MGLRasterStyleLayer_Private.h @@ -4,7 +4,7 @@ #include "MGLStyleLayer_Private.h" -#include +#include namespace mbgl { diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs index 0cccd16a4..c744db72e 100644 --- a/platform/darwin/src/MGLStyleLayer.mm.ejs +++ b/platform/darwin/src/MGLStyleLayer.mm.ejs @@ -16,6 +16,7 @@ #import "MGLLoggingConfiguration_Private.h" #import "MGL<%- camelize(type) %>StyleLayer_Private.h" +#include _layer.hpp> #include <% if (enumProperties) { -%> diff --git a/platform/darwin/src/MGLStyleLayer_Private.h.ejs b/platform/darwin/src/MGLStyleLayer_Private.h.ejs index 8cb8d6281..a6e6b9cd8 100644 --- a/platform/darwin/src/MGLStyleLayer_Private.h.ejs +++ b/platform/darwin/src/MGLStyleLayer_Private.h.ejs @@ -11,7 +11,7 @@ #include "MGLStyleLayer_Private.h" -#include _layer.hpp> +#include _layer_factory.hpp> namespace mbgl { diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm index 481570fde..5da74d8fa 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.mm +++ b/platform/darwin/src/MGLSymbolStyleLayer.mm @@ -10,6 +10,7 @@ #import "MGLLoggingConfiguration_Private.h" #import "MGLSymbolStyleLayer_Private.h" +#include #include diff --git a/platform/darwin/src/MGLSymbolStyleLayer_Private.h b/platform/darwin/src/MGLSymbolStyleLayer_Private.h index 5e5755ad6..4c3505a9d 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer_Private.h +++ b/platform/darwin/src/MGLSymbolStyleLayer_Private.h @@ -4,7 +4,7 @@ #include "MGLStyleLayer_Private.h" -#include +#include namespace mbgl { diff --git a/platform/default/layer_manager.cpp b/platform/default/layer_manager.cpp index 86343369b..05d0f4d1a 100644 --- a/platform/default/layer_manager.cpp +++ b/platform/default/layer_manager.cpp @@ -1,14 +1,15 @@ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/src/mbgl/layermanager/background_layer_factory.cpp b/src/mbgl/layermanager/background_layer_factory.cpp new file mode 100644 index 000000000..0e27e1034 --- /dev/null +++ b/src/mbgl/layermanager/background_layer_factory.cpp @@ -0,0 +1,23 @@ +#include + +#include +#include +#include + +namespace mbgl { + +const style::LayerTypeInfo* BackgroundLayerFactory::getTypeInfo() const noexcept { + return style::BackgroundLayer::Impl::staticTypeInfo(); +} + +std::unique_ptr BackgroundLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { + (void)value; + return std::unique_ptr(new style::BackgroundLayer(id)); +} + +std::unique_ptr BackgroundLayerFactory::createRenderLayer(Immutable impl) noexcept { + assert(impl->getTypeInfo() == getTypeInfo()); + return std::make_unique(staticImmutableCast(std::move(impl))); +} + +} // namespace mbgl diff --git a/src/mbgl/layermanager/circle_layer_factory.cpp b/src/mbgl/layermanager/circle_layer_factory.cpp new file mode 100644 index 000000000..215f228aa --- /dev/null +++ b/src/mbgl/layermanager/circle_layer_factory.cpp @@ -0,0 +1,31 @@ +#include + +#include +#include +#include + +namespace mbgl { + +const style::LayerTypeInfo* CircleLayerFactory::getTypeInfo() const noexcept { + return style::CircleLayer::Impl::staticTypeInfo(); +} + +std::unique_ptr CircleLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { + optional source = getSource(value); + if (!source) { + return nullptr; + } + + std::unique_ptr layer = std::unique_ptr(new style::CircleLayer(id, *source)); + if (!initSourceLayerAndFilter(layer.get(), value)) { + return nullptr; + } + return layer; +} + +std::unique_ptr CircleLayerFactory::createRenderLayer(Immutable impl) noexcept { + assert(impl->getTypeInfo() == getTypeInfo()); + return std::make_unique(staticImmutableCast(std::move(impl))); +} + +} // namespace mbgl diff --git a/src/mbgl/layermanager/custom_layer_factory.cpp b/src/mbgl/layermanager/custom_layer_factory.cpp new file mode 100644 index 000000000..31b1730fc --- /dev/null +++ b/src/mbgl/layermanager/custom_layer_factory.cpp @@ -0,0 +1,22 @@ +#include + +#include +#include +#include + +namespace mbgl { + +const style::LayerTypeInfo* CustomLayerFactory::getTypeInfo() const noexcept { + return style::CustomLayer::Impl::staticTypeInfo(); +} + +std::unique_ptr CustomLayerFactory::createLayer(const std::string&, const style::conversion::Convertible&) noexcept { + assert(false); + return nullptr; +} + +std::unique_ptr CustomLayerFactory::createRenderLayer(Immutable impl) noexcept { + return std::make_unique(staticImmutableCast(std::move(impl))); +} + +} // namespace mbgl diff --git a/src/mbgl/layermanager/fill_extrusion_layer_factory.cpp b/src/mbgl/layermanager/fill_extrusion_layer_factory.cpp new file mode 100644 index 000000000..8b90d950d --- /dev/null +++ b/src/mbgl/layermanager/fill_extrusion_layer_factory.cpp @@ -0,0 +1,31 @@ +#include + +#include +#include +#include + +namespace mbgl { + +const style::LayerTypeInfo* FillExtrusionLayerFactory::getTypeInfo() const noexcept { + return style::FillExtrusionLayer::Impl::staticTypeInfo(); +} + +std::unique_ptr FillExtrusionLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { + optional source = getSource(value); + if (!source) { + return nullptr; + } + + std::unique_ptr layer = std::unique_ptr(new style::FillExtrusionLayer(id, *source)); + if (!initSourceLayerAndFilter(layer.get(), value)) { + return nullptr; + } + return layer; +} + +std::unique_ptr FillExtrusionLayerFactory::createRenderLayer(Immutable impl) noexcept { + assert(impl->getTypeInfo() == getTypeInfo()); + return std::make_unique(staticImmutableCast(std::move(impl))); +} + +} // namespace mbgl diff --git a/src/mbgl/layermanager/fill_layer_factory.cpp b/src/mbgl/layermanager/fill_layer_factory.cpp new file mode 100644 index 000000000..664788de1 --- /dev/null +++ b/src/mbgl/layermanager/fill_layer_factory.cpp @@ -0,0 +1,31 @@ +#include + +#include +#include +#include + +namespace mbgl { + +const style::LayerTypeInfo* FillLayerFactory::getTypeInfo() const noexcept { + return style::FillLayer::Impl::staticTypeInfo(); +} + +std::unique_ptr FillLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { + optional source = getSource(value); + if (!source) { + return nullptr; + } + + std::unique_ptr layer = std::unique_ptr(new style::FillLayer(id, *source)); + if (!initSourceLayerAndFilter(layer.get(), value)) { + return nullptr; + } + return layer; +} + +std::unique_ptr FillLayerFactory::createRenderLayer(Immutable impl) noexcept { + assert(impl->getTypeInfo() == getTypeInfo()); + return std::make_unique(staticImmutableCast(std::move(impl))); +} + +} // namespace mbgl diff --git a/src/mbgl/layermanager/heatmap_layer_factory.cpp b/src/mbgl/layermanager/heatmap_layer_factory.cpp new file mode 100644 index 000000000..4785b7c01 --- /dev/null +++ b/src/mbgl/layermanager/heatmap_layer_factory.cpp @@ -0,0 +1,31 @@ +#include + +#include +#include +#include + +namespace mbgl { + +const style::LayerTypeInfo* HeatmapLayerFactory::getTypeInfo() const noexcept { + return style::HeatmapLayer::Impl::staticTypeInfo(); +} + +std::unique_ptr HeatmapLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { + optional source = getSource(value); + if (!source) { + return nullptr; + } + + std::unique_ptr layer = std::unique_ptr(new style::HeatmapLayer(id, *source)); + if (!initSourceLayerAndFilter(layer.get(), value)) { + return nullptr; + } + return layer; +} + +std::unique_ptr HeatmapLayerFactory::createRenderLayer(Immutable impl) noexcept { + assert(impl->getTypeInfo() == getTypeInfo()); + return std::make_unique(staticImmutableCast(std::move(impl))); +} + +} // namespace mbgl diff --git a/src/mbgl/layermanager/hillshade_layer_factory.cpp b/src/mbgl/layermanager/hillshade_layer_factory.cpp new file mode 100644 index 000000000..9291af071 --- /dev/null +++ b/src/mbgl/layermanager/hillshade_layer_factory.cpp @@ -0,0 +1,28 @@ +#include + +#include +#include +#include + +namespace mbgl { + +const style::LayerTypeInfo* HillshadeLayerFactory::getTypeInfo() const noexcept { + return style::HillshadeLayer::Impl::staticTypeInfo(); +} + +std::unique_ptr HillshadeLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { + optional source = getSource(value); + if (!source) { + return nullptr; + } + + std::unique_ptr layer = std::unique_ptr(new style::HillshadeLayer(id, *source)); + return layer; +} + +std::unique_ptr HillshadeLayerFactory::createRenderLayer(Immutable impl) noexcept { + assert(impl->getTypeInfo() == getTypeInfo()); + return std::make_unique(staticImmutableCast(std::move(impl))); +} + +} // namespace mbgl diff --git a/src/mbgl/layermanager/line_layer_factory.cpp b/src/mbgl/layermanager/line_layer_factory.cpp new file mode 100644 index 000000000..7a8ea01d7 --- /dev/null +++ b/src/mbgl/layermanager/line_layer_factory.cpp @@ -0,0 +1,31 @@ +#include + +#include +#include +#include + +namespace mbgl { + +const style::LayerTypeInfo* LineLayerFactory::getTypeInfo() const noexcept { + return style::LineLayer::Impl::staticTypeInfo(); +} + +std::unique_ptr LineLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { + optional source = getSource(value); + if (!source) { + return nullptr; + } + + std::unique_ptr layer = std::unique_ptr(new style::LineLayer(id, *source)); + if (!initSourceLayerAndFilter(layer.get(), value)) { + return nullptr; + } + return layer; +} + +std::unique_ptr LineLayerFactory::createRenderLayer(Immutable impl) noexcept { + assert(impl->getTypeInfo() == getTypeInfo()); + return std::make_unique(staticImmutableCast(std::move(impl))); +} + +} // namespace mbgl diff --git a/src/mbgl/layermanager/raster_layer_factory.cpp b/src/mbgl/layermanager/raster_layer_factory.cpp new file mode 100644 index 000000000..ac9205a14 --- /dev/null +++ b/src/mbgl/layermanager/raster_layer_factory.cpp @@ -0,0 +1,28 @@ +#include + +#include +#include +#include + +namespace mbgl { + +const style::LayerTypeInfo* RasterLayerFactory::getTypeInfo() const noexcept { + return style::RasterLayer::Impl::staticTypeInfo(); +} + +std::unique_ptr RasterLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { + optional source = getSource(value); + if (!source) { + return nullptr; + } + + std::unique_ptr layer = std::unique_ptr(new style::RasterLayer(id, *source)); + return layer; +} + +std::unique_ptr RasterLayerFactory::createRenderLayer(Immutable impl) noexcept { + assert(impl->getTypeInfo() == getTypeInfo()); + return std::make_unique(staticImmutableCast(std::move(impl))); +} + +} // namespace mbgl diff --git a/src/mbgl/layermanager/symbol_layer_factory.cpp b/src/mbgl/layermanager/symbol_layer_factory.cpp new file mode 100644 index 000000000..8acefb9f4 --- /dev/null +++ b/src/mbgl/layermanager/symbol_layer_factory.cpp @@ -0,0 +1,31 @@ +#include + +#include +#include +#include + +namespace mbgl { + +const style::LayerTypeInfo* SymbolLayerFactory::getTypeInfo() const noexcept { + return style::SymbolLayer::Impl::staticTypeInfo(); +} + +std::unique_ptr SymbolLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { + optional source = getSource(value); + if (!source) { + return nullptr; + } + + std::unique_ptr layer = std::unique_ptr(new style::SymbolLayer(id, *source)); + if (!initSourceLayerAndFilter(layer.get(), value)) { + return nullptr; + } + return layer; +} + +std::unique_ptr SymbolLayerFactory::createRenderLayer(Immutable impl) noexcept { + assert(impl->getTypeInfo() == getTypeInfo()); + return std::make_unique(staticImmutableCast(std::move(impl))); +} + +} // namespace mbgl diff --git a/src/mbgl/style/layers/background_layer.cpp b/src/mbgl/style/layers/background_layer.cpp index 8beafb027..eb3c7a266 100644 --- a/src/mbgl/style/layers/background_layer.cpp +++ b/src/mbgl/style/layers/background_layer.cpp @@ -11,8 +11,6 @@ #include #include -#include - namespace mbgl { namespace style { @@ -287,19 +285,4 @@ Mutable BackgroundLayer::mutableBaseImpl() const { } } // namespace style - -const style::LayerTypeInfo* BackgroundLayerFactory::getTypeInfo() const noexcept { - return style::BackgroundLayer::Impl::staticTypeInfo(); -} - -std::unique_ptr BackgroundLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { - (void)value; - return std::unique_ptr(new style::BackgroundLayer(id)); -} - -std::unique_ptr BackgroundLayerFactory::createRenderLayer(Immutable impl) noexcept { - assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique(staticImmutableCast(std::move(impl))); -} - } // namespace mbgl diff --git a/src/mbgl/style/layers/circle_layer.cpp b/src/mbgl/style/layers/circle_layer.cpp index 1e6200e4d..92327a57e 100644 --- a/src/mbgl/style/layers/circle_layer.cpp +++ b/src/mbgl/style/layers/circle_layer.cpp @@ -11,8 +11,6 @@ #include #include -#include - namespace mbgl { namespace style { @@ -704,27 +702,4 @@ Mutable CircleLayer::mutableBaseImpl() const { } } // namespace style - -const style::LayerTypeInfo* CircleLayerFactory::getTypeInfo() const noexcept { - return style::CircleLayer::Impl::staticTypeInfo(); -} - -std::unique_ptr CircleLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { - optional source = getSource(value); - if (!source) { - return nullptr; - } - - std::unique_ptr layer = std::unique_ptr(new style::CircleLayer(id, *source)); - if (!initSourceLayerAndFilter(layer.get(), value)) { - return nullptr; - } - return layer; -} - -std::unique_ptr CircleLayerFactory::createRenderLayer(Immutable impl) noexcept { - assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique(staticImmutableCast(std::move(impl))); -} - } // namespace mbgl diff --git a/src/mbgl/style/layers/custom_layer.cpp b/src/mbgl/style/layers/custom_layer.cpp index abea5d2d3..90c65193d 100644 --- a/src/mbgl/style/layers/custom_layer.cpp +++ b/src/mbgl/style/layers/custom_layer.cpp @@ -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 CustomLayerFactory::createLayer(const std::string&, const style::conversion::Convertible&) noexcept { - assert(false); - return nullptr; -} - -std::unique_ptr CustomLayerFactory::createRenderLayer(Immutable impl) noexcept { - return std::make_unique(staticImmutableCast(std::move(impl))); -} - } // namespace mbgl diff --git a/src/mbgl/style/layers/fill_extrusion_layer.cpp b/src/mbgl/style/layers/fill_extrusion_layer.cpp index 12f566e00..74fd4ad75 100644 --- a/src/mbgl/style/layers/fill_extrusion_layer.cpp +++ b/src/mbgl/style/layers/fill_extrusion_layer.cpp @@ -11,8 +11,6 @@ #include #include -#include - namespace mbgl { namespace style { @@ -562,27 +560,4 @@ Mutable FillExtrusionLayer::mutableBaseImpl() const { } } // namespace style - -const style::LayerTypeInfo* FillExtrusionLayerFactory::getTypeInfo() const noexcept { - return style::FillExtrusionLayer::Impl::staticTypeInfo(); -} - -std::unique_ptr FillExtrusionLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { - optional source = getSource(value); - if (!source) { - return nullptr; - } - - std::unique_ptr layer = std::unique_ptr(new style::FillExtrusionLayer(id, *source)); - if (!initSourceLayerAndFilter(layer.get(), value)) { - return nullptr; - } - return layer; -} - -std::unique_ptr FillExtrusionLayerFactory::createRenderLayer(Immutable impl) noexcept { - assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique(staticImmutableCast(std::move(impl))); -} - } // namespace mbgl diff --git a/src/mbgl/style/layers/fill_layer.cpp b/src/mbgl/style/layers/fill_layer.cpp index 480fc597d..55b5d9c8c 100644 --- a/src/mbgl/style/layers/fill_layer.cpp +++ b/src/mbgl/style/layers/fill_layer.cpp @@ -11,8 +11,6 @@ #include #include -#include - namespace mbgl { namespace style { @@ -506,27 +504,4 @@ Mutable FillLayer::mutableBaseImpl() const { } } // namespace style - -const style::LayerTypeInfo* FillLayerFactory::getTypeInfo() const noexcept { - return style::FillLayer::Impl::staticTypeInfo(); -} - -std::unique_ptr FillLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { - optional source = getSource(value); - if (!source) { - return nullptr; - } - - std::unique_ptr layer = std::unique_ptr(new style::FillLayer(id, *source)); - if (!initSourceLayerAndFilter(layer.get(), value)) { - return nullptr; - } - return layer; -} - -std::unique_ptr FillLayerFactory::createRenderLayer(Immutable impl) noexcept { - assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique(staticImmutableCast(std::move(impl))); -} - } // namespace mbgl diff --git a/src/mbgl/style/layers/heatmap_layer.cpp b/src/mbgl/style/layers/heatmap_layer.cpp index 92477615b..29c5fc5e4 100644 --- a/src/mbgl/style/layers/heatmap_layer.cpp +++ b/src/mbgl/style/layers/heatmap_layer.cpp @@ -11,8 +11,6 @@ #include #include -#include - namespace mbgl { namespace style { @@ -391,27 +389,4 @@ Mutable HeatmapLayer::mutableBaseImpl() const { } } // namespace style - -const style::LayerTypeInfo* HeatmapLayerFactory::getTypeInfo() const noexcept { - return style::HeatmapLayer::Impl::staticTypeInfo(); -} - -std::unique_ptr HeatmapLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { - optional source = getSource(value); - if (!source) { - return nullptr; - } - - std::unique_ptr layer = std::unique_ptr(new style::HeatmapLayer(id, *source)); - if (!initSourceLayerAndFilter(layer.get(), value)) { - return nullptr; - } - return layer; -} - -std::unique_ptr HeatmapLayerFactory::createRenderLayer(Immutable impl) noexcept { - assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique(staticImmutableCast(std::move(impl))); -} - } // namespace mbgl diff --git a/src/mbgl/style/layers/hillshade_layer.cpp b/src/mbgl/style/layers/hillshade_layer.cpp index d914d0cde..0ae63b18c 100644 --- a/src/mbgl/style/layers/hillshade_layer.cpp +++ b/src/mbgl/style/layers/hillshade_layer.cpp @@ -11,8 +11,6 @@ #include #include -#include - namespace mbgl { namespace style { @@ -438,24 +436,4 @@ Mutable HillshadeLayer::mutableBaseImpl() const { } } // namespace style - -const style::LayerTypeInfo* HillshadeLayerFactory::getTypeInfo() const noexcept { - return style::HillshadeLayer::Impl::staticTypeInfo(); -} - -std::unique_ptr HillshadeLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { - optional source = getSource(value); - if (!source) { - return nullptr; - } - - std::unique_ptr layer = std::unique_ptr(new style::HillshadeLayer(id, *source)); - return layer; -} - -std::unique_ptr HillshadeLayerFactory::createRenderLayer(Immutable impl) noexcept { - assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique(staticImmutableCast(std::move(impl))); -} - } // namespace mbgl diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs index d03e41da7..e34386fc2 100644 --- a/src/mbgl/style/layers/layer.cpp.ejs +++ b/src/mbgl/style/layers/layer.cpp.ejs @@ -16,8 +16,6 @@ #include #include -#include _layer.hpp> - namespace mbgl { namespace style { @@ -314,34 +312,4 @@ Mutable <%- 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 <%- camelize(type) %>LayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { -<% if (type === 'background') { -%> - (void)value; - return std::unique_ptr(new style::<%- camelize(type) %>Layer(id)); -<% } else { -%> - optional source = getSource(value); - if (!source) { - return nullptr; - } - - std::unique_ptr layer = std::unique_ptr(new style::<%- camelize(type) %>Layer(id, *source)); -<% if (type !== 'raster' && type !== 'hillshade') { -%> - if (!initSourceLayerAndFilter(layer.get(), value)) { - return nullptr; - } -<% } -%> - return layer; -<% } -%> -} - -std::unique_ptr <%- camelize(type) %>LayerFactory::createRenderLayer(Immutable impl) noexcept { - assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_uniqueLayer>(staticImmutableCastLayer::Impl>(std::move(impl))); -} - } // namespace mbgl diff --git a/src/mbgl/style/layers/line_layer.cpp b/src/mbgl/style/layers/line_layer.cpp index f021a5fd7..9b101a194 100644 --- a/src/mbgl/style/layers/line_layer.cpp +++ b/src/mbgl/style/layers/line_layer.cpp @@ -11,8 +11,6 @@ #include #include -#include - namespace mbgl { namespace style { @@ -845,27 +843,4 @@ Mutable LineLayer::mutableBaseImpl() const { } } // namespace style - -const style::LayerTypeInfo* LineLayerFactory::getTypeInfo() const noexcept { - return style::LineLayer::Impl::staticTypeInfo(); -} - -std::unique_ptr LineLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { - optional source = getSource(value); - if (!source) { - return nullptr; - } - - std::unique_ptr layer = std::unique_ptr(new style::LineLayer(id, *source)); - if (!initSourceLayerAndFilter(layer.get(), value)) { - return nullptr; - } - return layer; -} - -std::unique_ptr LineLayerFactory::createRenderLayer(Immutable impl) noexcept { - assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique(staticImmutableCast(std::move(impl))); -} - } // namespace mbgl diff --git a/src/mbgl/style/layers/raster_layer.cpp b/src/mbgl/style/layers/raster_layer.cpp index 40224a0b6..ea3ec3e31 100644 --- a/src/mbgl/style/layers/raster_layer.cpp +++ b/src/mbgl/style/layers/raster_layer.cpp @@ -11,8 +11,6 @@ #include #include -#include - namespace mbgl { namespace style { @@ -527,24 +525,4 @@ Mutable RasterLayer::mutableBaseImpl() const { } } // namespace style - -const style::LayerTypeInfo* RasterLayerFactory::getTypeInfo() const noexcept { - return style::RasterLayer::Impl::staticTypeInfo(); -} - -std::unique_ptr RasterLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { - optional source = getSource(value); - if (!source) { - return nullptr; - } - - std::unique_ptr layer = std::unique_ptr(new style::RasterLayer(id, *source)); - return layer; -} - -std::unique_ptr RasterLayerFactory::createRenderLayer(Immutable impl) noexcept { - assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique(staticImmutableCast(std::move(impl))); -} - } // namespace mbgl diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp index f4fbf550f..be25594f5 100644 --- a/src/mbgl/style/layers/symbol_layer.cpp +++ b/src/mbgl/style/layers/symbol_layer.cpp @@ -11,8 +11,6 @@ #include #include -#include - namespace mbgl { namespace style { @@ -1995,27 +1993,4 @@ Mutable SymbolLayer::mutableBaseImpl() const { } } // namespace style - -const style::LayerTypeInfo* SymbolLayerFactory::getTypeInfo() const noexcept { - return style::SymbolLayer::Impl::staticTypeInfo(); -} - -std::unique_ptr SymbolLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { - optional source = getSource(value); - if (!source) { - return nullptr; - } - - std::unique_ptr layer = std::unique_ptr(new style::SymbolLayer(id, *source)); - if (!initSourceLayerAndFilter(layer.get(), value)) { - return nullptr; - } - return layer; -} - -std::unique_ptr SymbolLayerFactory::createRenderLayer(Immutable impl) noexcept { - assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique(staticImmutableCast(std::move(impl))); -} - } // namespace mbgl