summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/style/layer.hpp30
-rw-r--r--include/mbgl/style/layers/background_layer.hpp14
-rw-r--r--include/mbgl/style/layers/circle_layer.hpp14
-rw-r--r--include/mbgl/style/layers/custom_layer.hpp12
-rw-r--r--include/mbgl/style/layers/fill_extrusion_layer.hpp14
-rw-r--r--include/mbgl/style/layers/fill_layer.hpp14
-rw-r--r--include/mbgl/style/layers/heatmap_layer.hpp14
-rw-r--r--include/mbgl/style/layers/hillshade_layer.hpp14
-rw-r--r--include/mbgl/style/layers/layer.hpp.ejs14
-rw-r--r--include/mbgl/style/layers/line_layer.hpp14
-rw-r--r--include/mbgl/style/layers/raster_layer.hpp14
-rw-r--r--include/mbgl/style/layers/symbol_layer.hpp14
12 files changed, 84 insertions, 98 deletions
diff --git a/include/mbgl/style/layer.hpp b/include/mbgl/style/layer.hpp
index 5c1b361419..9e73e994e6 100644
--- a/include/mbgl/style/layer.hpp
+++ b/include/mbgl/style/layer.hpp
@@ -74,8 +74,7 @@ public:
Layer& operator=(const Layer&) = delete;
virtual ~Layer();
- // Note: LayerType is deprecated, do not use it.
- LayerType getType() const;
+
std::string getID() const;
// Source
std::string getSourceID() const;
@@ -126,6 +125,10 @@ protected:
LayerObserver* observer;
};
+} // namespace style
+
+class RenderLayer;
+// TODO: The following classes shall not be here. Move layer factories and manager to a dedicated folder.
/**
* @brief The LayerFactory abstract class
@@ -136,17 +139,19 @@ class LayerFactory {
public:
virtual ~LayerFactory() = default;
/// Returns the layer type data.
- virtual const LayerTypeInfo* getTypeInfo() const noexcept = 0;
+ virtual const style::LayerTypeInfo* getTypeInfo() const noexcept = 0;
/// Returns a new Layer instance on success call; returns `nulltptr` otherwise.
- virtual std::unique_ptr<Layer> createLayer(const std::string& id, const conversion::Convertible& value) = 0;
+ virtual std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept = 0;
+ /// Returns a new RenderLayer instance on success call; returns `nulltptr` otherwise.
+ virtual std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept = 0;
protected:
- optional<std::string> getSource(const conversion::Convertible& value) const noexcept;
- bool initSourceLayerAndFilter(Layer*, const conversion::Convertible& value) const noexcept;
+ optional<std::string> getSource(const style::conversion::Convertible& value) const noexcept;
+ bool initSourceLayerAndFilter(style::Layer*, const style::conversion::Convertible& value) const noexcept;
};
/**
- * @brief A singleton class forwarding calls to the corresponding \c LayerFactory instance.
+ * @brief A singleton class responsible for creating layer instances.
*/
class LayerManager {
public:
@@ -157,13 +162,16 @@ public:
*/
static LayerManager* get() noexcept;
- virtual ~LayerManager() = default;
/// Returns a new Layer instance on success call; returns `nulltptr` otherwise.
- virtual std::unique_ptr<Layer> createLayer(const std::string& type, const std::string& id, const conversion::Convertible& value, conversion::Error& error) noexcept = 0;
+ std::unique_ptr<style::Layer> createLayer(const std::string& type, const std::string& id,
+ const style::conversion::Convertible& value, style::conversion::Error& error) noexcept;
+ /// Returns a new RenderLayer instance on success call; returns `nulltptr` otherwise.
+ std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept;
protected:
- LayerManager() = default;
+ virtual ~LayerManager() = default;
+ virtual LayerFactory* getFactory(const std::string& type) noexcept = 0;
+ virtual LayerFactory* getFactory(const style::LayerTypeInfo*) noexcept = 0;
};
-} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/background_layer.hpp b/include/mbgl/style/layers/background_layer.hpp
index e188a9ba2c..b471d8613e 100644
--- a/include/mbgl/style/layers/background_layer.hpp
+++ b/include/mbgl/style/layers/background_layer.hpp
@@ -56,15 +56,13 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-class BackgroundLayerFactory : public LayerFactory {
-public:
- BackgroundLayerFactory();
- ~BackgroundLayerFactory() override;
+} // namespace style
- // LayerFactory overrides.
- const LayerTypeInfo* getTypeInfo() const noexcept final;
- std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
+class BackgroundLayerFactory : public LayerFactory {
+protected:
+ const style::LayerTypeInfo* getTypeInfo() const noexcept final;
+ std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
+ std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
-} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/circle_layer.hpp b/include/mbgl/style/layers/circle_layer.hpp
index 4dacb905df..46951653b7 100644
--- a/include/mbgl/style/layers/circle_layer.hpp
+++ b/include/mbgl/style/layers/circle_layer.hpp
@@ -104,15 +104,13 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-class CircleLayerFactory : public LayerFactory {
-public:
- CircleLayerFactory();
- ~CircleLayerFactory() override;
+} // namespace style
- // LayerFactory overrides.
- const LayerTypeInfo* getTypeInfo() const noexcept final;
- std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
+class CircleLayerFactory : public LayerFactory {
+protected:
+ const style::LayerTypeInfo* getTypeInfo() const noexcept final;
+ std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
+ std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
-} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/custom_layer.hpp b/include/mbgl/style/layers/custom_layer.hpp
index 5021df6a60..d204a782f2 100644
--- a/include/mbgl/style/layers/custom_layer.hpp
+++ b/include/mbgl/style/layers/custom_layer.hpp
@@ -85,15 +85,13 @@ public:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
+} // namespace style
+
class CustomLayerFactory : public LayerFactory {
-public:
- CustomLayerFactory();
// LayerFactory overrides.
- ~CustomLayerFactory() override;
-
- const LayerTypeInfo* getTypeInfo() const noexcept final;
- std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
+ const style::LayerTypeInfo* getTypeInfo() const noexcept final;
+ std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
+ std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
-} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/fill_extrusion_layer.hpp b/include/mbgl/style/layers/fill_extrusion_layer.hpp
index 0092e61f3b..059b8f8996 100644
--- a/include/mbgl/style/layers/fill_extrusion_layer.hpp
+++ b/include/mbgl/style/layers/fill_extrusion_layer.hpp
@@ -80,15 +80,13 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-class FillExtrusionLayerFactory : public LayerFactory {
-public:
- FillExtrusionLayerFactory();
- ~FillExtrusionLayerFactory() override;
+} // namespace style
- // LayerFactory overrides.
- const LayerTypeInfo* getTypeInfo() const noexcept final;
- std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
+class FillExtrusionLayerFactory : public LayerFactory {
+protected:
+ const style::LayerTypeInfo* getTypeInfo() const noexcept final;
+ std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
+ std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
-} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/fill_layer.hpp b/include/mbgl/style/layers/fill_layer.hpp
index 52bbd054ae..222142daf3 100644
--- a/include/mbgl/style/layers/fill_layer.hpp
+++ b/include/mbgl/style/layers/fill_layer.hpp
@@ -80,15 +80,13 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-class FillLayerFactory : public LayerFactory {
-public:
- FillLayerFactory();
- ~FillLayerFactory() override;
+} // namespace style
- // LayerFactory overrides.
- const LayerTypeInfo* getTypeInfo() const noexcept final;
- std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
+class FillLayerFactory : public LayerFactory {
+protected:
+ const style::LayerTypeInfo* getTypeInfo() const noexcept final;
+ std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
+ std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
-} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/heatmap_layer.hpp b/include/mbgl/style/layers/heatmap_layer.hpp
index d1760100ad..004d77c487 100644
--- a/include/mbgl/style/layers/heatmap_layer.hpp
+++ b/include/mbgl/style/layers/heatmap_layer.hpp
@@ -69,15 +69,13 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-class HeatmapLayerFactory : public LayerFactory {
-public:
- HeatmapLayerFactory();
- ~HeatmapLayerFactory() override;
+} // namespace style
- // LayerFactory overrides.
- const LayerTypeInfo* getTypeInfo() const noexcept final;
- std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
+class HeatmapLayerFactory : public LayerFactory {
+protected:
+ const style::LayerTypeInfo* getTypeInfo() const noexcept final;
+ std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
+ std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
-} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/hillshade_layer.hpp b/include/mbgl/style/layers/hillshade_layer.hpp
index 978670f8a9..f840386907 100644
--- a/include/mbgl/style/layers/hillshade_layer.hpp
+++ b/include/mbgl/style/layers/hillshade_layer.hpp
@@ -74,15 +74,13 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-class HillshadeLayerFactory : public LayerFactory {
-public:
- HillshadeLayerFactory();
- ~HillshadeLayerFactory() override;
+} // namespace style
- // LayerFactory overrides.
- const LayerTypeInfo* getTypeInfo() const noexcept final;
- std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
+class HillshadeLayerFactory : public LayerFactory {
+protected:
+ const style::LayerTypeInfo* getTypeInfo() const noexcept final;
+ std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
+ std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
-} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/layer.hpp.ejs b/include/mbgl/style/layers/layer.hpp.ejs
index 11d45b4b0c..84a8edd9de 100644
--- a/include/mbgl/style/layers/layer.hpp.ejs
+++ b/include/mbgl/style/layers/layer.hpp.ejs
@@ -72,15 +72,13 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-class <%- camelize(type) %>LayerFactory : public LayerFactory {
-public:
- <%- camelize(type) %>LayerFactory();
- ~<%- camelize(type) %>LayerFactory() override;
+} // namespace style
- // LayerFactory overrides.
- const LayerTypeInfo* getTypeInfo() const noexcept final;
- std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
+class <%- camelize(type) %>LayerFactory : public LayerFactory {
+protected:
+ const style::LayerTypeInfo* getTypeInfo() const noexcept final;
+ std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
+ std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
-} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/line_layer.hpp b/include/mbgl/style/layers/line_layer.hpp
index 0f5e2bb347..bbc0213c53 100644
--- a/include/mbgl/style/layers/line_layer.hpp
+++ b/include/mbgl/style/layers/line_layer.hpp
@@ -125,15 +125,13 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-class LineLayerFactory : public LayerFactory {
-public:
- LineLayerFactory();
- ~LineLayerFactory() override;
+} // namespace style
- // LayerFactory overrides.
- const LayerTypeInfo* getTypeInfo() const noexcept final;
- std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
+class LineLayerFactory : public LayerFactory {
+protected:
+ const style::LayerTypeInfo* getTypeInfo() const noexcept final;
+ std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
+ std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
-} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/raster_layer.hpp b/include/mbgl/style/layers/raster_layer.hpp
index 4b63570590..0def2faacd 100644
--- a/include/mbgl/style/layers/raster_layer.hpp
+++ b/include/mbgl/style/layers/raster_layer.hpp
@@ -86,15 +86,13 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-class RasterLayerFactory : public LayerFactory {
-public:
- RasterLayerFactory();
- ~RasterLayerFactory() override;
+} // namespace style
- // LayerFactory overrides.
- const LayerTypeInfo* getTypeInfo() const noexcept final;
- std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
+class RasterLayerFactory : public LayerFactory {
+protected:
+ const style::LayerTypeInfo* getTypeInfo() const noexcept final;
+ std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
+ std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
-} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/symbol_layer.hpp b/include/mbgl/style/layers/symbol_layer.hpp
index 62ea393b33..e17df295f3 100644
--- a/include/mbgl/style/layers/symbol_layer.hpp
+++ b/include/mbgl/style/layers/symbol_layer.hpp
@@ -274,15 +274,13 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-class SymbolLayerFactory : public LayerFactory {
-public:
- SymbolLayerFactory();
- ~SymbolLayerFactory() override;
+} // namespace style
- // LayerFactory overrides.
- const LayerTypeInfo* getTypeInfo() const noexcept final;
- std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
+class SymbolLayerFactory : public LayerFactory {
+protected:
+ const style::LayerTypeInfo* getTypeInfo() const noexcept final;
+ std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
+ std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
-} // namespace style
} // namespace mbgl