// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #include #include #include #include #include #include #include #include #include #include namespace mbgl { namespace style { // static const LayerTypeInfo* BackgroundLayer::Impl::staticTypeInfo() noexcept { const static LayerTypeInfo typeInfo {"background", LayerTypeInfo::Source::NotRequired, LayerTypeInfo::Pass3D::NotRequired, LayerTypeInfo::Layout::NotRequired, LayerTypeInfo::FadingTiles::NotRequired }; return &typeInfo; } BackgroundLayer::BackgroundLayer(const std::string& layerID) : Layer(makeMutable(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 { } // Layout properties // Paint properties PropertyValue BackgroundLayer::getDefaultBackgroundColor() { return { Color::black() }; } const PropertyValue& BackgroundLayer::getBackgroundColor() const { return impl().paint.template get().value; } void BackgroundLayer::setBackgroundColor(const 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::getDefaultBackgroundOpacity() { return { 1 }; } const PropertyValue& BackgroundLayer::getBackgroundOpacity() const { return impl().paint.template get().value; } void BackgroundLayer::setBackgroundOpacity(const 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; } PropertyValue BackgroundLayer::getDefaultBackgroundPattern() { return { "" }; } const PropertyValue& BackgroundLayer::getBackgroundPattern() const { return impl().paint.template get().value; } void BackgroundLayer::setBackgroundPattern(const 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; } using namespace conversion; optional BackgroundLayer::setPaintProperty(const std::string& name, const Convertible& value) { enum class Property : uint8_t { BackgroundColor, BackgroundOpacity, BackgroundPattern, BackgroundColorTransition, BackgroundOpacityTransition, BackgroundPatternTransition, }; MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map({ { "background-color", static_cast(Property::BackgroundColor) }, { "background-opacity", static_cast(Property::BackgroundOpacity) }, { "background-pattern", static_cast(Property::BackgroundPattern) }, { "background-color-transition", static_cast(Property::BackgroundColorTransition) }, { "background-opacity-transition", static_cast(Property::BackgroundOpacityTransition) }, { "background-pattern-transition", static_cast(Property::BackgroundPatternTransition) } }); const auto it = properties.find(name.c_str()); if (it == properties.end()) { return Error { "layer doesn't support this property" }; } auto property = static_cast(it->second); if (property == Property::BackgroundColor) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setBackgroundColor(*typedValue); return nullopt; } if (property == Property::BackgroundOpacity) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setBackgroundOpacity(*typedValue); return nullopt; } if (property == Property::BackgroundPattern) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setBackgroundPattern(*typedValue); return nullopt; } Error error; optional transition = convert(value, error); if (!transition) { return error; } if (property == Property::BackgroundColorTransition) { setBackgroundColorTransition(*transition); return nullopt; } if (property == Property::BackgroundOpacityTransition) { setBackgroundOpacityTransition(*transition); return nullopt; } if (property == Property::BackgroundPatternTransition) { setBackgroundPatternTransition(*transition); return nullopt; } return Error { "layer doesn't support this property" }; } optional BackgroundLayer::setLayoutProperty(const std::string& name, const Convertible& value) { if (name == "visibility") { return Layer::setVisibility(value); } return Error { "layer doesn't support this property" }; } Mutable BackgroundLayer::mutableBaseImpl() const { return staticMutableCast(mutableImpl()); } } // namespace style } // namespace mbgl