summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layers/fill_layer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/layers/fill_layer.cpp')
-rw-r--r--src/mbgl/style/layers/fill_layer.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/mbgl/style/layers/fill_layer.cpp b/src/mbgl/style/layers/fill_layer.cpp
index 17a5eaf3b1..480fc597dd 100644
--- a/src/mbgl/style/layers/fill_layer.cpp
+++ b/src/mbgl/style/layers/fill_layer.cpp
@@ -11,21 +11,27 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
+#include <mbgl/renderer/layers/render_fill_layer.hpp>
+
namespace mbgl {
namespace style {
-namespace {
- const LayerTypeInfo typeInfoFill
+
+// static
+const LayerTypeInfo* FillLayer::Impl::staticTypeInfo() noexcept {
+ const static LayerTypeInfo typeInfo
{"fill",
LayerTypeInfo::Source::Required,
LayerTypeInfo::Pass3D::NotRequired,
LayerTypeInfo::Layout::Required,
LayerTypeInfo::Clipping::Required
};
-} // namespace
+ return &typeInfo;
+}
+
FillLayer::FillLayer(const std::string& layerID, const std::string& sourceID)
- : Layer(makeMutable<Impl>(LayerType::Fill, layerID, sourceID)) {
+ : Layer(makeMutable<Impl>(layerID, sourceID)) {
}
FillLayer::FillLayer(Immutable<Impl> impl_)
@@ -52,10 +58,6 @@ std::unique_ptr<Layer> FillLayer::cloneRef(const std::string& id_) const {
void FillLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const {
}
-const LayerTypeInfo* FillLayer::Impl::getTypeInfo() const noexcept {
- return &typeInfoFill;
-}
-
// Layout properties
@@ -503,26 +505,28 @@ Mutable<Layer::Impl> FillLayer::mutableBaseImpl() const {
return staticMutableCast<Layer::Impl>(mutableImpl());
}
-FillLayerFactory::FillLayerFactory() = default;
-
-FillLayerFactory::~FillLayerFactory() = default;
+} // namespace style
-const LayerTypeInfo* FillLayerFactory::getTypeInfo() const noexcept {
- return &typeInfoFill;
+const style::LayerTypeInfo* FillLayerFactory::getTypeInfo() const noexcept {
+ return style::FillLayer::Impl::staticTypeInfo();
}
-std::unique_ptr<style::Layer> FillLayerFactory::createLayer(const std::string& id, const conversion::Convertible& value) {
+std::unique_ptr<style::Layer> FillLayerFactory::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 FillLayer(id, *source));
+ std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::FillLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
-} // namespace style
+std::unique_ptr<RenderLayer> FillLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
+ assert(impl->getTypeInfo() == getTypeInfo());
+ return std::make_unique<RenderFillLayer>(staticImmutableCast<style::FillLayer::Impl>(std::move(impl)));
+}
+
} // namespace mbgl