diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-04-21 09:19:47 -0700 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2017-04-25 17:23:54 -0700 |
commit | 3c175adf30546fe58713b8fed29ac35a85e150be (patch) | |
tree | 5666e9bcf311ed1b86a13444e50dc7a030c10da9 /include/mbgl/style | |
parent | ea8ec38df156c6683c886253dbb1f6bc828686ff (diff) | |
download | qtlocation-mapboxgl-3c175adf30546fe58713b8fed29ac35a85e150be.tar.gz |
[core] split off render layers
Diffstat (limited to 'include/mbgl/style')
-rw-r--r-- | include/mbgl/style/layer.hpp | 38 | ||||
-rw-r--r-- | include/mbgl/style/layer_type.hpp | 18 | ||||
-rw-r--r-- | include/mbgl/style/layers/background_layer.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/style/layers/circle_layer.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/style/layers/fill_extrusion_layer.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/style/layers/fill_layer.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/style/layers/layer.hpp.ejs | 2 | ||||
-rw-r--r-- | include/mbgl/style/layers/line_layer.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/style/layers/raster_layer.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/style/layers/symbol_layer.hpp | 2 |
10 files changed, 41 insertions, 31 deletions
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 <mbgl/util/noncopyable.hpp> #include <mbgl/util/any.hpp> +#include <mbgl/style/layer_type.hpp> #include <mbgl/style/types.hpp> #include <memory> @@ -36,23 +37,16 @@ class FillExtrusionLayer; * auto circleLayer = std::make_unique<CircleLayer>("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<Impl>); + const LayerType type; + Layer(LayerType, std::unique_ptr<Impl>); public: + virtual ~Layer(); // Check whether this layer is of the given subtype. @@ -85,21 +79,21 @@ public: template <class V> auto accept(V&& visitor) { switch (type) { - case Type::Fill: + case LayerType::Fill: return visitor(*as<FillLayer>()); - case Type::Line: + case LayerType::Line: return visitor(*as<LineLayer>()); - case Type::Circle: + case LayerType::Circle: return visitor(*as<CircleLayer>()); - case Type::Symbol: + case LayerType::Symbol: return visitor(*as<SymbolLayer>()); - case Type::Raster: + case LayerType::Raster: return visitor(*as<RasterLayer>()); - case Type::Background: + case LayerType::Background: return visitor(*as<BackgroundLayer>()); - case Type::Custom: + case LayerType::Custom: return visitor(*as<CustomLayer>()); - case Type::FillExtrusion: + case LayerType::FillExtrusion: return visitor(*as<FillExtrusionLayer>()); } } @@ -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<BackgroundLayer>() 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<CircleLayer>() 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<FillExtrusionLayer>() 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<FillLayer>() 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<LineLayer>() 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<RasterLayer>() 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<SymbolLayer>() const { - return type == Type::Symbol; + return type == LayerType::Symbol; } } // namespace style |