summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layers/raster_layer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/layers/raster_layer.cpp')
-rw-r--r--src/mbgl/style/layers/raster_layer.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/mbgl/style/layers/raster_layer.cpp b/src/mbgl/style/layers/raster_layer.cpp
index 0356c2f75c..40224a0b6d 100644
--- a/src/mbgl/style/layers/raster_layer.cpp
+++ b/src/mbgl/style/layers/raster_layer.cpp
@@ -11,21 +11,27 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
+#include <mbgl/renderer/layers/render_raster_layer.hpp>
+
namespace mbgl {
namespace style {
-namespace {
- const LayerTypeInfo typeInfoRaster
+
+// static
+const LayerTypeInfo* RasterLayer::Impl::staticTypeInfo() noexcept {
+ const static LayerTypeInfo typeInfo
{"raster",
LayerTypeInfo::Source::Required,
LayerTypeInfo::Pass3D::NotRequired,
LayerTypeInfo::Layout::NotRequired,
LayerTypeInfo::Clipping::NotRequired
};
-} // namespace
+ return &typeInfo;
+}
+
RasterLayer::RasterLayer(const std::string& layerID, const std::string& sourceID)
- : Layer(makeMutable<Impl>(LayerType::Raster, layerID, sourceID)) {
+ : Layer(makeMutable<Impl>(layerID, sourceID)) {
}
RasterLayer::RasterLayer(Immutable<Impl> impl_)
@@ -52,10 +58,6 @@ std::unique_ptr<Layer> RasterLayer::cloneRef(const std::string& id_) const {
void RasterLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const {
}
-const LayerTypeInfo* RasterLayer::Impl::getTypeInfo() const noexcept {
- return &typeInfoRaster;
-}
-
// Layout properties
@@ -524,23 +526,25 @@ Mutable<Layer::Impl> RasterLayer::mutableBaseImpl() const {
return staticMutableCast<Layer::Impl>(mutableImpl());
}
-RasterLayerFactory::RasterLayerFactory() = default;
-
-RasterLayerFactory::~RasterLayerFactory() = default;
+} // namespace style
-const LayerTypeInfo* RasterLayerFactory::getTypeInfo() const noexcept {
- return &typeInfoRaster;
+const style::LayerTypeInfo* RasterLayerFactory::getTypeInfo() const noexcept {
+ return style::RasterLayer::Impl::staticTypeInfo();
}
-std::unique_ptr<style::Layer> RasterLayerFactory::createLayer(const std::string& id, const conversion::Convertible& value) {
+std::unique_ptr<style::Layer> RasterLayerFactory::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 RasterLayer(id, *source));
+ std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::RasterLayer(id, *source));
return layer;
}
-} // namespace style
+std::unique_ptr<RenderLayer> RasterLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
+ assert(impl->getTypeInfo() == getTypeInfo());
+ return std::make_unique<RenderRasterLayer>(staticImmutableCast<style::RasterLayer::Impl>(std::move(impl)));
+}
+
} // namespace mbgl