diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-10 12:37:46 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-15 09:45:55 -0700 |
commit | 9eba2a66d107f30aa9216fb34ed62df60797986a (patch) | |
tree | d334e6f3b5154b3dc5a49d87e8be9b42df2b212a /src/mbgl/style | |
parent | e473f2dcceb31eda816ac9e6c972d7e0a8f1dceb (diff) | |
download | qtlocation-mapboxgl-9eba2a66d107f30aa9216fb34ed62df60797986a.tar.gz |
[core, node, darwin, qt] Remove support for paint classes
Diffstat (limited to 'src/mbgl/style')
-rw-r--r-- | src/mbgl/style/class_dictionary.cpp | 51 | ||||
-rw-r--r-- | src/mbgl/style/class_dictionary.hpp | 52 | ||||
-rw-r--r-- | src/mbgl/style/layers/background_layer.cpp | 54 | ||||
-rw-r--r-- | src/mbgl/style/layers/circle_layer.cpp | 180 | ||||
-rw-r--r-- | src/mbgl/style/layers/fill_extrusion_layer.cpp | 126 | ||||
-rw-r--r-- | src/mbgl/style/layers/fill_layer.cpp | 126 | ||||
-rw-r--r-- | src/mbgl/style/layers/layer.cpp.ejs | 18 | ||||
-rw-r--r-- | src/mbgl/style/layers/line_layer.cpp | 180 | ||||
-rw-r--r-- | src/mbgl/style/layers/raster_layer.cpp | 126 | ||||
-rw-r--r-- | src/mbgl/style/layers/symbol_layer.cpp | 252 | ||||
-rw-r--r-- | src/mbgl/style/paint_property.hpp | 6 | ||||
-rw-r--r-- | src/mbgl/style/properties.hpp | 57 | ||||
-rw-r--r-- | src/mbgl/style/style.cpp | 41 | ||||
-rw-r--r-- | src/mbgl/style/style.hpp | 8 |
14 files changed, 536 insertions, 741 deletions
diff --git a/src/mbgl/style/class_dictionary.cpp b/src/mbgl/style/class_dictionary.cpp deleted file mode 100644 index 4474b28520..0000000000 --- a/src/mbgl/style/class_dictionary.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include <mbgl/style/class_dictionary.hpp> - -#include <pthread.h> - -namespace mbgl { -namespace style { - -ClassDictionary::ClassDictionary() = default; - -ClassDictionary &ClassDictionary::Get() { - static pthread_once_t store_once = PTHREAD_ONCE_INIT; - static pthread_key_t store_key; - - // Create the key. - pthread_once(&store_once, []() { - pthread_key_create(&store_key, [](void *ptr) { - delete reinterpret_cast<ClassDictionary *>(ptr); - }); - }); - - auto *ptr = reinterpret_cast<ClassDictionary *>(pthread_getspecific(store_key)); - if (ptr == nullptr) { - ptr = new ClassDictionary(); - pthread_setspecific(store_key, ptr); - } - - return *ptr; -} - -ClassID ClassDictionary::lookup(const std::string &class_name) { - auto it = store.find(class_name); - if (it == store.end()) { - // Insert the class name into the store. - auto id = ClassID(uint32_t(ClassID::Named) + offset++); - store.emplace(class_name, id); - return id; - } else { - return it->second; - } -} - -ClassID ClassDictionary::normalize(ClassID id) { - if (id >= ClassID::Named) { - return ClassID::Named; - } else { - return id; - } -} - -} // namespace style -} // namespace mbgl diff --git a/src/mbgl/style/class_dictionary.hpp b/src/mbgl/style/class_dictionary.hpp deleted file mode 100644 index 37eb488240..0000000000 --- a/src/mbgl/style/class_dictionary.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include <cstdint> -#include <string> -#include <unordered_map> -#include <functional> - -namespace mbgl { -namespace style { - -enum class ClassID : uint32_t { - Default = 1, // These values are from the default style for a layer - Named = 2 // These values (and all subsequent IDs) are from a named style from the layer -}; - -class ClassDictionary { -private: - ClassDictionary(); - -public: - static ClassDictionary &Get(); - - // Returns an ID for a class name. If the class name does not yet have an ID, one is - // auto-generated and stored for future reference. - ClassID lookup(const std::string &class_name); - - // Returns either Fallback, Default or Named, depending on the type of the class id. - ClassID normalize(ClassID id); - -private: - std::unordered_map<std::string, ClassID> store = { { "", ClassID::Default } }; - uint32_t offset = 0; -}; - -} // namespace style -} // namespace mbgl - -namespace std { - -// Explicitly define std::hash<style::ClassID> because GCC doesn't automatically use std::hash<> of -// the underlying enum type. - -template <> -struct hash<mbgl::style::ClassID> { -public: - size_t operator()(const mbgl::style::ClassID id) const { - using T = std::underlying_type_t<mbgl::style::ClassID>; - return std::hash<T>()(static_cast<T>(id)); - } -}; - -} // namespace std diff --git a/src/mbgl/style/layers/background_layer.cpp b/src/mbgl/style/layers/background_layer.cpp index 6c9be96528..c4b22aa0e3 100644 --- a/src/mbgl/style/layers/background_layer.cpp +++ b/src/mbgl/style/layers/background_layer.cpp @@ -70,81 +70,81 @@ PropertyValue<Color> BackgroundLayer::getDefaultBackgroundColor() { return { Color::black() }; } -PropertyValue<Color> BackgroundLayer::getBackgroundColor(const optional<std::string>& klass) const { - return impl().paint.template get<BackgroundColor>().get(klass); +PropertyValue<Color> BackgroundLayer::getBackgroundColor() const { + return impl().paint.template get<BackgroundColor>().value; } -void BackgroundLayer::setBackgroundColor(PropertyValue<Color> value, const optional<std::string>& klass) { - if (value == getBackgroundColor(klass)) +void BackgroundLayer::setBackgroundColor(PropertyValue<Color> value) { + if (value == getBackgroundColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<BackgroundColor>().set(value, klass); + impl_->paint.template get<BackgroundColor>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void BackgroundLayer::setBackgroundColorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void BackgroundLayer::setBackgroundColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<BackgroundColor>().setTransition(value, klass); + impl_->paint.template get<BackgroundColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions BackgroundLayer::getBackgroundColorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<BackgroundColor>().getTransition(klass); +TransitionOptions BackgroundLayer::getBackgroundColorTransition() const { + return impl().paint.template get<BackgroundColor>().options; } PropertyValue<std::string> BackgroundLayer::getDefaultBackgroundPattern() { return { "" }; } -PropertyValue<std::string> BackgroundLayer::getBackgroundPattern(const optional<std::string>& klass) const { - return impl().paint.template get<BackgroundPattern>().get(klass); +PropertyValue<std::string> BackgroundLayer::getBackgroundPattern() const { + return impl().paint.template get<BackgroundPattern>().value; } -void BackgroundLayer::setBackgroundPattern(PropertyValue<std::string> value, const optional<std::string>& klass) { - if (value == getBackgroundPattern(klass)) +void BackgroundLayer::setBackgroundPattern(PropertyValue<std::string> value) { + if (value == getBackgroundPattern()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<BackgroundPattern>().set(value, klass); + impl_->paint.template get<BackgroundPattern>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void BackgroundLayer::setBackgroundPatternTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void BackgroundLayer::setBackgroundPatternTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<BackgroundPattern>().setTransition(value, klass); + impl_->paint.template get<BackgroundPattern>().options = options; baseImpl = std::move(impl_); } -TransitionOptions BackgroundLayer::getBackgroundPatternTransition(const optional<std::string>& klass) const { - return impl().paint.template get<BackgroundPattern>().getTransition(klass); +TransitionOptions BackgroundLayer::getBackgroundPatternTransition() const { + return impl().paint.template get<BackgroundPattern>().options; } PropertyValue<float> BackgroundLayer::getDefaultBackgroundOpacity() { return { 1 }; } -PropertyValue<float> BackgroundLayer::getBackgroundOpacity(const optional<std::string>& klass) const { - return impl().paint.template get<BackgroundOpacity>().get(klass); +PropertyValue<float> BackgroundLayer::getBackgroundOpacity() const { + return impl().paint.template get<BackgroundOpacity>().value; } -void BackgroundLayer::setBackgroundOpacity(PropertyValue<float> value, const optional<std::string>& klass) { - if (value == getBackgroundOpacity(klass)) +void BackgroundLayer::setBackgroundOpacity(PropertyValue<float> value) { + if (value == getBackgroundOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<BackgroundOpacity>().set(value, klass); + impl_->paint.template get<BackgroundOpacity>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void BackgroundLayer::setBackgroundOpacityTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void BackgroundLayer::setBackgroundOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<BackgroundOpacity>().setTransition(value, klass); + impl_->paint.template get<BackgroundOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions BackgroundLayer::getBackgroundOpacityTransition(const optional<std::string>& klass) const { - return impl().paint.template get<BackgroundOpacity>().getTransition(klass); +TransitionOptions BackgroundLayer::getBackgroundOpacityTransition() const { + return impl().paint.template get<BackgroundOpacity>().options; } } // namespace style diff --git a/src/mbgl/style/layers/circle_layer.cpp b/src/mbgl/style/layers/circle_layer.cpp index 1f64aa7ca6..e5c4c33497 100644 --- a/src/mbgl/style/layers/circle_layer.cpp +++ b/src/mbgl/style/layers/circle_layer.cpp @@ -98,15 +98,15 @@ DataDrivenPropertyValue<float> CircleLayer::getDefaultCircleRadius() { return { 5 }; } -DataDrivenPropertyValue<float> CircleLayer::getCircleRadius(const optional<std::string>& klass) const { - return impl().paint.template get<CircleRadius>().get(klass); +DataDrivenPropertyValue<float> CircleLayer::getCircleRadius() const { + return impl().paint.template get<CircleRadius>().value; } -void CircleLayer::setCircleRadius(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getCircleRadius(klass)) +void CircleLayer::setCircleRadius(DataDrivenPropertyValue<float> value) { + if (value == getCircleRadius()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleRadius>().set(value, klass); + impl_->paint.template get<CircleRadius>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -115,29 +115,29 @@ void CircleLayer::setCircleRadius(DataDrivenPropertyValue<float> value, const op } } -void CircleLayer::setCircleRadiusTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void CircleLayer::setCircleRadiusTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleRadius>().setTransition(value, klass); + impl_->paint.template get<CircleRadius>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleRadiusTransition(const optional<std::string>& klass) const { - return impl().paint.template get<CircleRadius>().getTransition(klass); +TransitionOptions CircleLayer::getCircleRadiusTransition() const { + return impl().paint.template get<CircleRadius>().options; } DataDrivenPropertyValue<Color> CircleLayer::getDefaultCircleColor() { return { Color::black() }; } -DataDrivenPropertyValue<Color> CircleLayer::getCircleColor(const optional<std::string>& klass) const { - return impl().paint.template get<CircleColor>().get(klass); +DataDrivenPropertyValue<Color> CircleLayer::getCircleColor() const { + return impl().paint.template get<CircleColor>().value; } -void CircleLayer::setCircleColor(DataDrivenPropertyValue<Color> value, const optional<std::string>& klass) { - if (value == getCircleColor(klass)) +void CircleLayer::setCircleColor(DataDrivenPropertyValue<Color> value) { + if (value == getCircleColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleColor>().set(value, klass); + impl_->paint.template get<CircleColor>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -146,29 +146,29 @@ void CircleLayer::setCircleColor(DataDrivenPropertyValue<Color> value, const opt } } -void CircleLayer::setCircleColorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void CircleLayer::setCircleColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleColor>().setTransition(value, klass); + impl_->paint.template get<CircleColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleColorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<CircleColor>().getTransition(klass); +TransitionOptions CircleLayer::getCircleColorTransition() const { + return impl().paint.template get<CircleColor>().options; } DataDrivenPropertyValue<float> CircleLayer::getDefaultCircleBlur() { return { 0 }; } -DataDrivenPropertyValue<float> CircleLayer::getCircleBlur(const optional<std::string>& klass) const { - return impl().paint.template get<CircleBlur>().get(klass); +DataDrivenPropertyValue<float> CircleLayer::getCircleBlur() const { + return impl().paint.template get<CircleBlur>().value; } -void CircleLayer::setCircleBlur(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getCircleBlur(klass)) +void CircleLayer::setCircleBlur(DataDrivenPropertyValue<float> value) { + if (value == getCircleBlur()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleBlur>().set(value, klass); + impl_->paint.template get<CircleBlur>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -177,29 +177,29 @@ void CircleLayer::setCircleBlur(DataDrivenPropertyValue<float> value, const opti } } -void CircleLayer::setCircleBlurTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void CircleLayer::setCircleBlurTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleBlur>().setTransition(value, klass); + impl_->paint.template get<CircleBlur>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleBlurTransition(const optional<std::string>& klass) const { - return impl().paint.template get<CircleBlur>().getTransition(klass); +TransitionOptions CircleLayer::getCircleBlurTransition() const { + return impl().paint.template get<CircleBlur>().options; } DataDrivenPropertyValue<float> CircleLayer::getDefaultCircleOpacity() { return { 1 }; } -DataDrivenPropertyValue<float> CircleLayer::getCircleOpacity(const optional<std::string>& klass) const { - return impl().paint.template get<CircleOpacity>().get(klass); +DataDrivenPropertyValue<float> CircleLayer::getCircleOpacity() const { + return impl().paint.template get<CircleOpacity>().value; } -void CircleLayer::setCircleOpacity(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getCircleOpacity(klass)) +void CircleLayer::setCircleOpacity(DataDrivenPropertyValue<float> value) { + if (value == getCircleOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleOpacity>().set(value, klass); + impl_->paint.template get<CircleOpacity>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -208,110 +208,110 @@ void CircleLayer::setCircleOpacity(DataDrivenPropertyValue<float> value, const o } } -void CircleLayer::setCircleOpacityTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void CircleLayer::setCircleOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleOpacity>().setTransition(value, klass); + impl_->paint.template get<CircleOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleOpacityTransition(const optional<std::string>& klass) const { - return impl().paint.template get<CircleOpacity>().getTransition(klass); +TransitionOptions CircleLayer::getCircleOpacityTransition() const { + return impl().paint.template get<CircleOpacity>().options; } PropertyValue<std::array<float, 2>> CircleLayer::getDefaultCircleTranslate() { return { {{ 0, 0 }} }; } -PropertyValue<std::array<float, 2>> CircleLayer::getCircleTranslate(const optional<std::string>& klass) const { - return impl().paint.template get<CircleTranslate>().get(klass); +PropertyValue<std::array<float, 2>> CircleLayer::getCircleTranslate() const { + return impl().paint.template get<CircleTranslate>().value; } -void CircleLayer::setCircleTranslate(PropertyValue<std::array<float, 2>> value, const optional<std::string>& klass) { - if (value == getCircleTranslate(klass)) +void CircleLayer::setCircleTranslate(PropertyValue<std::array<float, 2>> value) { + if (value == getCircleTranslate()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleTranslate>().set(value, klass); + impl_->paint.template get<CircleTranslate>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void CircleLayer::setCircleTranslateTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void CircleLayer::setCircleTranslateTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleTranslate>().setTransition(value, klass); + impl_->paint.template get<CircleTranslate>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleTranslateTransition(const optional<std::string>& klass) const { - return impl().paint.template get<CircleTranslate>().getTransition(klass); +TransitionOptions CircleLayer::getCircleTranslateTransition() const { + return impl().paint.template get<CircleTranslate>().options; } PropertyValue<TranslateAnchorType> CircleLayer::getDefaultCircleTranslateAnchor() { return { TranslateAnchorType::Map }; } -PropertyValue<TranslateAnchorType> CircleLayer::getCircleTranslateAnchor(const optional<std::string>& klass) const { - return impl().paint.template get<CircleTranslateAnchor>().get(klass); +PropertyValue<TranslateAnchorType> CircleLayer::getCircleTranslateAnchor() const { + return impl().paint.template get<CircleTranslateAnchor>().value; } -void CircleLayer::setCircleTranslateAnchor(PropertyValue<TranslateAnchorType> value, const optional<std::string>& klass) { - if (value == getCircleTranslateAnchor(klass)) +void CircleLayer::setCircleTranslateAnchor(PropertyValue<TranslateAnchorType> value) { + if (value == getCircleTranslateAnchor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleTranslateAnchor>().set(value, klass); + impl_->paint.template get<CircleTranslateAnchor>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void CircleLayer::setCircleTranslateAnchorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void CircleLayer::setCircleTranslateAnchorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleTranslateAnchor>().setTransition(value, klass); + impl_->paint.template get<CircleTranslateAnchor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleTranslateAnchorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<CircleTranslateAnchor>().getTransition(klass); +TransitionOptions CircleLayer::getCircleTranslateAnchorTransition() const { + return impl().paint.template get<CircleTranslateAnchor>().options; } PropertyValue<CirclePitchScaleType> CircleLayer::getDefaultCirclePitchScale() { return { CirclePitchScaleType::Map }; } -PropertyValue<CirclePitchScaleType> CircleLayer::getCirclePitchScale(const optional<std::string>& klass) const { - return impl().paint.template get<CirclePitchScale>().get(klass); +PropertyValue<CirclePitchScaleType> CircleLayer::getCirclePitchScale() const { + return impl().paint.template get<CirclePitchScale>().value; } -void CircleLayer::setCirclePitchScale(PropertyValue<CirclePitchScaleType> value, const optional<std::string>& klass) { - if (value == getCirclePitchScale(klass)) +void CircleLayer::setCirclePitchScale(PropertyValue<CirclePitchScaleType> value) { + if (value == getCirclePitchScale()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CirclePitchScale>().set(value, klass); + impl_->paint.template get<CirclePitchScale>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void CircleLayer::setCirclePitchScaleTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void CircleLayer::setCirclePitchScaleTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CirclePitchScale>().setTransition(value, klass); + impl_->paint.template get<CirclePitchScale>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCirclePitchScaleTransition(const optional<std::string>& klass) const { - return impl().paint.template get<CirclePitchScale>().getTransition(klass); +TransitionOptions CircleLayer::getCirclePitchScaleTransition() const { + return impl().paint.template get<CirclePitchScale>().options; } DataDrivenPropertyValue<float> CircleLayer::getDefaultCircleStrokeWidth() { return { 0 }; } -DataDrivenPropertyValue<float> CircleLayer::getCircleStrokeWidth(const optional<std::string>& klass) const { - return impl().paint.template get<CircleStrokeWidth>().get(klass); +DataDrivenPropertyValue<float> CircleLayer::getCircleStrokeWidth() const { + return impl().paint.template get<CircleStrokeWidth>().value; } -void CircleLayer::setCircleStrokeWidth(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getCircleStrokeWidth(klass)) +void CircleLayer::setCircleStrokeWidth(DataDrivenPropertyValue<float> value) { + if (value == getCircleStrokeWidth()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleStrokeWidth>().set(value, klass); + impl_->paint.template get<CircleStrokeWidth>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -320,29 +320,29 @@ void CircleLayer::setCircleStrokeWidth(DataDrivenPropertyValue<float> value, con } } -void CircleLayer::setCircleStrokeWidthTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void CircleLayer::setCircleStrokeWidthTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleStrokeWidth>().setTransition(value, klass); + impl_->paint.template get<CircleStrokeWidth>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleStrokeWidthTransition(const optional<std::string>& klass) const { - return impl().paint.template get<CircleStrokeWidth>().getTransition(klass); +TransitionOptions CircleLayer::getCircleStrokeWidthTransition() const { + return impl().paint.template get<CircleStrokeWidth>().options; } DataDrivenPropertyValue<Color> CircleLayer::getDefaultCircleStrokeColor() { return { Color::black() }; } -DataDrivenPropertyValue<Color> CircleLayer::getCircleStrokeColor(const optional<std::string>& klass) const { - return impl().paint.template get<CircleStrokeColor>().get(klass); +DataDrivenPropertyValue<Color> CircleLayer::getCircleStrokeColor() const { + return impl().paint.template get<CircleStrokeColor>().value; } -void CircleLayer::setCircleStrokeColor(DataDrivenPropertyValue<Color> value, const optional<std::string>& klass) { - if (value == getCircleStrokeColor(klass)) +void CircleLayer::setCircleStrokeColor(DataDrivenPropertyValue<Color> value) { + if (value == getCircleStrokeColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleStrokeColor>().set(value, klass); + impl_->paint.template get<CircleStrokeColor>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -351,29 +351,29 @@ void CircleLayer::setCircleStrokeColor(DataDrivenPropertyValue<Color> value, con } } -void CircleLayer::setCircleStrokeColorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void CircleLayer::setCircleStrokeColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleStrokeColor>().setTransition(value, klass); + impl_->paint.template get<CircleStrokeColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleStrokeColorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<CircleStrokeColor>().getTransition(klass); +TransitionOptions CircleLayer::getCircleStrokeColorTransition() const { + return impl().paint.template get<CircleStrokeColor>().options; } DataDrivenPropertyValue<float> CircleLayer::getDefaultCircleStrokeOpacity() { return { 1 }; } -DataDrivenPropertyValue<float> CircleLayer::getCircleStrokeOpacity(const optional<std::string>& klass) const { - return impl().paint.template get<CircleStrokeOpacity>().get(klass); +DataDrivenPropertyValue<float> CircleLayer::getCircleStrokeOpacity() const { + return impl().paint.template get<CircleStrokeOpacity>().value; } -void CircleLayer::setCircleStrokeOpacity(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getCircleStrokeOpacity(klass)) +void CircleLayer::setCircleStrokeOpacity(DataDrivenPropertyValue<float> value) { + if (value == getCircleStrokeOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<CircleStrokeOpacity>().set(value, klass); + impl_->paint.template get<CircleStrokeOpacity>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -382,14 +382,14 @@ void CircleLayer::setCircleStrokeOpacity(DataDrivenPropertyValue<float> value, c } } -void CircleLayer::setCircleStrokeOpacityTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void CircleLayer::setCircleStrokeOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<CircleStrokeOpacity>().setTransition(value, klass); + impl_->paint.template get<CircleStrokeOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions CircleLayer::getCircleStrokeOpacityTransition(const optional<std::string>& klass) const { - return impl().paint.template get<CircleStrokeOpacity>().getTransition(klass); +TransitionOptions CircleLayer::getCircleStrokeOpacityTransition() const { + return impl().paint.template get<CircleStrokeOpacity>().options; } } // namespace style diff --git a/src/mbgl/style/layers/fill_extrusion_layer.cpp b/src/mbgl/style/layers/fill_extrusion_layer.cpp index 37ae79850b..4a5dc592e6 100644 --- a/src/mbgl/style/layers/fill_extrusion_layer.cpp +++ b/src/mbgl/style/layers/fill_extrusion_layer.cpp @@ -98,42 +98,42 @@ PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionOpacity() { return { 1 }; } -PropertyValue<float> FillExtrusionLayer::getFillExtrusionOpacity(const optional<std::string>& klass) const { - return impl().paint.template get<FillExtrusionOpacity>().get(klass); +PropertyValue<float> FillExtrusionLayer::getFillExtrusionOpacity() const { + return impl().paint.template get<FillExtrusionOpacity>().value; } -void FillExtrusionLayer::setFillExtrusionOpacity(PropertyValue<float> value, const optional<std::string>& klass) { - if (value == getFillExtrusionOpacity(klass)) +void FillExtrusionLayer::setFillExtrusionOpacity(PropertyValue<float> value) { + if (value == getFillExtrusionOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionOpacity>().set(value, klass); + impl_->paint.template get<FillExtrusionOpacity>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void FillExtrusionLayer::setFillExtrusionOpacityTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void FillExtrusionLayer::setFillExtrusionOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionOpacity>().setTransition(value, klass); + impl_->paint.template get<FillExtrusionOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillExtrusionLayer::getFillExtrusionOpacityTransition(const optional<std::string>& klass) const { - return impl().paint.template get<FillExtrusionOpacity>().getTransition(klass); +TransitionOptions FillExtrusionLayer::getFillExtrusionOpacityTransition() const { + return impl().paint.template get<FillExtrusionOpacity>().options; } DataDrivenPropertyValue<Color> FillExtrusionLayer::getDefaultFillExtrusionColor() { return { Color::black() }; } -DataDrivenPropertyValue<Color> FillExtrusionLayer::getFillExtrusionColor(const optional<std::string>& klass) const { - return impl().paint.template get<FillExtrusionColor>().get(klass); +DataDrivenPropertyValue<Color> FillExtrusionLayer::getFillExtrusionColor() const { + return impl().paint.template get<FillExtrusionColor>().value; } -void FillExtrusionLayer::setFillExtrusionColor(DataDrivenPropertyValue<Color> value, const optional<std::string>& klass) { - if (value == getFillExtrusionColor(klass)) +void FillExtrusionLayer::setFillExtrusionColor(DataDrivenPropertyValue<Color> value) { + if (value == getFillExtrusionColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionColor>().set(value, klass); + impl_->paint.template get<FillExtrusionColor>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -142,110 +142,110 @@ void FillExtrusionLayer::setFillExtrusionColor(DataDrivenPropertyValue<Color> va } } -void FillExtrusionLayer::setFillExtrusionColorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void FillExtrusionLayer::setFillExtrusionColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionColor>().setTransition(value, klass); + impl_->paint.template get<FillExtrusionColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillExtrusionLayer::getFillExtrusionColorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<FillExtrusionColor>().getTransition(klass); +TransitionOptions FillExtrusionLayer::getFillExtrusionColorTransition() const { + return impl().paint.template get<FillExtrusionColor>().options; } PropertyValue<std::array<float, 2>> FillExtrusionLayer::getDefaultFillExtrusionTranslate() { return { {{ 0, 0 }} }; } -PropertyValue<std::array<float, 2>> FillExtrusionLayer::getFillExtrusionTranslate(const optional<std::string>& klass) const { - return impl().paint.template get<FillExtrusionTranslate>().get(klass); +PropertyValue<std::array<float, 2>> FillExtrusionLayer::getFillExtrusionTranslate() const { + return impl().paint.template get<FillExtrusionTranslate>().value; } -void FillExtrusionLayer::setFillExtrusionTranslate(PropertyValue<std::array<float, 2>> value, const optional<std::string>& klass) { - if (value == getFillExtrusionTranslate(klass)) +void FillExtrusionLayer::setFillExtrusionTranslate(PropertyValue<std::array<float, 2>> value) { + if (value == getFillExtrusionTranslate()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionTranslate>().set(value, klass); + impl_->paint.template get<FillExtrusionTranslate>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void FillExtrusionLayer::setFillExtrusionTranslateTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void FillExtrusionLayer::setFillExtrusionTranslateTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionTranslate>().setTransition(value, klass); + impl_->paint.template get<FillExtrusionTranslate>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillExtrusionLayer::getFillExtrusionTranslateTransition(const optional<std::string>& klass) const { - return impl().paint.template get<FillExtrusionTranslate>().getTransition(klass); +TransitionOptions FillExtrusionLayer::getFillExtrusionTranslateTransition() const { + return impl().paint.template get<FillExtrusionTranslate>().options; } PropertyValue<TranslateAnchorType> FillExtrusionLayer::getDefaultFillExtrusionTranslateAnchor() { return { TranslateAnchorType::Map }; } -PropertyValue<TranslateAnchorType> FillExtrusionLayer::getFillExtrusionTranslateAnchor(const optional<std::string>& klass) const { - return impl().paint.template get<FillExtrusionTranslateAnchor>().get(klass); +PropertyValue<TranslateAnchorType> FillExtrusionLayer::getFillExtrusionTranslateAnchor() const { + return impl().paint.template get<FillExtrusionTranslateAnchor>().value; } -void FillExtrusionLayer::setFillExtrusionTranslateAnchor(PropertyValue<TranslateAnchorType> value, const optional<std::string>& klass) { - if (value == getFillExtrusionTranslateAnchor(klass)) +void FillExtrusionLayer::setFillExtrusionTranslateAnchor(PropertyValue<TranslateAnchorType> value) { + if (value == getFillExtrusionTranslateAnchor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionTranslateAnchor>().set(value, klass); + impl_->paint.template get<FillExtrusionTranslateAnchor>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void FillExtrusionLayer::setFillExtrusionTranslateAnchorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void FillExtrusionLayer::setFillExtrusionTranslateAnchorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionTranslateAnchor>().setTransition(value, klass); + impl_->paint.template get<FillExtrusionTranslateAnchor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillExtrusionLayer::getFillExtrusionTranslateAnchorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<FillExtrusionTranslateAnchor>().getTransition(klass); +TransitionOptions FillExtrusionLayer::getFillExtrusionTranslateAnchorTransition() const { + return impl().paint.template get<FillExtrusionTranslateAnchor>().options; } PropertyValue<std::string> FillExtrusionLayer::getDefaultFillExtrusionPattern() { return { "" }; } -PropertyValue<std::string> FillExtrusionLayer::getFillExtrusionPattern(const optional<std::string>& klass) const { - return impl().paint.template get<FillExtrusionPattern>().get(klass); +PropertyValue<std::string> FillExtrusionLayer::getFillExtrusionPattern() const { + return impl().paint.template get<FillExtrusionPattern>().value; } -void FillExtrusionLayer::setFillExtrusionPattern(PropertyValue<std::string> value, const optional<std::string>& klass) { - if (value == getFillExtrusionPattern(klass)) +void FillExtrusionLayer::setFillExtrusionPattern(PropertyValue<std::string> value) { + if (value == getFillExtrusionPattern()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionPattern>().set(value, klass); + impl_->paint.template get<FillExtrusionPattern>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void FillExtrusionLayer::setFillExtrusionPatternTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void FillExtrusionLayer::setFillExtrusionPatternTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionPattern>().setTransition(value, klass); + impl_->paint.template get<FillExtrusionPattern>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillExtrusionLayer::getFillExtrusionPatternTransition(const optional<std::string>& klass) const { - return impl().paint.template get<FillExtrusionPattern>().getTransition(klass); +TransitionOptions FillExtrusionLayer::getFillExtrusionPatternTransition() const { + return impl().paint.template get<FillExtrusionPattern>().options; } DataDrivenPropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionHeight() { return { 0 }; } -DataDrivenPropertyValue<float> FillExtrusionLayer::getFillExtrusionHeight(const optional<std::string>& klass) const { - return impl().paint.template get<FillExtrusionHeight>().get(klass); +DataDrivenPropertyValue<float> FillExtrusionLayer::getFillExtrusionHeight() const { + return impl().paint.template get<FillExtrusionHeight>().value; } -void FillExtrusionLayer::setFillExtrusionHeight(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getFillExtrusionHeight(klass)) +void FillExtrusionLayer::setFillExtrusionHeight(DataDrivenPropertyValue<float> value) { + if (value == getFillExtrusionHeight()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionHeight>().set(value, klass); + impl_->paint.template get<FillExtrusionHeight>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -254,29 +254,29 @@ void FillExtrusionLayer::setFillExtrusionHeight(DataDrivenPropertyValue<float> v } } -void FillExtrusionLayer::setFillExtrusionHeightTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void FillExtrusionLayer::setFillExtrusionHeightTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionHeight>().setTransition(value, klass); + impl_->paint.template get<FillExtrusionHeight>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillExtrusionLayer::getFillExtrusionHeightTransition(const optional<std::string>& klass) const { - return impl().paint.template get<FillExtrusionHeight>().getTransition(klass); +TransitionOptions FillExtrusionLayer::getFillExtrusionHeightTransition() const { + return impl().paint.template get<FillExtrusionHeight>().options; } DataDrivenPropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionBase() { return { 0 }; } -DataDrivenPropertyValue<float> FillExtrusionLayer::getFillExtrusionBase(const optional<std::string>& klass) const { - return impl().paint.template get<FillExtrusionBase>().get(klass); +DataDrivenPropertyValue<float> FillExtrusionLayer::getFillExtrusionBase() const { + return impl().paint.template get<FillExtrusionBase>().value; } -void FillExtrusionLayer::setFillExtrusionBase(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getFillExtrusionBase(klass)) +void FillExtrusionLayer::setFillExtrusionBase(DataDrivenPropertyValue<float> value) { + if (value == getFillExtrusionBase()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionBase>().set(value, klass); + impl_->paint.template get<FillExtrusionBase>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -285,14 +285,14 @@ void FillExtrusionLayer::setFillExtrusionBase(DataDrivenPropertyValue<float> val } } -void FillExtrusionLayer::setFillExtrusionBaseTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void FillExtrusionLayer::setFillExtrusionBaseTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillExtrusionBase>().setTransition(value, klass); + impl_->paint.template get<FillExtrusionBase>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillExtrusionLayer::getFillExtrusionBaseTransition(const optional<std::string>& klass) const { - return impl().paint.template get<FillExtrusionBase>().getTransition(klass); +TransitionOptions FillExtrusionLayer::getFillExtrusionBaseTransition() const { + return impl().paint.template get<FillExtrusionBase>().options; } } // namespace style diff --git a/src/mbgl/style/layers/fill_layer.cpp b/src/mbgl/style/layers/fill_layer.cpp index 5e3df1d54d..b98c325451 100644 --- a/src/mbgl/style/layers/fill_layer.cpp +++ b/src/mbgl/style/layers/fill_layer.cpp @@ -98,42 +98,42 @@ PropertyValue<bool> FillLayer::getDefaultFillAntialias() { return { true }; } -PropertyValue<bool> FillLayer::getFillAntialias(const optional<std::string>& klass) const { - return impl().paint.template get<FillAntialias>().get(klass); +PropertyValue<bool> FillLayer::getFillAntialias() const { + return impl().paint.template get<FillAntialias>().value; } -void FillLayer::setFillAntialias(PropertyValue<bool> value, const optional<std::string>& klass) { - if (value == getFillAntialias(klass)) +void FillLayer::setFillAntialias(PropertyValue<bool> value) { + if (value == getFillAntialias()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillAntialias>().set(value, klass); + impl_->paint.template get<FillAntialias>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void FillLayer::setFillAntialiasTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void FillLayer::setFillAntialiasTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillAntialias>().setTransition(value, klass); + impl_->paint.template get<FillAntialias>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillLayer::getFillAntialiasTransition(const optional<std::string>& klass) const { - return impl().paint.template get<FillAntialias>().getTransition(klass); +TransitionOptions FillLayer::getFillAntialiasTransition() const { + return impl().paint.template get<FillAntialias>().options; } DataDrivenPropertyValue<float> FillLayer::getDefaultFillOpacity() { return { 1 }; } -DataDrivenPropertyValue<float> FillLayer::getFillOpacity(const optional<std::string>& klass) const { - return impl().paint.template get<FillOpacity>().get(klass); +DataDrivenPropertyValue<float> FillLayer::getFillOpacity() const { + return impl().paint.template get<FillOpacity>().value; } -void FillLayer::setFillOpacity(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getFillOpacity(klass)) +void FillLayer::setFillOpacity(DataDrivenPropertyValue<float> value) { + if (value == getFillOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillOpacity>().set(value, klass); + impl_->paint.template get<FillOpacity>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -142,29 +142,29 @@ void FillLayer::setFillOpacity(DataDrivenPropertyValue<float> value, const optio } } -void FillLayer::setFillOpacityTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void FillLayer::setFillOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillOpacity>().setTransition(value, klass); + impl_->paint.template get<FillOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillLayer::getFillOpacityTransition(const optional<std::string>& klass) const { - return impl().paint.template get<FillOpacity>().getTransition(klass); +TransitionOptions FillLayer::getFillOpacityTransition() const { + return impl().paint.template get<FillOpacity>().options; } DataDrivenPropertyValue<Color> FillLayer::getDefaultFillColor() { return { Color::black() }; } -DataDrivenPropertyValue<Color> FillLayer::getFillColor(const optional<std::string>& klass) const { - return impl().paint.template get<FillColor>().get(klass); +DataDrivenPropertyValue<Color> FillLayer::getFillColor() const { + return impl().paint.template get<FillColor>().value; } -void FillLayer::setFillColor(DataDrivenPropertyValue<Color> value, const optional<std::string>& klass) { - if (value == getFillColor(klass)) +void FillLayer::setFillColor(DataDrivenPropertyValue<Color> value) { + if (value == getFillColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillColor>().set(value, klass); + impl_->paint.template get<FillColor>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -173,29 +173,29 @@ void FillLayer::setFillColor(DataDrivenPropertyValue<Color> value, const optiona } } -void FillLayer::setFillColorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void FillLayer::setFillColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillColor>().setTransition(value, klass); + impl_->paint.template get<FillColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillLayer::getFillColorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<FillColor>().getTransition(klass); +TransitionOptions FillLayer::getFillColorTransition() const { + return impl().paint.template get<FillColor>().options; } DataDrivenPropertyValue<Color> FillLayer::getDefaultFillOutlineColor() { return { {} }; } -DataDrivenPropertyValue<Color> FillLayer::getFillOutlineColor(const optional<std::string>& klass) const { - return impl().paint.template get<FillOutlineColor>().get(klass); +DataDrivenPropertyValue<Color> FillLayer::getFillOutlineColor() const { + return impl().paint.template get<FillOutlineColor>().value; } -void FillLayer::setFillOutlineColor(DataDrivenPropertyValue<Color> value, const optional<std::string>& klass) { - if (value == getFillOutlineColor(klass)) +void FillLayer::setFillOutlineColor(DataDrivenPropertyValue<Color> value) { + if (value == getFillOutlineColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillOutlineColor>().set(value, klass); + impl_->paint.template get<FillOutlineColor>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -204,95 +204,95 @@ void FillLayer::setFillOutlineColor(DataDrivenPropertyValue<Color> value, const } } -void FillLayer::setFillOutlineColorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void FillLayer::setFillOutlineColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillOutlineColor>().setTransition(value, klass); + impl_->paint.template get<FillOutlineColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillLayer::getFillOutlineColorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<FillOutlineColor>().getTransition(klass); +TransitionOptions FillLayer::getFillOutlineColorTransition() const { + return impl().paint.template get<FillOutlineColor>().options; } PropertyValue<std::array<float, 2>> FillLayer::getDefaultFillTranslate() { return { {{ 0, 0 }} }; } -PropertyValue<std::array<float, 2>> FillLayer::getFillTranslate(const optional<std::string>& klass) const { - return impl().paint.template get<FillTranslate>().get(klass); +PropertyValue<std::array<float, 2>> FillLayer::getFillTranslate() const { + return impl().paint.template get<FillTranslate>().value; } -void FillLayer::setFillTranslate(PropertyValue<std::array<float, 2>> value, const optional<std::string>& klass) { - if (value == getFillTranslate(klass)) +void FillLayer::setFillTranslate(PropertyValue<std::array<float, 2>> value) { + if (value == getFillTranslate()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillTranslate>().set(value, klass); + impl_->paint.template get<FillTranslate>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void FillLayer::setFillTranslateTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void FillLayer::setFillTranslateTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillTranslate>().setTransition(value, klass); + impl_->paint.template get<FillTranslate>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillLayer::getFillTranslateTransition(const optional<std::string>& klass) const { - return impl().paint.template get<FillTranslate>().getTransition(klass); +TransitionOptions FillLayer::getFillTranslateTransition() const { + return impl().paint.template get<FillTranslate>().options; } PropertyValue<TranslateAnchorType> FillLayer::getDefaultFillTranslateAnchor() { return { TranslateAnchorType::Map }; } -PropertyValue<TranslateAnchorType> FillLayer::getFillTranslateAnchor(const optional<std::string>& klass) const { - return impl().paint.template get<FillTranslateAnchor>().get(klass); +PropertyValue<TranslateAnchorType> FillLayer::getFillTranslateAnchor() const { + return impl().paint.template get<FillTranslateAnchor>().value; } -void FillLayer::setFillTranslateAnchor(PropertyValue<TranslateAnchorType> value, const optional<std::string>& klass) { - if (value == getFillTranslateAnchor(klass)) +void FillLayer::setFillTranslateAnchor(PropertyValue<TranslateAnchorType> value) { + if (value == getFillTranslateAnchor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillTranslateAnchor>().set(value, klass); + impl_->paint.template get<FillTranslateAnchor>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void FillLayer::setFillTranslateAnchorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void FillLayer::setFillTranslateAnchorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillTranslateAnchor>().setTransition(value, klass); + impl_->paint.template get<FillTranslateAnchor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillLayer::getFillTranslateAnchorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<FillTranslateAnchor>().getTransition(klass); +TransitionOptions FillLayer::getFillTranslateAnchorTransition() const { + return impl().paint.template get<FillTranslateAnchor>().options; } PropertyValue<std::string> FillLayer::getDefaultFillPattern() { return { "" }; } -PropertyValue<std::string> FillLayer::getFillPattern(const optional<std::string>& klass) const { - return impl().paint.template get<FillPattern>().get(klass); +PropertyValue<std::string> FillLayer::getFillPattern() const { + return impl().paint.template get<FillPattern>().value; } -void FillLayer::setFillPattern(PropertyValue<std::string> value, const optional<std::string>& klass) { - if (value == getFillPattern(klass)) +void FillLayer::setFillPattern(PropertyValue<std::string> value) { + if (value == getFillPattern()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<FillPattern>().set(value, klass); + impl_->paint.template get<FillPattern>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void FillLayer::setFillPatternTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void FillLayer::setFillPatternTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<FillPattern>().setTransition(value, klass); + impl_->paint.template get<FillPattern>().options = options; baseImpl = std::move(impl_); } -TransitionOptions FillLayer::getFillPatternTransition(const optional<std::string>& klass) const { - return impl().paint.template get<FillPattern>().getTransition(klass); +TransitionOptions FillLayer::getFillPatternTransition() const { + return impl().paint.template get<FillPattern>().options; } } // namespace style diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs index 4f747792cf..b9c3e64cb4 100644 --- a/src/mbgl/style/layers/layer.cpp.ejs +++ b/src/mbgl/style/layers/layer.cpp.ejs @@ -137,15 +137,15 @@ void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(<%- propertyV return { <%- defaultValue(property) %> }; } -<%- propertyValueType(property) %> <%- camelize(type) %>Layer::get<%- camelize(property.name) %>(const optional<std::string>& klass) const { - return impl().paint.template get<<%- camelize(property.name) %>>().get(klass); +<%- propertyValueType(property) %> <%- camelize(type) %>Layer::get<%- camelize(property.name) %>() const { + return impl().paint.template get<<%- camelize(property.name) %>>().value; } -void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(<%- propertyValueType(property) %> value, const optional<std::string>& klass) { - if (value == get<%- camelize(property.name) %>(klass)) +void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(<%- propertyValueType(property) %> value) { + if (value == get<%- camelize(property.name) %>()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<<%- camelize(property.name) %>>().set(value, klass); + impl_->paint.template get<<%- camelize(property.name) %>>().value = value; baseImpl = std::move(impl_); <% if (isDataDriven(property)) { -%> if (value.isDataDriven()) { @@ -158,14 +158,14 @@ void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(<%- propertyV <% } -%> } -void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>Transition(const TransitionOptions& value, const optional<std::string>& klass) { +void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>Transition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<<%- camelize(property.name) %>>().setTransition(value, klass); + impl_->paint.template get<<%- camelize(property.name) %>>().options = options; baseImpl = std::move(impl_); } -TransitionOptions <%- camelize(type) %>Layer::get<%- camelize(property.name) %>Transition(const optional<std::string>& klass) const { - return impl().paint.template get<<%- camelize(property.name) %>>().getTransition(klass); +TransitionOptions <%- camelize(type) %>Layer::get<%- camelize(property.name) %>Transition() const { + return impl().paint.template get<<%- camelize(property.name) %>>().options; } <% } -%> diff --git a/src/mbgl/style/layers/line_layer.cpp b/src/mbgl/style/layers/line_layer.cpp index 286289b28e..96f1fa4d11 100644 --- a/src/mbgl/style/layers/line_layer.cpp +++ b/src/mbgl/style/layers/line_layer.cpp @@ -163,15 +163,15 @@ DataDrivenPropertyValue<float> LineLayer::getDefaultLineOpacity() { return { 1 }; } -DataDrivenPropertyValue<float> LineLayer::getLineOpacity(const optional<std::string>& klass) const { - return impl().paint.template get<LineOpacity>().get(klass); +DataDrivenPropertyValue<float> LineLayer::getLineOpacity() const { + return impl().paint.template get<LineOpacity>().value; } -void LineLayer::setLineOpacity(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getLineOpacity(klass)) +void LineLayer::setLineOpacity(DataDrivenPropertyValue<float> value) { + if (value == getLineOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineOpacity>().set(value, klass); + impl_->paint.template get<LineOpacity>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -180,29 +180,29 @@ void LineLayer::setLineOpacity(DataDrivenPropertyValue<float> value, const optio } } -void LineLayer::setLineOpacityTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void LineLayer::setLineOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineOpacity>().setTransition(value, klass); + impl_->paint.template get<LineOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineOpacityTransition(const optional<std::string>& klass) const { - return impl().paint.template get<LineOpacity>().getTransition(klass); +TransitionOptions LineLayer::getLineOpacityTransition() const { + return impl().paint.template get<LineOpacity>().options; } DataDrivenPropertyValue<Color> LineLayer::getDefaultLineColor() { return { Color::black() }; } -DataDrivenPropertyValue<Color> LineLayer::getLineColor(const optional<std::string>& klass) const { - return impl().paint.template get<LineColor>().get(klass); +DataDrivenPropertyValue<Color> LineLayer::getLineColor() const { + return impl().paint.template get<LineColor>().value; } -void LineLayer::setLineColor(DataDrivenPropertyValue<Color> value, const optional<std::string>& klass) { - if (value == getLineColor(klass)) +void LineLayer::setLineColor(DataDrivenPropertyValue<Color> value) { + if (value == getLineColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineColor>().set(value, klass); + impl_->paint.template get<LineColor>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -211,110 +211,110 @@ void LineLayer::setLineColor(DataDrivenPropertyValue<Color> value, const optiona } } -void LineLayer::setLineColorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void LineLayer::setLineColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineColor>().setTransition(value, klass); + impl_->paint.template get<LineColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineColorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<LineColor>().getTransition(klass); +TransitionOptions LineLayer::getLineColorTransition() const { + return impl().paint.template get<LineColor>().options; } PropertyValue<std::array<float, 2>> LineLayer::getDefaultLineTranslate() { return { {{ 0, 0 }} }; } -PropertyValue<std::array<float, 2>> LineLayer::getLineTranslate(const optional<std::string>& klass) const { - return impl().paint.template get<LineTranslate>().get(klass); +PropertyValue<std::array<float, 2>> LineLayer::getLineTranslate() const { + return impl().paint.template get<LineTranslate>().value; } -void LineLayer::setLineTranslate(PropertyValue<std::array<float, 2>> value, const optional<std::string>& klass) { - if (value == getLineTranslate(klass)) +void LineLayer::setLineTranslate(PropertyValue<std::array<float, 2>> value) { + if (value == getLineTranslate()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineTranslate>().set(value, klass); + impl_->paint.template get<LineTranslate>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void LineLayer::setLineTranslateTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void LineLayer::setLineTranslateTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineTranslate>().setTransition(value, klass); + impl_->paint.template get<LineTranslate>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineTranslateTransition(const optional<std::string>& klass) const { - return impl().paint.template get<LineTranslate>().getTransition(klass); +TransitionOptions LineLayer::getLineTranslateTransition() const { + return impl().paint.template get<LineTranslate>().options; } PropertyValue<TranslateAnchorType> LineLayer::getDefaultLineTranslateAnchor() { return { TranslateAnchorType::Map }; } -PropertyValue<TranslateAnchorType> LineLayer::getLineTranslateAnchor(const optional<std::string>& klass) const { - return impl().paint.template get<LineTranslateAnchor>().get(klass); +PropertyValue<TranslateAnchorType> LineLayer::getLineTranslateAnchor() const { + return impl().paint.template get<LineTranslateAnchor>().value; } -void LineLayer::setLineTranslateAnchor(PropertyValue<TranslateAnchorType> value, const optional<std::string>& klass) { - if (value == getLineTranslateAnchor(klass)) +void LineLayer::setLineTranslateAnchor(PropertyValue<TranslateAnchorType> value) { + if (value == getLineTranslateAnchor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineTranslateAnchor>().set(value, klass); + impl_->paint.template get<LineTranslateAnchor>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void LineLayer::setLineTranslateAnchorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void LineLayer::setLineTranslateAnchorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineTranslateAnchor>().setTransition(value, klass); + impl_->paint.template get<LineTranslateAnchor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineTranslateAnchorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<LineTranslateAnchor>().getTransition(klass); +TransitionOptions LineLayer::getLineTranslateAnchorTransition() const { + return impl().paint.template get<LineTranslateAnchor>().options; } PropertyValue<float> LineLayer::getDefaultLineWidth() { return { 1 }; } -PropertyValue<float> LineLayer::getLineWidth(const optional<std::string>& klass) const { - return impl().paint.template get<LineWidth>().get(klass); +PropertyValue<float> LineLayer::getLineWidth() const { + return impl().paint.template get<LineWidth>().value; } -void LineLayer::setLineWidth(PropertyValue<float> value, const optional<std::string>& klass) { - if (value == getLineWidth(klass)) +void LineLayer::setLineWidth(PropertyValue<float> value) { + if (value == getLineWidth()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineWidth>().set(value, klass); + impl_->paint.template get<LineWidth>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void LineLayer::setLineWidthTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void LineLayer::setLineWidthTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineWidth>().setTransition(value, klass); + impl_->paint.template get<LineWidth>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineWidthTransition(const optional<std::string>& klass) const { - return impl().paint.template get<LineWidth>().getTransition(klass); +TransitionOptions LineLayer::getLineWidthTransition() const { + return impl().paint.template get<LineWidth>().options; } DataDrivenPropertyValue<float> LineLayer::getDefaultLineGapWidth() { return { 0 }; } -DataDrivenPropertyValue<float> LineLayer::getLineGapWidth(const optional<std::string>& klass) const { - return impl().paint.template get<LineGapWidth>().get(klass); +DataDrivenPropertyValue<float> LineLayer::getLineGapWidth() const { + return impl().paint.template get<LineGapWidth>().value; } -void LineLayer::setLineGapWidth(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getLineGapWidth(klass)) +void LineLayer::setLineGapWidth(DataDrivenPropertyValue<float> value) { + if (value == getLineGapWidth()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineGapWidth>().set(value, klass); + impl_->paint.template get<LineGapWidth>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -323,29 +323,29 @@ void LineLayer::setLineGapWidth(DataDrivenPropertyValue<float> value, const opti } } -void LineLayer::setLineGapWidthTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void LineLayer::setLineGapWidthTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineGapWidth>().setTransition(value, klass); + impl_->paint.template get<LineGapWidth>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineGapWidthTransition(const optional<std::string>& klass) const { - return impl().paint.template get<LineGapWidth>().getTransition(klass); +TransitionOptions LineLayer::getLineGapWidthTransition() const { + return impl().paint.template get<LineGapWidth>().options; } DataDrivenPropertyValue<float> LineLayer::getDefaultLineOffset() { return { 0 }; } -DataDrivenPropertyValue<float> LineLayer::getLineOffset(const optional<std::string>& klass) const { - return impl().paint.template get<LineOffset>().get(klass); +DataDrivenPropertyValue<float> LineLayer::getLineOffset() const { + return impl().paint.template get<LineOffset>().value; } -void LineLayer::setLineOffset(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getLineOffset(klass)) +void LineLayer::setLineOffset(DataDrivenPropertyValue<float> value) { + if (value == getLineOffset()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineOffset>().set(value, klass); + impl_->paint.template get<LineOffset>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -354,29 +354,29 @@ void LineLayer::setLineOffset(DataDrivenPropertyValue<float> value, const option } } -void LineLayer::setLineOffsetTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void LineLayer::setLineOffsetTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineOffset>().setTransition(value, klass); + impl_->paint.template get<LineOffset>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineOffsetTransition(const optional<std::string>& klass) const { - return impl().paint.template get<LineOffset>().getTransition(klass); +TransitionOptions LineLayer::getLineOffsetTransition() const { + return impl().paint.template get<LineOffset>().options; } DataDrivenPropertyValue<float> LineLayer::getDefaultLineBlur() { return { 0 }; } -DataDrivenPropertyValue<float> LineLayer::getLineBlur(const optional<std::string>& klass) const { - return impl().paint.template get<LineBlur>().get(klass); +DataDrivenPropertyValue<float> LineLayer::getLineBlur() const { + return impl().paint.template get<LineBlur>().value; } -void LineLayer::setLineBlur(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getLineBlur(klass)) +void LineLayer::setLineBlur(DataDrivenPropertyValue<float> value) { + if (value == getLineBlur()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineBlur>().set(value, klass); + impl_->paint.template get<LineBlur>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -385,68 +385,68 @@ void LineLayer::setLineBlur(DataDrivenPropertyValue<float> value, const optional } } -void LineLayer::setLineBlurTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void LineLayer::setLineBlurTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineBlur>().setTransition(value, klass); + impl_->paint.template get<LineBlur>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineBlurTransition(const optional<std::string>& klass) const { - return impl().paint.template get<LineBlur>().getTransition(klass); +TransitionOptions LineLayer::getLineBlurTransition() const { + return impl().paint.template get<LineBlur>().options; } PropertyValue<std::vector<float>> LineLayer::getDefaultLineDasharray() { return { { } }; } -PropertyValue<std::vector<float>> LineLayer::getLineDasharray(const optional<std::string>& klass) const { - return impl().paint.template get<LineDasharray>().get(klass); +PropertyValue<std::vector<float>> LineLayer::getLineDasharray() const { + return impl().paint.template get<LineDasharray>().value; } -void LineLayer::setLineDasharray(PropertyValue<std::vector<float>> value, const optional<std::string>& klass) { - if (value == getLineDasharray(klass)) +void LineLayer::setLineDasharray(PropertyValue<std::vector<float>> value) { + if (value == getLineDasharray()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LineDasharray>().set(value, klass); + impl_->paint.template get<LineDasharray>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void LineLayer::setLineDasharrayTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void LineLayer::setLineDasharrayTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LineDasharray>().setTransition(value, klass); + impl_->paint.template get<LineDasharray>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLineDasharrayTransition(const optional<std::string>& klass) const { - return impl().paint.template get<LineDasharray>().getTransition(klass); +TransitionOptions LineLayer::getLineDasharrayTransition() const { + return impl().paint.template get<LineDasharray>().options; } PropertyValue<std::string> LineLayer::getDefaultLinePattern() { return { "" }; } -PropertyValue<std::string> LineLayer::getLinePattern(const optional<std::string>& klass) const { - return impl().paint.template get<LinePattern>().get(klass); +PropertyValue<std::string> LineLayer::getLinePattern() const { + return impl().paint.template get<LinePattern>().value; } -void LineLayer::setLinePattern(PropertyValue<std::string> value, const optional<std::string>& klass) { - if (value == getLinePattern(klass)) +void LineLayer::setLinePattern(PropertyValue<std::string> value) { + if (value == getLinePattern()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<LinePattern>().set(value, klass); + impl_->paint.template get<LinePattern>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void LineLayer::setLinePatternTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void LineLayer::setLinePatternTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<LinePattern>().setTransition(value, klass); + impl_->paint.template get<LinePattern>().options = options; baseImpl = std::move(impl_); } -TransitionOptions LineLayer::getLinePatternTransition(const optional<std::string>& klass) const { - return impl().paint.template get<LinePattern>().getTransition(klass); +TransitionOptions LineLayer::getLinePatternTransition() const { + return impl().paint.template get<LinePattern>().options; } } // namespace style diff --git a/src/mbgl/style/layers/raster_layer.cpp b/src/mbgl/style/layers/raster_layer.cpp index fc28672abd..a7a32768b6 100644 --- a/src/mbgl/style/layers/raster_layer.cpp +++ b/src/mbgl/style/layers/raster_layer.cpp @@ -76,189 +76,189 @@ PropertyValue<float> RasterLayer::getDefaultRasterOpacity() { return { 1 }; } -PropertyValue<float> RasterLayer::getRasterOpacity(const optional<std::string>& klass) const { - return impl().paint.template get<RasterOpacity>().get(klass); +PropertyValue<float> RasterLayer::getRasterOpacity() const { + return impl().paint.template get<RasterOpacity>().value; } -void RasterLayer::setRasterOpacity(PropertyValue<float> value, const optional<std::string>& klass) { - if (value == getRasterOpacity(klass)) +void RasterLayer::setRasterOpacity(PropertyValue<float> value) { + if (value == getRasterOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<RasterOpacity>().set(value, klass); + impl_->paint.template get<RasterOpacity>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void RasterLayer::setRasterOpacityTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void RasterLayer::setRasterOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<RasterOpacity>().setTransition(value, klass); + impl_->paint.template get<RasterOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions RasterLayer::getRasterOpacityTransition(const optional<std::string>& klass) const { - return impl().paint.template get<RasterOpacity>().getTransition(klass); +TransitionOptions RasterLayer::getRasterOpacityTransition() const { + return impl().paint.template get<RasterOpacity>().options; } PropertyValue<float> RasterLayer::getDefaultRasterHueRotate() { return { 0 }; } -PropertyValue<float> RasterLayer::getRasterHueRotate(const optional<std::string>& klass) const { - return impl().paint.template get<RasterHueRotate>().get(klass); +PropertyValue<float> RasterLayer::getRasterHueRotate() const { + return impl().paint.template get<RasterHueRotate>().value; } -void RasterLayer::setRasterHueRotate(PropertyValue<float> value, const optional<std::string>& klass) { - if (value == getRasterHueRotate(klass)) +void RasterLayer::setRasterHueRotate(PropertyValue<float> value) { + if (value == getRasterHueRotate()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<RasterHueRotate>().set(value, klass); + impl_->paint.template get<RasterHueRotate>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void RasterLayer::setRasterHueRotateTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void RasterLayer::setRasterHueRotateTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<RasterHueRotate>().setTransition(value, klass); + impl_->paint.template get<RasterHueRotate>().options = options; baseImpl = std::move(impl_); } -TransitionOptions RasterLayer::getRasterHueRotateTransition(const optional<std::string>& klass) const { - return impl().paint.template get<RasterHueRotate>().getTransition(klass); +TransitionOptions RasterLayer::getRasterHueRotateTransition() const { + return impl().paint.template get<RasterHueRotate>().options; } PropertyValue<float> RasterLayer::getDefaultRasterBrightnessMin() { return { 0 }; } -PropertyValue<float> RasterLayer::getRasterBrightnessMin(const optional<std::string>& klass) const { - return impl().paint.template get<RasterBrightnessMin>().get(klass); +PropertyValue<float> RasterLayer::getRasterBrightnessMin() const { + return impl().paint.template get<RasterBrightnessMin>().value; } -void RasterLayer::setRasterBrightnessMin(PropertyValue<float> value, const optional<std::string>& klass) { - if (value == getRasterBrightnessMin(klass)) +void RasterLayer::setRasterBrightnessMin(PropertyValue<float> value) { + if (value == getRasterBrightnessMin()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<RasterBrightnessMin>().set(value, klass); + impl_->paint.template get<RasterBrightnessMin>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void RasterLayer::setRasterBrightnessMinTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void RasterLayer::setRasterBrightnessMinTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<RasterBrightnessMin>().setTransition(value, klass); + impl_->paint.template get<RasterBrightnessMin>().options = options; baseImpl = std::move(impl_); } -TransitionOptions RasterLayer::getRasterBrightnessMinTransition(const optional<std::string>& klass) const { - return impl().paint.template get<RasterBrightnessMin>().getTransition(klass); +TransitionOptions RasterLayer::getRasterBrightnessMinTransition() const { + return impl().paint.template get<RasterBrightnessMin>().options; } PropertyValue<float> RasterLayer::getDefaultRasterBrightnessMax() { return { 1 }; } -PropertyValue<float> RasterLayer::getRasterBrightnessMax(const optional<std::string>& klass) const { - return impl().paint.template get<RasterBrightnessMax>().get(klass); +PropertyValue<float> RasterLayer::getRasterBrightnessMax() const { + return impl().paint.template get<RasterBrightnessMax>().value; } -void RasterLayer::setRasterBrightnessMax(PropertyValue<float> value, const optional<std::string>& klass) { - if (value == getRasterBrightnessMax(klass)) +void RasterLayer::setRasterBrightnessMax(PropertyValue<float> value) { + if (value == getRasterBrightnessMax()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<RasterBrightnessMax>().set(value, klass); + impl_->paint.template get<RasterBrightnessMax>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void RasterLayer::setRasterBrightnessMaxTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void RasterLayer::setRasterBrightnessMaxTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<RasterBrightnessMax>().setTransition(value, klass); + impl_->paint.template get<RasterBrightnessMax>().options = options; baseImpl = std::move(impl_); } -TransitionOptions RasterLayer::getRasterBrightnessMaxTransition(const optional<std::string>& klass) const { - return impl().paint.template get<RasterBrightnessMax>().getTransition(klass); +TransitionOptions RasterLayer::getRasterBrightnessMaxTransition() const { + return impl().paint.template get<RasterBrightnessMax>().options; } PropertyValue<float> RasterLayer::getDefaultRasterSaturation() { return { 0 }; } -PropertyValue<float> RasterLayer::getRasterSaturation(const optional<std::string>& klass) const { - return impl().paint.template get<RasterSaturation>().get(klass); +PropertyValue<float> RasterLayer::getRasterSaturation() const { + return impl().paint.template get<RasterSaturation>().value; } -void RasterLayer::setRasterSaturation(PropertyValue<float> value, const optional<std::string>& klass) { - if (value == getRasterSaturation(klass)) +void RasterLayer::setRasterSaturation(PropertyValue<float> value) { + if (value == getRasterSaturation()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<RasterSaturation>().set(value, klass); + impl_->paint.template get<RasterSaturation>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void RasterLayer::setRasterSaturationTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void RasterLayer::setRasterSaturationTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<RasterSaturation>().setTransition(value, klass); + impl_->paint.template get<RasterSaturation>().options = options; baseImpl = std::move(impl_); } -TransitionOptions RasterLayer::getRasterSaturationTransition(const optional<std::string>& klass) const { - return impl().paint.template get<RasterSaturation>().getTransition(klass); +TransitionOptions RasterLayer::getRasterSaturationTransition() const { + return impl().paint.template get<RasterSaturation>().options; } PropertyValue<float> RasterLayer::getDefaultRasterContrast() { return { 0 }; } -PropertyValue<float> RasterLayer::getRasterContrast(const optional<std::string>& klass) const { - return impl().paint.template get<RasterContrast>().get(klass); +PropertyValue<float> RasterLayer::getRasterContrast() const { + return impl().paint.template get<RasterContrast>().value; } -void RasterLayer::setRasterContrast(PropertyValue<float> value, const optional<std::string>& klass) { - if (value == getRasterContrast(klass)) +void RasterLayer::setRasterContrast(PropertyValue<float> value) { + if (value == getRasterContrast()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<RasterContrast>().set(value, klass); + impl_->paint.template get<RasterContrast>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void RasterLayer::setRasterContrastTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void RasterLayer::setRasterContrastTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<RasterContrast>().setTransition(value, klass); + impl_->paint.template get<RasterContrast>().options = options; baseImpl = std::move(impl_); } -TransitionOptions RasterLayer::getRasterContrastTransition(const optional<std::string>& klass) const { - return impl().paint.template get<RasterContrast>().getTransition(klass); +TransitionOptions RasterLayer::getRasterContrastTransition() const { + return impl().paint.template get<RasterContrast>().options; } PropertyValue<float> RasterLayer::getDefaultRasterFadeDuration() { return { 300 }; } -PropertyValue<float> RasterLayer::getRasterFadeDuration(const optional<std::string>& klass) const { - return impl().paint.template get<RasterFadeDuration>().get(klass); +PropertyValue<float> RasterLayer::getRasterFadeDuration() const { + return impl().paint.template get<RasterFadeDuration>().value; } -void RasterLayer::setRasterFadeDuration(PropertyValue<float> value, const optional<std::string>& klass) { - if (value == getRasterFadeDuration(klass)) +void RasterLayer::setRasterFadeDuration(PropertyValue<float> value) { + if (value == getRasterFadeDuration()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<RasterFadeDuration>().set(value, klass); + impl_->paint.template get<RasterFadeDuration>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void RasterLayer::setRasterFadeDurationTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void RasterLayer::setRasterFadeDurationTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<RasterFadeDuration>().setTransition(value, klass); + impl_->paint.template get<RasterFadeDuration>().options = options; baseImpl = std::move(impl_); } -TransitionOptions RasterLayer::getRasterFadeDurationTransition(const optional<std::string>& klass) const { - return impl().paint.template get<RasterFadeDuration>().getTransition(klass); +TransitionOptions RasterLayer::getRasterFadeDurationTransition() const { + return impl().paint.template get<RasterFadeDuration>().options; } } // namespace style diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp index d21014dda0..b2f9ca754f 100644 --- a/src/mbgl/style/layers/symbol_layer.cpp +++ b/src/mbgl/style/layers/symbol_layer.cpp @@ -643,15 +643,15 @@ DataDrivenPropertyValue<float> SymbolLayer::getDefaultIconOpacity() { return { 1 }; } -DataDrivenPropertyValue<float> SymbolLayer::getIconOpacity(const optional<std::string>& klass) const { - return impl().paint.template get<IconOpacity>().get(klass); +DataDrivenPropertyValue<float> SymbolLayer::getIconOpacity() const { + return impl().paint.template get<IconOpacity>().value; } -void SymbolLayer::setIconOpacity(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getIconOpacity(klass)) +void SymbolLayer::setIconOpacity(DataDrivenPropertyValue<float> value) { + if (value == getIconOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<IconOpacity>().set(value, klass); + impl_->paint.template get<IconOpacity>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -660,29 +660,29 @@ void SymbolLayer::setIconOpacity(DataDrivenPropertyValue<float> value, const opt } } -void SymbolLayer::setIconOpacityTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void SymbolLayer::setIconOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<IconOpacity>().setTransition(value, klass); + impl_->paint.template get<IconOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getIconOpacityTransition(const optional<std::string>& klass) const { - return impl().paint.template get<IconOpacity>().getTransition(klass); +TransitionOptions SymbolLayer::getIconOpacityTransition() const { + return impl().paint.template get<IconOpacity>().options; } DataDrivenPropertyValue<Color> SymbolLayer::getDefaultIconColor() { return { Color::black() }; } -DataDrivenPropertyValue<Color> SymbolLayer::getIconColor(const optional<std::string>& klass) const { - return impl().paint.template get<IconColor>().get(klass); +DataDrivenPropertyValue<Color> SymbolLayer::getIconColor() const { + return impl().paint.template get<IconColor>().value; } -void SymbolLayer::setIconColor(DataDrivenPropertyValue<Color> value, const optional<std::string>& klass) { - if (value == getIconColor(klass)) +void SymbolLayer::setIconColor(DataDrivenPropertyValue<Color> value) { + if (value == getIconColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<IconColor>().set(value, klass); + impl_->paint.template get<IconColor>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -691,29 +691,29 @@ void SymbolLayer::setIconColor(DataDrivenPropertyValue<Color> value, const optio } } -void SymbolLayer::setIconColorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void SymbolLayer::setIconColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<IconColor>().setTransition(value, klass); + impl_->paint.template get<IconColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getIconColorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<IconColor>().getTransition(klass); +TransitionOptions SymbolLayer::getIconColorTransition() const { + return impl().paint.template get<IconColor>().options; } DataDrivenPropertyValue<Color> SymbolLayer::getDefaultIconHaloColor() { return { {} }; } -DataDrivenPropertyValue<Color> SymbolLayer::getIconHaloColor(const optional<std::string>& klass) const { - return impl().paint.template get<IconHaloColor>().get(klass); +DataDrivenPropertyValue<Color> SymbolLayer::getIconHaloColor() const { + return impl().paint.template get<IconHaloColor>().value; } -void SymbolLayer::setIconHaloColor(DataDrivenPropertyValue<Color> value, const optional<std::string>& klass) { - if (value == getIconHaloColor(klass)) +void SymbolLayer::setIconHaloColor(DataDrivenPropertyValue<Color> value) { + if (value == getIconHaloColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<IconHaloColor>().set(value, klass); + impl_->paint.template get<IconHaloColor>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -722,29 +722,29 @@ void SymbolLayer::setIconHaloColor(DataDrivenPropertyValue<Color> value, const o } } -void SymbolLayer::setIconHaloColorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void SymbolLayer::setIconHaloColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<IconHaloColor>().setTransition(value, klass); + impl_->paint.template get<IconHaloColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getIconHaloColorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<IconHaloColor>().getTransition(klass); +TransitionOptions SymbolLayer::getIconHaloColorTransition() const { + return impl().paint.template get<IconHaloColor>().options; } DataDrivenPropertyValue<float> SymbolLayer::getDefaultIconHaloWidth() { return { 0 }; } -DataDrivenPropertyValue<float> SymbolLayer::getIconHaloWidth(const optional<std::string>& klass) const { - return impl().paint.template get<IconHaloWidth>().get(klass); +DataDrivenPropertyValue<float> SymbolLayer::getIconHaloWidth() const { + return impl().paint.template get<IconHaloWidth>().value; } -void SymbolLayer::setIconHaloWidth(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getIconHaloWidth(klass)) +void SymbolLayer::setIconHaloWidth(DataDrivenPropertyValue<float> value) { + if (value == getIconHaloWidth()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<IconHaloWidth>().set(value, klass); + impl_->paint.template get<IconHaloWidth>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -753,29 +753,29 @@ void SymbolLayer::setIconHaloWidth(DataDrivenPropertyValue<float> value, const o } } -void SymbolLayer::setIconHaloWidthTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void SymbolLayer::setIconHaloWidthTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<IconHaloWidth>().setTransition(value, klass); + impl_->paint.template get<IconHaloWidth>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getIconHaloWidthTransition(const optional<std::string>& klass) const { - return impl().paint.template get<IconHaloWidth>().getTransition(klass); +TransitionOptions SymbolLayer::getIconHaloWidthTransition() const { + return impl().paint.template get<IconHaloWidth>().options; } DataDrivenPropertyValue<float> SymbolLayer::getDefaultIconHaloBlur() { return { 0 }; } -DataDrivenPropertyValue<float> SymbolLayer::getIconHaloBlur(const optional<std::string>& klass) const { - return impl().paint.template get<IconHaloBlur>().get(klass); +DataDrivenPropertyValue<float> SymbolLayer::getIconHaloBlur() const { + return impl().paint.template get<IconHaloBlur>().value; } -void SymbolLayer::setIconHaloBlur(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getIconHaloBlur(klass)) +void SymbolLayer::setIconHaloBlur(DataDrivenPropertyValue<float> value) { + if (value == getIconHaloBlur()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<IconHaloBlur>().set(value, klass); + impl_->paint.template get<IconHaloBlur>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -784,83 +784,83 @@ void SymbolLayer::setIconHaloBlur(DataDrivenPropertyValue<float> value, const op } } -void SymbolLayer::setIconHaloBlurTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void SymbolLayer::setIconHaloBlurTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<IconHaloBlur>().setTransition(value, klass); + impl_->paint.template get<IconHaloBlur>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getIconHaloBlurTransition(const optional<std::string>& klass) const { - return impl().paint.template get<IconHaloBlur>().getTransition(klass); +TransitionOptions SymbolLayer::getIconHaloBlurTransition() const { + return impl().paint.template get<IconHaloBlur>().options; } PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultIconTranslate() { return { {{ 0, 0 }} }; } -PropertyValue<std::array<float, 2>> SymbolLayer::getIconTranslate(const optional<std::string>& klass) const { - return impl().paint.template get<IconTranslate>().get(klass); +PropertyValue<std::array<float, 2>> SymbolLayer::getIconTranslate() const { + return impl().paint.template get<IconTranslate>().value; } -void SymbolLayer::setIconTranslate(PropertyValue<std::array<float, 2>> value, const optional<std::string>& klass) { - if (value == getIconTranslate(klass)) +void SymbolLayer::setIconTranslate(PropertyValue<std::array<float, 2>> value) { + if (value == getIconTranslate()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<IconTranslate>().set(value, klass); + impl_->paint.template get<IconTranslate>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void SymbolLayer::setIconTranslateTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void SymbolLayer::setIconTranslateTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<IconTranslate>().setTransition(value, klass); + impl_->paint.template get<IconTranslate>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getIconTranslateTransition(const optional<std::string>& klass) const { - return impl().paint.template get<IconTranslate>().getTransition(klass); +TransitionOptions SymbolLayer::getIconTranslateTransition() const { + return impl().paint.template get<IconTranslate>().options; } PropertyValue<TranslateAnchorType> SymbolLayer::getDefaultIconTranslateAnchor() { return { TranslateAnchorType::Map }; } -PropertyValue<TranslateAnchorType> SymbolLayer::getIconTranslateAnchor(const optional<std::string>& klass) const { - return impl().paint.template get<IconTranslateAnchor>().get(klass); +PropertyValue<TranslateAnchorType> SymbolLayer::getIconTranslateAnchor() const { + return impl().paint.template get<IconTranslateAnchor>().value; } -void SymbolLayer::setIconTranslateAnchor(PropertyValue<TranslateAnchorType> value, const optional<std::string>& klass) { - if (value == getIconTranslateAnchor(klass)) +void SymbolLayer::setIconTranslateAnchor(PropertyValue<TranslateAnchorType> value) { + if (value == getIconTranslateAnchor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<IconTranslateAnchor>().set(value, klass); + impl_->paint.template get<IconTranslateAnchor>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void SymbolLayer::setIconTranslateAnchorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void SymbolLayer::setIconTranslateAnchorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<IconTranslateAnchor>().setTransition(value, klass); + impl_->paint.template get<IconTranslateAnchor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getIconTranslateAnchorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<IconTranslateAnchor>().getTransition(klass); +TransitionOptions SymbolLayer::getIconTranslateAnchorTransition() const { + return impl().paint.template get<IconTranslateAnchor>().options; } DataDrivenPropertyValue<float> SymbolLayer::getDefaultTextOpacity() { return { 1 }; } -DataDrivenPropertyValue<float> SymbolLayer::getTextOpacity(const optional<std::string>& klass) const { - return impl().paint.template get<TextOpacity>().get(klass); +DataDrivenPropertyValue<float> SymbolLayer::getTextOpacity() const { + return impl().paint.template get<TextOpacity>().value; } -void SymbolLayer::setTextOpacity(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getTextOpacity(klass)) +void SymbolLayer::setTextOpacity(DataDrivenPropertyValue<float> value) { + if (value == getTextOpacity()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<TextOpacity>().set(value, klass); + impl_->paint.template get<TextOpacity>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -869,29 +869,29 @@ void SymbolLayer::setTextOpacity(DataDrivenPropertyValue<float> value, const opt } } -void SymbolLayer::setTextOpacityTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void SymbolLayer::setTextOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<TextOpacity>().setTransition(value, klass); + impl_->paint.template get<TextOpacity>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getTextOpacityTransition(const optional<std::string>& klass) const { - return impl().paint.template get<TextOpacity>().getTransition(klass); +TransitionOptions SymbolLayer::getTextOpacityTransition() const { + return impl().paint.template get<TextOpacity>().options; } DataDrivenPropertyValue<Color> SymbolLayer::getDefaultTextColor() { return { Color::black() }; } -DataDrivenPropertyValue<Color> SymbolLayer::getTextColor(const optional<std::string>& klass) const { - return impl().paint.template get<TextColor>().get(klass); +DataDrivenPropertyValue<Color> SymbolLayer::getTextColor() const { + return impl().paint.template get<TextColor>().value; } -void SymbolLayer::setTextColor(DataDrivenPropertyValue<Color> value, const optional<std::string>& klass) { - if (value == getTextColor(klass)) +void SymbolLayer::setTextColor(DataDrivenPropertyValue<Color> value) { + if (value == getTextColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<TextColor>().set(value, klass); + impl_->paint.template get<TextColor>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -900,29 +900,29 @@ void SymbolLayer::setTextColor(DataDrivenPropertyValue<Color> value, const optio } } -void SymbolLayer::setTextColorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void SymbolLayer::setTextColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<TextColor>().setTransition(value, klass); + impl_->paint.template get<TextColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getTextColorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<TextColor>().getTransition(klass); +TransitionOptions SymbolLayer::getTextColorTransition() const { + return impl().paint.template get<TextColor>().options; } DataDrivenPropertyValue<Color> SymbolLayer::getDefaultTextHaloColor() { return { {} }; } -DataDrivenPropertyValue<Color> SymbolLayer::getTextHaloColor(const optional<std::string>& klass) const { - return impl().paint.template get<TextHaloColor>().get(klass); +DataDrivenPropertyValue<Color> SymbolLayer::getTextHaloColor() const { + return impl().paint.template get<TextHaloColor>().value; } -void SymbolLayer::setTextHaloColor(DataDrivenPropertyValue<Color> value, const optional<std::string>& klass) { - if (value == getTextHaloColor(klass)) +void SymbolLayer::setTextHaloColor(DataDrivenPropertyValue<Color> value) { + if (value == getTextHaloColor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<TextHaloColor>().set(value, klass); + impl_->paint.template get<TextHaloColor>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -931,29 +931,29 @@ void SymbolLayer::setTextHaloColor(DataDrivenPropertyValue<Color> value, const o } } -void SymbolLayer::setTextHaloColorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void SymbolLayer::setTextHaloColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<TextHaloColor>().setTransition(value, klass); + impl_->paint.template get<TextHaloColor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getTextHaloColorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<TextHaloColor>().getTransition(klass); +TransitionOptions SymbolLayer::getTextHaloColorTransition() const { + return impl().paint.template get<TextHaloColor>().options; } DataDrivenPropertyValue<float> SymbolLayer::getDefaultTextHaloWidth() { return { 0 }; } -DataDrivenPropertyValue<float> SymbolLayer::getTextHaloWidth(const optional<std::string>& klass) const { - return impl().paint.template get<TextHaloWidth>().get(klass); +DataDrivenPropertyValue<float> SymbolLayer::getTextHaloWidth() const { + return impl().paint.template get<TextHaloWidth>().value; } -void SymbolLayer::setTextHaloWidth(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getTextHaloWidth(klass)) +void SymbolLayer::setTextHaloWidth(DataDrivenPropertyValue<float> value) { + if (value == getTextHaloWidth()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<TextHaloWidth>().set(value, klass); + impl_->paint.template get<TextHaloWidth>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -962,29 +962,29 @@ void SymbolLayer::setTextHaloWidth(DataDrivenPropertyValue<float> value, const o } } -void SymbolLayer::setTextHaloWidthTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void SymbolLayer::setTextHaloWidthTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<TextHaloWidth>().setTransition(value, klass); + impl_->paint.template get<TextHaloWidth>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getTextHaloWidthTransition(const optional<std::string>& klass) const { - return impl().paint.template get<TextHaloWidth>().getTransition(klass); +TransitionOptions SymbolLayer::getTextHaloWidthTransition() const { + return impl().paint.template get<TextHaloWidth>().options; } DataDrivenPropertyValue<float> SymbolLayer::getDefaultTextHaloBlur() { return { 0 }; } -DataDrivenPropertyValue<float> SymbolLayer::getTextHaloBlur(const optional<std::string>& klass) const { - return impl().paint.template get<TextHaloBlur>().get(klass); +DataDrivenPropertyValue<float> SymbolLayer::getTextHaloBlur() const { + return impl().paint.template get<TextHaloBlur>().value; } -void SymbolLayer::setTextHaloBlur(DataDrivenPropertyValue<float> value, const optional<std::string>& klass) { - if (value == getTextHaloBlur(klass)) +void SymbolLayer::setTextHaloBlur(DataDrivenPropertyValue<float> value) { + if (value == getTextHaloBlur()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<TextHaloBlur>().set(value, klass); + impl_->paint.template get<TextHaloBlur>().value = value; baseImpl = std::move(impl_); if (value.isDataDriven()) { observer->onLayerDataDrivenPaintPropertyChanged(*this); @@ -993,68 +993,68 @@ void SymbolLayer::setTextHaloBlur(DataDrivenPropertyValue<float> value, const op } } -void SymbolLayer::setTextHaloBlurTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void SymbolLayer::setTextHaloBlurTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<TextHaloBlur>().setTransition(value, klass); + impl_->paint.template get<TextHaloBlur>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getTextHaloBlurTransition(const optional<std::string>& klass) const { - return impl().paint.template get<TextHaloBlur>().getTransition(klass); +TransitionOptions SymbolLayer::getTextHaloBlurTransition() const { + return impl().paint.template get<TextHaloBlur>().options; } PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultTextTranslate() { return { {{ 0, 0 }} }; } -PropertyValue<std::array<float, 2>> SymbolLayer::getTextTranslate(const optional<std::string>& klass) const { - return impl().paint.template get<TextTranslate>().get(klass); +PropertyValue<std::array<float, 2>> SymbolLayer::getTextTranslate() const { + return impl().paint.template get<TextTranslate>().value; } -void SymbolLayer::setTextTranslate(PropertyValue<std::array<float, 2>> value, const optional<std::string>& klass) { - if (value == getTextTranslate(klass)) +void SymbolLayer::setTextTranslate(PropertyValue<std::array<float, 2>> value) { + if (value == getTextTranslate()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<TextTranslate>().set(value, klass); + impl_->paint.template get<TextTranslate>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void SymbolLayer::setTextTranslateTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void SymbolLayer::setTextTranslateTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<TextTranslate>().setTransition(value, klass); + impl_->paint.template get<TextTranslate>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getTextTranslateTransition(const optional<std::string>& klass) const { - return impl().paint.template get<TextTranslate>().getTransition(klass); +TransitionOptions SymbolLayer::getTextTranslateTransition() const { + return impl().paint.template get<TextTranslate>().options; } PropertyValue<TranslateAnchorType> SymbolLayer::getDefaultTextTranslateAnchor() { return { TranslateAnchorType::Map }; } -PropertyValue<TranslateAnchorType> SymbolLayer::getTextTranslateAnchor(const optional<std::string>& klass) const { - return impl().paint.template get<TextTranslateAnchor>().get(klass); +PropertyValue<TranslateAnchorType> SymbolLayer::getTextTranslateAnchor() const { + return impl().paint.template get<TextTranslateAnchor>().value; } -void SymbolLayer::setTextTranslateAnchor(PropertyValue<TranslateAnchorType> value, const optional<std::string>& klass) { - if (value == getTextTranslateAnchor(klass)) +void SymbolLayer::setTextTranslateAnchor(PropertyValue<TranslateAnchorType> value) { + if (value == getTextTranslateAnchor()) return; auto impl_ = mutableImpl(); - impl_->paint.template get<TextTranslateAnchor>().set(value, klass); + impl_->paint.template get<TextTranslateAnchor>().value = value; baseImpl = std::move(impl_); observer->onLayerPaintPropertyChanged(*this); } -void SymbolLayer::setTextTranslateAnchorTransition(const TransitionOptions& value, const optional<std::string>& klass) { +void SymbolLayer::setTextTranslateAnchorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); - impl_->paint.template get<TextTranslateAnchor>().setTransition(value, klass); + impl_->paint.template get<TextTranslateAnchor>().options = options; baseImpl = std::move(impl_); } -TransitionOptions SymbolLayer::getTextTranslateAnchorTransition(const optional<std::string>& klass) const { - return impl().paint.template get<TextTranslateAnchor>().getTransition(klass); +TransitionOptions SymbolLayer::getTextTranslateAnchorTransition() const { + return impl().paint.template get<TextTranslateAnchor>().options; } } // namespace style diff --git a/src/mbgl/style/paint_property.hpp b/src/mbgl/style/paint_property.hpp index 80d54abceb..cb86fd1a30 100644 --- a/src/mbgl/style/paint_property.hpp +++ b/src/mbgl/style/paint_property.hpp @@ -15,7 +15,7 @@ namespace style { template <class T> class PaintProperty { public: - using TransitionableType = Cascading<PropertyValue<T>>; + using TransitionableType = Transitionable<PropertyValue<T>>; using UnevaluatedType = Transitioning<PropertyValue<T>>; using EvaluatorType = PropertyEvaluator<T>; using PossiblyEvaluatedType = T; @@ -26,7 +26,7 @@ public: template <class T, class A> class DataDrivenPaintProperty { public: - using TransitionableType = Cascading<DataDrivenPropertyValue<T>>; + using TransitionableType = Transitionable<DataDrivenPropertyValue<T>>; using UnevaluatedType = Transitioning<DataDrivenPropertyValue<T>>; using EvaluatorType = DataDrivenPropertyEvaluator<T>; using PossiblyEvaluatedType = PossiblyEvaluatedPropertyValue<T>; @@ -39,7 +39,7 @@ public: template <class T> class CrossFadedPaintProperty { public: - using TransitionableType = Cascading<PropertyValue<T>>; + using TransitionableType = Transitionable<PropertyValue<T>>; using UnevaluatedType = Transitioning<PropertyValue<T>>; using EvaluatorType = CrossFadedPropertyEvaluator<T>; using PossiblyEvaluatedType = Faded<T>; diff --git a/src/mbgl/style/properties.hpp b/src/mbgl/style/properties.hpp index cd69ffb9be..678d38563a 100644 --- a/src/mbgl/style/properties.hpp +++ b/src/mbgl/style/properties.hpp @@ -92,63 +92,6 @@ public: } }; -template <class Value> -class Cascading { -public: - bool isUndefined() const { - return values.find(ClassID::Default) == values.end(); - } - - const Value& get(const optional<std::string>& klass) const { - static const Value staticValue{}; - const auto it = values.find(klass ? ClassDictionary::Get().lookup(*klass) : ClassID::Default); - return it == values.end() ? staticValue : it->second; - } - - void set(const Value& value_, const optional<std::string>& klass) { - values[klass ? ClassDictionary::Get().lookup(*klass) : ClassID::Default] = value_; - } - - const TransitionOptions& getTransition(const optional<std::string>& klass) const { - static const TransitionOptions staticValue{}; - const auto it = transitions.find(klass ? ClassDictionary::Get().lookup(*klass) : ClassID::Default); - return it == transitions.end() ? staticValue : it->second; - } - - void setTransition(const TransitionOptions& transition, const optional<std::string>& klass) { - transitions[klass ? ClassDictionary::Get().lookup(*klass) : ClassID::Default] = transition; - } - - Transitioning<Value> transition(const TransitionParameters& params, Transitioning<Value> prior) const { - TransitionOptions transition; - Value value; - - for (const auto classID : params.classes) { - if (values.find(classID) != values.end()) { - value = values.at(classID); - break; - } - } - - for (const auto classID : params.classes) { - if (transitions.find(classID) != transitions.end()) { - transition = transitions.at(classID).reverseMerge(transition); - break; - } - } - - return Transitioning<Value>(std::move(value), - std::move(prior), - transition.reverseMerge(params.transition), - params.now); - } - -private: - std::map<ClassID, Value> values; - std::map<ClassID, TransitionOptions> transitions; -}; - - template <class P> struct IsDataDriven : std::integral_constant<bool, P::IsDataDriven> {}; diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp index 962ba0f39b..f601c4126c 100644 --- a/src/mbgl/style/style.cpp +++ b/src/mbgl/style/style.cpp @@ -15,7 +15,6 @@ #include <mbgl/style/layer_impl.hpp> #include <mbgl/style/parser.hpp> #include <mbgl/style/transition_options.hpp> -#include <mbgl/style/class_dictionary.hpp> #include <mbgl/sprite/sprite_atlas.hpp> #include <mbgl/sprite/sprite_image_collection.hpp> #include <mbgl/sprite/sprite_loader.hpp> @@ -93,33 +92,6 @@ Style::~Style() { } } -bool Style::addClass(const std::string& className) { - if (hasClass(className)) return false; - classes.push_back(className); - return true; -} - -bool Style::hasClass(const std::string& className) const { - return std::find(classes.begin(), classes.end(), className) != classes.end(); -} - -bool Style::removeClass(const std::string& className) { - const auto it = std::find(classes.begin(), classes.end(), className); - if (it != classes.end()) { - classes.erase(it); - return true; - } - return false; -} - -void Style::setClasses(const std::vector<std::string>& classNames) { - classes = classNames; -} - -std::vector<std::string> Style::getClasses() const { - return classes; -} - void Style::setTransitionOptions(const TransitionOptions& options) { transitionOptions = options; } @@ -132,7 +104,6 @@ void Style::setJSON(const std::string& json) { sources.clear(); renderSources.clear(); layers.clear(); - classes.clear(); transitionOptions = {}; updateBatch = {}; @@ -333,16 +304,8 @@ double Style::getDefaultPitch() const { void Style::update(const UpdateParameters& parameters) { const bool zoomChanged = zoomHistory.update(parameters.transformState.getZoom(), parameters.timePoint); - const bool classesChanged = parameters.updateFlags & Update::Classes; - - std::vector<ClassID> classIDs; - for (const auto& className : classes) { - classIDs.push_back(ClassDictionary::Get().lookup(className)); - } - classIDs.push_back(ClassID::Default); const TransitionParameters transitionParameters { - classIDs, parameters.timePoint, parameters.mode == MapMode::Continuous ? transitionOptions : TransitionOptions() }; @@ -432,11 +395,11 @@ void Style::update(const UpdateParameters& parameters) { const bool layerAdded = layerDiff.added.count(entry.first); const bool layerChanged = layerDiff.changed.count(entry.first); - if (classesChanged || layerAdded || layerChanged) { + if (layerAdded || layerChanged) { layer.transition(transitionParameters); } - if (classesChanged || layerAdded || layerChanged || zoomChanged || layer.hasTransition()) { + if (layerAdded || layerChanged || zoomChanged || layer.hasTransition()) { layer.evaluate(evaluationParameters); } } diff --git a/src/mbgl/style/style.hpp b/src/mbgl/style/style.hpp index fb724e2b46..b4ff4f9ac4 100644 --- a/src/mbgl/style/style.hpp +++ b/src/mbgl/style/style.hpp @@ -93,16 +93,9 @@ public: double getDefaultBearing() const; double getDefaultPitch() const; - bool addClass(const std::string&); - bool removeClass(const std::string&); - void setClasses(const std::vector<std::string>&); - TransitionOptions getTransitionOptions() const; void setTransitionOptions(const TransitionOptions&); - bool hasClass(const std::string&) const; - std::vector<std::string> getClasses() const; - void setLight(std::unique_ptr<Light>); Light* getLight() const; const RenderLight& getRenderLight() const; @@ -134,7 +127,6 @@ public: private: std::vector<std::unique_ptr<Source>> sources; std::vector<std::unique_ptr<Layer>> layers; - std::vector<std::string> classes; TransitionOptions transitionOptions; std::unique_ptr<Light> light; |