// 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 { namespace { const LayerTypeInfo typeInfoBackground{ "background", LayerTypeInfo::SourceNotRequired }; } // namespace 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 { } const LayerTypeInfo* BackgroundLayer::Impl::getTypeInfo() const noexcept { return &typeInfoBackground; } // 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) { enum class Property { Unknown, BackgroundColor, BackgroundPattern, BackgroundOpacity, BackgroundColorTransition, BackgroundPatternTransition, BackgroundOpacityTransition, }; Property property = Property::Unknown; switch (util::hashFNV1a(name.c_str())) { case util::hashFNV1a("background-color"): if (name == "background-color") { property = Property::BackgroundColor; } break; case util::hashFNV1a("background-color-transition"): if (name == "background-color-transition") { property = Property::BackgroundColorTransition; } break; case util::hashFNV1a("background-pattern"): if (name == "background-pattern") { property = Property::BackgroundPattern; } break; case util::hashFNV1a("background-pattern-transition"): if (name == "background-pattern-transition") { property = Property::BackgroundPatternTransition; } break; case util::hashFNV1a("background-opacity"): if (name == "background-opacity") { property = Property::BackgroundOpacity; } break; case util::hashFNV1a("background-opacity-transition"): if (name == "background-opacity-transition") { property = Property::BackgroundOpacityTransition; } break; } if (property == Property::Unknown) { return Error { "layer doesn't support this property" }; } if (property == Property::BackgroundColor) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setBackgroundColor(*typedValue); return nullopt; } if (property == Property::BackgroundPattern) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setBackgroundPattern(*typedValue); return nullopt; } if (property == Property::BackgroundOpacity) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setBackgroundOpacity(*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::BackgroundPatternTransition) { setBackgroundPatternTransition(*transition); return nullopt; } if (property == Property::BackgroundOpacityTransition) { 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") { return Layer::setVisibility(value); } enum class Property { Unknown, }; Property property = Property::Unknown; switch (util::hashFNV1a(name.c_str())) { } if (property == Property::Unknown) { return Error { "layer doesn't support this property" }; } return Error { "layer doesn't support this property" }; } Mutable BackgroundLayer::mutableBaseImpl() const { return staticMutableCast(mutableImpl()); } BackgroundLayerFactory::BackgroundLayerFactory() = default; BackgroundLayerFactory::~BackgroundLayerFactory() = default; const LayerTypeInfo* BackgroundLayerFactory::getTypeInfo() const noexcept { return &typeInfoBackground; } std::unique_ptr BackgroundLayerFactory::createLayer(const std::string& id, const conversion::Convertible& value) { (void)value; return std::unique_ptr(new BackgroundLayer(id)); } } // namespace style } // namespace mbgl