diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-05-02 15:25:48 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2019-05-02 17:44:18 +0200 |
commit | 2489afdd0db97de0664198f5ae64bd94db6b6fc7 (patch) | |
tree | a7a52194daab971f58f60ef21bd45b1a0d517f4b /src | |
parent | a48152a9811a856e467eff3e396a76a059558fb1 (diff) | |
download | qtlocation-mapboxgl-2489afdd0db97de0664198f5ae64bd94db6b6fc7.tar.gz |
[build] change style code generator to sort properties alphabetically
JSON keys in our style specification don't have a defined order. This change sorts them alphabetically so that we can rely on the order remaining them same across code generation runs.
Diffstat (limited to 'src')
19 files changed, 1746 insertions, 1746 deletions
diff --git a/src/mbgl/style/layers/background_layer.cpp b/src/mbgl/style/layers/background_layer.cpp index 530c3ce6bf..76256b8d30 100644 --- a/src/mbgl/style/layers/background_layer.cpp +++ b/src/mbgl/style/layers/background_layer.cpp @@ -90,58 +90,58 @@ TransitionOptions BackgroundLayer::getBackgroundColorTransition() const { return impl().paint.template get<BackgroundColor>().options; } -PropertyValue<std::string> BackgroundLayer::getDefaultBackgroundPattern() { - return { "" }; +PropertyValue<float> BackgroundLayer::getDefaultBackgroundOpacity() { + return { 1 }; } -const PropertyValue<std::string>& BackgroundLayer::getBackgroundPattern() const { - return impl().paint.template get<BackgroundPattern>().value; +const PropertyValue<float>& BackgroundLayer::getBackgroundOpacity() const { + return impl().paint.template get<BackgroundOpacity>().value; } -void BackgroundLayer::setBackgroundPattern(const PropertyValue<std::string>& value) { - if (value == getBackgroundPattern()) +void BackgroundLayer::setBackgroundOpacity(const PropertyValue<float>& value) { + if (value == getBackgroundOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<BackgroundPattern>().value = value; + impl_->paint.template get<BackgroundOpacity>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void BackgroundLayer::setBackgroundPatternTransition(const TransitionOptions& options) { +void BackgroundLayer::setBackgroundOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<BackgroundPattern>().options = options; + impl_->paint.template get<BackgroundOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions BackgroundLayer::getBackgroundPatternTransition() const { - return impl().paint.template get<BackgroundPattern>().options; +TransitionOptions BackgroundLayer::getBackgroundOpacityTransition() const { + return impl().paint.template get<BackgroundOpacity>().options; } -PropertyValue<float> BackgroundLayer::getDefaultBackgroundOpacity() { - return { 1 }; +PropertyValue<std::string> BackgroundLayer::getDefaultBackgroundPattern() { + return { "" }; } -const PropertyValue<float>& BackgroundLayer::getBackgroundOpacity() const { - return impl().paint.template get<BackgroundOpacity>().value; +const PropertyValue<std::string>& BackgroundLayer::getBackgroundPattern() const { + return impl().paint.template get<BackgroundPattern>().value; } -void BackgroundLayer::setBackgroundOpacity(const PropertyValue<float>& value) { - if (value == getBackgroundOpacity()) +void BackgroundLayer::setBackgroundPattern(const PropertyValue<std::string>& value) { + if (value == getBackgroundPattern()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<BackgroundOpacity>().value = value; + impl_->paint.template get<BackgroundPattern>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void BackgroundLayer::setBackgroundOpacityTransition(const TransitionOptions& options) { +void BackgroundLayer::setBackgroundPatternTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<BackgroundOpacity>().options = options; + impl_->paint.template get<BackgroundPattern>().options = options; baseImpl = std::move(impl_); } -TransitionOptions BackgroundLayer::getBackgroundOpacityTransition() const { - return impl().paint.template get<BackgroundOpacity>().options; +TransitionOptions BackgroundLayer::getBackgroundPatternTransition() const { + return impl().paint.template get<BackgroundPattern>().options; } using namespace conversion; @@ -149,20 +149,20 @@ using namespace conversion; optional<Error> BackgroundLayer::setPaintProperty(const std::string& name, const Convertible& value) { enum class Property : uint8_t { BackgroundColor, - BackgroundPattern, BackgroundOpacity, + BackgroundPattern, BackgroundColorTransition, - BackgroundPatternTransition, BackgroundOpacityTransition, + BackgroundPatternTransition, }; MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({ { "background-color", static_cast<uint8_t>(Property::BackgroundColor) }, - { "background-pattern", static_cast<uint8_t>(Property::BackgroundPattern) }, { "background-opacity", static_cast<uint8_t>(Property::BackgroundOpacity) }, + { "background-pattern", static_cast<uint8_t>(Property::BackgroundPattern) }, { "background-color-transition", static_cast<uint8_t>(Property::BackgroundColorTransition) }, - { "background-pattern-transition", static_cast<uint8_t>(Property::BackgroundPatternTransition) }, - { "background-opacity-transition", static_cast<uint8_t>(Property::BackgroundOpacityTransition) } + { "background-opacity-transition", static_cast<uint8_t>(Property::BackgroundOpacityTransition) }, + { "background-pattern-transition", static_cast<uint8_t>(Property::BackgroundPatternTransition) } }); const auto it = properties.find(name.c_str()); @@ -185,26 +185,26 @@ optional<Error> BackgroundLayer::setPaintProperty(const std::string& name, const } - if (property == Property::BackgroundPattern) { + if (property == Property::BackgroundOpacity) { Error error; - optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, false, false); + optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false); if (!typedValue) { return error; } - setBackgroundPattern(*typedValue); + setBackgroundOpacity(*typedValue); return nullopt; } - if (property == Property::BackgroundOpacity) { + if (property == Property::BackgroundPattern) { Error error; - optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false); + optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, false, false); if (!typedValue) { return error; } - setBackgroundOpacity(*typedValue); + setBackgroundPattern(*typedValue); return nullopt; } @@ -221,13 +221,13 @@ optional<Error> BackgroundLayer::setPaintProperty(const std::string& name, const return nullopt; } - if (property == Property::BackgroundPatternTransition) { - setBackgroundPatternTransition(*transition); + if (property == Property::BackgroundOpacityTransition) { + setBackgroundOpacityTransition(*transition); return nullopt; } - if (property == Property::BackgroundOpacityTransition) { - setBackgroundOpacityTransition(*transition); + if (property == Property::BackgroundPatternTransition) { + setBackgroundPatternTransition(*transition); return nullopt; } diff --git a/src/mbgl/style/layers/background_layer_properties.hpp b/src/mbgl/style/layers/background_layer_properties.hpp index 3765e2e569..371e8639f1 100644 --- a/src/mbgl/style/layers/background_layer_properties.hpp +++ b/src/mbgl/style/layers/background_layer_properties.hpp @@ -18,18 +18,18 @@ struct BackgroundColor : PaintProperty<Color> { static Color defaultValue() { return Color::black(); } }; -struct BackgroundPattern : CrossFadedPaintProperty<std::string> { - static std::string defaultValue() { return ""; } -}; - struct BackgroundOpacity : PaintProperty<float> { static float defaultValue() { return 1; } }; +struct BackgroundPattern : CrossFadedPaintProperty<std::string> { + static std::string defaultValue() { return ""; } +}; + class BackgroundPaintProperties : public Properties< BackgroundColor, - BackgroundPattern, - BackgroundOpacity + BackgroundOpacity, + BackgroundPattern > {}; class BackgroundLayerProperties final : public LayerProperties { diff --git a/src/mbgl/style/layers/circle_layer.cpp b/src/mbgl/style/layers/circle_layer.cpp index 2759549e1c..a95193d651 100644 --- a/src/mbgl/style/layers/circle_layer.cpp +++ b/src/mbgl/style/layers/circle_layer.cpp @@ -63,31 +63,31 @@ void CircleLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffe // Paint properties -PropertyValue<float> CircleLayer::getDefaultCircleRadius() { - return { 5 }; +PropertyValue<float> CircleLayer::getDefaultCircleBlur() { + return { 0 }; } -const PropertyValue<float>& CircleLayer::getCircleRadius() const { - return impl().paint.template get<CircleRadius>().value; +const PropertyValue<float>& CircleLayer::getCircleBlur() const { + return impl().paint.template get<CircleBlur>().value; } -void CircleLayer::setCircleRadius(const PropertyValue<float>& value) { - if (value == getCircleRadius()) +void CircleLayer::setCircleBlur(const PropertyValue<float>& value) { + if (value == getCircleBlur()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleRadius>().value = value; + impl_->paint.template get<CircleBlur>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void CircleLayer::setCircleRadiusTransition(const TransitionOptions& options) { +void CircleLayer::setCircleBlurTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleRadius>().options = options; + impl_->paint.template get<CircleBlur>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleRadiusTransition() const { - return impl().paint.template get<CircleRadius>().options; +TransitionOptions CircleLayer::getCircleBlurTransition() const { + return impl().paint.template get<CircleBlur>().options; } PropertyValue<Color> CircleLayer::getDefaultCircleColor() { @@ -117,166 +117,166 @@ TransitionOptions CircleLayer::getCircleColorTransition() const { return impl().paint.template get<CircleColor>().options; } -PropertyValue<float> CircleLayer::getDefaultCircleBlur() { - return { 0 }; +PropertyValue<float> CircleLayer::getDefaultCircleOpacity() { + return { 1 }; } -const PropertyValue<float>& CircleLayer::getCircleBlur() const { - return impl().paint.template get<CircleBlur>().value; +const PropertyValue<float>& CircleLayer::getCircleOpacity() const { + return impl().paint.template get<CircleOpacity>().value; } -void CircleLayer::setCircleBlur(const PropertyValue<float>& value) { - if (value == getCircleBlur()) +void CircleLayer::setCircleOpacity(const PropertyValue<float>& value) { + if (value == getCircleOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleBlur>().value = value; + impl_->paint.template get<CircleOpacity>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void CircleLayer::setCircleBlurTransition(const TransitionOptions& options) { +void CircleLayer::setCircleOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleBlur>().options = options; + impl_->paint.template get<CircleOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleBlurTransition() const { - return impl().paint.template get<CircleBlur>().options; +TransitionOptions CircleLayer::getCircleOpacityTransition() const { + return impl().paint.template get<CircleOpacity>().options; } -PropertyValue<float> CircleLayer::getDefaultCircleOpacity() { - return { 1 }; +PropertyValue<AlignmentType> CircleLayer::getDefaultCirclePitchAlignment() { + return { AlignmentType::Viewport }; } -const PropertyValue<float>& CircleLayer::getCircleOpacity() const { - return impl().paint.template get<CircleOpacity>().value; +const PropertyValue<AlignmentType>& CircleLayer::getCirclePitchAlignment() const { + return impl().paint.template get<CirclePitchAlignment>().value; } -void CircleLayer::setCircleOpacity(const PropertyValue<float>& value) { - if (value == getCircleOpacity()) +void CircleLayer::setCirclePitchAlignment(const PropertyValue<AlignmentType>& value) { + if (value == getCirclePitchAlignment()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleOpacity>().value = value; + impl_->paint.template get<CirclePitchAlignment>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void CircleLayer::setCircleOpacityTransition(const TransitionOptions& options) { +void CircleLayer::setCirclePitchAlignmentTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleOpacity>().options = options; + impl_->paint.template get<CirclePitchAlignment>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleOpacityTransition() const { - return impl().paint.template get<CircleOpacity>().options; +TransitionOptions CircleLayer::getCirclePitchAlignmentTransition() const { + return impl().paint.template get<CirclePitchAlignment>().options; } -PropertyValue<std::array<float, 2>> CircleLayer::getDefaultCircleTranslate() { - return { {{ 0, 0 }} }; +PropertyValue<CirclePitchScaleType> CircleLayer::getDefaultCirclePitchScale() { + return { CirclePitchScaleType::Map }; } -const PropertyValue<std::array<float, 2>>& CircleLayer::getCircleTranslate() const { - return impl().paint.template get<CircleTranslate>().value; +const PropertyValue<CirclePitchScaleType>& CircleLayer::getCirclePitchScale() const { + return impl().paint.template get<CirclePitchScale>().value; } -void CircleLayer::setCircleTranslate(const PropertyValue<std::array<float, 2>>& value) { - if (value == getCircleTranslate()) +void CircleLayer::setCirclePitchScale(const PropertyValue<CirclePitchScaleType>& value) { + if (value == getCirclePitchScale()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleTranslate>().value = value; + impl_->paint.template get<CirclePitchScale>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void CircleLayer::setCircleTranslateTransition(const TransitionOptions& options) { +void CircleLayer::setCirclePitchScaleTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleTranslate>().options = options; + impl_->paint.template get<CirclePitchScale>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleTranslateTransition() const { - return impl().paint.template get<CircleTranslate>().options; +TransitionOptions CircleLayer::getCirclePitchScaleTransition() const { + return impl().paint.template get<CirclePitchScale>().options; } -PropertyValue<TranslateAnchorType> CircleLayer::getDefaultCircleTranslateAnchor() { - return { TranslateAnchorType::Map }; +PropertyValue<float> CircleLayer::getDefaultCircleRadius() { + return { 5 }; } -const PropertyValue<TranslateAnchorType>& CircleLayer::getCircleTranslateAnchor() const { - return impl().paint.template get<CircleTranslateAnchor>().value; +const PropertyValue<float>& CircleLayer::getCircleRadius() const { + return impl().paint.template get<CircleRadius>().value; } -void CircleLayer::setCircleTranslateAnchor(const PropertyValue<TranslateAnchorType>& value) { - if (value == getCircleTranslateAnchor()) +void CircleLayer::setCircleRadius(const PropertyValue<float>& value) { + if (value == getCircleRadius()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleTranslateAnchor>().value = value; + impl_->paint.template get<CircleRadius>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void CircleLayer::setCircleTranslateAnchorTransition(const TransitionOptions& options) { +void CircleLayer::setCircleRadiusTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleTranslateAnchor>().options = options; + impl_->paint.template get<CircleRadius>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleTranslateAnchorTransition() const { - return impl().paint.template get<CircleTranslateAnchor>().options; +TransitionOptions CircleLayer::getCircleRadiusTransition() const { + return impl().paint.template get<CircleRadius>().options; } -PropertyValue<CirclePitchScaleType> CircleLayer::getDefaultCirclePitchScale() { - return { CirclePitchScaleType::Map }; +PropertyValue<Color> CircleLayer::getDefaultCircleStrokeColor() { + return { Color::black() }; } -const PropertyValue<CirclePitchScaleType>& CircleLayer::getCirclePitchScale() const { - return impl().paint.template get<CirclePitchScale>().value; +const PropertyValue<Color>& CircleLayer::getCircleStrokeColor() const { + return impl().paint.template get<CircleStrokeColor>().value; } -void CircleLayer::setCirclePitchScale(const PropertyValue<CirclePitchScaleType>& value) { - if (value == getCirclePitchScale()) +void CircleLayer::setCircleStrokeColor(const PropertyValue<Color>& value) { + if (value == getCircleStrokeColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CirclePitchScale>().value = value; + impl_->paint.template get<CircleStrokeColor>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void CircleLayer::setCirclePitchScaleTransition(const TransitionOptions& options) { +void CircleLayer::setCircleStrokeColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CirclePitchScale>().options = options; + impl_->paint.template get<CircleStrokeColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCirclePitchScaleTransition() const { - return impl().paint.template get<CirclePitchScale>().options; +TransitionOptions CircleLayer::getCircleStrokeColorTransition() const { + return impl().paint.template get<CircleStrokeColor>().options; } -PropertyValue<AlignmentType> CircleLayer::getDefaultCirclePitchAlignment() { - return { AlignmentType::Viewport }; +PropertyValue<float> CircleLayer::getDefaultCircleStrokeOpacity() { + return { 1 }; } -const PropertyValue<AlignmentType>& CircleLayer::getCirclePitchAlignment() const { - return impl().paint.template get<CirclePitchAlignment>().value; +const PropertyValue<float>& CircleLayer::getCircleStrokeOpacity() const { + return impl().paint.template get<CircleStrokeOpacity>().value; } -void CircleLayer::setCirclePitchAlignment(const PropertyValue<AlignmentType>& value) { - if (value == getCirclePitchAlignment()) +void CircleLayer::setCircleStrokeOpacity(const PropertyValue<float>& value) { + if (value == getCircleStrokeOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CirclePitchAlignment>().value = value; + impl_->paint.template get<CircleStrokeOpacity>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void CircleLayer::setCirclePitchAlignmentTransition(const TransitionOptions& options) { +void CircleLayer::setCircleStrokeOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CirclePitchAlignment>().options = options; + impl_->paint.template get<CircleStrokeOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCirclePitchAlignmentTransition() const { - return impl().paint.template get<CirclePitchAlignment>().options; +TransitionOptions CircleLayer::getCircleStrokeOpacityTransition() const { + return impl().paint.template get<CircleStrokeOpacity>().options; } PropertyValue<float> CircleLayer::getDefaultCircleStrokeWidth() { @@ -306,111 +306,111 @@ TransitionOptions CircleLayer::getCircleStrokeWidthTransition() const { return impl().paint.template get<CircleStrokeWidth>().options; } -PropertyValue<Color> CircleLayer::getDefaultCircleStrokeColor() { - return { Color::black() }; +PropertyValue<std::array<float, 2>> CircleLayer::getDefaultCircleTranslate() { + return { {{ 0, 0 }} }; } -const PropertyValue<Color>& CircleLayer::getCircleStrokeColor() const { - return impl().paint.template get<CircleStrokeColor>().value; +const PropertyValue<std::array<float, 2>>& CircleLayer::getCircleTranslate() const { + return impl().paint.template get<CircleTranslate>().value; } -void CircleLayer::setCircleStrokeColor(const PropertyValue<Color>& value) { - if (value == getCircleStrokeColor()) +void CircleLayer::setCircleTranslate(const PropertyValue<std::array<float, 2>>& value) { + if (value == getCircleTranslate()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleStrokeColor>().value = value; + impl_->paint.template get<CircleTranslate>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void CircleLayer::setCircleStrokeColorTransition(const TransitionOptions& options) { +void CircleLayer::setCircleTranslateTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleStrokeColor>().options = options; + impl_->paint.template get<CircleTranslate>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleStrokeColorTransition() const { - return impl().paint.template get<CircleStrokeColor>().options; +TransitionOptions CircleLayer::getCircleTranslateTransition() const { + return impl().paint.template get<CircleTranslate>().options; } -PropertyValue<float> CircleLayer::getDefaultCircleStrokeOpacity() { - return { 1 }; +PropertyValue<TranslateAnchorType> CircleLayer::getDefaultCircleTranslateAnchor() { + return { TranslateAnchorType::Map }; } -const PropertyValue<float>& CircleLayer::getCircleStrokeOpacity() const { - return impl().paint.template get<CircleStrokeOpacity>().value; +const PropertyValue<TranslateAnchorType>& CircleLayer::getCircleTranslateAnchor() const { + return impl().paint.template get<CircleTranslateAnchor>().value; } -void CircleLayer::setCircleStrokeOpacity(const PropertyValue<float>& value) { - if (value == getCircleStrokeOpacity()) +void CircleLayer::setCircleTranslateAnchor(const PropertyValue<TranslateAnchorType>& value) { + if (value == getCircleTranslateAnchor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleStrokeOpacity>().value = value; + impl_->paint.template get<CircleTranslateAnchor>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void CircleLayer::setCircleStrokeOpacityTransition(const TransitionOptions& options) { +void CircleLayer::setCircleTranslateAnchorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleStrokeOpacity>().options = options; + impl_->paint.template get<CircleTranslateAnchor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleStrokeOpacityTransition() const { - return impl().paint.template get<CircleStrokeOpacity>().options; +TransitionOptions CircleLayer::getCircleTranslateAnchorTransition() const { + return impl().paint.template get<CircleTranslateAnchor>().options; } using namespace conversion; optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Convertible& value) { enum class Property : uint8_t { - CircleRadius, - CircleColor, CircleBlur, + CircleColor, CircleOpacity, - CircleTranslate, - CircleTranslateAnchor, - CirclePitchScale, CirclePitchAlignment, - CircleStrokeWidth, + CirclePitchScale, + CircleRadius, CircleStrokeColor, CircleStrokeOpacity, - CircleRadiusTransition, - CircleColorTransition, + CircleStrokeWidth, + CircleTranslate, + CircleTranslateAnchor, CircleBlurTransition, + CircleColorTransition, CircleOpacityTransition, - CircleTranslateTransition, - CircleTranslateAnchorTransition, - CirclePitchScaleTransition, CirclePitchAlignmentTransition, - CircleStrokeWidthTransition, + CirclePitchScaleTransition, + CircleRadiusTransition, CircleStrokeColorTransition, CircleStrokeOpacityTransition, + CircleStrokeWidthTransition, + CircleTranslateTransition, + CircleTranslateAnchorTransition, }; MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({ - { "circle-radius", static_cast<uint8_t>(Property::CircleRadius) }, - { "circle-color", static_cast<uint8_t>(Property::CircleColor) }, { "circle-blur", static_cast<uint8_t>(Property::CircleBlur) }, + { "circle-color", static_cast<uint8_t>(Property::CircleColor) }, { "circle-opacity", static_cast<uint8_t>(Property::CircleOpacity) }, - { "circle-translate", static_cast<uint8_t>(Property::CircleTranslate) }, - { "circle-translate-anchor", static_cast<uint8_t>(Property::CircleTranslateAnchor) }, - { "circle-pitch-scale", static_cast<uint8_t>(Property::CirclePitchScale) }, { "circle-pitch-alignment", static_cast<uint8_t>(Property::CirclePitchAlignment) }, - { "circle-stroke-width", static_cast<uint8_t>(Property::CircleStrokeWidth) }, + { "circle-pitch-scale", static_cast<uint8_t>(Property::CirclePitchScale) }, + { "circle-radius", static_cast<uint8_t>(Property::CircleRadius) }, { "circle-stroke-color", static_cast<uint8_t>(Property::CircleStrokeColor) }, { "circle-stroke-opacity", static_cast<uint8_t>(Property::CircleStrokeOpacity) }, - { "circle-radius-transition", static_cast<uint8_t>(Property::CircleRadiusTransition) }, - { "circle-color-transition", static_cast<uint8_t>(Property::CircleColorTransition) }, + { "circle-stroke-width", static_cast<uint8_t>(Property::CircleStrokeWidth) }, + { "circle-translate", static_cast<uint8_t>(Property::CircleTranslate) }, + { "circle-translate-anchor", static_cast<uint8_t>(Property::CircleTranslateAnchor) }, { "circle-blur-transition", static_cast<uint8_t>(Property::CircleBlurTransition) }, + { "circle-color-transition", static_cast<uint8_t>(Property::CircleColorTransition) }, { "circle-opacity-transition", static_cast<uint8_t>(Property::CircleOpacityTransition) }, - { "circle-translate-transition", static_cast<uint8_t>(Property::CircleTranslateTransition) }, - { "circle-translate-anchor-transition", static_cast<uint8_t>(Property::CircleTranslateAnchorTransition) }, - { "circle-pitch-scale-transition", static_cast<uint8_t>(Property::CirclePitchScaleTransition) }, { "circle-pitch-alignment-transition", static_cast<uint8_t>(Property::CirclePitchAlignmentTransition) }, - { "circle-stroke-width-transition", static_cast<uint8_t>(Property::CircleStrokeWidthTransition) }, + { "circle-pitch-scale-transition", static_cast<uint8_t>(Property::CirclePitchScaleTransition) }, + { "circle-radius-transition", static_cast<uint8_t>(Property::CircleRadiusTransition) }, { "circle-stroke-color-transition", static_cast<uint8_t>(Property::CircleStrokeColorTransition) }, - { "circle-stroke-opacity-transition", static_cast<uint8_t>(Property::CircleStrokeOpacityTransition) } + { "circle-stroke-opacity-transition", static_cast<uint8_t>(Property::CircleStrokeOpacityTransition) }, + { "circle-stroke-width-transition", static_cast<uint8_t>(Property::CircleStrokeWidthTransition) }, + { "circle-translate-transition", static_cast<uint8_t>(Property::CircleTranslateTransition) }, + { "circle-translate-anchor-transition", static_cast<uint8_t>(Property::CircleTranslateAnchorTransition) } }); const auto it = properties.find(name.c_str()); @@ -421,18 +421,13 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con auto property = static_cast<Property>(it->second); - if (property == Property::CircleRadius || property == Property::CircleBlur || property == Property::CircleOpacity || property == Property::CircleStrokeWidth || property == Property::CircleStrokeOpacity) { + if (property == Property::CircleBlur || property == Property::CircleOpacity || property == Property::CircleRadius || property == Property::CircleStrokeOpacity || property == Property::CircleStrokeWidth) { Error error; optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false); if (!typedValue) { return error; } - if (property == Property::CircleRadius) { - setCircleRadius(*typedValue); - return nullopt; - } - if (property == Property::CircleBlur) { setCircleBlur(*typedValue); return nullopt; @@ -443,8 +438,8 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con return nullopt; } - if (property == Property::CircleStrokeWidth) { - setCircleStrokeWidth(*typedValue); + if (property == Property::CircleRadius) { + setCircleRadius(*typedValue); return nullopt; } @@ -453,6 +448,11 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con return nullopt; } + if (property == Property::CircleStrokeWidth) { + setCircleStrokeWidth(*typedValue); + return nullopt; + } + } if (property == Property::CircleColor || property == Property::CircleStrokeColor) { @@ -474,50 +474,50 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con } - if (property == Property::CircleTranslate) { + if (property == Property::CirclePitchAlignment) { Error error; - optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false); + optional<PropertyValue<AlignmentType>> typedValue = convert<PropertyValue<AlignmentType>>(value, error, false, false); if (!typedValue) { return error; } - setCircleTranslate(*typedValue); + setCirclePitchAlignment(*typedValue); return nullopt; } - if (property == Property::CircleTranslateAnchor) { + if (property == Property::CirclePitchScale) { Error error; - optional<PropertyValue<TranslateAnchorType>> typedValue = convert<PropertyValue<TranslateAnchorType>>(value, error, false, false); + optional<PropertyValue<CirclePitchScaleType>> typedValue = convert<PropertyValue<CirclePitchScaleType>>(value, error, false, false); if (!typedValue) { return error; } - setCircleTranslateAnchor(*typedValue); + setCirclePitchScale(*typedValue); return nullopt; } - if (property == Property::CirclePitchScale) { + if (property == Property::CircleTranslate) { Error error; - optional<PropertyValue<CirclePitchScaleType>> typedValue = convert<PropertyValue<CirclePitchScaleType>>(value, error, false, false); + optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false); if (!typedValue) { return error; } - setCirclePitchScale(*typedValue); + setCircleTranslate(*typedValue); return nullopt; } - if (property == Property::CirclePitchAlignment) { + if (property == Property::CircleTranslateAnchor) { Error error; - optional<PropertyValue<AlignmentType>> typedValue = convert<PropertyValue<AlignmentType>>(value, error, false, false); + optional<PropertyValue<TranslateAnchorType>> typedValue = convert<PropertyValue<TranslateAnchorType>>(value, error, false, false); if (!typedValue) { return error; } - setCirclePitchAlignment(*typedValue); + setCircleTranslateAnchor(*typedValue); return nullopt; } @@ -529,8 +529,8 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con return error; } - if (property == Property::CircleRadiusTransition) { - setCircleRadiusTransition(*transition); + if (property == Property::CircleBlurTransition) { + setCircleBlurTransition(*transition); return nullopt; } @@ -539,33 +539,33 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con return nullopt; } - if (property == Property::CircleBlurTransition) { - setCircleBlurTransition(*transition); + if (property == Property::CircleOpacityTransition) { + setCircleOpacityTransition(*transition); return nullopt; } - if (property == Property::CircleOpacityTransition) { - setCircleOpacityTransition(*transition); + if (property == Property::CirclePitchAlignmentTransition) { + setCirclePitchAlignmentTransition(*transition); return nullopt; } - if (property == Property::CircleTranslateTransition) { - setCircleTranslateTransition(*transition); + if (property == Property::CirclePitchScaleTransition) { + setCirclePitchScaleTransition(*transition); return nullopt; } - if (property == Property::CircleTranslateAnchorTransition) { - setCircleTranslateAnchorTransition(*transition); + if (property == Property::CircleRadiusTransition) { + setCircleRadiusTransition(*transition); return nullopt; } - if (property == Property::CirclePitchScaleTransition) { - setCirclePitchScaleTransition(*transition); + if (property == Property::CircleStrokeColorTransition) { + setCircleStrokeColorTransition(*transition); return nullopt; } - if (property == Property::CirclePitchAlignmentTransition) { - setCirclePitchAlignmentTransition(*transition); + if (property == Property::CircleStrokeOpacityTransition) { + setCircleStrokeOpacityTransition(*transition); return nullopt; } @@ -574,13 +574,13 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con return nullopt; } - if (property == Property::CircleStrokeColorTransition) { - setCircleStrokeColorTransition(*transition); + if (property == Property::CircleTranslateTransition) { + setCircleTranslateTransition(*transition); return nullopt; } - if (property == Property::CircleStrokeOpacityTransition) { - setCircleStrokeOpacityTransition(*transition); + if (property == Property::CircleTranslateAnchorTransition) { + setCircleTranslateAnchorTransition(*transition); return nullopt; } diff --git a/src/mbgl/style/layers/circle_layer_properties.hpp b/src/mbgl/style/layers/circle_layer_properties.hpp index ef08e65455..17727c79eb 100644 --- a/src/mbgl/style/layers/circle_layer_properties.hpp +++ b/src/mbgl/style/layers/circle_layer_properties.hpp @@ -14,40 +14,28 @@ namespace mbgl { namespace style { -struct CircleRadius : DataDrivenPaintProperty<float, attributes::radius, uniforms::radius> { - static float defaultValue() { return 5; } +struct CircleBlur : DataDrivenPaintProperty<float, attributes::blur, uniforms::blur> { + static float defaultValue() { return 0; } }; struct CircleColor : DataDrivenPaintProperty<Color, attributes::color, uniforms::color> { static Color defaultValue() { return Color::black(); } }; -struct CircleBlur : DataDrivenPaintProperty<float, attributes::blur, uniforms::blur> { - static float defaultValue() { return 0; } -}; - struct CircleOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> { static float defaultValue() { return 1; } }; -struct CircleTranslate : PaintProperty<std::array<float, 2>> { - static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } -}; - -struct CircleTranslateAnchor : PaintProperty<TranslateAnchorType> { - static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; } +struct CirclePitchAlignment : PaintProperty<AlignmentType> { + static AlignmentType defaultValue() { return AlignmentType::Viewport; } }; struct CirclePitchScale : PaintProperty<CirclePitchScaleType> { static CirclePitchScaleType defaultValue() { return CirclePitchScaleType::Map; } }; -struct CirclePitchAlignment : PaintProperty<AlignmentType> { - static AlignmentType defaultValue() { return AlignmentType::Viewport; } -}; - -struct CircleStrokeWidth : DataDrivenPaintProperty<float, attributes::stroke_width, uniforms::stroke_width> { - static float defaultValue() { return 0; } +struct CircleRadius : DataDrivenPaintProperty<float, attributes::radius, uniforms::radius> { + static float defaultValue() { return 5; } }; struct CircleStrokeColor : DataDrivenPaintProperty<Color, attributes::stroke_color, uniforms::stroke_color> { @@ -58,18 +46,30 @@ struct CircleStrokeOpacity : DataDrivenPaintProperty<float, attributes::stroke_o static float defaultValue() { return 1; } }; +struct CircleStrokeWidth : DataDrivenPaintProperty<float, attributes::stroke_width, uniforms::stroke_width> { + static float defaultValue() { return 0; } +}; + +struct CircleTranslate : PaintProperty<std::array<float, 2>> { + static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } +}; + +struct CircleTranslateAnchor : PaintProperty<TranslateAnchorType> { + static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; } +}; + class CirclePaintProperties : public Properties< - CircleRadius, - CircleColor, CircleBlur, + CircleColor, CircleOpacity, - CircleTranslate, - CircleTranslateAnchor, - CirclePitchScale, CirclePitchAlignment, - CircleStrokeWidth, + CirclePitchScale, + CircleRadius, CircleStrokeColor, - CircleStrokeOpacity + CircleStrokeOpacity, + CircleStrokeWidth, + CircleTranslate, + CircleTranslateAnchor > {}; class CircleLayerProperties final : public LayerProperties { diff --git a/src/mbgl/style/layers/fill_extrusion_layer.cpp b/src/mbgl/style/layers/fill_extrusion_layer.cpp index 89796f098c..d477bf7262 100644 --- a/src/mbgl/style/layers/fill_extrusion_layer.cpp +++ b/src/mbgl/style/layers/fill_extrusion_layer.cpp @@ -63,31 +63,31 @@ void FillExtrusionLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::Stri // Paint properties -PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionOpacity() { - return { 1 }; +PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionBase() { + return { 0 }; } -const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionOpacity() const { - return impl().paint.template get<FillExtrusionOpacity>().value; +const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionBase() const { + return impl().paint.template get<FillExtrusionBase>().value; } -void FillExtrusionLayer::setFillExtrusionOpacity(const PropertyValue<float>& value) { - if (value == getFillExtrusionOpacity()) +void FillExtrusionLayer::setFillExtrusionBase(const PropertyValue<float>& value) { + if (value == getFillExtrusionBase()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionOpacity>().value = value; + impl_->paint.template get<FillExtrusionBase>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void FillExtrusionLayer::setFillExtrusionOpacityTransition(const TransitionOptions& options) { +void FillExtrusionLayer::setFillExtrusionBaseTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionOpacity>().options = options; + impl_->paint.template get<FillExtrusionBase>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillExtrusionLayer::getFillExtrusionOpacityTransition() const { - return impl().paint.template get<FillExtrusionOpacity>().options; +TransitionOptions FillExtrusionLayer::getFillExtrusionBaseTransition() const { + return impl().paint.template get<FillExtrusionBase>().options; } PropertyValue<Color> FillExtrusionLayer::getDefaultFillExtrusionColor() { @@ -117,58 +117,58 @@ TransitionOptions FillExtrusionLayer::getFillExtrusionColorTransition() const { return impl().paint.template get<FillExtrusionColor>().options; } -PropertyValue<std::array<float, 2>> FillExtrusionLayer::getDefaultFillExtrusionTranslate() { - return { {{ 0, 0 }} }; +PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionHeight() { + return { 0 }; } -const PropertyValue<std::array<float, 2>>& FillExtrusionLayer::getFillExtrusionTranslate() const { - return impl().paint.template get<FillExtrusionTranslate>().value; +const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionHeight() const { + return impl().paint.template get<FillExtrusionHeight>().value; } -void FillExtrusionLayer::setFillExtrusionTranslate(const PropertyValue<std::array<float, 2>>& value) { - if (value == getFillExtrusionTranslate()) +void FillExtrusionLayer::setFillExtrusionHeight(const PropertyValue<float>& value) { + if (value == getFillExtrusionHeight()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionTranslate>().value = value; + impl_->paint.template get<FillExtrusionHeight>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void FillExtrusionLayer::setFillExtrusionTranslateTransition(const TransitionOptions& options) { +void FillExtrusionLayer::setFillExtrusionHeightTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionTranslate>().options = options; + impl_->paint.template get<FillExtrusionHeight>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillExtrusionLayer::getFillExtrusionTranslateTransition() const { - return impl().paint.template get<FillExtrusionTranslate>().options; +TransitionOptions FillExtrusionLayer::getFillExtrusionHeightTransition() const { + return impl().paint.template get<FillExtrusionHeight>().options; } -PropertyValue<TranslateAnchorType> FillExtrusionLayer::getDefaultFillExtrusionTranslateAnchor() { - return { TranslateAnchorType::Map }; +PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionOpacity() { + return { 1 }; } -const PropertyValue<TranslateAnchorType>& FillExtrusionLayer::getFillExtrusionTranslateAnchor() const { - return impl().paint.template get<FillExtrusionTranslateAnchor>().value; +const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionOpacity() const { + return impl().paint.template get<FillExtrusionOpacity>().value; } -void FillExtrusionLayer::setFillExtrusionTranslateAnchor(const PropertyValue<TranslateAnchorType>& value) { - if (value == getFillExtrusionTranslateAnchor()) +void FillExtrusionLayer::setFillExtrusionOpacity(const PropertyValue<float>& value) { + if (value == getFillExtrusionOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionTranslateAnchor>().value = value; + impl_->paint.template get<FillExtrusionOpacity>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void FillExtrusionLayer::setFillExtrusionTranslateAnchorTransition(const TransitionOptions& options) { +void FillExtrusionLayer::setFillExtrusionOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionTranslateAnchor>().options = options; + impl_->paint.template get<FillExtrusionOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillExtrusionLayer::getFillExtrusionTranslateAnchorTransition() const { - return impl().paint.template get<FillExtrusionTranslateAnchor>().options; +TransitionOptions FillExtrusionLayer::getFillExtrusionOpacityTransition() const { + return impl().paint.template get<FillExtrusionOpacity>().options; } PropertyValue<std::string> FillExtrusionLayer::getDefaultFillExtrusionPattern() { @@ -198,58 +198,58 @@ TransitionOptions FillExtrusionLayer::getFillExtrusionPatternTransition() const return impl().paint.template get<FillExtrusionPattern>().options; } -PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionHeight() { - return { 0 }; +PropertyValue<std::array<float, 2>> FillExtrusionLayer::getDefaultFillExtrusionTranslate() { + return { {{ 0, 0 }} }; } -const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionHeight() const { - return impl().paint.template get<FillExtrusionHeight>().value; +const PropertyValue<std::array<float, 2>>& FillExtrusionLayer::getFillExtrusionTranslate() const { + return impl().paint.template get<FillExtrusionTranslate>().value; } -void FillExtrusionLayer::setFillExtrusionHeight(const PropertyValue<float>& value) { - if (value == getFillExtrusionHeight()) +void FillExtrusionLayer::setFillExtrusionTranslate(const PropertyValue<std::array<float, 2>>& value) { + if (value == getFillExtrusionTranslate()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionHeight>().value = value; + impl_->paint.template get<FillExtrusionTranslate>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void FillExtrusionLayer::setFillExtrusionHeightTransition(const TransitionOptions& options) { +void FillExtrusionLayer::setFillExtrusionTranslateTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionHeight>().options = options; + impl_->paint.template get<FillExtrusionTranslate>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillExtrusionLayer::getFillExtrusionHeightTransition() const { - return impl().paint.template get<FillExtrusionHeight>().options; +TransitionOptions FillExtrusionLayer::getFillExtrusionTranslateTransition() const { + return impl().paint.template get<FillExtrusionTranslate>().options; } -PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionBase() { - return { 0 }; +PropertyValue<TranslateAnchorType> FillExtrusionLayer::getDefaultFillExtrusionTranslateAnchor() { + return { TranslateAnchorType::Map }; } -const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionBase() const { - return impl().paint.template get<FillExtrusionBase>().value; +const PropertyValue<TranslateAnchorType>& FillExtrusionLayer::getFillExtrusionTranslateAnchor() const { + return impl().paint.template get<FillExtrusionTranslateAnchor>().value; } -void FillExtrusionLayer::setFillExtrusionBase(const PropertyValue<float>& value) { - if (value == getFillExtrusionBase()) +void FillExtrusionLayer::setFillExtrusionTranslateAnchor(const PropertyValue<TranslateAnchorType>& value) { + if (value == getFillExtrusionTranslateAnchor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionBase>().value = value; + impl_->paint.template get<FillExtrusionTranslateAnchor>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void FillExtrusionLayer::setFillExtrusionBaseTransition(const TransitionOptions& options) { +void FillExtrusionLayer::setFillExtrusionTranslateAnchorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionBase>().options = options; + impl_->paint.template get<FillExtrusionTranslateAnchor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillExtrusionLayer::getFillExtrusionBaseTransition() const { - return impl().paint.template get<FillExtrusionBase>().options; +TransitionOptions FillExtrusionLayer::getFillExtrusionTranslateAnchorTransition() const { + return impl().paint.template get<FillExtrusionTranslateAnchor>().options; } PropertyValue<bool> FillExtrusionLayer::getDefaultFillExtrusionVerticalGradient() { @@ -283,40 +283,40 @@ using namespace conversion; optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, const Convertible& value) { enum class Property : uint8_t { - FillExtrusionOpacity, + FillExtrusionBase, FillExtrusionColor, + FillExtrusionHeight, + FillExtrusionOpacity, + FillExtrusionPattern, FillExtrusionTranslate, FillExtrusionTranslateAnchor, - FillExtrusionPattern, - FillExtrusionHeight, - FillExtrusionBase, FillExtrusionVerticalGradient, - FillExtrusionOpacityTransition, + FillExtrusionBaseTransition, FillExtrusionColorTransition, + FillExtrusionHeightTransition, + FillExtrusionOpacityTransition, + FillExtrusionPatternTransition, FillExtrusionTranslateTransition, FillExtrusionTranslateAnchorTransition, - FillExtrusionPatternTransition, - FillExtrusionHeightTransition, - FillExtrusionBaseTransition, FillExtrusionVerticalGradientTransition, }; MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({ - { "fill-extrusion-opacity", static_cast<uint8_t>(Property::FillExtrusionOpacity) }, + { "fill-extrusion-base", static_cast<uint8_t>(Property::FillExtrusionBase) }, { "fill-extrusion-color", static_cast<uint8_t>(Property::FillExtrusionColor) }, + { "fill-extrusion-height", static_cast<uint8_t>(Property::FillExtrusionHeight) }, + { "fill-extrusion-opacity", static_cast<uint8_t>(Property::FillExtrusionOpacity) }, + { "fill-extrusion-pattern", static_cast<uint8_t>(Property::FillExtrusionPattern) }, { "fill-extrusion-translate", static_cast<uint8_t>(Property::FillExtrusionTranslate) }, { "fill-extrusion-translate-anchor", static_cast<uint8_t>(Property::FillExtrusionTranslateAnchor) }, - { "fill-extrusion-pattern", static_cast<uint8_t>(Property::FillExtrusionPattern) }, - { "fill-extrusion-height", static_cast<uint8_t>(Property::FillExtrusionHeight) }, - { "fill-extrusion-base", static_cast<uint8_t>(Property::FillExtrusionBase) }, { "fill-extrusion-vertical-gradient", static_cast<uint8_t>(Property::FillExtrusionVerticalGradient) }, - { "fill-extrusion-opacity-transition", static_cast<uint8_t>(Property::FillExtrusionOpacityTransition) }, + { "fill-extrusion-base-transition", static_cast<uint8_t>(Property::FillExtrusionBaseTransition) }, { "fill-extrusion-color-transition", static_cast<uint8_t>(Property::FillExtrusionColorTransition) }, + { "fill-extrusion-height-transition", static_cast<uint8_t>(Property::FillExtrusionHeightTransition) }, + { "fill-extrusion-opacity-transition", static_cast<uint8_t>(Property::FillExtrusionOpacityTransition) }, + { "fill-extrusion-pattern-transition", static_cast<uint8_t>(Property::FillExtrusionPatternTransition) }, { "fill-extrusion-translate-transition", static_cast<uint8_t>(Property::FillExtrusionTranslateTransition) }, { "fill-extrusion-translate-anchor-transition", static_cast<uint8_t>(Property::FillExtrusionTranslateAnchorTransition) }, - { "fill-extrusion-pattern-transition", static_cast<uint8_t>(Property::FillExtrusionPatternTransition) }, - { "fill-extrusion-height-transition", static_cast<uint8_t>(Property::FillExtrusionHeightTransition) }, - { "fill-extrusion-base-transition", static_cast<uint8_t>(Property::FillExtrusionBaseTransition) }, { "fill-extrusion-vertical-gradient-transition", static_cast<uint8_t>(Property::FillExtrusionVerticalGradientTransition) } }); @@ -328,15 +328,22 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co auto property = static_cast<Property>(it->second); - if (property == Property::FillExtrusionOpacity) { + if (property == Property::FillExtrusionBase || property == Property::FillExtrusionHeight) { Error error; - optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false); + optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false); if (!typedValue) { return error; } - setFillExtrusionOpacity(*typedValue); - return nullopt; + if (property == Property::FillExtrusionBase) { + setFillExtrusionBase(*typedValue); + return nullopt; + } + + if (property == Property::FillExtrusionHeight) { + setFillExtrusionHeight(*typedValue); + return nullopt; + } } @@ -352,58 +359,51 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co } - if (property == Property::FillExtrusionTranslate) { + if (property == Property::FillExtrusionOpacity) { Error error; - optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false); + optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false); if (!typedValue) { return error; } - setFillExtrusionTranslate(*typedValue); + setFillExtrusionOpacity(*typedValue); return nullopt; } - if (property == Property::FillExtrusionTranslateAnchor) { + if (property == Property::FillExtrusionPattern) { Error error; - optional<PropertyValue<TranslateAnchorType>> typedValue = convert<PropertyValue<TranslateAnchorType>>(value, error, false, false); + optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, false); if (!typedValue) { return error; } - setFillExtrusionTranslateAnchor(*typedValue); + setFillExtrusionPattern(*typedValue); return nullopt; } - if (property == Property::FillExtrusionPattern) { + if (property == Property::FillExtrusionTranslate) { Error error; - optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, false); + optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false); if (!typedValue) { return error; } - setFillExtrusionPattern(*typedValue); + setFillExtrusionTranslate(*typedValue); return nullopt; } - if (property == Property::FillExtrusionHeight || property == Property::FillExtrusionBase) { + if (property == Property::FillExtrusionTranslateAnchor) { Error error; - optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false); + optional<PropertyValue<TranslateAnchorType>> typedValue = convert<PropertyValue<TranslateAnchorType>>(value, error, false, false); if (!typedValue) { return error; } - if (property == Property::FillExtrusionHeight) { - setFillExtrusionHeight(*typedValue); - return nullopt; - } - - if (property == Property::FillExtrusionBase) { - setFillExtrusionBase(*typedValue); - return nullopt; - } + setFillExtrusionTranslateAnchor(*typedValue); + return nullopt; } @@ -426,8 +426,8 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co return error; } - if (property == Property::FillExtrusionOpacityTransition) { - setFillExtrusionOpacityTransition(*transition); + if (property == Property::FillExtrusionBaseTransition) { + setFillExtrusionBaseTransition(*transition); return nullopt; } @@ -436,13 +436,13 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co return nullopt; } - if (property == Property::FillExtrusionTranslateTransition) { - setFillExtrusionTranslateTransition(*transition); + if (property == Property::FillExtrusionHeightTransition) { + setFillExtrusionHeightTransition(*transition); return nullopt; } - if (property == Property::FillExtrusionTranslateAnchorTransition) { - setFillExtrusionTranslateAnchorTransition(*transition); + if (property == Property::FillExtrusionOpacityTransition) { + setFillExtrusionOpacityTransition(*transition); return nullopt; } @@ -451,13 +451,13 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co return nullopt; } - if (property == Property::FillExtrusionHeightTransition) { - setFillExtrusionHeightTransition(*transition); + if (property == Property::FillExtrusionTranslateTransition) { + setFillExtrusionTranslateTransition(*transition); return nullopt; } - if (property == Property::FillExtrusionBaseTransition) { - setFillExtrusionBaseTransition(*transition); + if (property == Property::FillExtrusionTranslateAnchorTransition) { + setFillExtrusionTranslateAnchorTransition(*transition); return nullopt; } diff --git a/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp b/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp index c90594036b..f5aeaf5c73 100644 --- a/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp +++ b/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp @@ -14,32 +14,32 @@ namespace mbgl { namespace style { -struct FillExtrusionOpacity : PaintProperty<float> { - static float defaultValue() { return 1; } +struct FillExtrusionBase : DataDrivenPaintProperty<float, attributes::base, uniforms::base> { + static float defaultValue() { return 0; } }; struct FillExtrusionColor : DataDrivenPaintProperty<Color, attributes::color, uniforms::color> { static Color defaultValue() { return Color::black(); } }; -struct FillExtrusionTranslate : PaintProperty<std::array<float, 2>> { - static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } +struct FillExtrusionHeight : DataDrivenPaintProperty<float, attributes::height, uniforms::height> { + static float defaultValue() { return 0; } }; -struct FillExtrusionTranslateAnchor : PaintProperty<TranslateAnchorType> { - static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; } +struct FillExtrusionOpacity : PaintProperty<float> { + static float defaultValue() { return 1; } }; struct FillExtrusionPattern : CrossFadedDataDrivenPaintProperty<std::string, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> { static std::string defaultValue() { return ""; } }; -struct FillExtrusionHeight : DataDrivenPaintProperty<float, attributes::height, uniforms::height> { - static float defaultValue() { return 0; } +struct FillExtrusionTranslate : PaintProperty<std::array<float, 2>> { + static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } }; -struct FillExtrusionBase : DataDrivenPaintProperty<float, attributes::base, uniforms::base> { - static float defaultValue() { return 0; } +struct FillExtrusionTranslateAnchor : PaintProperty<TranslateAnchorType> { + static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; } }; struct FillExtrusionVerticalGradient : PaintProperty<bool> { @@ -47,13 +47,13 @@ struct FillExtrusionVerticalGradient : PaintProperty<bool> { }; class FillExtrusionPaintProperties : public Properties< - FillExtrusionOpacity, + FillExtrusionBase, FillExtrusionColor, + FillExtrusionHeight, + FillExtrusionOpacity, + FillExtrusionPattern, FillExtrusionTranslate, FillExtrusionTranslateAnchor, - FillExtrusionPattern, - FillExtrusionHeight, - FillExtrusionBase, FillExtrusionVerticalGradient > {}; diff --git a/src/mbgl/style/layers/fill_layer.cpp b/src/mbgl/style/layers/fill_layer.cpp index 0511e06828..f35f62fb1d 100644 --- a/src/mbgl/style/layers/fill_layer.cpp +++ b/src/mbgl/style/layers/fill_layer.cpp @@ -90,58 +90,58 @@ TransitionOptions FillLayer::getFillAntialiasTransition() const { return impl().paint.template get<FillAntialias>().options; } -PropertyValue<float> FillLayer::getDefaultFillOpacity() { - return { 1 }; +PropertyValue<Color> FillLayer::getDefaultFillColor() { + return { Color::black() }; } -const PropertyValue<float>& FillLayer::getFillOpacity() const { - return impl().paint.template get<FillOpacity>().value; +const PropertyValue<Color>& FillLayer::getFillColor() const { + return impl().paint.template get<FillColor>().value; } -void FillLayer::setFillOpacity(const PropertyValue<float>& value) { - if (value == getFillOpacity()) +void FillLayer::setFillColor(const PropertyValue<Color>& value) { + if (value == getFillColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillOpacity>().value = value; + impl_->paint.template get<FillColor>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void FillLayer::setFillOpacityTransition(const TransitionOptions& options) { +void FillLayer::setFillColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillOpacity>().options = options; + impl_->paint.template get<FillColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillLayer::getFillOpacityTransition() const { - return impl().paint.template get<FillOpacity>().options; +TransitionOptions FillLayer::getFillColorTransition() const { + return impl().paint.template get<FillColor>().options; } -PropertyValue<Color> FillLayer::getDefaultFillColor() { - return { Color::black() }; +PropertyValue<float> FillLayer::getDefaultFillOpacity() { + return { 1 }; } -const PropertyValue<Color>& FillLayer::getFillColor() const { - return impl().paint.template get<FillColor>().value; +const PropertyValue<float>& FillLayer::getFillOpacity() const { + return impl().paint.template get<FillOpacity>().value; } -void FillLayer::setFillColor(const PropertyValue<Color>& value) { - if (value == getFillColor()) +void FillLayer::setFillOpacity(const PropertyValue<float>& value) { + if (value == getFillOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillColor>().value = value; + impl_->paint.template get<FillOpacity>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void FillLayer::setFillColorTransition(const TransitionOptions& options) { +void FillLayer::setFillOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillColor>().options = options; + impl_->paint.template get<FillOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillLayer::getFillColorTransition() const { - return impl().paint.template get<FillColor>().options; +TransitionOptions FillLayer::getFillOpacityTransition() const { + return impl().paint.template get<FillOpacity>().options; } PropertyValue<Color> FillLayer::getDefaultFillOutlineColor() { @@ -171,6 +171,33 @@ TransitionOptions FillLayer::getFillOutlineColorTransition() const { return impl().paint.template get<FillOutlineColor>().options; } +PropertyValue<std::string> FillLayer::getDefaultFillPattern() { + return { "" }; +} + +const PropertyValue<std::string>& FillLayer::getFillPattern() const { + return impl().paint.template get<FillPattern>().value; +} + +void FillLayer::setFillPattern(const PropertyValue<std::string>& value) { + if (value == getFillPattern()) + return; + auto impl_ = mutableImpl(); + impl_->paint.template get<FillPattern>().value = value; + baseImpl = std::move(impl_); + observer->onLayerChanged(*this); +} + +void FillLayer::setFillPatternTransition(const TransitionOptions& options) { + auto impl_ = mutableImpl(); + impl_->paint.template get<FillPattern>().options = options; + baseImpl = std::move(impl_); +} + +TransitionOptions FillLayer::getFillPatternTransition() const { + return impl().paint.template get<FillPattern>().options; +} + PropertyValue<std::array<float, 2>> FillLayer::getDefaultFillTranslate() { return { {{ 0, 0 }} }; } @@ -225,68 +252,41 @@ TransitionOptions FillLayer::getFillTranslateAnchorTransition() const { return impl().paint.template get<FillTranslateAnchor>().options; } -PropertyValue<std::string> FillLayer::getDefaultFillPattern() { - return { "" }; -} - -const PropertyValue<std::string>& FillLayer::getFillPattern() const { - return impl().paint.template get<FillPattern>().value; -} - -void FillLayer::setFillPattern(const PropertyValue<std::string>& value) { - if (value == getFillPattern()) - return; - auto impl_ = mutableImpl(); - impl_->paint.template get<FillPattern>().value = value; - baseImpl = std::move(impl_); - observer->onLayerChanged(*this); -} - -void FillLayer::setFillPatternTransition(const TransitionOptions& options) { - auto impl_ = mutableImpl(); - impl_->paint.template get<FillPattern>().options = options; - baseImpl = std::move(impl_); -} - -TransitionOptions FillLayer::getFillPatternTransition() const { - return impl().paint.template get<FillPattern>().options; -} - using namespace conversion; optional<Error> FillLayer::setPaintProperty(const std::string& name, const Convertible& value) { enum class Property : uint8_t { FillAntialias, - FillOpacity, FillColor, + FillOpacity, FillOutlineColor, + FillPattern, FillTranslate, FillTranslateAnchor, - FillPattern, FillAntialiasTransition, - FillOpacityTransition, FillColorTransition, + FillOpacityTransition, FillOutlineColorTransition, + FillPatternTransition, FillTranslateTransition, FillTranslateAnchorTransition, - FillPatternTransition, }; MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({ { "fill-antialias", static_cast<uint8_t>(Property::FillAntialias) }, - { "fill-opacity", static_cast<uint8_t>(Property::FillOpacity) }, { "fill-color", static_cast<uint8_t>(Property::FillColor) }, + { "fill-opacity", static_cast<uint8_t>(Property::FillOpacity) }, { "fill-outline-color", static_cast<uint8_t>(Property::FillOutlineColor) }, + { "fill-pattern", static_cast<uint8_t>(Property::FillPattern) }, { "fill-translate", static_cast<uint8_t>(Property::FillTranslate) }, { "fill-translate-anchor", static_cast<uint8_t>(Property::FillTranslateAnchor) }, - { "fill-pattern", static_cast<uint8_t>(Property::FillPattern) }, { "fill-antialias-transition", static_cast<uint8_t>(Property::FillAntialiasTransition) }, - { "fill-opacity-transition", static_cast<uint8_t>(Property::FillOpacityTransition) }, { "fill-color-transition", static_cast<uint8_t>(Property::FillColorTransition) }, + { "fill-opacity-transition", static_cast<uint8_t>(Property::FillOpacityTransition) }, { "fill-outline-color-transition", static_cast<uint8_t>(Property::FillOutlineColorTransition) }, + { "fill-pattern-transition", static_cast<uint8_t>(Property::FillPatternTransition) }, { "fill-translate-transition", static_cast<uint8_t>(Property::FillTranslateTransition) }, - { "fill-translate-anchor-transition", static_cast<uint8_t>(Property::FillTranslateAnchorTransition) }, - { "fill-pattern-transition", static_cast<uint8_t>(Property::FillPatternTransition) } + { "fill-translate-anchor-transition", static_cast<uint8_t>(Property::FillTranslateAnchorTransition) } }); const auto it = properties.find(name.c_str()); @@ -309,18 +309,6 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve } - if (property == Property::FillOpacity) { - Error error; - optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false); - if (!typedValue) { - return error; - } - - setFillOpacity(*typedValue); - return nullopt; - - } - if (property == Property::FillColor || property == Property::FillOutlineColor) { Error error; optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false); @@ -340,38 +328,50 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve } - if (property == Property::FillTranslate) { + if (property == Property::FillOpacity) { Error error; - optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false); + optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false); if (!typedValue) { return error; } - setFillTranslate(*typedValue); + setFillOpacity(*typedValue); return nullopt; } - if (property == Property::FillTranslateAnchor) { + if (property == Property::FillPattern) { Error error; - optional<PropertyValue<TranslateAnchorType>> typedValue = convert<PropertyValue<TranslateAnchorType>>(value, error, false, false); + optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, false); if (!typedValue) { return error; } - setFillTranslateAnchor(*typedValue); + setFillPattern(*typedValue); return nullopt; } - if (property == Property::FillPattern) { + if (property == Property::FillTranslate) { Error error; - optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, false); + optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false); if (!typedValue) { return error; } - setFillPattern(*typedValue); + setFillTranslate(*typedValue); + return nullopt; + + } + + if (property == Property::FillTranslateAnchor) { + Error error; + optional<PropertyValue<TranslateAnchorType>> typedValue = convert<PropertyValue<TranslateAnchorType>>(value, error, false, false); + if (!typedValue) { + return error; + } + + setFillTranslateAnchor(*typedValue); return nullopt; } @@ -388,13 +388,13 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve return nullopt; } - if (property == Property::FillOpacityTransition) { - setFillOpacityTransition(*transition); + if (property == Property::FillColorTransition) { + setFillColorTransition(*transition); return nullopt; } - if (property == Property::FillColorTransition) { - setFillColorTransition(*transition); + if (property == Property::FillOpacityTransition) { + setFillOpacityTransition(*transition); return nullopt; } @@ -403,6 +403,11 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve return nullopt; } + if (property == Property::FillPatternTransition) { + setFillPatternTransition(*transition); + return nullopt; + } + if (property == Property::FillTranslateTransition) { setFillTranslateTransition(*transition); return nullopt; @@ -413,11 +418,6 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve return nullopt; } - if (property == Property::FillPatternTransition) { - setFillPatternTransition(*transition); - return nullopt; - } - return Error { "layer doesn't support this property" }; } diff --git a/src/mbgl/style/layers/fill_layer_properties.hpp b/src/mbgl/style/layers/fill_layer_properties.hpp index f76aee448b..376852d254 100644 --- a/src/mbgl/style/layers/fill_layer_properties.hpp +++ b/src/mbgl/style/layers/fill_layer_properties.hpp @@ -18,18 +18,22 @@ struct FillAntialias : PaintProperty<bool> { static bool defaultValue() { return true; } }; -struct FillOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> { - static float defaultValue() { return 1; } -}; - struct FillColor : DataDrivenPaintProperty<Color, attributes::color, uniforms::color> { static Color defaultValue() { return Color::black(); } }; +struct FillOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> { + static float defaultValue() { return 1; } +}; + struct FillOutlineColor : DataDrivenPaintProperty<Color, attributes::outline_color, uniforms::outline_color> { static Color defaultValue() { return {}; } }; +struct FillPattern : CrossFadedDataDrivenPaintProperty<std::string, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> { + static std::string defaultValue() { return ""; } +}; + struct FillTranslate : PaintProperty<std::array<float, 2>> { static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } }; @@ -38,18 +42,14 @@ struct FillTranslateAnchor : PaintProperty<TranslateAnchorType> { static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; } }; -struct FillPattern : CrossFadedDataDrivenPaintProperty<std::string, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> { - static std::string defaultValue() { return ""; } -}; - class FillPaintProperties : public Properties< FillAntialias, - FillOpacity, FillColor, + FillOpacity, FillOutlineColor, + FillPattern, FillTranslate, - FillTranslateAnchor, - FillPattern + FillTranslateAnchor > {}; class FillLayerProperties final : public LayerProperties { diff --git a/src/mbgl/style/layers/heatmap_layer.cpp b/src/mbgl/style/layers/heatmap_layer.cpp index 7d23d86f15..e13089bfd5 100644 --- a/src/mbgl/style/layers/heatmap_layer.cpp +++ b/src/mbgl/style/layers/heatmap_layer.cpp @@ -63,170 +63,170 @@ void HeatmapLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuff // Paint properties -PropertyValue<float> HeatmapLayer::getDefaultHeatmapRadius() { - return { 30 }; +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<ColorRampPropertyValue>(rawValue, error); } -const PropertyValue<float>& HeatmapLayer::getHeatmapRadius() const { - return impl().paint.template get<HeatmapRadius>().value; +const ColorRampPropertyValue& HeatmapLayer::getHeatmapColor() const { + return impl().paint.template get<HeatmapColor>().value; } -void HeatmapLayer::setHeatmapRadius(const PropertyValue<float>& value) { - if (value == getHeatmapRadius()) +void HeatmapLayer::setHeatmapColor(const ColorRampPropertyValue& value) { + if (value == getHeatmapColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<HeatmapRadius>().value = value; + impl_->paint.template get<HeatmapColor>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void HeatmapLayer::setHeatmapRadiusTransition(const TransitionOptions& options) { +void HeatmapLayer::setHeatmapColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<HeatmapRadius>().options = options; + impl_->paint.template get<HeatmapColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions HeatmapLayer::getHeatmapRadiusTransition() const { - return impl().paint.template get<HeatmapRadius>().options; +TransitionOptions HeatmapLayer::getHeatmapColorTransition() const { + return impl().paint.template get<HeatmapColor>().options; } -PropertyValue<float> HeatmapLayer::getDefaultHeatmapWeight() { +PropertyValue<float> HeatmapLayer::getDefaultHeatmapIntensity() { return { 1 }; } -const PropertyValue<float>& HeatmapLayer::getHeatmapWeight() const { - return impl().paint.template get<HeatmapWeight>().value; +const PropertyValue<float>& HeatmapLayer::getHeatmapIntensity() const { + return impl().paint.template get<HeatmapIntensity>().value; } -void HeatmapLayer::setHeatmapWeight(const PropertyValue<float>& value) { - if (value == getHeatmapWeight()) +void HeatmapLayer::setHeatmapIntensity(const PropertyValue<float>& value) { + if (value == getHeatmapIntensity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<HeatmapWeight>().value = value; + impl_->paint.template get<HeatmapIntensity>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void HeatmapLayer::setHeatmapWeightTransition(const TransitionOptions& options) { +void HeatmapLayer::setHeatmapIntensityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<HeatmapWeight>().options = options; + impl_->paint.template get<HeatmapIntensity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions HeatmapLayer::getHeatmapWeightTransition() const { - return impl().paint.template get<HeatmapWeight>().options; +TransitionOptions HeatmapLayer::getHeatmapIntensityTransition() const { + return impl().paint.template get<HeatmapIntensity>().options; } -PropertyValue<float> HeatmapLayer::getDefaultHeatmapIntensity() { +PropertyValue<float> HeatmapLayer::getDefaultHeatmapOpacity() { return { 1 }; } -const PropertyValue<float>& HeatmapLayer::getHeatmapIntensity() const { - return impl().paint.template get<HeatmapIntensity>().value; +const PropertyValue<float>& HeatmapLayer::getHeatmapOpacity() const { + return impl().paint.template get<HeatmapOpacity>().value; } -void HeatmapLayer::setHeatmapIntensity(const PropertyValue<float>& value) { - if (value == getHeatmapIntensity()) +void HeatmapLayer::setHeatmapOpacity(const PropertyValue<float>& value) { + if (value == getHeatmapOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<HeatmapIntensity>().value = value; + impl_->paint.template get<HeatmapOpacity>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void HeatmapLayer::setHeatmapIntensityTransition(const TransitionOptions& options) { +void HeatmapLayer::setHeatmapOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<HeatmapIntensity>().options = options; + impl_->paint.template get<HeatmapOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions HeatmapLayer::getHeatmapIntensityTransition() const { - return impl().paint.template get<HeatmapIntensity>().options; +TransitionOptions HeatmapLayer::getHeatmapOpacityTransition() const { + return impl().paint.template get<HeatmapOpacity>().options; } -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<ColorRampPropertyValue>(rawValue, error); +PropertyValue<float> HeatmapLayer::getDefaultHeatmapRadius() { + return { 30 }; } -const ColorRampPropertyValue& HeatmapLayer::getHeatmapColor() const { - return impl().paint.template get<HeatmapColor>().value; +const PropertyValue<float>& HeatmapLayer::getHeatmapRadius() const { + return impl().paint.template get<HeatmapRadius>().value; } -void HeatmapLayer::setHeatmapColor(const ColorRampPropertyValue& value) { - if (value == getHeatmapColor()) +void HeatmapLayer::setHeatmapRadius(const PropertyValue<float>& value) { + if (value == getHeatmapRadius()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<HeatmapColor>().value = value; + impl_->paint.template get<HeatmapRadius>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void HeatmapLayer::setHeatmapColorTransition(const TransitionOptions& options) { +void HeatmapLayer::setHeatmapRadiusTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<HeatmapColor>().options = options; + impl_->paint.template get<HeatmapRadius>().options = options; baseImpl = std::move(impl_); } -TransitionOptions HeatmapLayer::getHeatmapColorTransition() const { - return impl().paint.template get<HeatmapColor>().options; +TransitionOptions HeatmapLayer::getHeatmapRadiusTransition() const { + return impl().paint.template get<HeatmapRadius>().options; } -PropertyValue<float> HeatmapLayer::getDefaultHeatmapOpacity() { +PropertyValue<float> HeatmapLayer::getDefaultHeatmapWeight() { return { 1 }; } -const PropertyValue<float>& HeatmapLayer::getHeatmapOpacity() const { - return impl().paint.template get<HeatmapOpacity>().value; +const PropertyValue<float>& HeatmapLayer::getHeatmapWeight() const { + return impl().paint.template get<HeatmapWeight>().value; } -void HeatmapLayer::setHeatmapOpacity(const PropertyValue<float>& value) { - if (value == getHeatmapOpacity()) +void HeatmapLayer::setHeatmapWeight(const PropertyValue<float>& value) { + if (value == getHeatmapWeight()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<HeatmapOpacity>().value = value; + impl_->paint.template get<HeatmapWeight>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void HeatmapLayer::setHeatmapOpacityTransition(const TransitionOptions& options) { +void HeatmapLayer::setHeatmapWeightTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<HeatmapOpacity>().options = options; + impl_->paint.template get<HeatmapWeight>().options = options; baseImpl = std::move(impl_); } -TransitionOptions HeatmapLayer::getHeatmapOpacityTransition() const { - return impl().paint.template get<HeatmapOpacity>().options; +TransitionOptions HeatmapLayer::getHeatmapWeightTransition() const { + return impl().paint.template get<HeatmapWeight>().options; } using namespace conversion; optional<Error> HeatmapLayer::setPaintProperty(const std::string& name, const Convertible& value) { enum class Property : uint8_t { - HeatmapRadius, - HeatmapWeight, - HeatmapIntensity, HeatmapColor, + HeatmapIntensity, HeatmapOpacity, - HeatmapRadiusTransition, - HeatmapWeightTransition, - HeatmapIntensityTransition, + HeatmapRadius, + HeatmapWeight, HeatmapColorTransition, + HeatmapIntensityTransition, HeatmapOpacityTransition, + HeatmapRadiusTransition, + HeatmapWeightTransition, }; MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({ - { "heatmap-radius", static_cast<uint8_t>(Property::HeatmapRadius) }, - { "heatmap-weight", static_cast<uint8_t>(Property::HeatmapWeight) }, - { "heatmap-intensity", static_cast<uint8_t>(Property::HeatmapIntensity) }, { "heatmap-color", static_cast<uint8_t>(Property::HeatmapColor) }, + { "heatmap-intensity", static_cast<uint8_t>(Property::HeatmapIntensity) }, { "heatmap-opacity", static_cast<uint8_t>(Property::HeatmapOpacity) }, - { "heatmap-radius-transition", static_cast<uint8_t>(Property::HeatmapRadiusTransition) }, - { "heatmap-weight-transition", static_cast<uint8_t>(Property::HeatmapWeightTransition) }, - { "heatmap-intensity-transition", static_cast<uint8_t>(Property::HeatmapIntensityTransition) }, + { "heatmap-radius", static_cast<uint8_t>(Property::HeatmapRadius) }, + { "heatmap-weight", static_cast<uint8_t>(Property::HeatmapWeight) }, { "heatmap-color-transition", static_cast<uint8_t>(Property::HeatmapColorTransition) }, - { "heatmap-opacity-transition", static_cast<uint8_t>(Property::HeatmapOpacityTransition) } + { "heatmap-intensity-transition", static_cast<uint8_t>(Property::HeatmapIntensityTransition) }, + { "heatmap-opacity-transition", static_cast<uint8_t>(Property::HeatmapOpacityTransition) }, + { "heatmap-radius-transition", static_cast<uint8_t>(Property::HeatmapRadiusTransition) }, + { "heatmap-weight-transition", static_cast<uint8_t>(Property::HeatmapWeightTransition) } }); const auto it = properties.find(name.c_str()); @@ -237,22 +237,15 @@ optional<Error> HeatmapLayer::setPaintProperty(const std::string& name, const Co auto property = static_cast<Property>(it->second); - if (property == Property::HeatmapRadius || property == Property::HeatmapWeight) { + if (property == Property::HeatmapColor) { Error error; - optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false); + optional<ColorRampPropertyValue> typedValue = convert<ColorRampPropertyValue>(value, error, false, false); if (!typedValue) { return error; } - if (property == Property::HeatmapRadius) { - setHeatmapRadius(*typedValue); - return nullopt; - } - - if (property == Property::HeatmapWeight) { - setHeatmapWeight(*typedValue); - return nullopt; - } + setHeatmapColor(*typedValue); + return nullopt; } @@ -275,15 +268,22 @@ optional<Error> HeatmapLayer::setPaintProperty(const std::string& name, const Co } - if (property == Property::HeatmapColor) { + if (property == Property::HeatmapRadius || property == Property::HeatmapWeight) { Error error; - optional<ColorRampPropertyValue> typedValue = convert<ColorRampPropertyValue>(value, error, false, false); + optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false); if (!typedValue) { return error; } - setHeatmapColor(*typedValue); - return nullopt; + if (property == Property::HeatmapRadius) { + setHeatmapRadius(*typedValue); + return nullopt; + } + + if (property == Property::HeatmapWeight) { + setHeatmapWeight(*typedValue); + return nullopt; + } } @@ -294,28 +294,28 @@ optional<Error> HeatmapLayer::setPaintProperty(const std::string& name, const Co return error; } - if (property == Property::HeatmapRadiusTransition) { - setHeatmapRadiusTransition(*transition); + if (property == Property::HeatmapColorTransition) { + setHeatmapColorTransition(*transition); return nullopt; } - if (property == Property::HeatmapWeightTransition) { - setHeatmapWeightTransition(*transition); + if (property == Property::HeatmapIntensityTransition) { + setHeatmapIntensityTransition(*transition); return nullopt; } - if (property == Property::HeatmapIntensityTransition) { - setHeatmapIntensityTransition(*transition); + if (property == Property::HeatmapOpacityTransition) { + setHeatmapOpacityTransition(*transition); return nullopt; } - if (property == Property::HeatmapColorTransition) { - setHeatmapColorTransition(*transition); + if (property == Property::HeatmapRadiusTransition) { + setHeatmapRadiusTransition(*transition); return nullopt; } - if (property == Property::HeatmapOpacityTransition) { - setHeatmapOpacityTransition(*transition); + if (property == Property::HeatmapWeightTransition) { + setHeatmapWeightTransition(*transition); return nullopt; } diff --git a/src/mbgl/style/layers/heatmap_layer_properties.hpp b/src/mbgl/style/layers/heatmap_layer_properties.hpp index cccff61449..dda9808e77 100644 --- a/src/mbgl/style/layers/heatmap_layer_properties.hpp +++ b/src/mbgl/style/layers/heatmap_layer_properties.hpp @@ -14,31 +14,31 @@ namespace mbgl { namespace style { -struct HeatmapRadius : DataDrivenPaintProperty<float, attributes::radius, uniforms::radius> { - static float defaultValue() { return 30; } +struct HeatmapColor : ColorRampProperty { }; -struct HeatmapWeight : DataDrivenPaintProperty<float, attributes::weight, uniforms::weight> { +struct HeatmapIntensity : PaintProperty<float> { static float defaultValue() { return 1; } }; -struct HeatmapIntensity : PaintProperty<float> { +struct HeatmapOpacity : PaintProperty<float> { static float defaultValue() { return 1; } }; -struct HeatmapColor : ColorRampProperty { +struct HeatmapRadius : DataDrivenPaintProperty<float, attributes::radius, uniforms::radius> { + static float defaultValue() { return 30; } }; -struct HeatmapOpacity : PaintProperty<float> { +struct HeatmapWeight : DataDrivenPaintProperty<float, attributes::weight, uniforms::weight> { static float defaultValue() { return 1; } }; class HeatmapPaintProperties : public Properties< - HeatmapRadius, - HeatmapWeight, - HeatmapIntensity, HeatmapColor, - HeatmapOpacity + HeatmapIntensity, + HeatmapOpacity, + HeatmapRadius, + HeatmapWeight > {}; class HeatmapLayerProperties final : public LayerProperties { diff --git a/src/mbgl/style/layers/hillshade_layer.cpp b/src/mbgl/style/layers/hillshade_layer.cpp index dacd639f52..558022eea8 100644 --- a/src/mbgl/style/layers/hillshade_layer.cpp +++ b/src/mbgl/style/layers/hillshade_layer.cpp @@ -63,199 +63,199 @@ void HillshadeLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBu // Paint properties -PropertyValue<float> HillshadeLayer::getDefaultHillshadeIlluminationDirection() { - return { 335 }; +PropertyValue<Color> HillshadeLayer::getDefaultHillshadeAccentColor() { + return { Color::black() }; } -const PropertyValue<float>& HillshadeLayer::getHillshadeIlluminationDirection() const { - return impl().paint.template get<HillshadeIlluminationDirection>().value; +const PropertyValue<Color>& HillshadeLayer::getHillshadeAccentColor() const { + return impl().paint.template get<HillshadeAccentColor>().value; } -void HillshadeLayer::setHillshadeIlluminationDirection(const PropertyValue<float>& value) { - if (value == getHillshadeIlluminationDirection()) +void HillshadeLayer::setHillshadeAccentColor(const PropertyValue<Color>& value) { + if (value == getHillshadeAccentColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<HillshadeIlluminationDirection>().value = value; + impl_->paint.template get<HillshadeAccentColor>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void HillshadeLayer::setHillshadeIlluminationDirectionTransition(const TransitionOptions& options) { +void HillshadeLayer::setHillshadeAccentColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<HillshadeIlluminationDirection>().options = options; + impl_->paint.template get<HillshadeAccentColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions HillshadeLayer::getHillshadeIlluminationDirectionTransition() const { - return impl().paint.template get<HillshadeIlluminationDirection>().options; +TransitionOptions HillshadeLayer::getHillshadeAccentColorTransition() const { + return impl().paint.template get<HillshadeAccentColor>().options; } -PropertyValue<HillshadeIlluminationAnchorType> HillshadeLayer::getDefaultHillshadeIlluminationAnchor() { - return { HillshadeIlluminationAnchorType::Viewport }; +PropertyValue<float> HillshadeLayer::getDefaultHillshadeExaggeration() { + return { 0.5 }; } -const PropertyValue<HillshadeIlluminationAnchorType>& HillshadeLayer::getHillshadeIlluminationAnchor() const { - return impl().paint.template get<HillshadeIlluminationAnchor>().value; +const PropertyValue<float>& HillshadeLayer::getHillshadeExaggeration() const { + return impl().paint.template get<HillshadeExaggeration>().value; } -void HillshadeLayer::setHillshadeIlluminationAnchor(const PropertyValue<HillshadeIlluminationAnchorType>& value) { - if (value == getHillshadeIlluminationAnchor()) +void HillshadeLayer::setHillshadeExaggeration(const PropertyValue<float>& value) { + if (value == getHillshadeExaggeration()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<HillshadeIlluminationAnchor>().value = value; + impl_->paint.template get<HillshadeExaggeration>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void HillshadeLayer::setHillshadeIlluminationAnchorTransition(const TransitionOptions& options) { +void HillshadeLayer::setHillshadeExaggerationTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<HillshadeIlluminationAnchor>().options = options; + impl_->paint.template get<HillshadeExaggeration>().options = options; baseImpl = std::move(impl_); } -TransitionOptions HillshadeLayer::getHillshadeIlluminationAnchorTransition() const { - return impl().paint.template get<HillshadeIlluminationAnchor>().options; +TransitionOptions HillshadeLayer::getHillshadeExaggerationTransition() const { + return impl().paint.template get<HillshadeExaggeration>().options; } -PropertyValue<float> HillshadeLayer::getDefaultHillshadeExaggeration() { - return { 0.5 }; +PropertyValue<Color> HillshadeLayer::getDefaultHillshadeHighlightColor() { + return { Color::white() }; } -const PropertyValue<float>& HillshadeLayer::getHillshadeExaggeration() const { - return impl().paint.template get<HillshadeExaggeration>().value; +const PropertyValue<Color>& HillshadeLayer::getHillshadeHighlightColor() const { + return impl().paint.template get<HillshadeHighlightColor>().value; } -void HillshadeLayer::setHillshadeExaggeration(const PropertyValue<float>& value) { - if (value == getHillshadeExaggeration()) +void HillshadeLayer::setHillshadeHighlightColor(const PropertyValue<Color>& value) { + if (value == getHillshadeHighlightColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<HillshadeExaggeration>().value = value; + impl_->paint.template get<HillshadeHighlightColor>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void HillshadeLayer::setHillshadeExaggerationTransition(const TransitionOptions& options) { +void HillshadeLayer::setHillshadeHighlightColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<HillshadeExaggeration>().options = options; + impl_->paint.template get<HillshadeHighlightColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions HillshadeLayer::getHillshadeExaggerationTransition() const { - return impl().paint.template get<HillshadeExaggeration>().options; +TransitionOptions HillshadeLayer::getHillshadeHighlightColorTransition() const { + return impl().paint.template get<HillshadeHighlightColor>().options; } -PropertyValue<Color> HillshadeLayer::getDefaultHillshadeShadowColor() { - return { Color::black() }; +PropertyValue<HillshadeIlluminationAnchorType> HillshadeLayer::getDefaultHillshadeIlluminationAnchor() { + return { HillshadeIlluminationAnchorType::Viewport }; } -const PropertyValue<Color>& HillshadeLayer::getHillshadeShadowColor() const { - return impl().paint.template get<HillshadeShadowColor>().value; +const PropertyValue<HillshadeIlluminationAnchorType>& HillshadeLayer::getHillshadeIlluminationAnchor() const { + return impl().paint.template get<HillshadeIlluminationAnchor>().value; } -void HillshadeLayer::setHillshadeShadowColor(const PropertyValue<Color>& value) { - if (value == getHillshadeShadowColor()) +void HillshadeLayer::setHillshadeIlluminationAnchor(const PropertyValue<HillshadeIlluminationAnchorType>& value) { + if (value == getHillshadeIlluminationAnchor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<HillshadeShadowColor>().value = value; + impl_->paint.template get<HillshadeIlluminationAnchor>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void HillshadeLayer::setHillshadeShadowColorTransition(const TransitionOptions& options) { +void HillshadeLayer::setHillshadeIlluminationAnchorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<HillshadeShadowColor>().options = options; + impl_->paint.template get<HillshadeIlluminationAnchor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions HillshadeLayer::getHillshadeShadowColorTransition() const { - return impl().paint.template get<HillshadeShadowColor>().options; +TransitionOptions HillshadeLayer::getHillshadeIlluminationAnchorTransition() const { + return impl().paint.template get<HillshadeIlluminationAnchor>().options; } -PropertyValue<Color> HillshadeLayer::getDefaultHillshadeHighlightColor() { - return { Color::white() }; +PropertyValue<float> HillshadeLayer::getDefaultHillshadeIlluminationDirection() { + return { 335 }; } -const PropertyValue<Color>& HillshadeLayer::getHillshadeHighlightColor() const { - return impl().paint.template get<HillshadeHighlightColor>().value; +const PropertyValue<float>& HillshadeLayer::getHillshadeIlluminationDirection() const { + return impl().paint.template get<HillshadeIlluminationDirection>().value; } -void HillshadeLayer::setHillshadeHighlightColor(const PropertyValue<Color>& value) { - if (value == getHillshadeHighlightColor()) +void HillshadeLayer::setHillshadeIlluminationDirection(const PropertyValue<float>& value) { + if (value == getHillshadeIlluminationDirection()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<HillshadeHighlightColor>().value = value; + impl_->paint.template get<HillshadeIlluminationDirection>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void HillshadeLayer::setHillshadeHighlightColorTransition(const TransitionOptions& options) { +void HillshadeLayer::setHillshadeIlluminationDirectionTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<HillshadeHighlightColor>().options = options; + impl_->paint.template get<HillshadeIlluminationDirection>().options = options; baseImpl = std::move(impl_); } -TransitionOptions HillshadeLayer::getHillshadeHighlightColorTransition() const { - return impl().paint.template get<HillshadeHighlightColor>().options; +TransitionOptions HillshadeLayer::getHillshadeIlluminationDirectionTransition() const { + return impl().paint.template get<HillshadeIlluminationDirection>().options; } -PropertyValue<Color> HillshadeLayer::getDefaultHillshadeAccentColor() { +PropertyValue<Color> HillshadeLayer::getDefaultHillshadeShadowColor() { return { Color::black() }; } -const PropertyValue<Color>& HillshadeLayer::getHillshadeAccentColor() const { - return impl().paint.template get<HillshadeAccentColor>().value; +const PropertyValue<Color>& HillshadeLayer::getHillshadeShadowColor() const { + return impl().paint.template get<HillshadeShadowColor>().value; } -void HillshadeLayer::setHillshadeAccentColor(const PropertyValue<Color>& value) { - if (value == getHillshadeAccentColor()) +void HillshadeLayer::setHillshadeShadowColor(const PropertyValue<Color>& value) { + if (value == getHillshadeShadowColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<HillshadeAccentColor>().value = value; + impl_->paint.template get<HillshadeShadowColor>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void HillshadeLayer::setHillshadeAccentColorTransition(const TransitionOptions& options) { +void HillshadeLayer::setHillshadeShadowColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<HillshadeAccentColor>().options = options; + impl_->paint.template get<HillshadeShadowColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions HillshadeLayer::getHillshadeAccentColorTransition() const { - return impl().paint.template get<HillshadeAccentColor>().options; +TransitionOptions HillshadeLayer::getHillshadeShadowColorTransition() const { + return impl().paint.template get<HillshadeShadowColor>().options; } using namespace conversion; optional<Error> HillshadeLayer::setPaintProperty(const std::string& name, const Convertible& value) { enum class Property : uint8_t { - HillshadeIlluminationDirection, - HillshadeIlluminationAnchor, + HillshadeAccentColor, HillshadeExaggeration, - HillshadeShadowColor, HillshadeHighlightColor, - HillshadeAccentColor, - HillshadeIlluminationDirectionTransition, - HillshadeIlluminationAnchorTransition, + HillshadeIlluminationAnchor, + HillshadeIlluminationDirection, + HillshadeShadowColor, + HillshadeAccentColorTransition, HillshadeExaggerationTransition, - HillshadeShadowColorTransition, HillshadeHighlightColorTransition, - HillshadeAccentColorTransition, + HillshadeIlluminationAnchorTransition, + HillshadeIlluminationDirectionTransition, + HillshadeShadowColorTransition, }; MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({ - { "hillshade-illumination-direction", static_cast<uint8_t>(Property::HillshadeIlluminationDirection) }, - { "hillshade-illumination-anchor", static_cast<uint8_t>(Property::HillshadeIlluminationAnchor) }, + { "hillshade-accent-color", static_cast<uint8_t>(Property::HillshadeAccentColor) }, { "hillshade-exaggeration", static_cast<uint8_t>(Property::HillshadeExaggeration) }, - { "hillshade-shadow-color", static_cast<uint8_t>(Property::HillshadeShadowColor) }, { "hillshade-highlight-color", static_cast<uint8_t>(Property::HillshadeHighlightColor) }, - { "hillshade-accent-color", static_cast<uint8_t>(Property::HillshadeAccentColor) }, - { "hillshade-illumination-direction-transition", static_cast<uint8_t>(Property::HillshadeIlluminationDirectionTransition) }, - { "hillshade-illumination-anchor-transition", static_cast<uint8_t>(Property::HillshadeIlluminationAnchorTransition) }, + { "hillshade-illumination-anchor", static_cast<uint8_t>(Property::HillshadeIlluminationAnchor) }, + { "hillshade-illumination-direction", static_cast<uint8_t>(Property::HillshadeIlluminationDirection) }, + { "hillshade-shadow-color", static_cast<uint8_t>(Property::HillshadeShadowColor) }, + { "hillshade-accent-color-transition", static_cast<uint8_t>(Property::HillshadeAccentColorTransition) }, { "hillshade-exaggeration-transition", static_cast<uint8_t>(Property::HillshadeExaggerationTransition) }, - { "hillshade-shadow-color-transition", static_cast<uint8_t>(Property::HillshadeShadowColorTransition) }, { "hillshade-highlight-color-transition", static_cast<uint8_t>(Property::HillshadeHighlightColorTransition) }, - { "hillshade-accent-color-transition", static_cast<uint8_t>(Property::HillshadeAccentColorTransition) } + { "hillshade-illumination-anchor-transition", static_cast<uint8_t>(Property::HillshadeIlluminationAnchorTransition) }, + { "hillshade-illumination-direction-transition", static_cast<uint8_t>(Property::HillshadeIlluminationDirectionTransition) }, + { "hillshade-shadow-color-transition", static_cast<uint8_t>(Property::HillshadeShadowColorTransition) } }); const auto it = properties.find(name.c_str()); @@ -266,59 +266,59 @@ optional<Error> HillshadeLayer::setPaintProperty(const std::string& name, const auto property = static_cast<Property>(it->second); - if (property == Property::HillshadeIlluminationDirection || property == Property::HillshadeExaggeration) { + if (property == Property::HillshadeAccentColor || property == Property::HillshadeHighlightColor || property == Property::HillshadeShadowColor) { Error error; - optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false); + optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, false, false); if (!typedValue) { return error; } - if (property == Property::HillshadeIlluminationDirection) { - setHillshadeIlluminationDirection(*typedValue); + if (property == Property::HillshadeAccentColor) { + setHillshadeAccentColor(*typedValue); return nullopt; } - if (property == Property::HillshadeExaggeration) { - setHillshadeExaggeration(*typedValue); + if (property == Property::HillshadeHighlightColor) { + setHillshadeHighlightColor(*typedValue); return nullopt; } - } - - if (property == Property::HillshadeIlluminationAnchor) { - Error error; - optional<PropertyValue<HillshadeIlluminationAnchorType>> typedValue = convert<PropertyValue<HillshadeIlluminationAnchorType>>(value, error, false, false); - if (!typedValue) { - return error; + if (property == Property::HillshadeShadowColor) { + setHillshadeShadowColor(*typedValue); + return nullopt; } - setHillshadeIlluminationAnchor(*typedValue); - return nullopt; - } - if (property == Property::HillshadeShadowColor || property == Property::HillshadeHighlightColor || property == Property::HillshadeAccentColor) { + if (property == Property::HillshadeExaggeration || property == Property::HillshadeIlluminationDirection) { Error error; - optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, false, false); + optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false); if (!typedValue) { return error; } - if (property == Property::HillshadeShadowColor) { - setHillshadeShadowColor(*typedValue); + if (property == Property::HillshadeExaggeration) { + setHillshadeExaggeration(*typedValue); return nullopt; } - if (property == Property::HillshadeHighlightColor) { - setHillshadeHighlightColor(*typedValue); + if (property == Property::HillshadeIlluminationDirection) { + setHillshadeIlluminationDirection(*typedValue); return nullopt; } - if (property == Property::HillshadeAccentColor) { - setHillshadeAccentColor(*typedValue); - return nullopt; + } + + if (property == Property::HillshadeIlluminationAnchor) { + Error error; + optional<PropertyValue<HillshadeIlluminationAnchorType>> typedValue = convert<PropertyValue<HillshadeIlluminationAnchorType>>(value, error, false, false); + if (!typedValue) { + return error; } + setHillshadeIlluminationAnchor(*typedValue); + return nullopt; + } @@ -328,33 +328,33 @@ optional<Error> HillshadeLayer::setPaintProperty(const std::string& name, const return error; } - if (property == Property::HillshadeIlluminationDirectionTransition) { - setHillshadeIlluminationDirectionTransition(*transition); + if (property == Property::HillshadeAccentColorTransition) { + setHillshadeAccentColorTransition(*transition); return nullopt; } - if (property == Property::HillshadeIlluminationAnchorTransition) { - setHillshadeIlluminationAnchorTransition(*transition); + if (property == Property::HillshadeExaggerationTransition) { + setHillshadeExaggerationTransition(*transition); return nullopt; } - if (property == Property::HillshadeExaggerationTransition) { - setHillshadeExaggerationTransition(*transition); + if (property == Property::HillshadeHighlightColorTransition) { + setHillshadeHighlightColorTransition(*transition); return nullopt; } - if (property == Property::HillshadeShadowColorTransition) { - setHillshadeShadowColorTransition(*transition); + if (property == Property::HillshadeIlluminationAnchorTransition) { + setHillshadeIlluminationAnchorTransition(*transition); return nullopt; } - if (property == Property::HillshadeHighlightColorTransition) { - setHillshadeHighlightColorTransition(*transition); + if (property == Property::HillshadeIlluminationDirectionTransition) { + setHillshadeIlluminationDirectionTransition(*transition); return nullopt; } - if (property == Property::HillshadeAccentColorTransition) { - setHillshadeAccentColorTransition(*transition); + if (property == Property::HillshadeShadowColorTransition) { + setHillshadeShadowColorTransition(*transition); return nullopt; } diff --git a/src/mbgl/style/layers/hillshade_layer_properties.hpp b/src/mbgl/style/layers/hillshade_layer_properties.hpp index 6433151148..85ef8b967c 100644 --- a/src/mbgl/style/layers/hillshade_layer_properties.hpp +++ b/src/mbgl/style/layers/hillshade_layer_properties.hpp @@ -14,37 +14,37 @@ namespace mbgl { namespace style { -struct HillshadeIlluminationDirection : PaintProperty<float> { - static float defaultValue() { return 335; } -}; - -struct HillshadeIlluminationAnchor : PaintProperty<HillshadeIlluminationAnchorType> { - static HillshadeIlluminationAnchorType defaultValue() { return HillshadeIlluminationAnchorType::Viewport; } +struct HillshadeAccentColor : PaintProperty<Color> { + static Color defaultValue() { return Color::black(); } }; struct HillshadeExaggeration : PaintProperty<float> { static float defaultValue() { return 0.5; } }; -struct HillshadeShadowColor : PaintProperty<Color> { - static Color defaultValue() { return Color::black(); } -}; - struct HillshadeHighlightColor : PaintProperty<Color> { static Color defaultValue() { return Color::white(); } }; -struct HillshadeAccentColor : PaintProperty<Color> { +struct HillshadeIlluminationAnchor : PaintProperty<HillshadeIlluminationAnchorType> { + static HillshadeIlluminationAnchorType defaultValue() { return HillshadeIlluminationAnchorType::Viewport; } +}; + +struct HillshadeIlluminationDirection : PaintProperty<float> { + static float defaultValue() { return 335; } +}; + +struct HillshadeShadowColor : PaintProperty<Color> { static Color defaultValue() { return Color::black(); } }; class HillshadePaintProperties : public Properties< - HillshadeIlluminationDirection, - HillshadeIlluminationAnchor, + HillshadeAccentColor, HillshadeExaggeration, - HillshadeShadowColor, HillshadeHighlightColor, - HillshadeAccentColor + HillshadeIlluminationAnchor, + HillshadeIlluminationDirection, + HillshadeShadowColor > {}; class HillshadeLayerProperties final : public LayerProperties { diff --git a/src/mbgl/style/layers/line_layer.cpp b/src/mbgl/style/layers/line_layer.cpp index d50ae27098..0a6f0824f4 100644 --- a/src/mbgl/style/layers/line_layer.cpp +++ b/src/mbgl/style/layers/line_layer.cpp @@ -128,31 +128,31 @@ void LineLayer::setLineRoundLimit(const PropertyValue<float>& value) { // Paint properties -PropertyValue<float> LineLayer::getDefaultLineOpacity() { - return { 1 }; +PropertyValue<float> LineLayer::getDefaultLineBlur() { + return { 0 }; } -const PropertyValue<float>& LineLayer::getLineOpacity() const { - return impl().paint.template get<LineOpacity>().value; +const PropertyValue<float>& LineLayer::getLineBlur() const { + return impl().paint.template get<LineBlur>().value; } -void LineLayer::setLineOpacity(const PropertyValue<float>& value) { - if (value == getLineOpacity()) +void LineLayer::setLineBlur(const PropertyValue<float>& value) { + if (value == getLineBlur()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineOpacity>().value = value; + impl_->paint.template get<LineBlur>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void LineLayer::setLineOpacityTransition(const TransitionOptions& options) { +void LineLayer::setLineBlurTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineOpacity>().options = options; + impl_->paint.template get<LineBlur>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineOpacityTransition() const { - return impl().paint.template get<LineOpacity>().options; +TransitionOptions LineLayer::getLineBlurTransition() const { + return impl().paint.template get<LineBlur>().options; } PropertyValue<Color> LineLayer::getDefaultLineColor() { @@ -182,301 +182,301 @@ TransitionOptions LineLayer::getLineColorTransition() const { return impl().paint.template get<LineColor>().options; } -PropertyValue<std::array<float, 2>> LineLayer::getDefaultLineTranslate() { - return { {{ 0, 0 }} }; +PropertyValue<std::vector<float>> LineLayer::getDefaultLineDasharray() { + return { { } }; } -const PropertyValue<std::array<float, 2>>& LineLayer::getLineTranslate() const { - return impl().paint.template get<LineTranslate>().value; +const PropertyValue<std::vector<float>>& LineLayer::getLineDasharray() const { + return impl().paint.template get<LineDasharray>().value; } -void LineLayer::setLineTranslate(const PropertyValue<std::array<float, 2>>& value) { - if (value == getLineTranslate()) +void LineLayer::setLineDasharray(const PropertyValue<std::vector<float>>& value) { + if (value == getLineDasharray()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineTranslate>().value = value; + impl_->paint.template get<LineDasharray>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void LineLayer::setLineTranslateTransition(const TransitionOptions& options) { +void LineLayer::setLineDasharrayTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineTranslate>().options = options; + impl_->paint.template get<LineDasharray>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineTranslateTransition() const { - return impl().paint.template get<LineTranslate>().options; +TransitionOptions LineLayer::getLineDasharrayTransition() const { + return impl().paint.template get<LineDasharray>().options; } -PropertyValue<TranslateAnchorType> LineLayer::getDefaultLineTranslateAnchor() { - return { TranslateAnchorType::Map }; +PropertyValue<float> LineLayer::getDefaultLineGapWidth() { + return { 0 }; } -const PropertyValue<TranslateAnchorType>& LineLayer::getLineTranslateAnchor() const { - return impl().paint.template get<LineTranslateAnchor>().value; +const PropertyValue<float>& LineLayer::getLineGapWidth() const { + return impl().paint.template get<LineGapWidth>().value; } -void LineLayer::setLineTranslateAnchor(const PropertyValue<TranslateAnchorType>& value) { - if (value == getLineTranslateAnchor()) +void LineLayer::setLineGapWidth(const PropertyValue<float>& value) { + if (value == getLineGapWidth()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineTranslateAnchor>().value = value; + impl_->paint.template get<LineGapWidth>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void LineLayer::setLineTranslateAnchorTransition(const TransitionOptions& options) { +void LineLayer::setLineGapWidthTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineTranslateAnchor>().options = options; + impl_->paint.template get<LineGapWidth>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineTranslateAnchorTransition() const { - return impl().paint.template get<LineTranslateAnchor>().options; +TransitionOptions LineLayer::getLineGapWidthTransition() const { + return impl().paint.template get<LineGapWidth>().options; } -PropertyValue<float> LineLayer::getDefaultLineWidth() { - return { 1 }; +ColorRampPropertyValue LineLayer::getDefaultLineGradient() { + return { {} }; } -const PropertyValue<float>& LineLayer::getLineWidth() const { - return impl().paint.template get<LineWidth>().value; +const ColorRampPropertyValue& LineLayer::getLineGradient() const { + return impl().paint.template get<LineGradient>().value; } -void LineLayer::setLineWidth(const PropertyValue<float>& value) { - if (value == getLineWidth()) +void LineLayer::setLineGradient(const ColorRampPropertyValue& value) { + if (value == getLineGradient()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineWidth>().value = value; - impl_->paint.template get<LineFloorWidth>().value = value; + impl_->paint.template get<LineGradient>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void LineLayer::setLineWidthTransition(const TransitionOptions& options) { +void LineLayer::setLineGradientTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineWidth>().options = options; + impl_->paint.template get<LineGradient>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineWidthTransition() const { - return impl().paint.template get<LineWidth>().options; +TransitionOptions LineLayer::getLineGradientTransition() const { + return impl().paint.template get<LineGradient>().options; } -PropertyValue<float> LineLayer::getDefaultLineGapWidth() { +PropertyValue<float> LineLayer::getDefaultLineOffset() { return { 0 }; } -const PropertyValue<float>& LineLayer::getLineGapWidth() const { - return impl().paint.template get<LineGapWidth>().value; +const PropertyValue<float>& LineLayer::getLineOffset() const { + return impl().paint.template get<LineOffset>().value; } -void LineLayer::setLineGapWidth(const PropertyValue<float>& value) { - if (value == getLineGapWidth()) +void LineLayer::setLineOffset(const PropertyValue<float>& value) { + if (value == getLineOffset()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineGapWidth>().value = value; + impl_->paint.template get<LineOffset>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void LineLayer::setLineGapWidthTransition(const TransitionOptions& options) { +void LineLayer::setLineOffsetTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineGapWidth>().options = options; + impl_->paint.template get<LineOffset>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineGapWidthTransition() const { - return impl().paint.template get<LineGapWidth>().options; +TransitionOptions LineLayer::getLineOffsetTransition() const { + return impl().paint.template get<LineOffset>().options; } -PropertyValue<float> LineLayer::getDefaultLineOffset() { - return { 0 }; +PropertyValue<float> LineLayer::getDefaultLineOpacity() { + return { 1 }; } -const PropertyValue<float>& LineLayer::getLineOffset() const { - return impl().paint.template get<LineOffset>().value; +const PropertyValue<float>& LineLayer::getLineOpacity() const { + return impl().paint.template get<LineOpacity>().value; } -void LineLayer::setLineOffset(const PropertyValue<float>& value) { - if (value == getLineOffset()) +void LineLayer::setLineOpacity(const PropertyValue<float>& value) { + if (value == getLineOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineOffset>().value = value; + impl_->paint.template get<LineOpacity>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void LineLayer::setLineOffsetTransition(const TransitionOptions& options) { +void LineLayer::setLineOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineOffset>().options = options; + impl_->paint.template get<LineOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineOffsetTransition() const { - return impl().paint.template get<LineOffset>().options; +TransitionOptions LineLayer::getLineOpacityTransition() const { + return impl().paint.template get<LineOpacity>().options; } -PropertyValue<float> LineLayer::getDefaultLineBlur() { - return { 0 }; +PropertyValue<std::string> LineLayer::getDefaultLinePattern() { + return { "" }; } -const PropertyValue<float>& LineLayer::getLineBlur() const { - return impl().paint.template get<LineBlur>().value; +const PropertyValue<std::string>& LineLayer::getLinePattern() const { + return impl().paint.template get<LinePattern>().value; } -void LineLayer::setLineBlur(const PropertyValue<float>& value) { - if (value == getLineBlur()) +void LineLayer::setLinePattern(const PropertyValue<std::string>& value) { + if (value == getLinePattern()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineBlur>().value = value; + impl_->paint.template get<LinePattern>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void LineLayer::setLineBlurTransition(const TransitionOptions& options) { +void LineLayer::setLinePatternTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineBlur>().options = options; + impl_->paint.template get<LinePattern>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineBlurTransition() const { - return impl().paint.template get<LineBlur>().options; +TransitionOptions LineLayer::getLinePatternTransition() const { + return impl().paint.template get<LinePattern>().options; } -PropertyValue<std::vector<float>> LineLayer::getDefaultLineDasharray() { - return { { } }; +PropertyValue<std::array<float, 2>> LineLayer::getDefaultLineTranslate() { + return { {{ 0, 0 }} }; } -const PropertyValue<std::vector<float>>& LineLayer::getLineDasharray() const { - return impl().paint.template get<LineDasharray>().value; +const PropertyValue<std::array<float, 2>>& LineLayer::getLineTranslate() const { + return impl().paint.template get<LineTranslate>().value; } -void LineLayer::setLineDasharray(const PropertyValue<std::vector<float>>& value) { - if (value == getLineDasharray()) +void LineLayer::setLineTranslate(const PropertyValue<std::array<float, 2>>& value) { + if (value == getLineTranslate()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineDasharray>().value = value; + impl_->paint.template get<LineTranslate>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void LineLayer::setLineDasharrayTransition(const TransitionOptions& options) { +void LineLayer::setLineTranslateTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineDasharray>().options = options; + impl_->paint.template get<LineTranslate>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineDasharrayTransition() const { - return impl().paint.template get<LineDasharray>().options; +TransitionOptions LineLayer::getLineTranslateTransition() const { + return impl().paint.template get<LineTranslate>().options; } -PropertyValue<std::string> LineLayer::getDefaultLinePattern() { - return { "" }; +PropertyValue<TranslateAnchorType> LineLayer::getDefaultLineTranslateAnchor() { + return { TranslateAnchorType::Map }; } -const PropertyValue<std::string>& LineLayer::getLinePattern() const { - return impl().paint.template get<LinePattern>().value; +const PropertyValue<TranslateAnchorType>& LineLayer::getLineTranslateAnchor() const { + return impl().paint.template get<LineTranslateAnchor>().value; } -void LineLayer::setLinePattern(const PropertyValue<std::string>& value) { - if (value == getLinePattern()) +void LineLayer::setLineTranslateAnchor(const PropertyValue<TranslateAnchorType>& value) { + if (value == getLineTranslateAnchor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LinePattern>().value = value; + impl_->paint.template get<LineTranslateAnchor>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void LineLayer::setLinePatternTransition(const TransitionOptions& options) { +void LineLayer::setLineTranslateAnchorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LinePattern>().options = options; + impl_->paint.template get<LineTranslateAnchor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLinePatternTransition() const { - return impl().paint.template get<LinePattern>().options; +TransitionOptions LineLayer::getLineTranslateAnchorTransition() const { + return impl().paint.template get<LineTranslateAnchor>().options; } -ColorRampPropertyValue LineLayer::getDefaultLineGradient() { - return { {} }; +PropertyValue<float> LineLayer::getDefaultLineWidth() { + return { 1 }; } -const ColorRampPropertyValue& LineLayer::getLineGradient() const { - return impl().paint.template get<LineGradient>().value; +const PropertyValue<float>& LineLayer::getLineWidth() const { + return impl().paint.template get<LineWidth>().value; } -void LineLayer::setLineGradient(const ColorRampPropertyValue& value) { - if (value == getLineGradient()) +void LineLayer::setLineWidth(const PropertyValue<float>& value) { + if (value == getLineWidth()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineGradient>().value = value; + impl_->paint.template get<LineWidth>().value = value; + impl_->paint.template get<LineFloorWidth>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void LineLayer::setLineGradientTransition(const TransitionOptions& options) { +void LineLayer::setLineWidthTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineGradient>().options = options; + impl_->paint.template get<LineWidth>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineGradientTransition() const { - return impl().paint.template get<LineGradient>().options; +TransitionOptions LineLayer::getLineWidthTransition() const { + return impl().paint.template get<LineWidth>().options; } using namespace conversion; optional<Error> LineLayer::setPaintProperty(const std::string& name, const Convertible& value) { enum class Property : uint8_t { - LineOpacity, + LineBlur, LineColor, - LineTranslate, - LineTranslateAnchor, - LineWidth, + LineDasharray, LineGapWidth, + LineGradient, LineOffset, - LineBlur, - LineDasharray, + LineOpacity, LinePattern, - LineGradient, - LineOpacityTransition, + LineTranslate, + LineTranslateAnchor, + LineWidth, + LineBlurTransition, LineColorTransition, - LineTranslateTransition, - LineTranslateAnchorTransition, - LineWidthTransition, + LineDasharrayTransition, LineGapWidthTransition, + LineGradientTransition, LineOffsetTransition, - LineBlurTransition, - LineDasharrayTransition, + LineOpacityTransition, LinePatternTransition, - LineGradientTransition, + LineTranslateTransition, + LineTranslateAnchorTransition, + LineWidthTransition, }; MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({ - { "line-opacity", static_cast<uint8_t>(Property::LineOpacity) }, + { "line-blur", static_cast<uint8_t>(Property::LineBlur) }, { "line-color", static_cast<uint8_t>(Property::LineColor) }, - { "line-translate", static_cast<uint8_t>(Property::LineTranslate) }, - { "line-translate-anchor", static_cast<uint8_t>(Property::LineTranslateAnchor) }, - { "line-width", static_cast<uint8_t>(Property::LineWidth) }, + { "line-dasharray", static_cast<uint8_t>(Property::LineDasharray) }, { "line-gap-width", static_cast<uint8_t>(Property::LineGapWidth) }, + { "line-gradient", static_cast<uint8_t>(Property::LineGradient) }, { "line-offset", static_cast<uint8_t>(Property::LineOffset) }, - { "line-blur", static_cast<uint8_t>(Property::LineBlur) }, - { "line-dasharray", static_cast<uint8_t>(Property::LineDasharray) }, + { "line-opacity", static_cast<uint8_t>(Property::LineOpacity) }, { "line-pattern", static_cast<uint8_t>(Property::LinePattern) }, - { "line-gradient", static_cast<uint8_t>(Property::LineGradient) }, - { "line-opacity-transition", static_cast<uint8_t>(Property::LineOpacityTransition) }, + { "line-translate", static_cast<uint8_t>(Property::LineTranslate) }, + { "line-translate-anchor", static_cast<uint8_t>(Property::LineTranslateAnchor) }, + { "line-width", static_cast<uint8_t>(Property::LineWidth) }, + { "line-blur-transition", static_cast<uint8_t>(Property::LineBlurTransition) }, { "line-color-transition", static_cast<uint8_t>(Property::LineColorTransition) }, - { "line-translate-transition", static_cast<uint8_t>(Property::LineTranslateTransition) }, - { "line-translate-anchor-transition", static_cast<uint8_t>(Property::LineTranslateAnchorTransition) }, - { "line-width-transition", static_cast<uint8_t>(Property::LineWidthTransition) }, + { "line-dasharray-transition", static_cast<uint8_t>(Property::LineDasharrayTransition) }, { "line-gap-width-transition", static_cast<uint8_t>(Property::LineGapWidthTransition) }, + { "line-gradient-transition", static_cast<uint8_t>(Property::LineGradientTransition) }, { "line-offset-transition", static_cast<uint8_t>(Property::LineOffsetTransition) }, - { "line-blur-transition", static_cast<uint8_t>(Property::LineBlurTransition) }, - { "line-dasharray-transition", static_cast<uint8_t>(Property::LineDasharrayTransition) }, + { "line-opacity-transition", static_cast<uint8_t>(Property::LineOpacityTransition) }, { "line-pattern-transition", static_cast<uint8_t>(Property::LinePatternTransition) }, - { "line-gradient-transition", static_cast<uint8_t>(Property::LineGradientTransition) } + { "line-translate-transition", static_cast<uint8_t>(Property::LineTranslateTransition) }, + { "line-translate-anchor-transition", static_cast<uint8_t>(Property::LineTranslateAnchorTransition) }, + { "line-width-transition", static_cast<uint8_t>(Property::LineWidthTransition) } }); const auto it = properties.find(name.c_str()); @@ -487,20 +487,15 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve auto property = static_cast<Property>(it->second); - if (property == Property::LineOpacity || property == Property::LineWidth || property == Property::LineGapWidth || property == Property::LineOffset || property == Property::LineBlur) { + if (property == Property::LineBlur || property == Property::LineGapWidth || property == Property::LineOffset || property == Property::LineOpacity || property == Property::LineWidth) { Error error; optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false); if (!typedValue) { return error; } - if (property == Property::LineOpacity) { - setLineOpacity(*typedValue); - return nullopt; - } - - if (property == Property::LineWidth) { - setLineWidth(*typedValue); + if (property == Property::LineBlur) { + setLineBlur(*typedValue); return nullopt; } @@ -514,8 +509,13 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve return nullopt; } - if (property == Property::LineBlur) { - setLineBlur(*typedValue); + if (property == Property::LineOpacity) { + setLineOpacity(*typedValue); + return nullopt; + } + + if (property == Property::LineWidth) { + setLineWidth(*typedValue); return nullopt; } @@ -533,62 +533,62 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve } - if (property == Property::LineTranslate) { + if (property == Property::LineDasharray) { Error error; - optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false); + optional<PropertyValue<std::vector<float>>> typedValue = convert<PropertyValue<std::vector<float>>>(value, error, false, false); if (!typedValue) { return error; } - setLineTranslate(*typedValue); + setLineDasharray(*typedValue); return nullopt; } - if (property == Property::LineTranslateAnchor) { + if (property == Property::LineGradient) { Error error; - optional<PropertyValue<TranslateAnchorType>> typedValue = convert<PropertyValue<TranslateAnchorType>>(value, error, false, false); + optional<ColorRampPropertyValue> typedValue = convert<ColorRampPropertyValue>(value, error, false, false); if (!typedValue) { return error; } - setLineTranslateAnchor(*typedValue); + setLineGradient(*typedValue); return nullopt; } - if (property == Property::LineDasharray) { + if (property == Property::LinePattern) { Error error; - optional<PropertyValue<std::vector<float>>> typedValue = convert<PropertyValue<std::vector<float>>>(value, error, false, false); + optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, false); if (!typedValue) { return error; } - setLineDasharray(*typedValue); + setLinePattern(*typedValue); return nullopt; } - if (property == Property::LinePattern) { + if (property == Property::LineTranslate) { Error error; - optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, false); + optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false); if (!typedValue) { return error; } - setLinePattern(*typedValue); + setLineTranslate(*typedValue); return nullopt; } - if (property == Property::LineGradient) { + if (property == Property::LineTranslateAnchor) { Error error; - optional<ColorRampPropertyValue> typedValue = convert<ColorRampPropertyValue>(value, error, false, false); + optional<PropertyValue<TranslateAnchorType>> typedValue = convert<PropertyValue<TranslateAnchorType>>(value, error, false, false); if (!typedValue) { return error; } - setLineGradient(*typedValue); + setLineTranslateAnchor(*typedValue); return nullopt; } @@ -600,8 +600,8 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve return error; } - if (property == Property::LineOpacityTransition) { - setLineOpacityTransition(*transition); + if (property == Property::LineBlurTransition) { + setLineBlurTransition(*transition); return nullopt; } @@ -610,48 +610,48 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve return nullopt; } - if (property == Property::LineTranslateTransition) { - setLineTranslateTransition(*transition); + if (property == Property::LineDasharrayTransition) { + setLineDasharrayTransition(*transition); return nullopt; } - if (property == Property::LineTranslateAnchorTransition) { - setLineTranslateAnchorTransition(*transition); + if (property == Property::LineGapWidthTransition) { + setLineGapWidthTransition(*transition); return nullopt; } - if (property == Property::LineWidthTransition) { - setLineWidthTransition(*transition); + if (property == Property::LineGradientTransition) { + setLineGradientTransition(*transition); return nullopt; } - if (property == Property::LineGapWidthTransition) { - setLineGapWidthTransition(*transition); + if (property == Property::LineOffsetTransition) { + setLineOffsetTransition(*transition); return nullopt; } - if (property == Property::LineOffsetTransition) { - setLineOffsetTransition(*transition); + if (property == Property::LineOpacityTransition) { + setLineOpacityTransition(*transition); return nullopt; } - if (property == Property::LineBlurTransition) { - setLineBlurTransition(*transition); + if (property == Property::LinePatternTransition) { + setLinePatternTransition(*transition); return nullopt; } - if (property == Property::LineDasharrayTransition) { - setLineDasharrayTransition(*transition); + if (property == Property::LineTranslateTransition) { + setLineTranslateTransition(*transition); return nullopt; } - if (property == Property::LinePatternTransition) { - setLinePatternTransition(*transition); + if (property == Property::LineTranslateAnchorTransition) { + setLineTranslateAnchorTransition(*transition); return nullopt; } - if (property == Property::LineGradientTransition) { - setLineGradientTransition(*transition); + if (property == Property::LineWidthTransition) { + setLineWidthTransition(*transition); return nullopt; } diff --git a/src/mbgl/style/layers/line_layer_properties.hpp b/src/mbgl/style/layers/line_layer_properties.hpp index 24a6c13675..7463d94393 100644 --- a/src/mbgl/style/layers/line_layer_properties.hpp +++ b/src/mbgl/style/layers/line_layer_properties.hpp @@ -34,52 +34,52 @@ struct LineRoundLimit : LayoutProperty<float> { static float defaultValue() { return 1; } }; -struct LineOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> { - static float defaultValue() { return 1; } +struct LineBlur : DataDrivenPaintProperty<float, attributes::blur, uniforms::blur> { + static float defaultValue() { return 0; } }; struct LineColor : DataDrivenPaintProperty<Color, attributes::color, uniforms::color> { static Color defaultValue() { return Color::black(); } }; -struct LineTranslate : PaintProperty<std::array<float, 2>> { - static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } -}; - -struct LineTranslateAnchor : PaintProperty<TranslateAnchorType> { - static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; } +struct LineDasharray : CrossFadedPaintProperty<std::vector<float>> { + static std::vector<float> defaultValue() { return { }; } }; -struct LineWidth : DataDrivenPaintProperty<float, attributes::width, uniforms::width> { +struct LineFloorWidth : DataDrivenPaintProperty<float, attributes::floorwidth, uniforms::floorwidth> { static float defaultValue() { return 1; } + using EvaluatorType = DataDrivenPropertyEvaluator<float, true>; }; struct LineGapWidth : DataDrivenPaintProperty<float, attributes::gapwidth, uniforms::gapwidth> { static float defaultValue() { return 0; } }; -struct LineOffset : DataDrivenPaintProperty<float, attributes::offset, uniforms::offset> { - static float defaultValue() { return 0; } +struct LineGradient : ColorRampProperty { }; -struct LineBlur : DataDrivenPaintProperty<float, attributes::blur, uniforms::blur> { +struct LineOffset : DataDrivenPaintProperty<float, attributes::offset, uniforms::offset> { static float defaultValue() { return 0; } }; -struct LineDasharray : CrossFadedPaintProperty<std::vector<float>> { - static std::vector<float> defaultValue() { return { }; } +struct LineOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> { + static float defaultValue() { return 1; } }; struct LinePattern : CrossFadedDataDrivenPaintProperty<std::string, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> { static std::string defaultValue() { return ""; } }; -struct LineGradient : ColorRampProperty { +struct LineTranslate : PaintProperty<std::array<float, 2>> { + static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } }; -struct LineFloorWidth : DataDrivenPaintProperty<float, attributes::floorwidth, uniforms::floorwidth> { +struct LineTranslateAnchor : PaintProperty<TranslateAnchorType> { + static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; } +}; + +struct LineWidth : DataDrivenPaintProperty<float, attributes::width, uniforms::width> { static float defaultValue() { return 1; } - using EvaluatorType = DataDrivenPropertyEvaluator<float, true>; }; class LineLayoutProperties : public Properties< @@ -90,18 +90,18 @@ class LineLayoutProperties : public Properties< > {}; class LinePaintProperties : public Properties< - LineOpacity, + LineBlur, LineColor, - LineTranslate, - LineTranslateAnchor, - LineWidth, + LineDasharray, + LineFloorWidth, LineGapWidth, + LineGradient, LineOffset, - LineBlur, - LineDasharray, + LineOpacity, LinePattern, - LineGradient, - LineFloorWidth + LineTranslate, + LineTranslateAnchor, + LineWidth > {}; class LineLayerProperties final : public LayerProperties { diff --git a/src/mbgl/style/layers/raster_layer.cpp b/src/mbgl/style/layers/raster_layer.cpp index 784b720c68..b364870cff 100644 --- a/src/mbgl/style/layers/raster_layer.cpp +++ b/src/mbgl/style/layers/raster_layer.cpp @@ -63,166 +63,166 @@ void RasterLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffe // Paint properties -PropertyValue<float> RasterLayer::getDefaultRasterOpacity() { +PropertyValue<float> RasterLayer::getDefaultRasterBrightnessMax() { return { 1 }; } -const PropertyValue<float>& RasterLayer::getRasterOpacity() const { - return impl().paint.template get<RasterOpacity>().value; +const PropertyValue<float>& RasterLayer::getRasterBrightnessMax() const { + return impl().paint.template get<RasterBrightnessMax>().value; } -void RasterLayer::setRasterOpacity(const PropertyValue<float>& value) { - if (value == getRasterOpacity()) +void RasterLayer::setRasterBrightnessMax(const PropertyValue<float>& value) { + if (value == getRasterBrightnessMax()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<RasterOpacity>().value = value; + impl_->paint.template get<RasterBrightnessMax>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void RasterLayer::setRasterOpacityTransition(const TransitionOptions& options) { +void RasterLayer::setRasterBrightnessMaxTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<RasterOpacity>().options = options; + impl_->paint.template get<RasterBrightnessMax>().options = options; baseImpl = std::move(impl_); } -TransitionOptions RasterLayer::getRasterOpacityTransition() const { - return impl().paint.template get<RasterOpacity>().options; +TransitionOptions RasterLayer::getRasterBrightnessMaxTransition() const { + return impl().paint.template get<RasterBrightnessMax>().options; } -PropertyValue<float> RasterLayer::getDefaultRasterHueRotate() { +PropertyValue<float> RasterLayer::getDefaultRasterBrightnessMin() { return { 0 }; } -const PropertyValue<float>& RasterLayer::getRasterHueRotate() const { - return impl().paint.template get<RasterHueRotate>().value; +const PropertyValue<float>& RasterLayer::getRasterBrightnessMin() const { + return impl().paint.template get<RasterBrightnessMin>().value; } -void RasterLayer::setRasterHueRotate(const PropertyValue<float>& value) { - if (value == getRasterHueRotate()) +void RasterLayer::setRasterBrightnessMin(const PropertyValue<float>& value) { + if (value == getRasterBrightnessMin()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<RasterHueRotate>().value = value; + impl_->paint.template get<RasterBrightnessMin>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void RasterLayer::setRasterHueRotateTransition(const TransitionOptions& options) { +void RasterLayer::setRasterBrightnessMinTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<RasterHueRotate>().options = options; + impl_->paint.template get<RasterBrightnessMin>().options = options; baseImpl = std::move(impl_); } -TransitionOptions RasterLayer::getRasterHueRotateTransition() const { - return impl().paint.template get<RasterHueRotate>().options; +TransitionOptions RasterLayer::getRasterBrightnessMinTransition() const { + return impl().paint.template get<RasterBrightnessMin>().options; } -PropertyValue<float> RasterLayer::getDefaultRasterBrightnessMin() { +PropertyValue<float> RasterLayer::getDefaultRasterContrast() { return { 0 }; } -const PropertyValue<float>& RasterLayer::getRasterBrightnessMin() const { - return impl().paint.template get<RasterBrightnessMin>().value; +const PropertyValue<float>& RasterLayer::getRasterContrast() const { + return impl().paint.template get<RasterContrast>().value; } -void RasterLayer::setRasterBrightnessMin(const PropertyValue<float>& value) { - if (value == getRasterBrightnessMin()) +void RasterLayer::setRasterContrast(const PropertyValue<float>& value) { + if (value == getRasterContrast()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<RasterBrightnessMin>().value = value; + impl_->paint.template get<RasterContrast>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void RasterLayer::setRasterBrightnessMinTransition(const TransitionOptions& options) { +void RasterLayer::setRasterContrastTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<RasterBrightnessMin>().options = options; + impl_->paint.template get<RasterContrast>().options = options; baseImpl = std::move(impl_); } -TransitionOptions RasterLayer::getRasterBrightnessMinTransition() const { - return impl().paint.template get<RasterBrightnessMin>().options; +TransitionOptions RasterLayer::getRasterContrastTransition() const { + return impl().paint.template get<RasterContrast>().options; } -PropertyValue<float> RasterLayer::getDefaultRasterBrightnessMax() { - return { 1 }; +PropertyValue<float> RasterLayer::getDefaultRasterFadeDuration() { + return { 300 }; } -const PropertyValue<float>& RasterLayer::getRasterBrightnessMax() const { - return impl().paint.template get<RasterBrightnessMax>().value; +const PropertyValue<float>& RasterLayer::getRasterFadeDuration() const { + return impl().paint.template get<RasterFadeDuration>().value; } -void RasterLayer::setRasterBrightnessMax(const PropertyValue<float>& value) { - if (value == getRasterBrightnessMax()) +void RasterLayer::setRasterFadeDuration(const PropertyValue<float>& value) { + if (value == getRasterFadeDuration()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<RasterBrightnessMax>().value = value; + impl_->paint.template get<RasterFadeDuration>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void RasterLayer::setRasterBrightnessMaxTransition(const TransitionOptions& options) { +void RasterLayer::setRasterFadeDurationTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<RasterBrightnessMax>().options = options; + impl_->paint.template get<RasterFadeDuration>().options = options; baseImpl = std::move(impl_); } -TransitionOptions RasterLayer::getRasterBrightnessMaxTransition() const { - return impl().paint.template get<RasterBrightnessMax>().options; +TransitionOptions RasterLayer::getRasterFadeDurationTransition() const { + return impl().paint.template get<RasterFadeDuration>().options; } -PropertyValue<float> RasterLayer::getDefaultRasterSaturation() { +PropertyValue<float> RasterLayer::getDefaultRasterHueRotate() { return { 0 }; } -const PropertyValue<float>& RasterLayer::getRasterSaturation() const { - return impl().paint.template get<RasterSaturation>().value; +const PropertyValue<float>& RasterLayer::getRasterHueRotate() const { + return impl().paint.template get<RasterHueRotate>().value; } -void RasterLayer::setRasterSaturation(const PropertyValue<float>& value) { - if (value == getRasterSaturation()) +void RasterLayer::setRasterHueRotate(const PropertyValue<float>& value) { + if (value == getRasterHueRotate()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<RasterSaturation>().value = value; + impl_->paint.template get<RasterHueRotate>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void RasterLayer::setRasterSaturationTransition(const TransitionOptions& options) { +void RasterLayer::setRasterHueRotateTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<RasterSaturation>().options = options; + impl_->paint.template get<RasterHueRotate>().options = options; baseImpl = std::move(impl_); } -TransitionOptions RasterLayer::getRasterSaturationTransition() const { - return impl().paint.template get<RasterSaturation>().options; +TransitionOptions RasterLayer::getRasterHueRotateTransition() const { + return impl().paint.template get<RasterHueRotate>().options; } -PropertyValue<float> RasterLayer::getDefaultRasterContrast() { - return { 0 }; +PropertyValue<float> RasterLayer::getDefaultRasterOpacity() { + return { 1 }; } -const PropertyValue<float>& RasterLayer::getRasterContrast() const { - return impl().paint.template get<RasterContrast>().value; +const PropertyValue<float>& RasterLayer::getRasterOpacity() const { + return impl().paint.template get<RasterOpacity>().value; } -void RasterLayer::setRasterContrast(const PropertyValue<float>& value) { - if (value == getRasterContrast()) +void RasterLayer::setRasterOpacity(const PropertyValue<float>& value) { + if (value == getRasterOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<RasterContrast>().value = value; + impl_->paint.template get<RasterOpacity>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void RasterLayer::setRasterContrastTransition(const TransitionOptions& options) { +void RasterLayer::setRasterOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<RasterContrast>().options = options; + impl_->paint.template get<RasterOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions RasterLayer::getRasterContrastTransition() const { - return impl().paint.template get<RasterContrast>().options; +TransitionOptions RasterLayer::getRasterOpacityTransition() const { + return impl().paint.template get<RasterOpacity>().options; } PropertyValue<RasterResamplingType> RasterLayer::getDefaultRasterResampling() { @@ -252,72 +252,72 @@ TransitionOptions RasterLayer::getRasterResamplingTransition() const { return impl().paint.template get<RasterResampling>().options; } -PropertyValue<float> RasterLayer::getDefaultRasterFadeDuration() { - return { 300 }; +PropertyValue<float> RasterLayer::getDefaultRasterSaturation() { + return { 0 }; } -const PropertyValue<float>& RasterLayer::getRasterFadeDuration() const { - return impl().paint.template get<RasterFadeDuration>().value; +const PropertyValue<float>& RasterLayer::getRasterSaturation() const { + return impl().paint.template get<RasterSaturation>().value; } -void RasterLayer::setRasterFadeDuration(const PropertyValue<float>& value) { - if (value == getRasterFadeDuration()) +void RasterLayer::setRasterSaturation(const PropertyValue<float>& value) { + if (value == getRasterSaturation()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<RasterFadeDuration>().value = value; + impl_->paint.template get<RasterSaturation>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void RasterLayer::setRasterFadeDurationTransition(const TransitionOptions& options) { +void RasterLayer::setRasterSaturationTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<RasterFadeDuration>().options = options; + impl_->paint.template get<RasterSaturation>().options = options; baseImpl = std::move(impl_); } -TransitionOptions RasterLayer::getRasterFadeDurationTransition() const { - return impl().paint.template get<RasterFadeDuration>().options; +TransitionOptions RasterLayer::getRasterSaturationTransition() const { + return impl().paint.template get<RasterSaturation>().options; } using namespace conversion; optional<Error> RasterLayer::setPaintProperty(const std::string& name, const Convertible& value) { enum class Property : uint8_t { - RasterOpacity, - RasterHueRotate, - RasterBrightnessMin, RasterBrightnessMax, - RasterSaturation, + RasterBrightnessMin, RasterContrast, - RasterResampling, RasterFadeDuration, - RasterOpacityTransition, - RasterHueRotateTransition, - RasterBrightnessMinTransition, + RasterHueRotate, + RasterOpacity, + RasterResampling, + RasterSaturation, RasterBrightnessMaxTransition, - RasterSaturationTransition, + RasterBrightnessMinTransition, RasterContrastTransition, - RasterResamplingTransition, RasterFadeDurationTransition, + RasterHueRotateTransition, + RasterOpacityTransition, + RasterResamplingTransition, + RasterSaturationTransition, }; MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({ - { "raster-opacity", static_cast<uint8_t>(Property::RasterOpacity) }, - { "raster-hue-rotate", static_cast<uint8_t>(Property::RasterHueRotate) }, - { "raster-brightness-min", static_cast<uint8_t>(Property::RasterBrightnessMin) }, { "raster-brightness-max", static_cast<uint8_t>(Property::RasterBrightnessMax) }, - { "raster-saturation", static_cast<uint8_t>(Property::RasterSaturation) }, + { "raster-brightness-min", static_cast<uint8_t>(Property::RasterBrightnessMin) }, { "raster-contrast", static_cast<uint8_t>(Property::RasterContrast) }, - { "raster-resampling", static_cast<uint8_t>(Property::RasterResampling) }, { "raster-fade-duration", static_cast<uint8_t>(Property::RasterFadeDuration) }, - { "raster-opacity-transition", static_cast<uint8_t>(Property::RasterOpacityTransition) }, - { "raster-hue-rotate-transition", static_cast<uint8_t>(Property::RasterHueRotateTransition) }, - { "raster-brightness-min-transition", static_cast<uint8_t>(Property::RasterBrightnessMinTransition) }, + { "raster-hue-rotate", static_cast<uint8_t>(Property::RasterHueRotate) }, + { "raster-opacity", static_cast<uint8_t>(Property::RasterOpacity) }, + { "raster-resampling", static_cast<uint8_t>(Property::RasterResampling) }, + { "raster-saturation", static_cast<uint8_t>(Property::RasterSaturation) }, { "raster-brightness-max-transition", static_cast<uint8_t>(Property::RasterBrightnessMaxTransition) }, - { "raster-saturation-transition", static_cast<uint8_t>(Property::RasterSaturationTransition) }, + { "raster-brightness-min-transition", static_cast<uint8_t>(Property::RasterBrightnessMinTransition) }, { "raster-contrast-transition", static_cast<uint8_t>(Property::RasterContrastTransition) }, + { "raster-fade-duration-transition", static_cast<uint8_t>(Property::RasterFadeDurationTransition) }, + { "raster-hue-rotate-transition", static_cast<uint8_t>(Property::RasterHueRotateTransition) }, + { "raster-opacity-transition", static_cast<uint8_t>(Property::RasterOpacityTransition) }, { "raster-resampling-transition", static_cast<uint8_t>(Property::RasterResamplingTransition) }, - { "raster-fade-duration-transition", static_cast<uint8_t>(Property::RasterFadeDurationTransition) } + { "raster-saturation-transition", static_cast<uint8_t>(Property::RasterSaturationTransition) } }); const auto it = properties.find(name.c_str()); @@ -328,45 +328,45 @@ optional<Error> RasterLayer::setPaintProperty(const std::string& name, const Con auto property = static_cast<Property>(it->second); - if (property == Property::RasterOpacity || property == Property::RasterHueRotate || property == Property::RasterBrightnessMin || property == Property::RasterBrightnessMax || property == Property::RasterSaturation || property == Property::RasterContrast || property == Property::RasterFadeDuration) { + if (property == Property::RasterBrightnessMax || property == Property::RasterBrightnessMin || property == Property::RasterContrast || property == Property::RasterFadeDuration || property == Property::RasterHueRotate || property == Property::RasterOpacity || property == Property::RasterSaturation) { Error error; optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false); if (!typedValue) { return error; } - if (property == Property::RasterOpacity) { - setRasterOpacity(*typedValue); + if (property == Property::RasterBrightnessMax) { + setRasterBrightnessMax(*typedValue); return nullopt; } - if (property == Property::RasterHueRotate) { - setRasterHueRotate(*typedValue); + if (property == Property::RasterBrightnessMin) { + setRasterBrightnessMin(*typedValue); return nullopt; } - if (property == Property::RasterBrightnessMin) { - setRasterBrightnessMin(*typedValue); + if (property == Property::RasterContrast) { + setRasterContrast(*typedValue); return nullopt; } - if (property == Property::RasterBrightnessMax) { - setRasterBrightnessMax(*typedValue); + if (property == Property::RasterFadeDuration) { + setRasterFadeDuration(*typedValue); return nullopt; } - if (property == Property::RasterSaturation) { - setRasterSaturation(*typedValue); + if (property == Property::RasterHueRotate) { + setRasterHueRotate(*typedValue); return nullopt; } - if (property == Property::RasterContrast) { - setRasterContrast(*typedValue); + if (property == Property::RasterOpacity) { + setRasterOpacity(*typedValue); return nullopt; } - if (property == Property::RasterFadeDuration) { - setRasterFadeDuration(*typedValue); + if (property == Property::RasterSaturation) { + setRasterSaturation(*typedValue); return nullopt; } @@ -391,33 +391,33 @@ optional<Error> RasterLayer::setPaintProperty(const std::string& name, const Con return error; } - if (property == Property::RasterOpacityTransition) { - setRasterOpacityTransition(*transition); + if (property == Property::RasterBrightnessMaxTransition) { + setRasterBrightnessMaxTransition(*transition); return nullopt; } - if (property == Property::RasterHueRotateTransition) { - setRasterHueRotateTransition(*transition); + if (property == Property::RasterBrightnessMinTransition) { + setRasterBrightnessMinTransition(*transition); return nullopt; } - if (property == Property::RasterBrightnessMinTransition) { - setRasterBrightnessMinTransition(*transition); + if (property == Property::RasterContrastTransition) { + setRasterContrastTransition(*transition); return nullopt; } - if (property == Property::RasterBrightnessMaxTransition) { - setRasterBrightnessMaxTransition(*transition); + if (property == Property::RasterFadeDurationTransition) { + setRasterFadeDurationTransition(*transition); return nullopt; } - if (property == Property::RasterSaturationTransition) { - setRasterSaturationTransition(*transition); + if (property == Property::RasterHueRotateTransition) { + setRasterHueRotateTransition(*transition); return nullopt; } - if (property == Property::RasterContrastTransition) { - setRasterContrastTransition(*transition); + if (property == Property::RasterOpacityTransition) { + setRasterOpacityTransition(*transition); return nullopt; } @@ -426,8 +426,8 @@ optional<Error> RasterLayer::setPaintProperty(const std::string& name, const Con return nullopt; } - if (property == Property::RasterFadeDurationTransition) { - setRasterFadeDurationTransition(*transition); + if (property == Property::RasterSaturationTransition) { + setRasterSaturationTransition(*transition); return nullopt; } diff --git a/src/mbgl/style/layers/raster_layer_properties.hpp b/src/mbgl/style/layers/raster_layer_properties.hpp index c380ea471d..61aa32de2d 100644 --- a/src/mbgl/style/layers/raster_layer_properties.hpp +++ b/src/mbgl/style/layers/raster_layer_properties.hpp @@ -14,47 +14,47 @@ namespace mbgl { namespace style { -struct RasterOpacity : PaintProperty<float> { +struct RasterBrightnessMax : PaintProperty<float> { static float defaultValue() { return 1; } }; -struct RasterHueRotate : PaintProperty<float> { +struct RasterBrightnessMin : PaintProperty<float> { static float defaultValue() { return 0; } }; -struct RasterBrightnessMin : PaintProperty<float> { +struct RasterContrast : PaintProperty<float> { static float defaultValue() { return 0; } }; -struct RasterBrightnessMax : PaintProperty<float> { - static float defaultValue() { return 1; } +struct RasterFadeDuration : PaintProperty<float> { + static float defaultValue() { return 300; } }; -struct RasterSaturation : PaintProperty<float> { +struct RasterHueRotate : PaintProperty<float> { static float defaultValue() { return 0; } }; -struct RasterContrast : PaintProperty<float> { - static float defaultValue() { return 0; } +struct RasterOpacity : PaintProperty<float> { + static float defaultValue() { return 1; } }; struct RasterResampling : PaintProperty<RasterResamplingType> { static RasterResamplingType defaultValue() { return RasterResamplingType::Linear; } }; -struct RasterFadeDuration : PaintProperty<float> { - static float defaultValue() { return 300; } +struct RasterSaturation : PaintProperty<float> { + static float defaultValue() { return 0; } }; class RasterPaintProperties : public Properties< - RasterOpacity, - RasterHueRotate, - RasterBrightnessMin, RasterBrightnessMax, - RasterSaturation, + RasterBrightnessMin, RasterContrast, + RasterFadeDuration, + RasterHueRotate, + RasterOpacity, RasterResampling, - RasterFadeDuration + RasterSaturation > {}; class RasterLayerProperties final : public LayerProperties { diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp index 0567c224bd..1740e5bb2e 100644 --- a/src/mbgl/style/layers/symbol_layer.cpp +++ b/src/mbgl/style/layers/symbol_layer.cpp @@ -61,131 +61,163 @@ void SymbolLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffe // Layout properties -PropertyValue<SymbolPlacementType> SymbolLayer::getDefaultSymbolPlacement() { - return SymbolPlacement::defaultValue(); +PropertyValue<bool> SymbolLayer::getDefaultIconAllowOverlap() { + return IconAllowOverlap::defaultValue(); } -const PropertyValue<SymbolPlacementType>& SymbolLayer::getSymbolPlacement() const { - return impl().layout.get<SymbolPlacement>(); +const PropertyValue<bool>& SymbolLayer::getIconAllowOverlap() const { + return impl().layout.get<IconAllowOverlap>(); } -void SymbolLayer::setSymbolPlacement(const PropertyValue<SymbolPlacementType>& value) { - if (value == getSymbolPlacement()) +void SymbolLayer::setIconAllowOverlap(const PropertyValue<bool>& value) { + if (value == getIconAllowOverlap()) return; auto impl_ = mutableImpl(); - impl_->layout.get<SymbolPlacement>() = value; + impl_->layout.get<IconAllowOverlap>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<float> SymbolLayer::getDefaultSymbolSpacing() { - return SymbolSpacing::defaultValue(); +PropertyValue<SymbolAnchorType> SymbolLayer::getDefaultIconAnchor() { + return IconAnchor::defaultValue(); } -const PropertyValue<float>& SymbolLayer::getSymbolSpacing() const { - return impl().layout.get<SymbolSpacing>(); +const PropertyValue<SymbolAnchorType>& SymbolLayer::getIconAnchor() const { + return impl().layout.get<IconAnchor>(); } -void SymbolLayer::setSymbolSpacing(const PropertyValue<float>& value) { - if (value == getSymbolSpacing()) +void SymbolLayer::setIconAnchor(const PropertyValue<SymbolAnchorType>& value) { + if (value == getIconAnchor()) return; auto impl_ = mutableImpl(); - impl_->layout.get<SymbolSpacing>() = value; + impl_->layout.get<IconAnchor>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<bool> SymbolLayer::getDefaultSymbolAvoidEdges() { - return SymbolAvoidEdges::defaultValue(); +PropertyValue<bool> SymbolLayer::getDefaultIconIgnorePlacement() { + return IconIgnorePlacement::defaultValue(); } -const PropertyValue<bool>& SymbolLayer::getSymbolAvoidEdges() const { - return impl().layout.get<SymbolAvoidEdges>(); +const PropertyValue<bool>& SymbolLayer::getIconIgnorePlacement() const { + return impl().layout.get<IconIgnorePlacement>(); } -void SymbolLayer::setSymbolAvoidEdges(const PropertyValue<bool>& value) { - if (value == getSymbolAvoidEdges()) +void SymbolLayer::setIconIgnorePlacement(const PropertyValue<bool>& value) { + if (value == getIconIgnorePlacement()) return; auto impl_ = mutableImpl(); - impl_->layout.get<SymbolAvoidEdges>() = value; + impl_->layout.get<IconIgnorePlacement>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<float> SymbolLayer::getDefaultSymbolSortKey() { - return SymbolSortKey::defaultValue(); +PropertyValue<std::string> SymbolLayer::getDefaultIconImage() { + return IconImage::defaultValue(); } -const PropertyValue<float>& SymbolLayer::getSymbolSortKey() const { - return impl().layout.get<SymbolSortKey>(); +const PropertyValue<std::string>& SymbolLayer::getIconImage() const { + return impl().layout.get<IconImage>(); } -void SymbolLayer::setSymbolSortKey(const PropertyValue<float>& value) { - if (value == getSymbolSortKey()) +void SymbolLayer::setIconImage(const PropertyValue<std::string>& value) { + if (value == getIconImage()) return; auto impl_ = mutableImpl(); - impl_->layout.get<SymbolSortKey>() = value; + impl_->layout.get<IconImage>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<SymbolZOrderType> SymbolLayer::getDefaultSymbolZOrder() { - return SymbolZOrder::defaultValue(); +PropertyValue<bool> SymbolLayer::getDefaultIconKeepUpright() { + return IconKeepUpright::defaultValue(); } -const PropertyValue<SymbolZOrderType>& SymbolLayer::getSymbolZOrder() const { - return impl().layout.get<SymbolZOrder>(); +const PropertyValue<bool>& SymbolLayer::getIconKeepUpright() const { + return impl().layout.get<IconKeepUpright>(); } -void SymbolLayer::setSymbolZOrder(const PropertyValue<SymbolZOrderType>& value) { - if (value == getSymbolZOrder()) +void SymbolLayer::setIconKeepUpright(const PropertyValue<bool>& value) { + if (value == getIconKeepUpright()) return; auto impl_ = mutableImpl(); - impl_->layout.get<SymbolZOrder>() = value; + impl_->layout.get<IconKeepUpright>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<bool> SymbolLayer::getDefaultIconAllowOverlap() { - return IconAllowOverlap::defaultValue(); +PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultIconOffset() { + return IconOffset::defaultValue(); } -const PropertyValue<bool>& SymbolLayer::getIconAllowOverlap() const { - return impl().layout.get<IconAllowOverlap>(); +const PropertyValue<std::array<float, 2>>& SymbolLayer::getIconOffset() const { + return impl().layout.get<IconOffset>(); } -void SymbolLayer::setIconAllowOverlap(const PropertyValue<bool>& value) { - if (value == getIconAllowOverlap()) +void SymbolLayer::setIconOffset(const PropertyValue<std::array<float, 2>>& value) { + if (value == getIconOffset()) return; auto impl_ = mutableImpl(); - impl_->layout.get<IconAllowOverlap>() = value; + impl_->layout.get<IconOffset>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<bool> SymbolLayer::getDefaultIconIgnorePlacement() { - return IconIgnorePlacement::defaultValue(); +PropertyValue<bool> SymbolLayer::getDefaultIconOptional() { + return IconOptional::defaultValue(); } -const PropertyValue<bool>& SymbolLayer::getIconIgnorePlacement() const { - return impl().layout.get<IconIgnorePlacement>(); +const PropertyValue<bool>& SymbolLayer::getIconOptional() const { + return impl().layout.get<IconOptional>(); } -void SymbolLayer::setIconIgnorePlacement(const PropertyValue<bool>& value) { - if (value == getIconIgnorePlacement()) +void SymbolLayer::setIconOptional(const PropertyValue<bool>& value) { + if (value == getIconOptional()) return; auto impl_ = mutableImpl(); - impl_->layout.get<IconIgnorePlacement>() = value; + impl_->layout.get<IconOptional>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<bool> SymbolLayer::getDefaultIconOptional() { - return IconOptional::defaultValue(); +PropertyValue<float> SymbolLayer::getDefaultIconPadding() { + return IconPadding::defaultValue(); } -const PropertyValue<bool>& SymbolLayer::getIconOptional() const { - return impl().layout.get<IconOptional>(); +const PropertyValue<float>& SymbolLayer::getIconPadding() const { + return impl().layout.get<IconPadding>(); } -void SymbolLayer::setIconOptional(const PropertyValue<bool>& value) { - if (value == getIconOptional()) +void SymbolLayer::setIconPadding(const PropertyValue<float>& value) { + if (value == getIconPadding()) return; auto impl_ = mutableImpl(); - impl_->layout.get<IconOptional>() = value; + impl_->layout.get<IconPadding>() = value; + baseImpl = std::move(impl_); + observer->onLayerChanged(*this); +} +PropertyValue<AlignmentType> SymbolLayer::getDefaultIconPitchAlignment() { + return IconPitchAlignment::defaultValue(); +} + +const PropertyValue<AlignmentType>& SymbolLayer::getIconPitchAlignment() const { + return impl().layout.get<IconPitchAlignment>(); +} + +void SymbolLayer::setIconPitchAlignment(const PropertyValue<AlignmentType>& value) { + if (value == getIconPitchAlignment()) + return; + auto impl_ = mutableImpl(); + impl_->layout.get<IconPitchAlignment>() = value; + baseImpl = std::move(impl_); + observer->onLayerChanged(*this); +} +PropertyValue<float> SymbolLayer::getDefaultIconRotate() { + return IconRotate::defaultValue(); +} + +const PropertyValue<float>& SymbolLayer::getIconRotate() const { + return impl().layout.get<IconRotate>(); +} + +void SymbolLayer::setIconRotate(const PropertyValue<float>& value) { + if (value == getIconRotate()) + return; + auto impl_ = mutableImpl(); + impl_->layout.get<IconRotate>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } @@ -253,147 +285,115 @@ void SymbolLayer::setIconTextFitPadding(const PropertyValue<std::array<float, 4> baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<std::string> SymbolLayer::getDefaultIconImage() { - return IconImage::defaultValue(); -} - -const PropertyValue<std::string>& SymbolLayer::getIconImage() const { - return impl().layout.get<IconImage>(); -} - -void SymbolLayer::setIconImage(const PropertyValue<std::string>& value) { - if (value == getIconImage()) - return; - auto impl_ = mutableImpl(); - impl_->layout.get<IconImage>() = value; - baseImpl = std::move(impl_); - observer->onLayerChanged(*this); -} -PropertyValue<float> SymbolLayer::getDefaultIconRotate() { - return IconRotate::defaultValue(); -} - -const PropertyValue<float>& SymbolLayer::getIconRotate() const { - return impl().layout.get<IconRotate>(); -} - -void SymbolLayer::setIconRotate(const PropertyValue<float>& value) { - if (value == getIconRotate()) - return; - auto impl_ = mutableImpl(); - impl_->layout.get<IconRotate>() = value; - baseImpl = std::move(impl_); - observer->onLayerChanged(*this); -} -PropertyValue<float> SymbolLayer::getDefaultIconPadding() { - return IconPadding::defaultValue(); +PropertyValue<bool> SymbolLayer::getDefaultSymbolAvoidEdges() { + return SymbolAvoidEdges::defaultValue(); } -const PropertyValue<float>& SymbolLayer::getIconPadding() const { - return impl().layout.get<IconPadding>(); +const PropertyValue<bool>& SymbolLayer::getSymbolAvoidEdges() const { + return impl().layout.get<SymbolAvoidEdges>(); } -void SymbolLayer::setIconPadding(const PropertyValue<float>& value) { - if (value == getIconPadding()) +void SymbolLayer::setSymbolAvoidEdges(const PropertyValue<bool>& value) { + if (value == getSymbolAvoidEdges()) return; auto impl_ = mutableImpl(); - impl_->layout.get<IconPadding>() = value; + impl_->layout.get<SymbolAvoidEdges>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<bool> SymbolLayer::getDefaultIconKeepUpright() { - return IconKeepUpright::defaultValue(); +PropertyValue<SymbolPlacementType> SymbolLayer::getDefaultSymbolPlacement() { + return SymbolPlacement::defaultValue(); } -const PropertyValue<bool>& SymbolLayer::getIconKeepUpright() const { - return impl().layout.get<IconKeepUpright>(); +const PropertyValue<SymbolPlacementType>& SymbolLayer::getSymbolPlacement() const { + return impl().layout.get<SymbolPlacement>(); } -void SymbolLayer::setIconKeepUpright(const PropertyValue<bool>& value) { - if (value == getIconKeepUpright()) +void SymbolLayer::setSymbolPlacement(const PropertyValue<SymbolPlacementType>& value) { + if (value == getSymbolPlacement()) return; auto impl_ = mutableImpl(); - impl_->layout.get<IconKeepUpright>() = value; + impl_->layout.get<SymbolPlacement>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultIconOffset() { - return IconOffset::defaultValue(); +PropertyValue<float> SymbolLayer::getDefaultSymbolSortKey() { + return SymbolSortKey::defaultValue(); } -const PropertyValue<std::array<float, 2>>& SymbolLayer::getIconOffset() const { - return impl().layout.get<IconOffset>(); +const PropertyValue<float>& SymbolLayer::getSymbolSortKey() const { + return impl().layout.get<SymbolSortKey>(); } -void SymbolLayer::setIconOffset(const PropertyValue<std::array<float, 2>>& value) { - if (value == getIconOffset()) +void SymbolLayer::setSymbolSortKey(const PropertyValue<float>& value) { + if (value == getSymbolSortKey()) return; auto impl_ = mutableImpl(); - impl_->layout.get<IconOffset>() = value; + impl_->layout.get<SymbolSortKey>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<SymbolAnchorType> SymbolLayer::getDefaultIconAnchor() { - return IconAnchor::defaultValue(); +PropertyValue<float> SymbolLayer::getDefaultSymbolSpacing() { + return SymbolSpacing::defaultValue(); } -const PropertyValue<SymbolAnchorType>& SymbolLayer::getIconAnchor() const { - return impl().layout.get<IconAnchor>(); +const PropertyValue<float>& SymbolLayer::getSymbolSpacing() const { + return impl().layout.get<SymbolSpacing>(); } -void SymbolLayer::setIconAnchor(const PropertyValue<SymbolAnchorType>& value) { - if (value == getIconAnchor()) +void SymbolLayer::setSymbolSpacing(const PropertyValue<float>& value) { + if (value == getSymbolSpacing()) return; auto impl_ = mutableImpl(); - impl_->layout.get<IconAnchor>() = value; + impl_->layout.get<SymbolSpacing>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<AlignmentType> SymbolLayer::getDefaultIconPitchAlignment() { - return IconPitchAlignment::defaultValue(); +PropertyValue<SymbolZOrderType> SymbolLayer::getDefaultSymbolZOrder() { + return SymbolZOrder::defaultValue(); } -const PropertyValue<AlignmentType>& SymbolLayer::getIconPitchAlignment() const { - return impl().layout.get<IconPitchAlignment>(); +const PropertyValue<SymbolZOrderType>& SymbolLayer::getSymbolZOrder() const { + return impl().layout.get<SymbolZOrder>(); } -void SymbolLayer::setIconPitchAlignment(const PropertyValue<AlignmentType>& value) { - if (value == getIconPitchAlignment()) +void SymbolLayer::setSymbolZOrder(const PropertyValue<SymbolZOrderType>& value) { + if (value == getSymbolZOrder()) return; auto impl_ = mutableImpl(); - impl_->layout.get<IconPitchAlignment>() = value; + impl_->layout.get<SymbolZOrder>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<AlignmentType> SymbolLayer::getDefaultTextPitchAlignment() { - return TextPitchAlignment::defaultValue(); +PropertyValue<bool> SymbolLayer::getDefaultTextAllowOverlap() { + return TextAllowOverlap::defaultValue(); } -const PropertyValue<AlignmentType>& SymbolLayer::getTextPitchAlignment() const { - return impl().layout.get<TextPitchAlignment>(); +const PropertyValue<bool>& SymbolLayer::getTextAllowOverlap() const { + return impl().layout.get<TextAllowOverlap>(); } -void SymbolLayer::setTextPitchAlignment(const PropertyValue<AlignmentType>& value) { - if (value == getTextPitchAlignment()) +void SymbolLayer::setTextAllowOverlap(const PropertyValue<bool>& value) { + if (value == getTextAllowOverlap()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextPitchAlignment>() = value; + impl_->layout.get<TextAllowOverlap>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<AlignmentType> SymbolLayer::getDefaultTextRotationAlignment() { - return TextRotationAlignment::defaultValue(); +PropertyValue<SymbolAnchorType> SymbolLayer::getDefaultTextAnchor() { + return TextAnchor::defaultValue(); } -const PropertyValue<AlignmentType>& SymbolLayer::getTextRotationAlignment() const { - return impl().layout.get<TextRotationAlignment>(); +const PropertyValue<SymbolAnchorType>& SymbolLayer::getTextAnchor() const { + return impl().layout.get<TextAnchor>(); } -void SymbolLayer::setTextRotationAlignment(const PropertyValue<AlignmentType>& value) { - if (value == getTextRotationAlignment()) +void SymbolLayer::setTextAnchor(const PropertyValue<SymbolAnchorType>& value) { + if (value == getTextAnchor()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextRotationAlignment>() = value; + impl_->layout.get<TextAnchor>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } @@ -429,51 +429,51 @@ void SymbolLayer::setTextFont(const PropertyValue<std::vector<std::string>>& val baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<float> SymbolLayer::getDefaultTextSize() { - return TextSize::defaultValue(); +PropertyValue<bool> SymbolLayer::getDefaultTextIgnorePlacement() { + return TextIgnorePlacement::defaultValue(); } -const PropertyValue<float>& SymbolLayer::getTextSize() const { - return impl().layout.get<TextSize>(); +const PropertyValue<bool>& SymbolLayer::getTextIgnorePlacement() const { + return impl().layout.get<TextIgnorePlacement>(); } -void SymbolLayer::setTextSize(const PropertyValue<float>& value) { - if (value == getTextSize()) +void SymbolLayer::setTextIgnorePlacement(const PropertyValue<bool>& value) { + if (value == getTextIgnorePlacement()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextSize>() = value; + impl_->layout.get<TextIgnorePlacement>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<float> SymbolLayer::getDefaultTextMaxWidth() { - return TextMaxWidth::defaultValue(); +PropertyValue<TextJustifyType> SymbolLayer::getDefaultTextJustify() { + return TextJustify::defaultValue(); } -const PropertyValue<float>& SymbolLayer::getTextMaxWidth() const { - return impl().layout.get<TextMaxWidth>(); +const PropertyValue<TextJustifyType>& SymbolLayer::getTextJustify() const { + return impl().layout.get<TextJustify>(); } -void SymbolLayer::setTextMaxWidth(const PropertyValue<float>& value) { - if (value == getTextMaxWidth()) +void SymbolLayer::setTextJustify(const PropertyValue<TextJustifyType>& value) { + if (value == getTextJustify()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextMaxWidth>() = value; + impl_->layout.get<TextJustify>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<float> SymbolLayer::getDefaultTextLineHeight() { - return TextLineHeight::defaultValue(); +PropertyValue<bool> SymbolLayer::getDefaultTextKeepUpright() { + return TextKeepUpright::defaultValue(); } -const PropertyValue<float>& SymbolLayer::getTextLineHeight() const { - return impl().layout.get<TextLineHeight>(); +const PropertyValue<bool>& SymbolLayer::getTextKeepUpright() const { + return impl().layout.get<TextKeepUpright>(); } -void SymbolLayer::setTextLineHeight(const PropertyValue<float>& value) { - if (value == getTextLineHeight()) +void SymbolLayer::setTextKeepUpright(const PropertyValue<bool>& value) { + if (value == getTextKeepUpright()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextLineHeight>() = value; + impl_->layout.get<TextKeepUpright>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } @@ -493,99 +493,83 @@ void SymbolLayer::setTextLetterSpacing(const PropertyValue<float>& value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<TextJustifyType> SymbolLayer::getDefaultTextJustify() { - return TextJustify::defaultValue(); -} - -const PropertyValue<TextJustifyType>& SymbolLayer::getTextJustify() const { - return impl().layout.get<TextJustify>(); -} - -void SymbolLayer::setTextJustify(const PropertyValue<TextJustifyType>& value) { - if (value == getTextJustify()) - return; - auto impl_ = mutableImpl(); - impl_->layout.get<TextJustify>() = value; - baseImpl = std::move(impl_); - observer->onLayerChanged(*this); -} -PropertyValue<float> SymbolLayer::getDefaultTextRadialOffset() { - return TextRadialOffset::defaultValue(); +PropertyValue<float> SymbolLayer::getDefaultTextLineHeight() { + return TextLineHeight::defaultValue(); } -const PropertyValue<float>& SymbolLayer::getTextRadialOffset() const { - return impl().layout.get<TextRadialOffset>(); +const PropertyValue<float>& SymbolLayer::getTextLineHeight() const { + return impl().layout.get<TextLineHeight>(); } -void SymbolLayer::setTextRadialOffset(const PropertyValue<float>& value) { - if (value == getTextRadialOffset()) +void SymbolLayer::setTextLineHeight(const PropertyValue<float>& value) { + if (value == getTextLineHeight()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextRadialOffset>() = value; + impl_->layout.get<TextLineHeight>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<std::vector<TextVariableAnchorType>> SymbolLayer::getDefaultTextVariableAnchor() { - return TextVariableAnchor::defaultValue(); +PropertyValue<float> SymbolLayer::getDefaultTextMaxAngle() { + return TextMaxAngle::defaultValue(); } -const PropertyValue<std::vector<TextVariableAnchorType>>& SymbolLayer::getTextVariableAnchor() const { - return impl().layout.get<TextVariableAnchor>(); +const PropertyValue<float>& SymbolLayer::getTextMaxAngle() const { + return impl().layout.get<TextMaxAngle>(); } -void SymbolLayer::setTextVariableAnchor(const PropertyValue<std::vector<TextVariableAnchorType>>& value) { - if (value == getTextVariableAnchor()) +void SymbolLayer::setTextMaxAngle(const PropertyValue<float>& value) { + if (value == getTextMaxAngle()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextVariableAnchor>() = value; + impl_->layout.get<TextMaxAngle>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<SymbolAnchorType> SymbolLayer::getDefaultTextAnchor() { - return TextAnchor::defaultValue(); +PropertyValue<float> SymbolLayer::getDefaultTextMaxWidth() { + return TextMaxWidth::defaultValue(); } -const PropertyValue<SymbolAnchorType>& SymbolLayer::getTextAnchor() const { - return impl().layout.get<TextAnchor>(); +const PropertyValue<float>& SymbolLayer::getTextMaxWidth() const { + return impl().layout.get<TextMaxWidth>(); } -void SymbolLayer::setTextAnchor(const PropertyValue<SymbolAnchorType>& value) { - if (value == getTextAnchor()) +void SymbolLayer::setTextMaxWidth(const PropertyValue<float>& value) { + if (value == getTextMaxWidth()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextAnchor>() = value; + impl_->layout.get<TextMaxWidth>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<float> SymbolLayer::getDefaultTextMaxAngle() { - return TextMaxAngle::defaultValue(); +PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultTextOffset() { + return TextOffset::defaultValue(); } -const PropertyValue<float>& SymbolLayer::getTextMaxAngle() const { - return impl().layout.get<TextMaxAngle>(); +const PropertyValue<std::array<float, 2>>& SymbolLayer::getTextOffset() const { + return impl().layout.get<TextOffset>(); } -void SymbolLayer::setTextMaxAngle(const PropertyValue<float>& value) { - if (value == getTextMaxAngle()) +void SymbolLayer::setTextOffset(const PropertyValue<std::array<float, 2>>& value) { + if (value == getTextOffset()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextMaxAngle>() = value; + impl_->layout.get<TextOffset>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<float> SymbolLayer::getDefaultTextRotate() { - return TextRotate::defaultValue(); +PropertyValue<bool> SymbolLayer::getDefaultTextOptional() { + return TextOptional::defaultValue(); } -const PropertyValue<float>& SymbolLayer::getTextRotate() const { - return impl().layout.get<TextRotate>(); +const PropertyValue<bool>& SymbolLayer::getTextOptional() const { + return impl().layout.get<TextOptional>(); } -void SymbolLayer::setTextRotate(const PropertyValue<float>& value) { - if (value == getTextRotate()) +void SymbolLayer::setTextOptional(const PropertyValue<bool>& value) { + if (value == getTextOptional()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextRotate>() = value; + impl_->layout.get<TextOptional>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } @@ -605,131 +589,120 @@ void SymbolLayer::setTextPadding(const PropertyValue<float>& value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<bool> SymbolLayer::getDefaultTextKeepUpright() { - return TextKeepUpright::defaultValue(); +PropertyValue<AlignmentType> SymbolLayer::getDefaultTextPitchAlignment() { + return TextPitchAlignment::defaultValue(); } -const PropertyValue<bool>& SymbolLayer::getTextKeepUpright() const { - return impl().layout.get<TextKeepUpright>(); +const PropertyValue<AlignmentType>& SymbolLayer::getTextPitchAlignment() const { + return impl().layout.get<TextPitchAlignment>(); } -void SymbolLayer::setTextKeepUpright(const PropertyValue<bool>& value) { - if (value == getTextKeepUpright()) +void SymbolLayer::setTextPitchAlignment(const PropertyValue<AlignmentType>& value) { + if (value == getTextPitchAlignment()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextKeepUpright>() = value; + impl_->layout.get<TextPitchAlignment>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<TextTransformType> SymbolLayer::getDefaultTextTransform() { - return TextTransform::defaultValue(); +PropertyValue<float> SymbolLayer::getDefaultTextRadialOffset() { + return TextRadialOffset::defaultValue(); } -const PropertyValue<TextTransformType>& SymbolLayer::getTextTransform() const { - return impl().layout.get<TextTransform>(); +const PropertyValue<float>& SymbolLayer::getTextRadialOffset() const { + return impl().layout.get<TextRadialOffset>(); } -void SymbolLayer::setTextTransform(const PropertyValue<TextTransformType>& value) { - if (value == getTextTransform()) +void SymbolLayer::setTextRadialOffset(const PropertyValue<float>& value) { + if (value == getTextRadialOffset()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextTransform>() = value; + impl_->layout.get<TextRadialOffset>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultTextOffset() { - return TextOffset::defaultValue(); +PropertyValue<float> SymbolLayer::getDefaultTextRotate() { + return TextRotate::defaultValue(); } -const PropertyValue<std::array<float, 2>>& SymbolLayer::getTextOffset() const { - return impl().layout.get<TextOffset>(); +const PropertyValue<float>& SymbolLayer::getTextRotate() const { + return impl().layout.get<TextRotate>(); } -void SymbolLayer::setTextOffset(const PropertyValue<std::array<float, 2>>& value) { - if (value == getTextOffset()) +void SymbolLayer::setTextRotate(const PropertyValue<float>& value) { + if (value == getTextRotate()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextOffset>() = value; + impl_->layout.get<TextRotate>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<bool> SymbolLayer::getDefaultTextAllowOverlap() { - return TextAllowOverlap::defaultValue(); +PropertyValue<AlignmentType> SymbolLayer::getDefaultTextRotationAlignment() { + return TextRotationAlignment::defaultValue(); } -const PropertyValue<bool>& SymbolLayer::getTextAllowOverlap() const { - return impl().layout.get<TextAllowOverlap>(); +const PropertyValue<AlignmentType>& SymbolLayer::getTextRotationAlignment() const { + return impl().layout.get<TextRotationAlignment>(); } -void SymbolLayer::setTextAllowOverlap(const PropertyValue<bool>& value) { - if (value == getTextAllowOverlap()) +void SymbolLayer::setTextRotationAlignment(const PropertyValue<AlignmentType>& value) { + if (value == getTextRotationAlignment()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextAllowOverlap>() = value; + impl_->layout.get<TextRotationAlignment>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<bool> SymbolLayer::getDefaultTextIgnorePlacement() { - return TextIgnorePlacement::defaultValue(); +PropertyValue<float> SymbolLayer::getDefaultTextSize() { + return TextSize::defaultValue(); } -const PropertyValue<bool>& SymbolLayer::getTextIgnorePlacement() const { - return impl().layout.get<TextIgnorePlacement>(); +const PropertyValue<float>& SymbolLayer::getTextSize() const { + return impl().layout.get<TextSize>(); } -void SymbolLayer::setTextIgnorePlacement(const PropertyValue<bool>& value) { - if (value == getTextIgnorePlacement()) +void SymbolLayer::setTextSize(const PropertyValue<float>& value) { + if (value == getTextSize()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextIgnorePlacement>() = value; + impl_->layout.get<TextSize>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<bool> SymbolLayer::getDefaultTextOptional() { - return TextOptional::defaultValue(); +PropertyValue<TextTransformType> SymbolLayer::getDefaultTextTransform() { + return TextTransform::defaultValue(); } -const PropertyValue<bool>& SymbolLayer::getTextOptional() const { - return impl().layout.get<TextOptional>(); +const PropertyValue<TextTransformType>& SymbolLayer::getTextTransform() const { + return impl().layout.get<TextTransform>(); } -void SymbolLayer::setTextOptional(const PropertyValue<bool>& value) { - if (value == getTextOptional()) +void SymbolLayer::setTextTransform(const PropertyValue<TextTransformType>& value) { + if (value == getTextTransform()) return; auto impl_ = mutableImpl(); - impl_->layout.get<TextOptional>() = value; + impl_->layout.get<TextTransform>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } - -// Paint properties - -PropertyValue<float> SymbolLayer::getDefaultIconOpacity() { - return { 1 }; +PropertyValue<std::vector<TextVariableAnchorType>> SymbolLayer::getDefaultTextVariableAnchor() { + return TextVariableAnchor::defaultValue(); } -const PropertyValue<float>& SymbolLayer::getIconOpacity() const { - return impl().paint.template get<IconOpacity>().value; +const PropertyValue<std::vector<TextVariableAnchorType>>& SymbolLayer::getTextVariableAnchor() const { + return impl().layout.get<TextVariableAnchor>(); } -void SymbolLayer::setIconOpacity(const PropertyValue<float>& value) { - if (value == getIconOpacity()) +void SymbolLayer::setTextVariableAnchor(const PropertyValue<std::vector<TextVariableAnchorType>>& value) { + if (value == getTextVariableAnchor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<IconOpacity>().value = value; + impl_->layout.get<TextVariableAnchor>() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void SymbolLayer::setIconOpacityTransition(const TransitionOptions& options) { - auto impl_ = mutableImpl(); - impl_->paint.template get<IconOpacity>().options = options; - baseImpl = std::move(impl_); -} - -TransitionOptions SymbolLayer::getIconOpacityTransition() const { - return impl().paint.template get<IconOpacity>().options; -} +// Paint properties PropertyValue<Color> SymbolLayer::getDefaultIconColor() { return { Color::black() }; @@ -758,6 +731,33 @@ TransitionOptions SymbolLayer::getIconColorTransition() const { return impl().paint.template get<IconColor>().options; } +PropertyValue<float> SymbolLayer::getDefaultIconHaloBlur() { + return { 0 }; +} + +const PropertyValue<float>& SymbolLayer::getIconHaloBlur() const { + return impl().paint.template get<IconHaloBlur>().value; +} + +void SymbolLayer::setIconHaloBlur(const PropertyValue<float>& value) { + if (value == getIconHaloBlur()) + return; + auto impl_ = mutableImpl(); + impl_->paint.template get<IconHaloBlur>().value = value; + baseImpl = std::move(impl_); + observer->onLayerChanged(*this); +} + +void SymbolLayer::setIconHaloBlurTransition(const TransitionOptions& options) { + auto impl_ = mutableImpl(); + impl_->paint.template get<IconHaloBlur>().options = options; + baseImpl = std::move(impl_); +} + +TransitionOptions SymbolLayer::getIconHaloBlurTransition() const { + return impl().paint.template get<IconHaloBlur>().options; +} + PropertyValue<Color> SymbolLayer::getDefaultIconHaloColor() { return { {} }; } @@ -812,31 +812,31 @@ TransitionOptions SymbolLayer::getIconHaloWidthTransition() const { return impl().paint.template get<IconHaloWidth>().options; } -PropertyValue<float> SymbolLayer::getDefaultIconHaloBlur() { - return { 0 }; +PropertyValue<float> SymbolLayer::getDefaultIconOpacity() { + return { 1 }; } -const PropertyValue<float>& SymbolLayer::getIconHaloBlur() const { - return impl().paint.template get<IconHaloBlur>().value; +const PropertyValue<float>& SymbolLayer::getIconOpacity() const { + return impl().paint.template get<IconOpacity>().value; } -void SymbolLayer::setIconHaloBlur(const PropertyValue<float>& value) { - if (value == getIconHaloBlur()) +void SymbolLayer::setIconOpacity(const PropertyValue<float>& value) { + if (value == getIconOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<IconHaloBlur>().value = value; + impl_->paint.template get<IconOpacity>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void SymbolLayer::setIconHaloBlurTransition(const TransitionOptions& options) { +void SymbolLayer::setIconOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<IconHaloBlur>().options = options; + impl_->paint.template get<IconOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getIconHaloBlurTransition() const { - return impl().paint.template get<IconHaloBlur>().options; +TransitionOptions SymbolLayer::getIconOpacityTransition() const { + return impl().paint.template get<IconOpacity>().options; } PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultIconTranslate() { @@ -893,58 +893,58 @@ TransitionOptions SymbolLayer::getIconTranslateAnchorTransition() const { return impl().paint.template get<IconTranslateAnchor>().options; } -PropertyValue<float> SymbolLayer::getDefaultTextOpacity() { - return { 1 }; +PropertyValue<Color> SymbolLayer::getDefaultTextColor() { + return { Color::black() }; } -const PropertyValue<float>& SymbolLayer::getTextOpacity() const { - return impl().paint.template get<TextOpacity>().value; +const PropertyValue<Color>& SymbolLayer::getTextColor() const { + return impl().paint.template get<TextColor>().value; } -void SymbolLayer::setTextOpacity(const PropertyValue<float>& value) { - if (value == getTextOpacity()) +void SymbolLayer::setTextColor(const PropertyValue<Color>& value) { + if (value == getTextColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<TextOpacity>().value = value; + impl_->paint.template get<TextColor>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void SymbolLayer::setTextOpacityTransition(const TransitionOptions& options) { +void SymbolLayer::setTextColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<TextOpacity>().options = options; + impl_->paint.template get<TextColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getTextOpacityTransition() const { - return impl().paint.template get<TextOpacity>().options; +TransitionOptions SymbolLayer::getTextColorTransition() const { + return impl().paint.template get<TextColor>().options; } -PropertyValue<Color> SymbolLayer::getDefaultTextColor() { - return { Color::black() }; +PropertyValue<float> SymbolLayer::getDefaultTextHaloBlur() { + return { 0 }; } -const PropertyValue<Color>& SymbolLayer::getTextColor() const { - return impl().paint.template get<TextColor>().value; +const PropertyValue<float>& SymbolLayer::getTextHaloBlur() const { + return impl().paint.template get<TextHaloBlur>().value; } -void SymbolLayer::setTextColor(const PropertyValue<Color>& value) { - if (value == getTextColor()) +void SymbolLayer::setTextHaloBlur(const PropertyValue<float>& value) { + if (value == getTextHaloBlur()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<TextColor>().value = value; + impl_->paint.template get<TextHaloBlur>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void SymbolLayer::setTextColorTransition(const TransitionOptions& options) { +void SymbolLayer::setTextHaloBlurTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<TextColor>().options = options; + impl_->paint.template get<TextHaloBlur>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getTextColorTransition() const { - return impl().paint.template get<TextColor>().options; +TransitionOptions SymbolLayer::getTextHaloBlurTransition() const { + return impl().paint.template get<TextHaloBlur>().options; } PropertyValue<Color> SymbolLayer::getDefaultTextHaloColor() { @@ -1001,31 +1001,31 @@ TransitionOptions SymbolLayer::getTextHaloWidthTransition() const { return impl().paint.template get<TextHaloWidth>().options; } -PropertyValue<float> SymbolLayer::getDefaultTextHaloBlur() { - return { 0 }; +PropertyValue<float> SymbolLayer::getDefaultTextOpacity() { + return { 1 }; } -const PropertyValue<float>& SymbolLayer::getTextHaloBlur() const { - return impl().paint.template get<TextHaloBlur>().value; +const PropertyValue<float>& SymbolLayer::getTextOpacity() const { + return impl().paint.template get<TextOpacity>().value; } -void SymbolLayer::setTextHaloBlur(const PropertyValue<float>& value) { - if (value == getTextHaloBlur()) +void SymbolLayer::setTextOpacity(const PropertyValue<float>& value) { + if (value == getTextOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<TextHaloBlur>().value = value; + impl_->paint.template get<TextOpacity>().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -void SymbolLayer::setTextHaloBlurTransition(const TransitionOptions& options) { +void SymbolLayer::setTextOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<TextHaloBlur>().options = options; + impl_->paint.template get<TextOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getTextHaloBlurTransition() const { - return impl().paint.template get<TextHaloBlur>().options; +TransitionOptions SymbolLayer::getTextOpacityTransition() const { + return impl().paint.template get<TextOpacity>().options; } PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultTextTranslate() { @@ -1086,63 +1086,63 @@ using namespace conversion; optional<Error> SymbolLayer::setPaintProperty(const std::string& name, const Convertible& value) { enum class Property : uint8_t { - IconOpacity, IconColor, + IconHaloBlur, IconHaloColor, IconHaloWidth, - IconHaloBlur, + IconOpacity, IconTranslate, IconTranslateAnchor, - TextOpacity, TextColor, + TextHaloBlur, TextHaloColor, TextHaloWidth, - TextHaloBlur, + TextOpacity, TextTranslate, TextTranslateAnchor, - IconOpacityTransition, IconColorTransition, + IconHaloBlurTransition, IconHaloColorTransition, IconHaloWidthTransition, - IconHaloBlurTransition, + IconOpacityTransition, IconTranslateTransition, IconTranslateAnchorTransition, - TextOpacityTransition, TextColorTransition, + TextHaloBlurTransition, TextHaloColorTransition, TextHaloWidthTransition, - TextHaloBlurTransition, + TextOpacityTransition, TextTranslateTransition, TextTranslateAnchorTransition, }; MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({ - { "icon-opacity", static_cast<uint8_t>(Property::IconOpacity) }, { "icon-color", static_cast<uint8_t>(Property::IconColor) }, + { "icon-halo-blur", static_cast<uint8_t>(Property::IconHaloBlur) }, { "icon-halo-color", static_cast<uint8_t>(Property::IconHaloColor) }, { "icon-halo-width", static_cast<uint8_t>(Property::IconHaloWidth) }, - { "icon-halo-blur", static_cast<uint8_t>(Property::IconHaloBlur) }, + { "icon-opacity", static_cast<uint8_t>(Property::IconOpacity) }, { "icon-translate", static_cast<uint8_t>(Property::IconTranslate) }, { "icon-translate-anchor", static_cast<uint8_t>(Property::IconTranslateAnchor) }, - { "text-opacity", static_cast<uint8_t>(Property::TextOpacity) }, { "text-color", static_cast<uint8_t>(Property::TextColor) }, + { "text-halo-blur", static_cast<uint8_t>(Property::TextHaloBlur) }, { "text-halo-color", static_cast<uint8_t>(Property::TextHaloColor) }, { "text-halo-width", static_cast<uint8_t>(Property::TextHaloWidth) }, - { "text-halo-blur", static_cast<uint8_t>(Property::TextHaloBlur) }, + { "text-opacity", static_cast<uint8_t>(Property::TextOpacity) }, { "text-translate", static_cast<uint8_t>(Property::TextTranslate) }, { "text-translate-anchor", static_cast<uint8_t>(Property::TextTranslateAnchor) }, - { "icon-opacity-transition", static_cast<uint8_t>(Property::IconOpacityTransition) }, { "icon-color-transition", static_cast<uint8_t>(Property::IconColorTransition) }, + { "icon-halo-blur-transition", static_cast<uint8_t>(Property::IconHaloBlurTransition) }, { "icon-halo-color-transition", static_cast<uint8_t>(Property::IconHaloColorTransition) }, { "icon-halo-width-transition", static_cast<uint8_t>(Property::IconHaloWidthTransition) }, - { "icon-halo-blur-transition", static_cast<uint8_t>(Property::IconHaloBlurTransition) }, + { "icon-opacity-transition", static_cast<uint8_t>(Property::IconOpacityTransition) }, { "icon-translate-transition", static_cast<uint8_t>(Property::IconTranslateTransition) }, { "icon-translate-anchor-transition", static_cast<uint8_t>(Property::IconTranslateAnchorTransition) }, - { "text-opacity-transition", static_cast<uint8_t>(Property::TextOpacityTransition) }, { "text-color-transition", static_cast<uint8_t>(Property::TextColorTransition) }, + { "text-halo-blur-transition", static_cast<uint8_t>(Property::TextHaloBlurTransition) }, { "text-halo-color-transition", static_cast<uint8_t>(Property::TextHaloColorTransition) }, { "text-halo-width-transition", static_cast<uint8_t>(Property::TextHaloWidthTransition) }, - { "text-halo-blur-transition", static_cast<uint8_t>(Property::TextHaloBlurTransition) }, + { "text-opacity-transition", static_cast<uint8_t>(Property::TextOpacityTransition) }, { "text-translate-transition", static_cast<uint8_t>(Property::TextTranslateTransition) }, { "text-translate-anchor-transition", static_cast<uint8_t>(Property::TextTranslateAnchorTransition) } }); @@ -1155,69 +1155,69 @@ optional<Error> SymbolLayer::setPaintProperty(const std::string& name, const Con auto property = static_cast<Property>(it->second); - if (property == Property::IconOpacity || property == Property::IconHaloWidth || property == Property::IconHaloBlur || property == Property::TextOpacity || property == Property::TextHaloWidth || property == Property::TextHaloBlur) { + if (property == Property::IconColor || property == Property::IconHaloColor || property == Property::TextColor || property == Property::TextHaloColor) { Error error; - optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false); + optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false); if (!typedValue) { return error; } - if (property == Property::IconOpacity) { - setIconOpacity(*typedValue); - return nullopt; - } - - if (property == Property::IconHaloWidth) { - setIconHaloWidth(*typedValue); - return nullopt; - } - - if (property == Property::IconHaloBlur) { - setIconHaloBlur(*typedValue); + if (property == Property::IconColor) { + setIconColor(*typedValue); return nullopt; } - if (property == Property::TextOpacity) { - setTextOpacity(*typedValue); + if (property == Property::IconHaloColor) { + setIconHaloColor(*typedValue); return nullopt; } - if (property == Property::TextHaloWidth) { - setTextHaloWidth(*typedValue); + if (property == Property::TextColor) { + setTextColor(*typedValue); return nullopt; } - if (property == Property::TextHaloBlur) { - setTextHaloBlur(*typedValue); + if (property == Property::TextHaloColor) { + setTextHaloColor(*typedValue); return nullopt; } } - if (property == Property::IconColor || property == Property::IconHaloColor || property == Property::TextColor || property == Property::TextHaloColor) { + if (property == Property::IconHaloBlur || property == Property::IconHaloWidth || property == Property::IconOpacity || property == Property::TextHaloBlur || property == Property::TextHaloWidth || property == Property::TextOpacity) { Error error; - optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false); + optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false); if (!typedValue) { return error; } - if (property == Property::IconColor) { - setIconColor(*typedValue); + if (property == Property::IconHaloBlur) { + setIconHaloBlur(*typedValue); return nullopt; } - if (property == Property::IconHaloColor) { - setIconHaloColor(*typedValue); + if (property == Property::IconHaloWidth) { + setIconHaloWidth(*typedValue); return nullopt; } - if (property == Property::TextColor) { - setTextColor(*typedValue); + if (property == Property::IconOpacity) { + setIconOpacity(*typedValue); return nullopt; } - if (property == Property::TextHaloColor) { - setTextHaloColor(*typedValue); + if (property == Property::TextHaloBlur) { + setTextHaloBlur(*typedValue); + return nullopt; + } + + if (property == Property::TextHaloWidth) { + setTextHaloWidth(*typedValue); + return nullopt; + } + + if (property == Property::TextOpacity) { + setTextOpacity(*typedValue); return nullopt; } @@ -1268,13 +1268,13 @@ optional<Error> SymbolLayer::setPaintProperty(const std::string& name, const Con return error; } - if (property == Property::IconOpacityTransition) { - setIconOpacityTransition(*transition); + if (property == Property::IconColorTransition) { + setIconColorTransition(*transition); return nullopt; } - if (property == Property::IconColorTransition) { - setIconColorTransition(*transition); + if (property == Property::IconHaloBlurTransition) { + setIconHaloBlurTransition(*transition); return nullopt; } @@ -1288,8 +1288,8 @@ optional<Error> SymbolLayer::setPaintProperty(const std::string& name, const Con return nullopt; } - if (property == Property::IconHaloBlurTransition) { - setIconHaloBlurTransition(*transition); + if (property == Property::IconOpacityTransition) { + setIconOpacityTransition(*transition); return nullopt; } @@ -1303,13 +1303,13 @@ optional<Error> SymbolLayer::setPaintProperty(const std::string& name, const Con return nullopt; } - if (property == Property::TextOpacityTransition) { - setTextOpacityTransition(*transition); + if (property == Property::TextColorTransition) { + setTextColorTransition(*transition); return nullopt; } - if (property == Property::TextColorTransition) { - setTextColorTransition(*transition); + if (property == Property::TextHaloBlurTransition) { + setTextHaloBlurTransition(*transition); return nullopt; } @@ -1323,8 +1323,8 @@ optional<Error> SymbolLayer::setPaintProperty(const std::string& name, const Con return nullopt; } - if (property == Property::TextHaloBlurTransition) { - setTextHaloBlurTransition(*transition); + if (property == Property::TextOpacityTransition) { + setTextOpacityTransition(*transition); return nullopt; } @@ -1347,88 +1347,88 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co return Layer::setVisibility(value); } enum class Property { - SymbolPlacement, - SymbolSpacing, - SymbolAvoidEdges, - SymbolSortKey, - SymbolZOrder, IconAllowOverlap, + IconAnchor, IconIgnorePlacement, + IconImage, + IconKeepUpright, + IconOffset, IconOptional, + IconPadding, + IconPitchAlignment, + IconRotate, IconRotationAlignment, IconSize, IconTextFit, IconTextFitPadding, - IconImage, - IconRotate, - IconPadding, - IconKeepUpright, - IconOffset, - IconAnchor, - IconPitchAlignment, - TextPitchAlignment, - TextRotationAlignment, + SymbolAvoidEdges, + SymbolPlacement, + SymbolSortKey, + SymbolSpacing, + SymbolZOrder, + TextAllowOverlap, + TextAnchor, TextField, TextFont, - TextSize, - TextMaxWidth, - TextLineHeight, - TextLetterSpacing, + TextIgnorePlacement, TextJustify, - TextRadialOffset, - TextVariableAnchor, - TextAnchor, - TextMaxAngle, - TextRotate, - TextPadding, TextKeepUpright, - TextTransform, + TextLetterSpacing, + TextLineHeight, + TextMaxAngle, + TextMaxWidth, TextOffset, - TextAllowOverlap, - TextIgnorePlacement, TextOptional, + TextPadding, + TextPitchAlignment, + TextRadialOffset, + TextRotate, + TextRotationAlignment, + TextSize, + TextTransform, + TextVariableAnchor, }; MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({ - { "symbol-placement", static_cast<uint8_t>(Property::SymbolPlacement) }, - { "symbol-spacing", static_cast<uint8_t>(Property::SymbolSpacing) }, - { "symbol-avoid-edges", static_cast<uint8_t>(Property::SymbolAvoidEdges) }, - { "symbol-sort-key", static_cast<uint8_t>(Property::SymbolSortKey) }, - { "symbol-z-order", static_cast<uint8_t>(Property::SymbolZOrder) }, { "icon-allow-overlap", static_cast<uint8_t>(Property::IconAllowOverlap) }, + { "icon-anchor", static_cast<uint8_t>(Property::IconAnchor) }, { "icon-ignore-placement", static_cast<uint8_t>(Property::IconIgnorePlacement) }, + { "icon-image", static_cast<uint8_t>(Property::IconImage) }, + { "icon-keep-upright", static_cast<uint8_t>(Property::IconKeepUpright) }, + { "icon-offset", static_cast<uint8_t>(Property::IconOffset) }, { "icon-optional", static_cast<uint8_t>(Property::IconOptional) }, + { "icon-padding", static_cast<uint8_t>(Property::IconPadding) }, + { "icon-pitch-alignment", static_cast<uint8_t>(Property::IconPitchAlignment) }, + { "icon-rotate", static_cast<uint8_t>(Property::IconRotate) }, { "icon-rotation-alignment", static_cast<uint8_t>(Property::IconRotationAlignment) }, { "icon-size", static_cast<uint8_t>(Property::IconSize) }, { "icon-text-fit", static_cast<uint8_t>(Property::IconTextFit) }, { "icon-text-fit-padding", static_cast<uint8_t>(Property::IconTextFitPadding) }, - { "icon-image", static_cast<uint8_t>(Property::IconImage) }, - { "icon-rotate", static_cast<uint8_t>(Property::IconRotate) }, - { "icon-padding", static_cast<uint8_t>(Property::IconPadding) }, - { "icon-keep-upright", static_cast<uint8_t>(Property::IconKeepUpright) }, - { "icon-offset", static_cast<uint8_t>(Property::IconOffset) }, - { "icon-anchor", static_cast<uint8_t>(Property::IconAnchor) }, - { "icon-pitch-alignment", static_cast<uint8_t>(Property::IconPitchAlignment) }, - { "text-pitch-alignment", static_cast<uint8_t>(Property::TextPitchAlignment) }, - { "text-rotation-alignment", static_cast<uint8_t>(Property::TextRotationAlignment) }, + { "symbol-avoid-edges", static_cast<uint8_t>(Property::SymbolAvoidEdges) }, + { "symbol-placement", static_cast<uint8_t>(Property::SymbolPlacement) }, + { "symbol-sort-key", static_cast<uint8_t>(Property::SymbolSortKey) }, + { "symbol-spacing", static_cast<uint8_t>(Property::SymbolSpacing) }, + { "symbol-z-order", static_cast<uint8_t>(Property::SymbolZOrder) }, + { "text-allow-overlap", static_cast<uint8_t>(Property::TextAllowOverlap) }, + { "text-anchor", static_cast<uint8_t>(Property::TextAnchor) }, { "text-field", static_cast<uint8_t>(Property::TextField) }, { "text-font", static_cast<uint8_t>(Property::TextFont) }, - { "text-size", static_cast<uint8_t>(Property::TextSize) }, - { "text-max-width", static_cast<uint8_t>(Property::TextMaxWidth) }, - { "text-line-height", static_cast<uint8_t>(Property::TextLineHeight) }, - { "text-letter-spacing", static_cast<uint8_t>(Property::TextLetterSpacing) }, + { "text-ignore-placement", static_cast<uint8_t>(Property::TextIgnorePlacement) }, { "text-justify", static_cast<uint8_t>(Property::TextJustify) }, - { "text-radial-offset", static_cast<uint8_t>(Property::TextRadialOffset) }, - { "text-variable-anchor", static_cast<uint8_t>(Property::TextVariableAnchor) }, - { "text-anchor", static_cast<uint8_t>(Property::TextAnchor) }, + { "text-keep-upright", static_cast<uint8_t>(Property::TextKeepUpright) }, + { "text-letter-spacing", static_cast<uint8_t>(Property::TextLetterSpacing) }, + { "text-line-height", static_cast<uint8_t>(Property::TextLineHeight) }, { "text-max-angle", static_cast<uint8_t>(Property::TextMaxAngle) }, - { "text-rotate", static_cast<uint8_t>(Property::TextRotate) }, + { "text-max-width", static_cast<uint8_t>(Property::TextMaxWidth) }, + { "text-offset", static_cast<uint8_t>(Property::TextOffset) }, + { "text-optional", static_cast<uint8_t>(Property::TextOptional) }, { "text-padding", static_cast<uint8_t>(Property::TextPadding) }, - { "text-keep-upright", static_cast<uint8_t>(Property::TextKeepUpright) }, + { "text-pitch-alignment", static_cast<uint8_t>(Property::TextPitchAlignment) }, + { "text-radial-offset", static_cast<uint8_t>(Property::TextRadialOffset) }, + { "text-rotate", static_cast<uint8_t>(Property::TextRotate) }, + { "text-rotation-alignment", static_cast<uint8_t>(Property::TextRotationAlignment) }, + { "text-size", static_cast<uint8_t>(Property::TextSize) }, { "text-transform", static_cast<uint8_t>(Property::TextTransform) }, - { "text-offset", static_cast<uint8_t>(Property::TextOffset) }, - { "text-allow-overlap", static_cast<uint8_t>(Property::TextAllowOverlap) }, - { "text-ignore-placement", static_cast<uint8_t>(Property::TextIgnorePlacement) }, - { "text-optional", static_cast<uint8_t>(Property::TextOptional) } + { "text-variable-anchor", static_cast<uint8_t>(Property::TextVariableAnchor) } }); const auto it = properties.find(name.c_str()); @@ -1439,191 +1439,217 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co auto property = static_cast<Property>(it->second); - if (property == Property::SymbolPlacement) { - Error error; - optional<PropertyValue<SymbolPlacementType>> typedValue = convert<PropertyValue<SymbolPlacementType>>(value, error, false, false); - if (!typedValue) { - return error; - } - - setSymbolPlacement(*typedValue); - return nullopt; - - } - - if (property == Property::SymbolSpacing || property == Property::IconPadding || property == Property::TextLineHeight || property == Property::TextMaxAngle || property == Property::TextPadding) { + if (property == Property::IconAllowOverlap || property == Property::IconIgnorePlacement || property == Property::IconKeepUpright || property == Property::IconOptional || property == Property::SymbolAvoidEdges || property == Property::TextAllowOverlap || property == Property::TextIgnorePlacement || property == Property::TextKeepUpright || property == Property::TextOptional) { Error error; - optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false); + optional<PropertyValue<bool>> typedValue = convert<PropertyValue<bool>>(value, error, false, false); if (!typedValue) { return error; } - if (property == Property::SymbolSpacing) { - setSymbolSpacing(*typedValue); - return nullopt; - } - - if (property == Property::IconPadding) { - setIconPadding(*typedValue); + if (property == Property::IconAllowOverlap) { + setIconAllowOverlap(*typedValue); return nullopt; } - if (property == Property::TextLineHeight) { - setTextLineHeight(*typedValue); + if (property == Property::IconIgnorePlacement) { + setIconIgnorePlacement(*typedValue); return nullopt; } - if (property == Property::TextMaxAngle) { - setTextMaxAngle(*typedValue); + if (property == Property::IconKeepUpright) { + setIconKeepUpright(*typedValue); return nullopt; } - if (property == Property::TextPadding) { - setTextPadding(*typedValue); + if (property == Property::IconOptional) { + setIconOptional(*typedValue); return nullopt; } - } - - if (property == Property::SymbolAvoidEdges || property == Property::IconAllowOverlap || property == Property::IconIgnorePlacement || property == Property::IconOptional || property == Property::IconKeepUpright || property == Property::TextKeepUpright || property == Property::TextAllowOverlap || property == Property::TextIgnorePlacement || property == Property::TextOptional) { - Error error; - optional<PropertyValue<bool>> typedValue = convert<PropertyValue<bool>>(value, error, false, false); - if (!typedValue) { - return error; - } - if (property == Property::SymbolAvoidEdges) { setSymbolAvoidEdges(*typedValue); return nullopt; } - if (property == Property::IconAllowOverlap) { - setIconAllowOverlap(*typedValue); + if (property == Property::TextAllowOverlap) { + setTextAllowOverlap(*typedValue); return nullopt; } - if (property == Property::IconIgnorePlacement) { - setIconIgnorePlacement(*typedValue); + if (property == Property::TextIgnorePlacement) { + setTextIgnorePlacement(*typedValue); return nullopt; } - if (property == Property::IconOptional) { - setIconOptional(*typedValue); + if (property == Property::TextKeepUpright) { + setTextKeepUpright(*typedValue); return nullopt; } - if (property == Property::IconKeepUpright) { - setIconKeepUpright(*typedValue); + if (property == Property::TextOptional) { + setTextOptional(*typedValue); return nullopt; } - if (property == Property::TextKeepUpright) { - setTextKeepUpright(*typedValue); - return nullopt; + } + + if (property == Property::IconAnchor || property == Property::TextAnchor) { + Error error; + optional<PropertyValue<SymbolAnchorType>> typedValue = convert<PropertyValue<SymbolAnchorType>>(value, error, true, false); + if (!typedValue) { + return error; } - if (property == Property::TextAllowOverlap) { - setTextAllowOverlap(*typedValue); + if (property == Property::IconAnchor) { + setIconAnchor(*typedValue); return nullopt; } - if (property == Property::TextIgnorePlacement) { - setTextIgnorePlacement(*typedValue); + if (property == Property::TextAnchor) { + setTextAnchor(*typedValue); return nullopt; } - if (property == Property::TextOptional) { - setTextOptional(*typedValue); - return nullopt; + } + + if (property == Property::IconImage) { + Error error; + optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, true); + if (!typedValue) { + return error; } + setIconImage(*typedValue); + return nullopt; + } - if (property == Property::SymbolSortKey || property == Property::IconSize || property == Property::IconRotate || property == Property::TextSize || property == Property::TextMaxWidth || property == Property::TextLetterSpacing || property == Property::TextRadialOffset || property == Property::TextRotate) { + if (property == Property::IconOffset || property == Property::TextOffset) { Error error; - optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false); + optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, true, false); if (!typedValue) { return error; } - if (property == Property::SymbolSortKey) { - setSymbolSortKey(*typedValue); + if (property == Property::IconOffset) { + setIconOffset(*typedValue); return nullopt; } - if (property == Property::IconSize) { - setIconSize(*typedValue); + if (property == Property::TextOffset) { + setTextOffset(*typedValue); return nullopt; } - if (property == Property::IconRotate) { - setIconRotate(*typedValue); - return nullopt; + } + + if (property == Property::IconPadding || property == Property::SymbolSpacing || property == Property::TextLineHeight || property == Property::TextMaxAngle || property == Property::TextPadding) { + Error error; + optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false); + if (!typedValue) { + return error; } - if (property == Property::TextSize) { - setTextSize(*typedValue); + if (property == Property::IconPadding) { + setIconPadding(*typedValue); return nullopt; } - if (property == Property::TextMaxWidth) { - setTextMaxWidth(*typedValue); + if (property == Property::SymbolSpacing) { + setSymbolSpacing(*typedValue); return nullopt; } - if (property == Property::TextLetterSpacing) { - setTextLetterSpacing(*typedValue); + if (property == Property::TextLineHeight) { + setTextLineHeight(*typedValue); return nullopt; } - if (property == Property::TextRadialOffset) { - setTextRadialOffset(*typedValue); + if (property == Property::TextMaxAngle) { + setTextMaxAngle(*typedValue); return nullopt; } - if (property == Property::TextRotate) { - setTextRotate(*typedValue); + if (property == Property::TextPadding) { + setTextPadding(*typedValue); return nullopt; } } - if (property == Property::SymbolZOrder) { + if (property == Property::IconPitchAlignment || property == Property::IconRotationAlignment || property == Property::TextPitchAlignment || property == Property::TextRotationAlignment) { Error error; - optional<PropertyValue<SymbolZOrderType>> typedValue = convert<PropertyValue<SymbolZOrderType>>(value, error, false, false); + optional<PropertyValue<AlignmentType>> typedValue = convert<PropertyValue<AlignmentType>>(value, error, false, false); if (!typedValue) { return error; } - setSymbolZOrder(*typedValue); - return nullopt; + if (property == Property::IconPitchAlignment) { + setIconPitchAlignment(*typedValue); + return nullopt; + } + + if (property == Property::IconRotationAlignment) { + setIconRotationAlignment(*typedValue); + return nullopt; + } + + if (property == Property::TextPitchAlignment) { + setTextPitchAlignment(*typedValue); + return nullopt; + } + + if (property == Property::TextRotationAlignment) { + setTextRotationAlignment(*typedValue); + return nullopt; + } } - if (property == Property::IconRotationAlignment || property == Property::IconPitchAlignment || property == Property::TextPitchAlignment || property == Property::TextRotationAlignment) { + if (property == Property::IconRotate || property == Property::IconSize || property == Property::SymbolSortKey || property == Property::TextLetterSpacing || property == Property::TextMaxWidth || property == Property::TextRadialOffset || property == Property::TextRotate || property == Property::TextSize) { Error error; - optional<PropertyValue<AlignmentType>> typedValue = convert<PropertyValue<AlignmentType>>(value, error, false, false); + optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false); if (!typedValue) { return error; } - if (property == Property::IconRotationAlignment) { - setIconRotationAlignment(*typedValue); + if (property == Property::IconRotate) { + setIconRotate(*typedValue); return nullopt; } - if (property == Property::IconPitchAlignment) { - setIconPitchAlignment(*typedValue); + if (property == Property::IconSize) { + setIconSize(*typedValue); return nullopt; } - if (property == Property::TextPitchAlignment) { - setTextPitchAlignment(*typedValue); + if (property == Property::SymbolSortKey) { + setSymbolSortKey(*typedValue); return nullopt; } - if (property == Property::TextRotationAlignment) { - setTextRotationAlignment(*typedValue); + if (property == Property::TextLetterSpacing) { + setTextLetterSpacing(*typedValue); + return nullopt; + } + + if (property == Property::TextMaxWidth) { + setTextMaxWidth(*typedValue); + return nullopt; + } + + if (property == Property::TextRadialOffset) { + setTextRadialOffset(*typedValue); + return nullopt; + } + + if (property == Property::TextRotate) { + setTextRotate(*typedValue); + return nullopt; + } + + if (property == Property::TextSize) { + setTextSize(*typedValue); return nullopt; } @@ -1653,53 +1679,27 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co } - if (property == Property::IconImage) { + if (property == Property::SymbolPlacement) { Error error; - optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, true); + optional<PropertyValue<SymbolPlacementType>> typedValue = convert<PropertyValue<SymbolPlacementType>>(value, error, false, false); if (!typedValue) { return error; } - setIconImage(*typedValue); + setSymbolPlacement(*typedValue); return nullopt; } - if (property == Property::IconOffset || property == Property::TextOffset) { - Error error; - optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, true, false); - if (!typedValue) { - return error; - } - - if (property == Property::IconOffset) { - setIconOffset(*typedValue); - return nullopt; - } - - if (property == Property::TextOffset) { - setTextOffset(*typedValue); - return nullopt; - } - - } - - if (property == Property::IconAnchor || property == Property::TextAnchor) { + if (property == Property::SymbolZOrder) { Error error; - optional<PropertyValue<SymbolAnchorType>> typedValue = convert<PropertyValue<SymbolAnchorType>>(value, error, true, false); + optional<PropertyValue<SymbolZOrderType>> typedValue = convert<PropertyValue<SymbolZOrderType>>(value, error, false, false); if (!typedValue) { return error; } - if (property == Property::IconAnchor) { - setIconAnchor(*typedValue); - return nullopt; - } - - if (property == Property::TextAnchor) { - setTextAnchor(*typedValue); - return nullopt; - } + setSymbolZOrder(*typedValue); + return nullopt; } @@ -1739,26 +1739,26 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co } - if (property == Property::TextVariableAnchor) { + if (property == Property::TextTransform) { Error error; - optional<PropertyValue<std::vector<TextVariableAnchorType>>> typedValue = convert<PropertyValue<std::vector<TextVariableAnchorType>>>(value, error, false, false); + optional<PropertyValue<TextTransformType>> typedValue = convert<PropertyValue<TextTransformType>>(value, error, true, false); if (!typedValue) { return error; } - setTextVariableAnchor(*typedValue); + setTextTransform(*typedValue); return nullopt; } - if (property == Property::TextTransform) { + if (property == Property::TextVariableAnchor) { Error error; - optional<PropertyValue<TextTransformType>> typedValue = convert<PropertyValue<TextTransformType>>(value, error, true, false); + optional<PropertyValue<std::vector<TextVariableAnchorType>>> typedValue = convert<PropertyValue<std::vector<TextVariableAnchorType>>>(value, error, false, false); if (!typedValue) { return error; } - setTextTransform(*typedValue); + setTextVariableAnchor(*typedValue); return nullopt; } diff --git a/src/mbgl/style/layers/symbol_layer_properties.hpp b/src/mbgl/style/layers/symbol_layer_properties.hpp index 6e3fa54241..7b630a1ca3 100644 --- a/src/mbgl/style/layers/symbol_layer_properties.hpp +++ b/src/mbgl/style/layers/symbol_layer_properties.hpp @@ -14,39 +14,34 @@ namespace mbgl { namespace style { -struct SymbolPlacement : LayoutProperty<SymbolPlacementType> { - static constexpr const char *name() { return "symbol-placement"; } - static SymbolPlacementType defaultValue() { return SymbolPlacementType::Point; } +struct IconAllowOverlap : LayoutProperty<bool> { + static constexpr const char *name() { return "icon-allow-overlap"; } + static bool defaultValue() { return false; } }; -struct SymbolSpacing : LayoutProperty<float> { - static constexpr const char *name() { return "symbol-spacing"; } - static float defaultValue() { return 250; } +struct IconAnchor : DataDrivenLayoutProperty<SymbolAnchorType> { + static constexpr const char *name() { return "icon-anchor"; } + static SymbolAnchorType defaultValue() { return SymbolAnchorType::Center; } }; -struct SymbolAvoidEdges : LayoutProperty<bool> { - static constexpr const char *name() { return "symbol-avoid-edges"; } +struct IconIgnorePlacement : LayoutProperty<bool> { + static constexpr const char *name() { return "icon-ignore-placement"; } static bool defaultValue() { return false; } }; -struct SymbolSortKey : DataDrivenLayoutProperty<float> { - static constexpr const char *name() { return "symbol-sort-key"; } - static float defaultValue() { return 0; } -}; - -struct SymbolZOrder : LayoutProperty<SymbolZOrderType> { - static constexpr const char *name() { return "symbol-z-order"; } - static SymbolZOrderType defaultValue() { return SymbolZOrderType::Auto; } +struct IconImage : DataDrivenLayoutProperty<std::string> { + static constexpr const char *name() { return "icon-image"; } + static std::string defaultValue() { return ""; } }; -struct IconAllowOverlap : LayoutProperty<bool> { - static constexpr const char *name() { return "icon-allow-overlap"; } +struct IconKeepUpright : LayoutProperty<bool> { + static constexpr const char *name() { return "icon-keep-upright"; } static bool defaultValue() { return false; } }; -struct IconIgnorePlacement : LayoutProperty<bool> { - static constexpr const char *name() { return "icon-ignore-placement"; } - static bool defaultValue() { return false; } +struct IconOffset : DataDrivenLayoutProperty<std::array<float, 2>> { + static constexpr const char *name() { return "icon-offset"; } + static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } }; struct IconOptional : LayoutProperty<bool> { @@ -54,6 +49,21 @@ struct IconOptional : LayoutProperty<bool> { static bool defaultValue() { return false; } }; +struct IconPadding : LayoutProperty<float> { + static constexpr const char *name() { return "icon-padding"; } + static float defaultValue() { return 2; } +}; + +struct IconPitchAlignment : LayoutProperty<AlignmentType> { + static constexpr const char *name() { return "icon-pitch-alignment"; } + static AlignmentType defaultValue() { return AlignmentType::Auto; } +}; + +struct IconRotate : DataDrivenLayoutProperty<float> { + static constexpr const char *name() { return "icon-rotate"; } + static float defaultValue() { return 0; } +}; + struct IconRotationAlignment : LayoutProperty<AlignmentType> { static constexpr const char *name() { return "icon-rotation-alignment"; } static AlignmentType defaultValue() { return AlignmentType::Auto; } @@ -74,49 +84,39 @@ struct IconTextFitPadding : LayoutProperty<std::array<float, 4>> { static std::array<float, 4> defaultValue() { return {{ 0, 0, 0, 0 }}; } }; -struct IconImage : DataDrivenLayoutProperty<std::string> { - static constexpr const char *name() { return "icon-image"; } - static std::string defaultValue() { return ""; } -}; - -struct IconRotate : DataDrivenLayoutProperty<float> { - static constexpr const char *name() { return "icon-rotate"; } - static float defaultValue() { return 0; } -}; - -struct IconPadding : LayoutProperty<float> { - static constexpr const char *name() { return "icon-padding"; } - static float defaultValue() { return 2; } +struct SymbolAvoidEdges : LayoutProperty<bool> { + static constexpr const char *name() { return "symbol-avoid-edges"; } + static bool defaultValue() { return false; } }; -struct IconKeepUpright : LayoutProperty<bool> { - static constexpr const char *name() { return "icon-keep-upright"; } - static bool defaultValue() { return false; } +struct SymbolPlacement : LayoutProperty<SymbolPlacementType> { + static constexpr const char *name() { return "symbol-placement"; } + static SymbolPlacementType defaultValue() { return SymbolPlacementType::Point; } }; -struct IconOffset : DataDrivenLayoutProperty<std::array<float, 2>> { - static constexpr const char *name() { return "icon-offset"; } - static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } +struct SymbolSortKey : DataDrivenLayoutProperty<float> { + static constexpr const char *name() { return "symbol-sort-key"; } + static float defaultValue() { return 0; } }; -struct IconAnchor : DataDrivenLayoutProperty<SymbolAnchorType> { - static constexpr const char *name() { return "icon-anchor"; } - static SymbolAnchorType defaultValue() { return SymbolAnchorType::Center; } +struct SymbolSpacing : LayoutProperty<float> { + static constexpr const char *name() { return "symbol-spacing"; } + static float defaultValue() { return 250; } }; -struct IconPitchAlignment : LayoutProperty<AlignmentType> { - static constexpr const char *name() { return "icon-pitch-alignment"; } - static AlignmentType defaultValue() { return AlignmentType::Auto; } +struct SymbolZOrder : LayoutProperty<SymbolZOrderType> { + static constexpr const char *name() { return "symbol-z-order"; } + static SymbolZOrderType defaultValue() { return SymbolZOrderType::Auto; } }; -struct TextPitchAlignment : LayoutProperty<AlignmentType> { - static constexpr const char *name() { return "text-pitch-alignment"; } - static AlignmentType defaultValue() { return AlignmentType::Auto; } +struct TextAllowOverlap : LayoutProperty<bool> { + static constexpr const char *name() { return "text-allow-overlap"; } + static bool defaultValue() { return false; } }; -struct TextRotationAlignment : LayoutProperty<AlignmentType> { - static constexpr const char *name() { return "text-rotation-alignment"; } - static AlignmentType defaultValue() { return AlignmentType::Auto; } +struct TextAnchor : DataDrivenLayoutProperty<SymbolAnchorType> { + static constexpr const char *name() { return "text-anchor"; } + static SymbolAnchorType defaultValue() { return SymbolAnchorType::Center; } }; struct TextField : DataDrivenLayoutProperty<expression::Formatted> { @@ -129,19 +129,19 @@ struct TextFont : DataDrivenLayoutProperty<std::vector<std::string>> { static std::vector<std::string> defaultValue() { return { "Open Sans Regular", "Arial Unicode MS Regular" }; } }; -struct TextSize : DataDrivenLayoutProperty<float> { - static constexpr const char *name() { return "text-size"; } - static float defaultValue() { return 16; } +struct TextIgnorePlacement : LayoutProperty<bool> { + static constexpr const char *name() { return "text-ignore-placement"; } + static bool defaultValue() { return false; } }; -struct TextMaxWidth : DataDrivenLayoutProperty<float> { - static constexpr const char *name() { return "text-max-width"; } - static float defaultValue() { return 10; } +struct TextJustify : DataDrivenLayoutProperty<TextJustifyType> { + static constexpr const char *name() { return "text-justify"; } + static TextJustifyType defaultValue() { return TextJustifyType::Center; } }; -struct TextLineHeight : LayoutProperty<float> { - static constexpr const char *name() { return "text-line-height"; } - static float defaultValue() { return 1.2; } +struct TextKeepUpright : LayoutProperty<bool> { + static constexpr const char *name() { return "text-keep-upright"; } + static bool defaultValue() { return true; } }; struct TextLetterSpacing : DataDrivenLayoutProperty<float> { @@ -149,34 +149,29 @@ struct TextLetterSpacing : DataDrivenLayoutProperty<float> { static float defaultValue() { return 0; } }; -struct TextJustify : DataDrivenLayoutProperty<TextJustifyType> { - static constexpr const char *name() { return "text-justify"; } - static TextJustifyType defaultValue() { return TextJustifyType::Center; } -}; - -struct TextRadialOffset : DataDrivenLayoutProperty<float> { - static constexpr const char *name() { return "text-radial-offset"; } - static float defaultValue() { return 0; } +struct TextLineHeight : LayoutProperty<float> { + static constexpr const char *name() { return "text-line-height"; } + static float defaultValue() { return 1.2; } }; -struct TextVariableAnchor : LayoutProperty<std::vector<TextVariableAnchorType>> { - static constexpr const char *name() { return "text-variable-anchor"; } - static std::vector<TextVariableAnchorType> defaultValue() { return { }; } +struct TextMaxAngle : LayoutProperty<float> { + static constexpr const char *name() { return "text-max-angle"; } + static float defaultValue() { return 45; } }; -struct TextAnchor : DataDrivenLayoutProperty<SymbolAnchorType> { - static constexpr const char *name() { return "text-anchor"; } - static SymbolAnchorType defaultValue() { return SymbolAnchorType::Center; } +struct TextMaxWidth : DataDrivenLayoutProperty<float> { + static constexpr const char *name() { return "text-max-width"; } + static float defaultValue() { return 10; } }; -struct TextMaxAngle : LayoutProperty<float> { - static constexpr const char *name() { return "text-max-angle"; } - static float defaultValue() { return 45; } +struct TextOffset : DataDrivenLayoutProperty<std::array<float, 2>> { + static constexpr const char *name() { return "text-offset"; } + static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } }; -struct TextRotate : DataDrivenLayoutProperty<float> { - static constexpr const char *name() { return "text-rotate"; } - static float defaultValue() { return 0; } +struct TextOptional : LayoutProperty<bool> { + static constexpr const char *name() { return "text-optional"; } + static bool defaultValue() { return false; } }; struct TextPadding : LayoutProperty<float> { @@ -184,44 +179,49 @@ struct TextPadding : LayoutProperty<float> { static float defaultValue() { return 2; } }; -struct TextKeepUpright : LayoutProperty<bool> { - static constexpr const char *name() { return "text-keep-upright"; } - static bool defaultValue() { return true; } +struct TextPitchAlignment : LayoutProperty<AlignmentType> { + static constexpr const char *name() { return "text-pitch-alignment"; } + static AlignmentType defaultValue() { return AlignmentType::Auto; } }; -struct TextTransform : DataDrivenLayoutProperty<TextTransformType> { - static constexpr const char *name() { return "text-transform"; } - static TextTransformType defaultValue() { return TextTransformType::None; } +struct TextRadialOffset : DataDrivenLayoutProperty<float> { + static constexpr const char *name() { return "text-radial-offset"; } + static float defaultValue() { return 0; } }; -struct TextOffset : DataDrivenLayoutProperty<std::array<float, 2>> { - static constexpr const char *name() { return "text-offset"; } - static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } +struct TextRotate : DataDrivenLayoutProperty<float> { + static constexpr const char *name() { return "text-rotate"; } + static float defaultValue() { return 0; } }; -struct TextAllowOverlap : LayoutProperty<bool> { - static constexpr const char *name() { return "text-allow-overlap"; } - static bool defaultValue() { return false; } +struct TextRotationAlignment : LayoutProperty<AlignmentType> { + static constexpr const char *name() { return "text-rotation-alignment"; } + static AlignmentType defaultValue() { return AlignmentType::Auto; } }; -struct TextIgnorePlacement : LayoutProperty<bool> { - static constexpr const char *name() { return "text-ignore-placement"; } - static bool defaultValue() { return false; } +struct TextSize : DataDrivenLayoutProperty<float> { + static constexpr const char *name() { return "text-size"; } + static float defaultValue() { return 16; } }; -struct TextOptional : LayoutProperty<bool> { - static constexpr const char *name() { return "text-optional"; } - static bool defaultValue() { return false; } +struct TextTransform : DataDrivenLayoutProperty<TextTransformType> { + static constexpr const char *name() { return "text-transform"; } + static TextTransformType defaultValue() { return TextTransformType::None; } }; -struct IconOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> { - static float defaultValue() { return 1; } +struct TextVariableAnchor : LayoutProperty<std::vector<TextVariableAnchorType>> { + static constexpr const char *name() { return "text-variable-anchor"; } + static std::vector<TextVariableAnchorType> defaultValue() { return { }; } }; struct IconColor : DataDrivenPaintProperty<Color, attributes::fill_color, uniforms::fill_color> { static Color defaultValue() { return Color::black(); } }; +struct IconHaloBlur : DataDrivenPaintProperty<float, attributes::halo_blur, uniforms::halo_blur> { + static float defaultValue() { return 0; } +}; + struct IconHaloColor : DataDrivenPaintProperty<Color, attributes::halo_color, uniforms::halo_color> { static Color defaultValue() { return {}; } }; @@ -230,8 +230,8 @@ struct IconHaloWidth : DataDrivenPaintProperty<float, attributes::halo_width, un static float defaultValue() { return 0; } }; -struct IconHaloBlur : DataDrivenPaintProperty<float, attributes::halo_blur, uniforms::halo_blur> { - static float defaultValue() { return 0; } +struct IconOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> { + static float defaultValue() { return 1; } }; struct IconTranslate : PaintProperty<std::array<float, 2>> { @@ -242,10 +242,6 @@ struct IconTranslateAnchor : PaintProperty<TranslateAnchorType> { static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; } }; -struct TextOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> { - static float defaultValue() { return 1; } -}; - struct TextColor : DataDrivenPaintProperty<Color, attributes::fill_color, uniforms::fill_color, true> { static Color defaultValue() { return Color::black(); } static constexpr const char *name() { return "text-color"; } @@ -253,6 +249,10 @@ struct TextColor : DataDrivenPaintProperty<Color, attributes::fill_color, unifor template<typename T> static bool hasOverride(const T& t) { return !!t.textColor; }; }; +struct TextHaloBlur : DataDrivenPaintProperty<float, attributes::halo_blur, uniforms::halo_blur> { + static float defaultValue() { return 0; } +}; + struct TextHaloColor : DataDrivenPaintProperty<Color, attributes::halo_color, uniforms::halo_color> { static Color defaultValue() { return {}; } }; @@ -261,8 +261,8 @@ struct TextHaloWidth : DataDrivenPaintProperty<float, attributes::halo_width, un static float defaultValue() { return 0; } }; -struct TextHaloBlur : DataDrivenPaintProperty<float, attributes::halo_blur, uniforms::halo_blur> { - static float defaultValue() { return 0; } +struct TextOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> { + static float defaultValue() { return 1; } }; struct TextTranslate : PaintProperty<std::array<float, 2>> { @@ -274,61 +274,61 @@ struct TextTranslateAnchor : PaintProperty<TranslateAnchorType> { }; class SymbolLayoutProperties : public Properties< - SymbolPlacement, - SymbolSpacing, - SymbolAvoidEdges, - SymbolSortKey, - SymbolZOrder, IconAllowOverlap, + IconAnchor, IconIgnorePlacement, + IconImage, + IconKeepUpright, + IconOffset, IconOptional, + IconPadding, + IconPitchAlignment, + IconRotate, IconRotationAlignment, IconSize, IconTextFit, IconTextFitPadding, - IconImage, - IconRotate, - IconPadding, - IconKeepUpright, - IconOffset, - IconAnchor, - IconPitchAlignment, - TextPitchAlignment, - TextRotationAlignment, + SymbolAvoidEdges, + SymbolPlacement, + SymbolSortKey, + SymbolSpacing, + SymbolZOrder, + TextAllowOverlap, + TextAnchor, TextField, TextFont, - TextSize, - TextMaxWidth, - TextLineHeight, - TextLetterSpacing, + TextIgnorePlacement, TextJustify, - TextRadialOffset, - TextVariableAnchor, - TextAnchor, + TextKeepUpright, + TextLetterSpacing, + TextLineHeight, TextMaxAngle, - TextRotate, + TextMaxWidth, + TextOffset, + TextOptional, TextPadding, - TextKeepUpright, + TextPitchAlignment, + TextRadialOffset, + TextRotate, + TextRotationAlignment, + TextSize, TextTransform, - TextOffset, - TextAllowOverlap, - TextIgnorePlacement, - TextOptional + TextVariableAnchor > {}; class SymbolPaintProperties : public Properties< - IconOpacity, IconColor, + IconHaloBlur, IconHaloColor, IconHaloWidth, - IconHaloBlur, + IconOpacity, IconTranslate, IconTranslateAnchor, - TextOpacity, TextColor, + TextHaloBlur, TextHaloColor, TextHaloWidth, - TextHaloBlur, + TextOpacity, TextTranslate, TextTranslateAnchor > {}; diff --git a/src/mbgl/style/light.cpp b/src/mbgl/style/light.cpp index 352dc4d942..a88cc02bd7 100644 --- a/src/mbgl/style/light.cpp +++ b/src/mbgl/style/light.cpp @@ -50,32 +50,6 @@ TransitionOptions Light::getAnchorTransition() const { return impl->properties.template get<LightAnchor>().options; } -Position Light::getDefaultPosition() { - return LightPosition::defaultValue(); -} - -PropertyValue<Position> Light::getPosition() const { - return impl->properties.template get<LightPosition>().value; -} - -void Light::setPosition(PropertyValue<Position> property) { - auto impl_ = mutableImpl(); - impl_->properties.template get<LightPosition>().value = property; - impl = std::move(impl_); - observer->onLightChanged(*this); -} - -void Light::setPositionTransition(const TransitionOptions& options) { - auto impl_ = mutableImpl(); - impl_->properties.template get<LightPosition>().options = options; - impl = std::move(impl_); - observer->onLightChanged(*this); -} - -TransitionOptions Light::getPositionTransition() const { - return impl->properties.template get<LightPosition>().options; -} - Color Light::getDefaultColor() { return LightColor::defaultValue(); } @@ -128,6 +102,32 @@ TransitionOptions Light::getIntensityTransition() const { return impl->properties.template get<LightIntensity>().options; } +Position Light::getDefaultPosition() { + return LightPosition::defaultValue(); +} + +PropertyValue<Position> Light::getPosition() const { + return impl->properties.template get<LightPosition>().value; +} + +void Light::setPosition(PropertyValue<Position> property) { + auto impl_ = mutableImpl(); + impl_->properties.template get<LightPosition>().value = property; + impl = std::move(impl_); + observer->onLightChanged(*this); +} + +void Light::setPositionTransition(const TransitionOptions& options) { + auto impl_ = mutableImpl(); + impl_->properties.template get<LightPosition>().options = options; + impl = std::move(impl_); + observer->onLightChanged(*this); +} + +TransitionOptions Light::getPositionTransition() const { + return impl->properties.template get<LightPosition>().options; +} + } // namespace style } // namespace mbgl |