// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #include #include #include #include #include #include #include #include #include namespace mbgl { namespace style { BackgroundLayer::BackgroundLayer(const std::string& layerID) : Layer(makeMutable(LayerType::Background, layerID, std::string())) { } BackgroundLayer::BackgroundLayer(Immutable impl_) : Layer(std::move(impl_)) { } BackgroundLayer::~BackgroundLayer() = default; const BackgroundLayer::Impl& BackgroundLayer::impl() const { return static_cast(*baseImpl); } Mutable BackgroundLayer::mutableImpl() const { return makeMutable(impl()); } std::unique_ptr BackgroundLayer::cloneRef(const std::string& id_) const { auto impl_ = mutableImpl(); impl_->id = id_; impl_->paint = BackgroundPaintProperties::Transitionable(); return std::make_unique(std::move(impl_)); } void BackgroundLayer::Impl::stringifyLayout(rapidjson::Writer&) const { } // Visibility void BackgroundLayer::setVisibility(VisibilityType value) { if (value == getVisibility()) return; auto impl_ = mutableImpl(); impl_->visibility = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } // Zoom range void BackgroundLayer::setMinZoom(float minZoom) { auto impl_ = mutableImpl(); impl_->minZoom = minZoom; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void BackgroundLayer::setMaxZoom(float maxZoom) { auto impl_ = mutableImpl(); impl_->maxZoom = maxZoom; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } // Layout properties // Paint properties PropertyValue BackgroundLayer::getDefaultBackgroundColor() { return { Color::black() }; } PropertyValue BackgroundLayer::getBackgroundColor() const { return impl().paint.template get().value; } void BackgroundLayer::setBackgroundColor(PropertyValue value) { if (value == getBackgroundColor()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void BackgroundLayer::setBackgroundColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions BackgroundLayer::getBackgroundColorTransition() const { return impl().paint.template get().options; } PropertyValue BackgroundLayer::getDefaultBackgroundPattern() { return { "" }; } PropertyValue BackgroundLayer::getBackgroundPattern() const { return impl().paint.template get().value; } void BackgroundLayer::setBackgroundPattern(PropertyValue value) { if (value == getBackgroundPattern()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void BackgroundLayer::setBackgroundPatternTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions BackgroundLayer::getBackgroundPatternTransition() const { return impl().paint.template get().options; } PropertyValue BackgroundLayer::getDefaultBackgroundOpacity() { return { 1 }; } PropertyValue BackgroundLayer::getBackgroundOpacity() const { return impl().paint.template get().value; } void BackgroundLayer::setBackgroundOpacity(PropertyValue value) { if (value == getBackgroundOpacity()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void BackgroundLayer::setBackgroundOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions BackgroundLayer::getBackgroundOpacityTransition() const { return impl().paint.template get().options; } using namespace conversion; optional BackgroundLayer::setPaintProperty(const std::string& name, const Convertible& value) { if (name == "background-color") { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setBackgroundColor(*typedValue); return nullopt; } if (name == "background-color-transition") { Error error; optional transition = convert(value, error); if (!transition) { return error; } setBackgroundColorTransition(*transition); return nullopt; } if (name == "background-pattern") { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setBackgroundPattern(*typedValue); return nullopt; } if (name == "background-pattern-transition") { Error error; optional transition = convert(value, error); if (!transition) { return error; } setBackgroundPatternTransition(*transition); return nullopt; } if (name == "background-opacity") { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setBackgroundOpacity(*typedValue); return nullopt; } if (name == "background-opacity-transition") { Error error; optional transition = convert(value, error); if (!transition) { return error; } setBackgroundOpacityTransition(*transition); return nullopt; } return Error { "layer doesn't support this property" }; } optional BackgroundLayer::setLayoutProperty(const std::string& name, const Convertible& value) { if (name == "visibility") { if (isUndefined(value)) { setVisibility(VisibilityType::Visible); return nullopt; } Error error; optional visibility = convert(value, error); if (!visibility) { return error; } setVisibility(*visibility); return nullopt; } return Error { "layer doesn't support this property" }; } } // namespace style } // namespace mbgl