diff options
Diffstat (limited to 'src/mbgl/style/layers/background_layer.cpp')
-rw-r--r-- | src/mbgl/style/layers/background_layer.cpp | 74 |
1 files changed, 37 insertions, 37 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; } |