// 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 #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::FadingTiles::NotRequired, LayerTypeInfo::CrossTileIndex::NotRequired, LayerTypeInfo::TileKind::Geometry}; 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; namespace { 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, LineCap, LineJoin, LineMiterLimit, LineRoundLimit, }; template constexpr uint8_t toUint8(T t) noexcept { return uint8_t(mbgl::underlying_type(t)); } MAPBOX_ETERNAL_CONSTEXPR const auto layerProperties = mapbox::eternal::hash_map( {{"line-blur", toUint8(Property::LineBlur)}, {"line-color", toUint8(Property::LineColor)}, {"line-dasharray", toUint8(Property::LineDasharray)}, {"line-gap-width", toUint8(Property::LineGapWidth)}, {"line-gradient", toUint8(Property::LineGradient)}, {"line-offset", toUint8(Property::LineOffset)}, {"line-opacity", toUint8(Property::LineOpacity)}, {"line-pattern", toUint8(Property::LinePattern)}, {"line-translate", toUint8(Property::LineTranslate)}, {"line-translate-anchor", toUint8(Property::LineTranslateAnchor)}, {"line-width", toUint8(Property::LineWidth)}, {"line-blur-transition", toUint8(Property::LineBlurTransition)}, {"line-color-transition", toUint8(Property::LineColorTransition)}, {"line-dasharray-transition", toUint8(Property::LineDasharrayTransition)}, {"line-gap-width-transition", toUint8(Property::LineGapWidthTransition)}, {"line-gradient-transition", toUint8(Property::LineGradientTransition)}, {"line-offset-transition", toUint8(Property::LineOffsetTransition)}, {"line-opacity-transition", toUint8(Property::LineOpacityTransition)}, {"line-pattern-transition", toUint8(Property::LinePatternTransition)}, {"line-translate-transition", toUint8(Property::LineTranslateTransition)}, {"line-translate-anchor-transition", toUint8(Property::LineTranslateAnchorTransition)}, {"line-width-transition", toUint8(Property::LineWidthTransition)}, {"line-cap", toUint8(Property::LineCap)}, {"line-join", toUint8(Property::LineJoin)}, {"line-miter-limit", toUint8(Property::LineMiterLimit)}, {"line-round-limit", toUint8(Property::LineRoundLimit)}}); constexpr uint8_t lastPaintPropertyIndex = toUint8(Property::LineWidthTransition); } // namespace optional LineLayer::setPaintProperty(const std::string& name, const Convertible& value) { const auto it = layerProperties.find(name.c_str()); if (it == layerProperties.end() || it->second > lastPaintPropertyIndex) { 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"}; } StyleProperty LineLayer::getProperty(const std::string& name) const { const auto it = layerProperties.find(name.c_str()); if (it == layerProperties.end()) { return {}; } switch (static_cast(it->second)) { case Property::LineBlur: return makeStyleProperty(getLineBlur()); case Property::LineColor: return makeStyleProperty(getLineColor()); case Property::LineDasharray: return makeStyleProperty(getLineDasharray()); case Property::LineGapWidth: return makeStyleProperty(getLineGapWidth()); case Property::LineGradient: return makeStyleProperty(getLineGradient()); case Property::LineOffset: return makeStyleProperty(getLineOffset()); case Property::LineOpacity: return makeStyleProperty(getLineOpacity()); case Property::LinePattern: return makeStyleProperty(getLinePattern()); case Property::LineTranslate: return makeStyleProperty(getLineTranslate()); case Property::LineTranslateAnchor: return makeStyleProperty(getLineTranslateAnchor()); case Property::LineWidth: return makeStyleProperty(getLineWidth()); case Property::LineBlurTransition: return makeStyleProperty(getLineBlurTransition()); case Property::LineColorTransition: return makeStyleProperty(getLineColorTransition()); case Property::LineDasharrayTransition: return makeStyleProperty(getLineDasharrayTransition()); case Property::LineGapWidthTransition: return makeStyleProperty(getLineGapWidthTransition()); case Property::LineGradientTransition: return makeStyleProperty(getLineGradientTransition()); case Property::LineOffsetTransition: return makeStyleProperty(getLineOffsetTransition()); case Property::LineOpacityTransition: return makeStyleProperty(getLineOpacityTransition()); case Property::LinePatternTransition: return makeStyleProperty(getLinePatternTransition()); case Property::LineTranslateTransition: return makeStyleProperty(getLineTranslateTransition()); case Property::LineTranslateAnchorTransition: return makeStyleProperty(getLineTranslateAnchorTransition()); case Property::LineWidthTransition: return makeStyleProperty(getLineWidthTransition()); case Property::LineCap: return makeStyleProperty(getLineCap()); case Property::LineJoin: return makeStyleProperty(getLineJoin()); case Property::LineMiterLimit: return makeStyleProperty(getLineMiterLimit()); case Property::LineRoundLimit: return makeStyleProperty(getLineRoundLimit()); } return {}; } optional LineLayer::setLayoutProperty(const std::string& name, const Convertible& value) { if (name == "visibility") { return Layer::setVisibility(value); } const auto it = layerProperties.find(name.c_str()); if (it == layerProperties.end() || it->second <= lastPaintPropertyIndex) { 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