// 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* HeatmapLayer::Impl::staticTypeInfo() noexcept { const static LayerTypeInfo typeInfo{"heatmap", LayerTypeInfo::Source::Required, LayerTypeInfo::Pass3D::Required, LayerTypeInfo::Layout::NotRequired, LayerTypeInfo::FadingTiles::NotRequired, LayerTypeInfo::CrossTileIndex::NotRequired, LayerTypeInfo::TileKind::Geometry}; return &typeInfo; } HeatmapLayer::HeatmapLayer(const std::string& layerID, const std::string& sourceID) : Layer(makeMutable(layerID, sourceID)) { } HeatmapLayer::HeatmapLayer(Immutable impl_) : Layer(std::move(impl_)) { } HeatmapLayer::~HeatmapLayer() = default; const HeatmapLayer::Impl& HeatmapLayer::impl() const { return static_cast(*baseImpl); } Mutable HeatmapLayer::mutableImpl() const { return makeMutable(impl()); } std::unique_ptr HeatmapLayer::cloneRef(const std::string& id_) const { auto impl_ = mutableImpl(); impl_->id = id_; impl_->paint = HeatmapPaintProperties::Transitionable(); return std::make_unique(std::move(impl_)); } void HeatmapLayer::Impl::stringifyLayout(rapidjson::Writer&) const { } // Layout properties // Paint properties ColorRampPropertyValue HeatmapLayer::getDefaultHeatmapColor() { conversion::Error error; std::string rawValue = R"JSON(["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"])JSON"; return *conversion::convertJSON(rawValue, error); } const ColorRampPropertyValue& HeatmapLayer::getHeatmapColor() const { return impl().paint.template get().value; } void HeatmapLayer::setHeatmapColor(const ColorRampPropertyValue& value) { if (value == getHeatmapColor()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void HeatmapLayer::setHeatmapColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions HeatmapLayer::getHeatmapColorTransition() const { return impl().paint.template get().options; } PropertyValue HeatmapLayer::getDefaultHeatmapIntensity() { return { 1 }; } const PropertyValue& HeatmapLayer::getHeatmapIntensity() const { return impl().paint.template get().value; } void HeatmapLayer::setHeatmapIntensity(const PropertyValue& value) { if (value == getHeatmapIntensity()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void HeatmapLayer::setHeatmapIntensityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions HeatmapLayer::getHeatmapIntensityTransition() const { return impl().paint.template get().options; } PropertyValue HeatmapLayer::getDefaultHeatmapOpacity() { return { 1 }; } const PropertyValue& HeatmapLayer::getHeatmapOpacity() const { return impl().paint.template get().value; } void HeatmapLayer::setHeatmapOpacity(const PropertyValue& value) { if (value == getHeatmapOpacity()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void HeatmapLayer::setHeatmapOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions HeatmapLayer::getHeatmapOpacityTransition() const { return impl().paint.template get().options; } PropertyValue HeatmapLayer::getDefaultHeatmapRadius() { return { 30 }; } const PropertyValue& HeatmapLayer::getHeatmapRadius() const { return impl().paint.template get().value; } void HeatmapLayer::setHeatmapRadius(const PropertyValue& value) { if (value == getHeatmapRadius()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void HeatmapLayer::setHeatmapRadiusTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions HeatmapLayer::getHeatmapRadiusTransition() const { return impl().paint.template get().options; } PropertyValue HeatmapLayer::getDefaultHeatmapWeight() { return { 1 }; } const PropertyValue& HeatmapLayer::getHeatmapWeight() const { return impl().paint.template get().value; } void HeatmapLayer::setHeatmapWeight(const PropertyValue& value) { if (value == getHeatmapWeight()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void HeatmapLayer::setHeatmapWeightTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions HeatmapLayer::getHeatmapWeightTransition() const { return impl().paint.template get().options; } using namespace conversion; namespace { enum class Property : uint8_t { HeatmapColor, HeatmapIntensity, HeatmapOpacity, HeatmapRadius, HeatmapWeight, HeatmapColorTransition, HeatmapIntensityTransition, HeatmapOpacityTransition, HeatmapRadiusTransition, HeatmapWeightTransition, }; 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( {{"heatmap-color", toUint8(Property::HeatmapColor)}, {"heatmap-intensity", toUint8(Property::HeatmapIntensity)}, {"heatmap-opacity", toUint8(Property::HeatmapOpacity)}, {"heatmap-radius", toUint8(Property::HeatmapRadius)}, {"heatmap-weight", toUint8(Property::HeatmapWeight)}, {"heatmap-color-transition", toUint8(Property::HeatmapColorTransition)}, {"heatmap-intensity-transition", toUint8(Property::HeatmapIntensityTransition)}, {"heatmap-opacity-transition", toUint8(Property::HeatmapOpacityTransition)}, {"heatmap-radius-transition", toUint8(Property::HeatmapRadiusTransition)}, {"heatmap-weight-transition", toUint8(Property::HeatmapWeightTransition)}}); } // namespace optional HeatmapLayer::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::HeatmapColor) { Error error; optional typedValue = convert(value, error, false, false); if (!typedValue) { return error; } setHeatmapColor(*typedValue); return nullopt; } if (property == Property::HeatmapIntensity || property == Property::HeatmapOpacity) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } if (property == Property::HeatmapIntensity) { setHeatmapIntensity(*typedValue); return nullopt; } if (property == Property::HeatmapOpacity) { setHeatmapOpacity(*typedValue); return nullopt; } } if (property == Property::HeatmapRadius || property == Property::HeatmapWeight) { Error error; optional> typedValue = convert>(value, error, true, false); if (!typedValue) { return error; } if (property == Property::HeatmapRadius) { setHeatmapRadius(*typedValue); return nullopt; } if (property == Property::HeatmapWeight) { setHeatmapWeight(*typedValue); return nullopt; } } Error error; optional transition = convert(value, error); if (!transition) { return error; } if (property == Property::HeatmapColorTransition) { setHeatmapColorTransition(*transition); return nullopt; } if (property == Property::HeatmapIntensityTransition) { setHeatmapIntensityTransition(*transition); return nullopt; } if (property == Property::HeatmapOpacityTransition) { setHeatmapOpacityTransition(*transition); return nullopt; } if (property == Property::HeatmapRadiusTransition) { setHeatmapRadiusTransition(*transition); return nullopt; } if (property == Property::HeatmapWeightTransition) { setHeatmapWeightTransition(*transition); return nullopt; } return Error{"layer doesn't support this property"}; } StyleProperty HeatmapLayer::getPaintProperty(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::HeatmapColor: return makeStyleProperty(getHeatmapColor()); case Property::HeatmapIntensity: return makeStyleProperty(getHeatmapIntensity()); case Property::HeatmapOpacity: return makeStyleProperty(getHeatmapOpacity()); case Property::HeatmapRadius: return makeStyleProperty(getHeatmapRadius()); case Property::HeatmapWeight: return makeStyleProperty(getHeatmapWeight()); case Property::HeatmapColorTransition: return makeStyleProperty(getHeatmapColorTransition()); case Property::HeatmapIntensityTransition: return makeStyleProperty(getHeatmapIntensityTransition()); case Property::HeatmapOpacityTransition: return makeStyleProperty(getHeatmapOpacityTransition()); case Property::HeatmapRadiusTransition: return makeStyleProperty(getHeatmapRadiusTransition()); case Property::HeatmapWeightTransition: return makeStyleProperty(getHeatmapWeightTransition()); } return {}; } optional HeatmapLayer::setLayoutProperty(const std::string& name, const Convertible& value) { if (name == "visibility") { return Layer::setVisibility(value); } return Error { "layer doesn't support this property" }; } Mutable HeatmapLayer::mutableBaseImpl() const { return staticMutableCast(mutableImpl()); } } // namespace style } // namespace mbgl // clang-format on