// 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* LineLayer::Impl::staticTypeInfo() noexcept { const static LayerTypeInfo typeInfo {"line", LayerTypeInfo::Source::Required, LayerTypeInfo::Pass3D::NotRequired, LayerTypeInfo::Layout::Required, LayerTypeInfo::Clipping::Required, LayerTypeInfo::FadingTiles::NotRequired }; return &typeInfo; } LineLayer::LineLayer(const std::string& layerID, const std::string& sourceID) : Layer(makeMutable(layerID, sourceID)) { } LineLayer::LineLayer(Immutable impl_) : Layer(std::move(impl_)) { } LineLayer::~LineLayer() = default; const LineLayer::Impl& LineLayer::impl() const { return static_cast(*baseImpl); } Mutable LineLayer::mutableImpl() const { return makeMutable(impl()); } std::unique_ptr LineLayer::cloneRef(const std::string& id_) const { auto impl_ = mutableImpl(); impl_->id = id_; impl_->paint = LinePaintProperties::Transitionable(); return std::make_unique(std::move(impl_)); } void LineLayer::Impl::stringifyLayout(rapidjson::Writer& writer) const { layout.stringify(writer); } // Layout properties PropertyValue LineLayer::getDefaultLineCap() { return LineCap::defaultValue(); } const PropertyValue& LineLayer::getLineCap() const { return impl().layout.get(); } void LineLayer::setLineCap(const PropertyValue& value) { if (value == getLineCap()) return; auto impl_ = mutableImpl(); impl_->layout.get() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } PropertyValue LineLayer::getDefaultLineJoin() { return LineJoin::defaultValue(); } const PropertyValue& LineLayer::getLineJoin() const { return impl().layout.get(); } void LineLayer::setLineJoin(const PropertyValue& value) { if (value == getLineJoin()) return; auto impl_ = mutableImpl(); impl_->layout.get() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } PropertyValue LineLayer::getDefaultLineMiterLimit() { return LineMiterLimit::defaultValue(); } const PropertyValue& LineLayer::getLineMiterLimit() const { return impl().layout.get(); } void LineLayer::setLineMiterLimit(const PropertyValue& value) { if (value == getLineMiterLimit()) return; auto impl_ = mutableImpl(); impl_->layout.get() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } PropertyValue LineLayer::getDefaultLineRoundLimit() { return LineRoundLimit::defaultValue(); } const PropertyValue& LineLayer::getLineRoundLimit() const { return impl().layout.get(); } void LineLayer::setLineRoundLimit(const PropertyValue& value) { if (value == getLineRoundLimit()) return; auto impl_ = mutableImpl(); impl_->layout.get() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } // Paint properties PropertyValue LineLayer::getDefaultLineBlur() { return { 0 }; } const PropertyValue& LineLayer::getLineBlur() const { return impl().paint.template get().value; } void LineLayer::setLineBlur(const PropertyValue& value) { if (value == getLineBlur()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LineLayer::setLineBlurTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LineLayer::getLineBlurTransition() const { return impl().paint.template get().options; } PropertyValue LineLayer::getDefaultLineColor() { return { Color::black() }; } const PropertyValue& LineLayer::getLineColor() const { return impl().paint.template get().value; } void LineLayer::setLineColor(const PropertyValue& value) { if (value == getLineColor()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LineLayer::setLineColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LineLayer::getLineColorTransition() const { return impl().paint.template get().options; } PropertyValue> LineLayer::getDefaultLineDasharray() { return { { } }; } const PropertyValue>& LineLayer::getLineDasharray() const { return impl().paint.template get().value; } void LineLayer::setLineDasharray(const PropertyValue>& value) { if (value == getLineDasharray()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LineLayer::setLineDasharrayTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LineLayer::getLineDasharrayTransition() const { return impl().paint.template get().options; } PropertyValue LineLayer::getDefaultLineGapWidth() { return { 0 }; } const PropertyValue& LineLayer::getLineGapWidth() const { return impl().paint.template get().value; } void LineLayer::setLineGapWidth(const PropertyValue& value) { if (value == getLineGapWidth()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LineLayer::setLineGapWidthTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LineLayer::getLineGapWidthTransition() const { return impl().paint.template get().options; } ColorRampPropertyValue LineLayer::getDefaultLineGradient() { return { {} }; } const ColorRampPropertyValue& LineLayer::getLineGradient() const { return impl().paint.template get().value; } void LineLayer::setLineGradient(const ColorRampPropertyValue& value) { if (value == getLineGradient()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LineLayer::setLineGradientTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LineLayer::getLineGradientTransition() const { return impl().paint.template get().options; } PropertyValue LineLayer::getDefaultLineOffset() { return { 0 }; } const PropertyValue& LineLayer::getLineOffset() const { return impl().paint.template get().value; } void LineLayer::setLineOffset(const PropertyValue& value) { if (value == getLineOffset()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LineLayer::setLineOffsetTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LineLayer::getLineOffsetTransition() const { return impl().paint.template get().options; } PropertyValue LineLayer::getDefaultLineOpacity() { return { 1 }; } const PropertyValue& LineLayer::getLineOpacity() const { return impl().paint.template get().value; } void LineLayer::setLineOpacity(const PropertyValue& value) { if (value == getLineOpacity()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LineLayer::setLineOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LineLayer::getLineOpacityTransition() const { return impl().paint.template get().options; } PropertyValue LineLayer::getDefaultLinePattern() { return { "" }; } const PropertyValue& LineLayer::getLinePattern() const { return impl().paint.template get().value; } void LineLayer::setLinePattern(const PropertyValue& value) { if (value == getLinePattern()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LineLayer::setLinePatternTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LineLayer::getLinePatternTransition() const { return impl().paint.template get().options; } PropertyValue> LineLayer::getDefaultLineTranslate() { return { {{ 0, 0 }} }; } const PropertyValue>& LineLayer::getLineTranslate() const { return impl().paint.template get().value; } void LineLayer::setLineTranslate(const PropertyValue>& value) { if (value == getLineTranslate()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LineLayer::setLineTranslateTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LineLayer::getLineTranslateTransition() const { return impl().paint.template get().options; } PropertyValue LineLayer::getDefaultLineTranslateAnchor() { return { TranslateAnchorType::Map }; } const PropertyValue& LineLayer::getLineTranslateAnchor() const { return impl().paint.template get().value; } void LineLayer::setLineTranslateAnchor(const PropertyValue& value) { if (value == getLineTranslateAnchor()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LineLayer::setLineTranslateAnchorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LineLayer::getLineTranslateAnchorTransition() const { return impl().paint.template get().options; } PropertyValue LineLayer::getDefaultLineWidth() { return { 1 }; } const PropertyValue& LineLayer::getLineWidth() const { return impl().paint.template get().value; } void LineLayer::setLineWidth(const PropertyValue& value) { if (value == getLineWidth()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LineLayer::setLineWidthTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LineLayer::getLineWidthTransition() const { return impl().paint.template get().options; } using namespace conversion; optional LineLayer::setPaintProperty(const std::string& name, const Convertible& value) { enum class Property : uint8_t { LineBlur, LineColor, LineDasharray, LineGapWidth, LineGradient, LineOffset, LineOpacity, LinePattern, LineTranslate, LineTranslateAnchor, LineWidth, LineBlurTransition, LineColorTransition, LineDasharrayTransition, LineGapWidthTransition, LineGradientTransition, LineOffsetTransition, LineOpacityTransition, LinePatternTransition, LineTranslateTransition, LineTranslateAnchorTransition, LineWidthTransition, }; MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map({ { "line-blur", static_cast(Property::LineBlur) }, { "line-color", static_cast(Property::LineColor) }, { "line-dasharray", static_cast(Property::LineDasharray) }, { "line-gap-width", static_cast(Property::LineGapWidth) }, { "line-gradient", static_cast(Property::LineGradient) }, { "line-offset", static_cast(Property::LineOffset) }, { "line-opacity", static_cast(Property::LineOpacity) }, { "line-pattern", static_cast(Property::LinePattern) }, { "line-translate", static_cast(Property::LineTranslate) }, { "line-translate-anchor", static_cast(Property::LineTranslateAnchor) }, { "line-width", static_cast(Property::LineWidth) }, { "line-blur-transition", static_cast(Property::LineBlurTransition) }, { "line-color-transition", static_cast(Property::LineColorTransition) }, { "line-dasharray-transition", static_cast(Property::LineDasharrayTransition) }, { "line-gap-width-transition", static_cast(Property::LineGapWidthTransition) }, { "line-gradient-transition", static_cast(Property::LineGradientTransition) }, { "line-offset-transition", static_cast(Property::LineOffsetTransition) }, { "line-opacity-transition", static_cast(Property::LineOpacityTransition) }, { "line-pattern-transition", static_cast(Property::LinePatternTransition) }, { "line-translate-transition", static_cast(Property::LineTranslateTransition) }, { "line-translate-anchor-transition", static_cast(Property::LineTranslateAnchorTransition) }, { "line-width-transition", static_cast(Property::LineWidthTransition) } }); 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::LineBlur || property == Property::LineGapWidth || property == Property::LineOffset || property == Property::LineOpacity || property == Property::LineWidth) { Error error; optional> typedValue = convert>(value, error, true, false); if (!typedValue) { return error; } if (property == Property::LineBlur) { setLineBlur(*typedValue); return nullopt; } if (property == Property::LineGapWidth) { setLineGapWidth(*typedValue); return nullopt; } if (property == Property::LineOffset) { setLineOffset(*typedValue); return nullopt; } if (property == Property::LineOpacity) { setLineOpacity(*typedValue); return nullopt; } if (property == Property::LineWidth) { setLineWidth(*typedValue); return nullopt; } } if (property == Property::LineColor) { Error error; optional> typedValue = convert>(value, error, true, false); if (!typedValue) { return error; } setLineColor(*typedValue); return nullopt; } if (property == Property::LineDasharray) { Error error; optional>> typedValue = convert>>(value, error, false, false); if (!typedValue) { return error; } setLineDasharray(*typedValue); return nullopt; } if (property == Property::LineGradient) { Error error; optional typedValue = convert(value, error, false, false); if (!typedValue) { return error; } setLineGradient(*typedValue); return nullopt; } if (property == Property::LinePattern) { Error error; optional> typedValue = convert>(value, error, true, false); if (!typedValue) { return error; } setLinePattern(*typedValue); return nullopt; } if (property == Property::LineTranslate) { Error error; optional>> typedValue = convert>>(value, error, false, false); if (!typedValue) { return error; } setLineTranslate(*typedValue); return nullopt; } if (property == Property::LineTranslateAnchor) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setLineTranslateAnchor(*typedValue); return nullopt; } Error error; optional transition = convert(value, error); if (!transition) { return error; } if (property == Property::LineBlurTransition) { setLineBlurTransition(*transition); return nullopt; } if (property == Property::LineColorTransition) { setLineColorTransition(*transition); return nullopt; } if (property == Property::LineDasharrayTransition) { setLineDasharrayTransition(*transition); return nullopt; } if (property == Property::LineGapWidthTransition) { setLineGapWidthTransition(*transition); return nullopt; } if (property == Property::LineGradientTransition) { setLineGradientTransition(*transition); return nullopt; } if (property == Property::LineOffsetTransition) { setLineOffsetTransition(*transition); return nullopt; } if (property == Property::LineOpacityTransition) { setLineOpacityTransition(*transition); return nullopt; } if (property == Property::LinePatternTransition) { setLinePatternTransition(*transition); return nullopt; } if (property == Property::LineTranslateTransition) { setLineTranslateTransition(*transition); return nullopt; } if (property == Property::LineTranslateAnchorTransition) { setLineTranslateAnchorTransition(*transition); return nullopt; } if (property == Property::LineWidthTransition) { setLineWidthTransition(*transition); return nullopt; } return Error { "layer doesn't support this property" }; } optional LineLayer::setLayoutProperty(const std::string& name, const Convertible& value) { if (name == "visibility") { return Layer::setVisibility(value); } enum class Property { LineCap, LineJoin, LineMiterLimit, LineRoundLimit, }; MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map({ { "line-cap", static_cast(Property::LineCap) }, { "line-join", static_cast(Property::LineJoin) }, { "line-miter-limit", static_cast(Property::LineMiterLimit) }, { "line-round-limit", static_cast(Property::LineRoundLimit) } }); 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::LineCap) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setLineCap(*typedValue); return nullopt; } if (property == Property::LineJoin) { Error error; optional> typedValue = convert>(value, error, true, false); if (!typedValue) { return error; } setLineJoin(*typedValue); return nullopt; } if (property == Property::LineMiterLimit || property == Property::LineRoundLimit) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } if (property == Property::LineMiterLimit) { setLineMiterLimit(*typedValue); return nullopt; } if (property == Property::LineRoundLimit) { setLineRoundLimit(*typedValue); return nullopt; } } return Error { "layer doesn't support this property" }; } Mutable LineLayer::mutableBaseImpl() const { return staticMutableCast(mutableImpl()); } } // namespace style } // namespace mbgl