From 3c175adf30546fe58713b8fed29ac35a85e150be Mon Sep 17 00:00:00 2001 From: Ivo van Dongen Date: Fri, 21 Apr 2017 09:19:47 -0700 Subject: [core] split off render layers --- include/mbgl/style/layer.hpp | 38 +++++++++------------- include/mbgl/style/layer_type.hpp | 18 ++++++++++ include/mbgl/style/layers/background_layer.hpp | 2 +- include/mbgl/style/layers/circle_layer.hpp | 2 +- include/mbgl/style/layers/fill_extrusion_layer.hpp | 2 +- include/mbgl/style/layers/fill_layer.hpp | 2 +- include/mbgl/style/layers/layer.hpp.ejs | 2 +- include/mbgl/style/layers/line_layer.hpp | 2 +- include/mbgl/style/layers/raster_layer.hpp | 2 +- include/mbgl/style/layers/symbol_layer.hpp | 2 +- 10 files changed, 41 insertions(+), 31 deletions(-) create mode 100644 include/mbgl/style/layer_type.hpp (limited to 'include/mbgl/style') diff --git a/include/mbgl/style/layer.hpp b/include/mbgl/style/layer.hpp index fa88b30dbc..f09eb0165a 100644 --- a/include/mbgl/style/layer.hpp +++ b/include/mbgl/style/layer.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -36,23 +37,16 @@ class FillExtrusionLayer; * auto circleLayer = std::make_unique("my-circle-layer"); */ class Layer : public mbgl::util::noncopyable { +public: + class Impl; + protected: - enum class Type { - Fill, - Line, - Circle, - Symbol, - Raster, - Background, - Custom, - FillExtrusion, - }; - class Impl; - const Type type; - Layer(Type, std::unique_ptr); + const LayerType type; + Layer(LayerType, std::unique_ptr); public: + virtual ~Layer(); // Check whether this layer is of the given subtype. @@ -85,21 +79,21 @@ public: template auto accept(V&& visitor) { switch (type) { - case Type::Fill: + case LayerType::Fill: return visitor(*as()); - case Type::Line: + case LayerType::Line: return visitor(*as()); - case Type::Circle: + case LayerType::Circle: return visitor(*as()); - case Type::Symbol: + case LayerType::Symbol: return visitor(*as()); - case Type::Raster: + case LayerType::Raster: return visitor(*as()); - case Type::Background: + case LayerType::Background: return visitor(*as()); - case Type::Custom: + case LayerType::Custom: return visitor(*as()); - case Type::FillExtrusion: + case LayerType::FillExtrusion: return visitor(*as()); } } @@ -123,8 +117,6 @@ public: // object here, so that separately-obtained references to this object share // identical platform-native peers. any peer; - - friend std::string layoutKey(const Layer&); }; } // namespace style diff --git a/include/mbgl/style/layer_type.hpp b/include/mbgl/style/layer_type.hpp new file mode 100644 index 0000000000..66ff834eee --- /dev/null +++ b/include/mbgl/style/layer_type.hpp @@ -0,0 +1,18 @@ +#pragma once + +namespace mbgl { +namespace style { + +enum class LayerType { + Fill, + Line, + Circle, + Symbol, + Raster, + Background, + Custom, + FillExtrusion, +}; + +} // namespace style +} // namespace mbgl \ No newline at end of file diff --git a/include/mbgl/style/layers/background_layer.hpp b/include/mbgl/style/layers/background_layer.hpp index 0de3302b7a..6604a868f3 100644 --- a/include/mbgl/style/layers/background_layer.hpp +++ b/include/mbgl/style/layers/background_layer.hpp @@ -50,7 +50,7 @@ public: template <> inline bool Layer::is() const { - return type == Type::Background; + return type == LayerType::Background; } } // namespace style diff --git a/include/mbgl/style/layers/circle_layer.hpp b/include/mbgl/style/layers/circle_layer.hpp index c12d476706..3a3723249f 100644 --- a/include/mbgl/style/layers/circle_layer.hpp +++ b/include/mbgl/style/layers/circle_layer.hpp @@ -100,7 +100,7 @@ public: template <> inline bool Layer::is() const { - return type == Type::Circle; + return type == LayerType::Circle; } } // namespace style diff --git a/include/mbgl/style/layers/fill_extrusion_layer.hpp b/include/mbgl/style/layers/fill_extrusion_layer.hpp index 31d517d016..1f79f87fac 100644 --- a/include/mbgl/style/layers/fill_extrusion_layer.hpp +++ b/include/mbgl/style/layers/fill_extrusion_layer.hpp @@ -82,7 +82,7 @@ public: template <> inline bool Layer::is() const { - return type == Type::FillExtrusion; + return type == LayerType::FillExtrusion; } } // namespace style diff --git a/include/mbgl/style/layers/fill_layer.hpp b/include/mbgl/style/layers/fill_layer.hpp index aac4be92e2..8371ff7a8f 100644 --- a/include/mbgl/style/layers/fill_layer.hpp +++ b/include/mbgl/style/layers/fill_layer.hpp @@ -82,7 +82,7 @@ public: template <> inline bool Layer::is() const { - return type == Type::Fill; + return type == LayerType::Fill; } } // namespace style diff --git a/include/mbgl/style/layers/layer.hpp.ejs b/include/mbgl/style/layers/layer.hpp.ejs index 972d932b59..59d7cd6415 100644 --- a/include/mbgl/style/layers/layer.hpp.ejs +++ b/include/mbgl/style/layers/layer.hpp.ejs @@ -75,7 +75,7 @@ public: template <> inline bool Layer::is<<%- camelize(type) %>Layer>() const { - return type == Type::<%- camelize(type) %>; + return type == LayerType::<%- camelize(type) %>; } } // namespace style diff --git a/include/mbgl/style/layers/line_layer.hpp b/include/mbgl/style/layers/line_layer.hpp index 756cc6f431..a5f08e553c 100644 --- a/include/mbgl/style/layers/line_layer.hpp +++ b/include/mbgl/style/layers/line_layer.hpp @@ -120,7 +120,7 @@ public: template <> inline bool Layer::is() const { - return type == Type::Line; + return type == LayerType::Line; } } // namespace style diff --git a/include/mbgl/style/layers/raster_layer.hpp b/include/mbgl/style/layers/raster_layer.hpp index 3596a71f58..c0351da5d0 100644 --- a/include/mbgl/style/layers/raster_layer.hpp +++ b/include/mbgl/style/layers/raster_layer.hpp @@ -77,7 +77,7 @@ public: template <> inline bool Layer::is() const { - return type == Type::Raster; + return type == LayerType::Raster; } } // namespace style diff --git a/include/mbgl/style/layers/symbol_layer.hpp b/include/mbgl/style/layers/symbol_layer.hpp index 6e29faa949..ea6bda55d7 100644 --- a/include/mbgl/style/layers/symbol_layer.hpp +++ b/include/mbgl/style/layers/symbol_layer.hpp @@ -264,7 +264,7 @@ public: template <> inline bool Layer::is() const { - return type == Type::Symbol; + return type == LayerType::Symbol; } } // namespace style -- cgit v1.2.1