From 7a9461a8d439458b18656ecfb839923adc5f0e9b Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Thu, 25 Oct 2018 16:15:31 +0300 Subject: Consolidate `style::Layer` properties API The `style::Layer` class now exposes all the properties contained at `style::LayerImpl`. This allowed to drop `style::Layer::accept()` method usage, avoid the repeated generated code and thus save some binary size. This patch is a part of the layers modularization effort. --- src/mbgl/style/layers/custom_layer.cpp | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) (limited to 'src/mbgl/style/layers/custom_layer.cpp') diff --git a/src/mbgl/style/layers/custom_layer.cpp b/src/mbgl/style/layers/custom_layer.cpp index d1ac1a705c..a31586f708 100644 --- a/src/mbgl/style/layers/custom_layer.cpp +++ b/src/mbgl/style/layers/custom_layer.cpp @@ -25,31 +25,6 @@ std::unique_ptr CustomLayer::cloneRef(const std::string&) const { return nullptr; } -// Visibility - -void CustomLayer::setVisibility(VisibilityType value) { - if (value == getVisibility()) - return; - auto impl_ = mutableImpl(); - impl_->visibility = value; - baseImpl = std::move(impl_); - observer->onLayerChanged(*this); -} - -// Zoom range - -void CustomLayer::setMinZoom(float minZoom) { - auto impl_ = mutableImpl(); - impl_->minZoom = minZoom; - baseImpl = std::move(impl_); -} - -void CustomLayer::setMaxZoom(float maxZoom) { - auto impl_ = mutableImpl(); - impl_->maxZoom = maxZoom; - baseImpl = std::move(impl_); -} - using namespace conversion; optional CustomLayer::setPaintProperty(const std::string&, const Convertible&) { @@ -60,6 +35,10 @@ optional CustomLayer::setLayoutProperty(const std::string&, const Convert return Error { "layer doesn't support this property" }; } +Mutable CustomLayer::mutableBaseImpl() const { + return staticMutableCast(mutableImpl()); +} + template <> bool Layer::is() const { return getType() == LayerType::Custom; -- cgit v1.2.1