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/layer.cpp.ejs | 64 +++---------------------------------- 1 file changed, 4 insertions(+), 60 deletions(-) (limited to 'src/mbgl/style/layers/layer.cpp.ejs') diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs index b5fb1a97a4..d4404ed949 100644 --- a/src/mbgl/style/layers/layer.cpp.ejs +++ b/src/mbgl/style/layers/layer.cpp.ejs @@ -59,66 +59,6 @@ void <%- camelize(type) %>Layer::Impl::stringifyLayout(rapidjson::Writer -<% if (type !== 'background') { -%> -// Source - -const std::string& <%- camelize(type) %>Layer::getSourceID() const { - return impl().source; -} - -<% if (type !== 'raster' && type !== 'hillshade') { -%> -void <%- camelize(type) %>Layer::setSourceLayer(const std::string& sourceLayer) { - auto impl_ = mutableImpl(); - impl_->sourceLayer = sourceLayer; - baseImpl = std::move(impl_); -} - -const std::string& <%- camelize(type) %>Layer::getSourceLayer() const { - return impl().sourceLayer; -} - -// Filter - -void <%- camelize(type) %>Layer::setFilter(const Filter& filter) { - auto impl_ = mutableImpl(); - impl_->filter = filter; - baseImpl = std::move(impl_); - observer->onLayerChanged(*this); -} - -const Filter& <%- camelize(type) %>Layer::getFilter() const { - return impl().filter; -} -<% } -%> -<% } -%> - -// Visibility - -void <%- camelize(type) %>Layer::setVisibility(VisibilityType value) { - if (value == getVisibility()) - return; - auto impl_ = mutableImpl(); - impl_->visibility = value; - baseImpl = std::move(impl_); - observer->onLayerChanged(*this); -} - -// Zoom range - -void <%- camelize(type) %>Layer::setMinZoom(float minZoom) { - auto impl_ = mutableImpl(); - impl_->minZoom = minZoom; - baseImpl = std::move(impl_); - observer->onLayerChanged(*this); -} - -void <%- camelize(type) %>Layer::setMaxZoom(float maxZoom) { - auto impl_ = mutableImpl(); - impl_->maxZoom = maxZoom; - baseImpl = std::move(impl_); - observer->onLayerChanged(*this); -} - // Layout properties <% for (const property of layoutProperties) { -%> @@ -316,5 +256,9 @@ optional <%- camelize(type) %>Layer::setLayoutProperty(const std::string& return Error { "layer doesn't support this property" }; } +Mutable <%- camelize(type) %>Layer::mutableBaseImpl() const { + return staticMutableCast(mutableImpl()); +} + } // namespace style } // namespace mbgl -- cgit v1.2.1