// clang-format off // 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* HillshadeLayer::Impl::staticTypeInfo() noexcept { const static LayerTypeInfo typeInfo{"hillshade", LayerTypeInfo::Source::Required, LayerTypeInfo::Pass3D::Required, LayerTypeInfo::Layout::NotRequired, LayerTypeInfo::FadingTiles::NotRequired, LayerTypeInfo::CrossTileIndex::NotRequired, LayerTypeInfo::TileKind::RasterDEM}; return &typeInfo; } HillshadeLayer::HillshadeLayer(const std::string& layerID, const std::string& sourceID) : Layer(makeMutable(layerID, sourceID)) { } HillshadeLayer::HillshadeLayer(Immutable impl_) : Layer(std::move(impl_)) { } HillshadeLayer::~HillshadeLayer() = default; const HillshadeLayer::Impl& HillshadeLayer::impl() const { return static_cast(*baseImpl); } Mutable HillshadeLayer::mutableImpl() const { return makeMutable(impl()); } std::unique_ptr HillshadeLayer::cloneRef(const std::string& id_) const { auto impl_ = mutableImpl(); impl_->id = id_; impl_->paint = HillshadePaintProperties::Transitionable(); return std::make_unique(std::move(impl_)); } void HillshadeLayer::Impl::stringifyLayout(rapidjson::Writer&) const { } // Layout properties // Paint properties PropertyValue HillshadeLayer::getDefaultHillshadeAccentColor() { return { Color::black() }; } const PropertyValue& HillshadeLayer::getHillshadeAccentColor() const { return impl().paint.template get().value; } void HillshadeLayer::setHillshadeAccentColor(const PropertyValue& value) { if (value == getHillshadeAccentColor()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void HillshadeLayer::setHillshadeAccentColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions HillshadeLayer::getHillshadeAccentColorTransition() const { return impl().paint.template get().options; } PropertyValue HillshadeLayer::getDefaultHillshadeExaggeration() { return { 0.5 }; } const PropertyValue& HillshadeLayer::getHillshadeExaggeration() const { return impl().paint.template get().value; } void HillshadeLayer::setHillshadeExaggeration(const PropertyValue& value) { if (value == getHillshadeExaggeration()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void HillshadeLayer::setHillshadeExaggerationTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions HillshadeLayer::getHillshadeExaggerationTransition() const { return impl().paint.template get().options; } PropertyValue HillshadeLayer::getDefaultHillshadeHighlightColor() { return { Color::white() }; } const PropertyValue& HillshadeLayer::getHillshadeHighlightColor() const { return impl().paint.template get().value; } void HillshadeLayer::setHillshadeHighlightColor(const PropertyValue& value) { if (value == getHillshadeHighlightColor()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void HillshadeLayer::setHillshadeHighlightColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions HillshadeLayer::getHillshadeHighlightColorTransition() const { return impl().paint.template get().options; } PropertyValue HillshadeLayer::getDefaultHillshadeIlluminationAnchor() { return { HillshadeIlluminationAnchorType::Viewport }; } const PropertyValue& HillshadeLayer::getHillshadeIlluminationAnchor() const { return impl().paint.template get().value; } void HillshadeLayer::setHillshadeIlluminationAnchor(const PropertyValue& value) { if (value == getHillshadeIlluminationAnchor()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void HillshadeLayer::setHillshadeIlluminationAnchorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions HillshadeLayer::getHillshadeIlluminationAnchorTransition() const { return impl().paint.template get().options; } PropertyValue HillshadeLayer::getDefaultHillshadeIlluminationDirection() { return { 335 }; } const PropertyValue& HillshadeLayer::getHillshadeIlluminationDirection() const { return impl().paint.template get().value; } void HillshadeLayer::setHillshadeIlluminationDirection(const PropertyValue& value) { if (value == getHillshadeIlluminationDirection()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void HillshadeLayer::setHillshadeIlluminationDirectionTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions HillshadeLayer::getHillshadeIlluminationDirectionTransition() const { return impl().paint.template get().options; } PropertyValue HillshadeLayer::getDefaultHillshadeShadowColor() { return { Color::black() }; } const PropertyValue& HillshadeLayer::getHillshadeShadowColor() const { return impl().paint.template get().value; } void HillshadeLayer::setHillshadeShadowColor(const PropertyValue& value) { if (value == getHillshadeShadowColor()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void HillshadeLayer::setHillshadeShadowColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions HillshadeLayer::getHillshadeShadowColorTransition() const { return impl().paint.template get().options; } using namespace conversion; namespace { enum class Property : uint8_t { HillshadeAccentColor, HillshadeExaggeration, HillshadeHighlightColor, HillshadeIlluminationAnchor, HillshadeIlluminationDirection, HillshadeShadowColor, HillshadeAccentColorTransition, HillshadeExaggerationTransition, HillshadeHighlightColorTransition, HillshadeIlluminationAnchorTransition, HillshadeIlluminationDirectionTransition, HillshadeShadowColorTransition, }; template constexpr uint8_t toUint8(T t) noexcept { return uint8_t(mbgl::underlying_type(t)); } MAPBOX_ETERNAL_CONSTEXPR const auto paintProperties = mapbox::eternal::hash_map( {{"hillshade-accent-color", toUint8(Property::HillshadeAccentColor)}, {"hillshade-exaggeration", toUint8(Property::HillshadeExaggeration)}, {"hillshade-highlight-color", toUint8(Property::HillshadeHighlightColor)}, {"hillshade-illumination-anchor", toUint8(Property::HillshadeIlluminationAnchor)}, {"hillshade-illumination-direction", toUint8(Property::HillshadeIlluminationDirection)}, {"hillshade-shadow-color", toUint8(Property::HillshadeShadowColor)}, {"hillshade-accent-color-transition", toUint8(Property::HillshadeAccentColorTransition)}, {"hillshade-exaggeration-transition", toUint8(Property::HillshadeExaggerationTransition)}, {"hillshade-highlight-color-transition", toUint8(Property::HillshadeHighlightColorTransition)}, {"hillshade-illumination-anchor-transition", toUint8(Property::HillshadeIlluminationAnchorTransition)}, {"hillshade-illumination-direction-transition", toUint8(Property::HillshadeIlluminationDirectionTransition)}, {"hillshade-shadow-color-transition", toUint8(Property::HillshadeShadowColorTransition)}}); } // namespace optional HillshadeLayer::setPaintProperty(const std::string& name, const Convertible& value) { const auto it = paintProperties.find(name.c_str()); if (it == paintProperties.end()) { return Error{"layer doesn't support this property"}; } auto property = static_cast(it->second); if (property == Property::HillshadeAccentColor || property == Property::HillshadeHighlightColor || property == Property::HillshadeShadowColor) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } if (property == Property::HillshadeAccentColor) { setHillshadeAccentColor(*typedValue); return nullopt; } if (property == Property::HillshadeHighlightColor) { setHillshadeHighlightColor(*typedValue); return nullopt; } if (property == Property::HillshadeShadowColor) { setHillshadeShadowColor(*typedValue); return nullopt; } } if (property == Property::HillshadeExaggeration || property == Property::HillshadeIlluminationDirection) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } if (property == Property::HillshadeExaggeration) { setHillshadeExaggeration(*typedValue); return nullopt; } if (property == Property::HillshadeIlluminationDirection) { setHillshadeIlluminationDirection(*typedValue); return nullopt; } } if (property == Property::HillshadeIlluminationAnchor) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setHillshadeIlluminationAnchor(*typedValue); return nullopt; } Error error; optional transition = convert(value, error); if (!transition) { return error; } if (property == Property::HillshadeAccentColorTransition) { setHillshadeAccentColorTransition(*transition); return nullopt; } if (property == Property::HillshadeExaggerationTransition) { setHillshadeExaggerationTransition(*transition); return nullopt; } if (property == Property::HillshadeHighlightColorTransition) { setHillshadeHighlightColorTransition(*transition); return nullopt; } if (property == Property::HillshadeIlluminationAnchorTransition) { setHillshadeIlluminationAnchorTransition(*transition); return nullopt; } if (property == Property::HillshadeIlluminationDirectionTransition) { setHillshadeIlluminationDirectionTransition(*transition); return nullopt; } if (property == Property::HillshadeShadowColorTransition) { setHillshadeShadowColorTransition(*transition); return nullopt; } return Error{"layer doesn't support this property"}; } StyleProperty HillshadeLayer::getProperty(const std::string& name) const { const auto it = paintProperties.find(name.c_str()); if (it == paintProperties.end()) { return {}; } switch (static_cast(it->second)) { case Property::HillshadeAccentColor: return makeStyleProperty(getHillshadeAccentColor()); case Property::HillshadeExaggeration: return makeStyleProperty(getHillshadeExaggeration()); case Property::HillshadeHighlightColor: return makeStyleProperty(getHillshadeHighlightColor()); case Property::HillshadeIlluminationAnchor: return makeStyleProperty(getHillshadeIlluminationAnchor()); case Property::HillshadeIlluminationDirection: return makeStyleProperty(getHillshadeIlluminationDirection()); case Property::HillshadeShadowColor: return makeStyleProperty(getHillshadeShadowColor()); case Property::HillshadeAccentColorTransition: return makeStyleProperty(getHillshadeAccentColorTransition()); case Property::HillshadeExaggerationTransition: return makeStyleProperty(getHillshadeExaggerationTransition()); case Property::HillshadeHighlightColorTransition: return makeStyleProperty(getHillshadeHighlightColorTransition()); case Property::HillshadeIlluminationAnchorTransition: return makeStyleProperty(getHillshadeIlluminationAnchorTransition()); case Property::HillshadeIlluminationDirectionTransition: return makeStyleProperty(getHillshadeIlluminationDirectionTransition()); case Property::HillshadeShadowColorTransition: return makeStyleProperty(getHillshadeShadowColorTransition()); } return {}; } optional HillshadeLayer::setLayoutProperty(const std::string& name, const Convertible& value) { if (name == "visibility") { return Layer::setVisibility(value); } return Error { "layer doesn't support this property" }; } Mutable HillshadeLayer::mutableBaseImpl() const { return staticMutableCast(mutableImpl()); } } // namespace style } // namespace mbgl // clang-format on