diff options
Diffstat (limited to 'src/mbgl/layermanager/hillshade_layer_factory.cpp')
-rw-r--r-- | src/mbgl/layermanager/hillshade_layer_factory.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mbgl/layermanager/hillshade_layer_factory.cpp b/src/mbgl/layermanager/hillshade_layer_factory.cpp new file mode 100644 index 0000000000..9291af0711 --- /dev/null +++ b/src/mbgl/layermanager/hillshade_layer_factory.cpp @@ -0,0 +1,28 @@ +#include <mbgl/layermanager/hillshade_layer_factory.hpp> + +#include <mbgl/renderer/layers/render_hillshade_layer.hpp> +#include <mbgl/style/layers/hillshade_layer.hpp> +#include <mbgl/style/layers/hillshade_layer_impl.hpp> + +namespace mbgl { + +const style::LayerTypeInfo* HillshadeLayerFactory::getTypeInfo() const noexcept { + return style::HillshadeLayer::Impl::staticTypeInfo(); +} + +std::unique_ptr<style::Layer> HillshadeLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept { + optional<std::string> source = getSource(value); + if (!source) { + return nullptr; + } + + std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::HillshadeLayer(id, *source)); + return layer; +} + +std::unique_ptr<RenderLayer> HillshadeLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { + assert(impl->getTypeInfo() == getTypeInfo()); + return std::make_unique<RenderHillshadeLayer>(staticImmutableCast<style::HillshadeLayer::Impl>(std::move(impl))); +} + +} // namespace mbgl |