// 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 typeInfoLine{ "line", LayerTypeInfo::SourceRequired }; } // namespace LineLayer::LineLayer(const std::string& layerID, const std::string& sourceID) : Layer(makeMutable(LayerType::Line, 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); } const LayerTypeInfo* LineLayer::Impl::getTypeInfo() const noexcept { return &typeInfoLine; } // Layout properties PropertyValue LineLayer::getDefaultLineCap() { return LineCap::defaultValue(); } PropertyValue LineLayer::getLineCap() const { return impl().layout.get(); } void LineLayer::setLineCap(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(); } PropertyValue LineLayer::getLineJoin() const { return impl().layout.get(); } void LineLayer::setLineJoin(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(); } PropertyValue LineLayer::getLineMiterLimit() const { return impl().layout.get(); } void LineLayer::setLineMiterLimit(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(); } PropertyValue LineLayer::getLineRoundLimit() const { return impl().layout.get(); } void LineLayer::setLineRoundLimit(PropertyValue value) { if (value == getLineRoundLimit()) return; auto impl_ = mutableImpl(); impl_->layout.get() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } // Paint properties PropertyValue LineLayer::getDefaultLineOpacity() { return { 1 }; } PropertyValue LineLayer::getLineOpacity() const { return impl().paint.template get().value; } void LineLayer::setLineOpacity(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::getDefaultLineColor() { return { Color::black() }; } PropertyValue LineLayer::getLineColor() const { return impl().paint.template get().value; } void LineLayer::setLineColor(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::getDefaultLineTranslate() { return { {{ 0, 0 }} }; } PropertyValue> LineLayer::getLineTranslate() const { return impl().paint.template get().value; } void LineLayer::setLineTranslate(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 }; } PropertyValue LineLayer::getLineTranslateAnchor() const { return impl().paint.template get().value; } void LineLayer::setLineTranslateAnchor(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 }; } PropertyValue LineLayer::getLineWidth() const { return impl().paint.template get().value; } void LineLayer::setLineWidth(PropertyValue value) { if (value == getLineWidth()) return; auto impl_ = mutableImpl(); 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; } PropertyValue LineLayer::getDefaultLineGapWidth() { return { 0 }; } PropertyValue LineLayer::getLineGapWidth() const { return impl().paint.template get().value; } void LineLayer::setLineGapWidth(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; } PropertyValue LineLayer::getDefaultLineOffset() { return { 0 }; } PropertyValue LineLayer::getLineOffset() const { return impl().paint.template get().value; } void LineLayer::setLineOffset(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::getDefaultLineBlur() { return { 0 }; } PropertyValue LineLayer::getLineBlur() const { return impl().paint.template get().value; } void LineLayer::setLineBlur(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::getDefaultLineDasharray() { return { { } }; } PropertyValue> LineLayer::getLineDasharray() const { return impl().paint.template get().value; } void LineLayer::setLineDasharray(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::getDefaultLinePattern() { return { "" }; } PropertyValue LineLayer::getLinePattern() const { return impl().paint.template get().value; } void LineLayer::setLinePattern(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; } ColorRampPropertyValue LineLayer::getDefaultLineGradient() { return { {} }; } ColorRampPropertyValue LineLayer::getLineGradient() const { return impl().paint.template get().value; } void LineLayer::setLineGradient(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; } using namespace conversion; optional LineLayer::setPaintProperty(const std::string& name, const Convertible& value) { enum class Property { Unknown, LineOpacity, LineColor, LineTranslate, LineTranslateAnchor, LineWidth, LineGapWidth, LineOffset, LineBlur, LineDasharray, LinePattern, LineGradient, LineOpacityTransition, LineColorTransition, LineTranslateTransition, LineTranslateAnchorTransition, LineWidthTransition, LineGapWidthTransition, LineOffsetTransition, LineBlurTransition, LineDasharrayTransition, LinePatternTransition, LineGradientTransition, }; Property property = Property::Unknown; switch (util::hashFNV1a(name.c_str())) { case util::hashFNV1a("line-opacity"): if (name == "line-opacity") { property = Property::LineOpacity; } break; case util::hashFNV1a("line-opacity-transition"): if (name == "line-opacity-transition") { property = Property::LineOpacityTransition; } break; case util::hashFNV1a("line-color"): if (name == "line-color") { property = Property::LineColor; } break; case util::hashFNV1a("line-color-transition"): if (name == "line-color-transition") { property = Property::LineColorTransition; } break; case util::hashFNV1a("line-translate"): if (name == "line-translate") { property = Property::LineTranslate; } break; case util::hashFNV1a("line-translate-transition"): if (name == "line-translate-transition") { property = Property::LineTranslateTransition; } break; case util::hashFNV1a("line-translate-anchor"): if (name == "line-translate-anchor") { property = Property::LineTranslateAnchor; } break; case util::hashFNV1a("line-translate-anchor-transition"): if (name == "line-translate-anchor-transition") { property = Property::LineTranslateAnchorTransition; } break; case util::hashFNV1a("line-width"): if (name == "line-width") { property = Property::LineWidth; } break; case util::hashFNV1a("line-width-transition"): if (name == "line-width-transition") { property = Property::LineWidthTransition; } break; case util::hashFNV1a("line-gap-width"): if (name == "line-gap-width") { property = Property::LineGapWidth; } break; case util::hashFNV1a("line-gap-width-transition"): if (name == "line-gap-width-transition") { property = Property::LineGapWidthTransition; } break; case util::hashFNV1a("line-offset"): if (name == "line-offset") { property = Property::LineOffset; } break; case util::hashFNV1a("line-offset-transition"): if (name == "line-offset-transition") { property = Property::LineOffsetTransition; } break; case util::hashFNV1a("line-blur"): if (name == "line-blur") { property = Property::LineBlur; } break; case util::hashFNV1a("line-blur-transition"): if (name == "line-blur-transition") { property = Property::LineBlurTransition; } break; case util::hashFNV1a("line-dasharray"): if (name == "line-dasharray") { property = Property::LineDasharray; } break; case util::hashFNV1a("line-dasharray-transition"): if (name == "line-dasharray-transition") { property = Property::LineDasharrayTransition; } break; case util::hashFNV1a("line-pattern"): if (name == "line-pattern") { property = Property::LinePattern; } break; case util::hashFNV1a("line-pattern-transition"): if (name == "line-pattern-transition") { property = Property::LinePatternTransition; } break; case util::hashFNV1a("line-gradient"): if (name == "line-gradient") { property = Property::LineGradient; } break; case util::hashFNV1a("line-gradient-transition"): if (name == "line-gradient-transition") { property = Property::LineGradientTransition; } break; } if (property == Property::Unknown) { return Error { "layer doesn't support this property" }; } if (property == Property::LineOpacity || property == Property::LineWidth || property == Property::LineGapWidth || property == Property::LineOffset || property == Property::LineBlur) { Error error; optional> typedValue = convert>(value, error, true, false); if (!typedValue) { return error; } if (property == Property::LineOpacity) { setLineOpacity(*typedValue); return nullopt; } if (property == Property::LineWidth) { setLineWidth(*typedValue); return nullopt; } if (property == Property::LineGapWidth) { setLineGapWidth(*typedValue); return nullopt; } if (property == Property::LineOffset) { setLineOffset(*typedValue); return nullopt; } if (property == Property::LineBlur) { setLineBlur(*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::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; } if (property == Property::LineDasharray) { Error error; optional>> typedValue = convert>>(value, error, false, false); if (!typedValue) { return error; } setLineDasharray(*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::LineGradient) { Error error; optional typedValue = convert(value, error, false, false); if (!typedValue) { return error; } setLineGradient(*typedValue); return nullopt; } Error error; optional transition = convert(value, error); if (!transition) { return error; } if (property == Property::LineOpacityTransition) { setLineOpacityTransition(*transition); return nullopt; } if (property == Property::LineColorTransition) { setLineColorTransition(*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; } if (property == Property::LineGapWidthTransition) { setLineGapWidthTransition(*transition); return nullopt; } if (property == Property::LineOffsetTransition) { setLineOffsetTransition(*transition); return nullopt; } if (property == Property::LineBlurTransition) { setLineBlurTransition(*transition); return nullopt; } if (property == Property::LineDasharrayTransition) { setLineDasharrayTransition(*transition); return nullopt; } if (property == Property::LinePatternTransition) { setLinePatternTransition(*transition); return nullopt; } if (property == Property::LineGradientTransition) { setLineGradientTransition(*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 { Unknown, LineCap, LineJoin, LineMiterLimit, LineRoundLimit, }; Property property = Property::Unknown; switch (util::hashFNV1a(name.c_str())) { case util::hashFNV1a("line-cap"): if (name == "line-cap") { property = Property::LineCap; } break; case util::hashFNV1a("line-join"): if (name == "line-join") { property = Property::LineJoin; } break; case util::hashFNV1a("line-miter-limit"): if (name == "line-miter-limit") { property = Property::LineMiterLimit; } break; case util::hashFNV1a("line-round-limit"): if (name == "line-round-limit") { property = Property::LineRoundLimit; } break; } if (property == Property::Unknown) { return Error { "layer doesn't support this property" }; } 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()); } LineLayerFactory::LineLayerFactory() = default; LineLayerFactory::~LineLayerFactory() = default; const LayerTypeInfo* LineLayerFactory::getTypeInfo() const noexcept { return &typeInfoLine; } std::unique_ptr LineLayerFactory::createLayer(const std::string& id, const conversion::Convertible& value) { optional source = getSource(value); if (!source) { return nullptr; } std::unique_ptr layer = std::unique_ptr(new LineLayer(id, *source)); if (!initSourceLayerAndFilter(layer.get(), value)) { return nullptr; } return layer; } } // namespace style } // namespace mbgl