diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2018-11-30 12:10:33 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2018-11-30 19:09:17 +0200 |
commit | 92352de87d4068985fa56100f2c6e16bf26a1c86 (patch) | |
tree | e3dd5729e2ef8e32931b8e42ab34a3d0b806ee18 /include/mbgl/layermanager/layer_factory.hpp | |
parent | 8bc362e3a2836cfa96ef14a41a0e882a1d08e881 (diff) | |
download | qtlocation-mapboxgl-92352de87d4068985fa56100f2c6e16bf26a1c86.tar.gz |
[core] layermanager folder
Move `LayerManager` and `LayerFactory` abstract classes to a dedicated folder.
Diffstat (limited to 'include/mbgl/layermanager/layer_factory.hpp')
-rw-r--r-- | include/mbgl/layermanager/layer_factory.hpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/mbgl/layermanager/layer_factory.hpp b/include/mbgl/layermanager/layer_factory.hpp new file mode 100644 index 0000000000..3e2b2c3ddd --- /dev/null +++ b/include/mbgl/layermanager/layer_factory.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include <mbgl/style/layer.hpp> + +namespace mbgl { + +class RenderLayer; + +/** + * @brief The LayerFactory abstract class + * + * This class is responsible for creation of the layer objects that belong to a concrete layer type. + */ +class LayerFactory { +public: + virtual ~LayerFactory() = default; + /// Returns the layer type data. + virtual const style::LayerTypeInfo* getTypeInfo() const noexcept = 0; + /// Returns a new Layer instance on success call; returns `nulltptr` otherwise. + 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 style::conversion::Convertible& value) const noexcept; + bool initSourceLayerAndFilter(style::Layer*, const style::conversion::Convertible& value) const noexcept; +}; + +} // namespace mbgl |