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:
Mikhail Pozdnyakov
2018-10-25 16:15:31 +03:00
parent fdd8b54900
commit 7a9461a8d4
30 changed files with 203 additions and 929 deletions

View File

@@ -42,40 +42,6 @@ std::unique_ptr<Layer> RasterLayer::cloneRef(const std::string& id_) const {
void RasterLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const {
}
// Source
const std::string& RasterLayer::getSourceID() const {
return impl().source;
}
// Visibility
void RasterLayer::setVisibility(VisibilityType value) {
if (value == getVisibility())
return;
auto impl_ = mutableImpl();
impl_->visibility = value;
baseImpl = std::move(impl_);
observer->onLayerChanged(*this);
}
// Zoom range
void RasterLayer::setMinZoom(float minZoom) {
auto impl_ = mutableImpl();
impl_->minZoom = minZoom;
baseImpl = std::move(impl_);
observer->onLayerChanged(*this);
}
void RasterLayer::setMaxZoom(float maxZoom) {
auto impl_ = mutableImpl();
impl_->maxZoom = maxZoom;
baseImpl = std::move(impl_);
observer->onLayerChanged(*this);
}
// Layout properties
@@ -540,5 +506,9 @@ optional<Error> RasterLayer::setLayoutProperty(const std::string& name, const Co
return Error { "layer doesn't support this property" };
}
Mutable<Layer::Impl> RasterLayer::mutableBaseImpl() const {
return staticMutableCast<Layer::Impl>(mutableImpl());
}
} // namespace style
} // namespace mbgl