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.
This commit is contained in:
@@ -42,62 +42,6 @@ std::unique_ptr<Layer> FillLayer::cloneRef(const std::string& id_) const {
|
||||
void FillLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const {
|
||||
}
|
||||
|
||||
// Source
|
||||
|
||||
const std::string& FillLayer::getSourceID() const {
|
||||
return impl().source;
|
||||
}
|
||||
|
||||
void FillLayer::setSourceLayer(const std::string& sourceLayer) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->sourceLayer = sourceLayer;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
const std::string& FillLayer::getSourceLayer() const {
|
||||
return impl().sourceLayer;
|
||||
}
|
||||
|
||||
// Filter
|
||||
|
||||
void FillLayer::setFilter(const Filter& filter) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->filter = filter;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
const Filter& FillLayer::getFilter() const {
|
||||
return impl().filter;
|
||||
}
|
||||
|
||||
// Visibility
|
||||
|
||||
void FillLayer::setVisibility(VisibilityType value) {
|
||||
if (value == getVisibility())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->visibility = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
// Zoom range
|
||||
|
||||
void FillLayer::setMinZoom(float minZoom) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->minZoom = minZoom;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void FillLayer::setMaxZoom(float maxZoom) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->maxZoom = maxZoom;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
// Layout properties
|
||||
|
||||
|
||||
@@ -541,5 +485,9 @@ optional<Error> FillLayer::setLayoutProperty(const std::string& name, const Conv
|
||||
return Error { "layer doesn't support this property" };
|
||||
}
|
||||
|
||||
Mutable<Layer::Impl> FillLayer::mutableBaseImpl() const {
|
||||
return staticMutableCast<Layer::Impl>(mutableImpl());
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
|
||||
Reference in New Issue
Block a user