summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mbgl/style/layer_observer.hpp6
-rw-r--r--src/mbgl/style/layers/background_layer.cpp8
-rw-r--r--src/mbgl/style/layers/circle_layer.cpp52
-rw-r--r--src/mbgl/style/layers/custom_layer.cpp2
-rw-r--r--src/mbgl/style/layers/fill_extrusion_layer.cpp30
-rw-r--r--src/mbgl/style/layers/fill_layer.cpp30
-rw-r--r--src/mbgl/style/layers/layer.cpp.ejs16
-rw-r--r--src/mbgl/style/layers/line_layer.cpp52
-rw-r--r--src/mbgl/style/layers/raster_layer.cpp16
-rw-r--r--src/mbgl/style/layers/symbol_layer.cpp140
-rw-r--r--src/mbgl/style/style.cpp18
-rw-r--r--src/mbgl/style/style.hpp6
-rw-r--r--test/src/mbgl/test/stub_layer_observer.hpp26
-rw-r--r--test/style/style_layer.test.cpp20
14 files changed, 135 insertions, 287 deletions
diff --git a/src/mbgl/style/layer_observer.hpp b/src/mbgl/style/layer_observer.hpp
index 2fa1c39660..28074a65e7 100644
--- a/src/mbgl/style/layer_observer.hpp
+++ b/src/mbgl/style/layer_observer.hpp
@@ -9,11 +9,7 @@ class LayerObserver {
public:
virtual ~LayerObserver() = default;
- virtual void onLayerFilterChanged(Layer&) {}
- virtual void onLayerVisibilityChanged(Layer&) {}
- virtual void onLayerPaintPropertyChanged(Layer&) {}
- virtual void onLayerDataDrivenPaintPropertyChanged(Layer&) {}
- virtual void onLayerLayoutPropertyChanged(Layer&, const char *) {}
+ virtual void onLayerChanged(Layer&) {}
};
} // namespace style
diff --git a/src/mbgl/style/layers/background_layer.cpp b/src/mbgl/style/layers/background_layer.cpp
index c4b22aa0e3..d4ead18816 100644
--- a/src/mbgl/style/layers/background_layer.cpp
+++ b/src/mbgl/style/layers/background_layer.cpp
@@ -44,7 +44,7 @@ void BackgroundLayer::setVisibility(VisibilityType value) {
auto impl_ = mutableImpl();
impl_->visibility = value;
baseImpl = std::move(impl_);
- observer->onLayerVisibilityChanged(*this);
+ observer->onLayerChanged(*this);
}
// Zoom range
@@ -80,7 +80,7 @@ void BackgroundLayer::setBackgroundColor(PropertyValue<Color> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<BackgroundColor>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void BackgroundLayer::setBackgroundColorTransition(const TransitionOptions& options) {
@@ -107,7 +107,7 @@ void BackgroundLayer::setBackgroundPattern(PropertyValue<std::string> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<BackgroundPattern>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void BackgroundLayer::setBackgroundPatternTransition(const TransitionOptions& options) {
@@ -134,7 +134,7 @@ void BackgroundLayer::setBackgroundOpacity(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<BackgroundOpacity>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void BackgroundLayer::setBackgroundOpacityTransition(const TransitionOptions& options) {
diff --git a/src/mbgl/style/layers/circle_layer.cpp b/src/mbgl/style/layers/circle_layer.cpp
index e5c4c33497..3bba135c84 100644
--- a/src/mbgl/style/layers/circle_layer.cpp
+++ b/src/mbgl/style/layers/circle_layer.cpp
@@ -57,7 +57,7 @@ void CircleLayer::setFilter(const Filter& filter) {
auto impl_ = mutableImpl();
impl_->filter = filter;
baseImpl = std::move(impl_);
- observer->onLayerFilterChanged(*this);
+ observer->onLayerChanged(*this);
}
const Filter& CircleLayer::getFilter() const {
@@ -72,7 +72,7 @@ void CircleLayer::setVisibility(VisibilityType value) {
auto impl_ = mutableImpl();
impl_->visibility = value;
baseImpl = std::move(impl_);
- observer->onLayerVisibilityChanged(*this);
+ observer->onLayerChanged(*this);
}
// Zoom range
@@ -108,11 +108,7 @@ void CircleLayer::setCircleRadius(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<CircleRadius>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void CircleLayer::setCircleRadiusTransition(const TransitionOptions& options) {
@@ -139,11 +135,7 @@ void CircleLayer::setCircleColor(DataDrivenPropertyValue<Color> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<CircleColor>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void CircleLayer::setCircleColorTransition(const TransitionOptions& options) {
@@ -170,11 +162,7 @@ void CircleLayer::setCircleBlur(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<CircleBlur>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void CircleLayer::setCircleBlurTransition(const TransitionOptions& options) {
@@ -201,11 +189,7 @@ void CircleLayer::setCircleOpacity(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<CircleOpacity>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void CircleLayer::setCircleOpacityTransition(const TransitionOptions& options) {
@@ -232,7 +216,7 @@ void CircleLayer::setCircleTranslate(PropertyValue<std::array<float, 2>> value)
auto impl_ = mutableImpl();
impl_->paint.template get<CircleTranslate>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void CircleLayer::setCircleTranslateTransition(const TransitionOptions& options) {
@@ -259,7 +243,7 @@ void CircleLayer::setCircleTranslateAnchor(PropertyValue<TranslateAnchorType> va
auto impl_ = mutableImpl();
impl_->paint.template get<CircleTranslateAnchor>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void CircleLayer::setCircleTranslateAnchorTransition(const TransitionOptions& options) {
@@ -286,7 +270,7 @@ void CircleLayer::setCirclePitchScale(PropertyValue<CirclePitchScaleType> value)
auto impl_ = mutableImpl();
impl_->paint.template get<CirclePitchScale>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void CircleLayer::setCirclePitchScaleTransition(const TransitionOptions& options) {
@@ -313,11 +297,7 @@ void CircleLayer::setCircleStrokeWidth(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<CircleStrokeWidth>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void CircleLayer::setCircleStrokeWidthTransition(const TransitionOptions& options) {
@@ -344,11 +324,7 @@ void CircleLayer::setCircleStrokeColor(DataDrivenPropertyValue<Color> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<CircleStrokeColor>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void CircleLayer::setCircleStrokeColorTransition(const TransitionOptions& options) {
@@ -375,11 +351,7 @@ void CircleLayer::setCircleStrokeOpacity(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<CircleStrokeOpacity>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void CircleLayer::setCircleStrokeOpacityTransition(const TransitionOptions& options) {
diff --git a/src/mbgl/style/layers/custom_layer.cpp b/src/mbgl/style/layers/custom_layer.cpp
index f7c349b3d8..e37382d5ef 100644
--- a/src/mbgl/style/layers/custom_layer.cpp
+++ b/src/mbgl/style/layers/custom_layer.cpp
@@ -36,7 +36,7 @@ void CustomLayer::setVisibility(VisibilityType value) {
auto impl_ = mutableImpl();
impl_->visibility = value;
baseImpl = std::move(impl_);
- observer->onLayerVisibilityChanged(*this);
+ observer->onLayerChanged(*this);
}
// Zoom range
diff --git a/src/mbgl/style/layers/fill_extrusion_layer.cpp b/src/mbgl/style/layers/fill_extrusion_layer.cpp
index 4a5dc592e6..62f92cef75 100644
--- a/src/mbgl/style/layers/fill_extrusion_layer.cpp
+++ b/src/mbgl/style/layers/fill_extrusion_layer.cpp
@@ -57,7 +57,7 @@ void FillExtrusionLayer::setFilter(const Filter& filter) {
auto impl_ = mutableImpl();
impl_->filter = filter;
baseImpl = std::move(impl_);
- observer->onLayerFilterChanged(*this);
+ observer->onLayerChanged(*this);
}
const Filter& FillExtrusionLayer::getFilter() const {
@@ -72,7 +72,7 @@ void FillExtrusionLayer::setVisibility(VisibilityType value) {
auto impl_ = mutableImpl();
impl_->visibility = value;
baseImpl = std::move(impl_);
- observer->onLayerVisibilityChanged(*this);
+ observer->onLayerChanged(*this);
}
// Zoom range
@@ -108,7 +108,7 @@ void FillExtrusionLayer::setFillExtrusionOpacity(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<FillExtrusionOpacity>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void FillExtrusionLayer::setFillExtrusionOpacityTransition(const TransitionOptions& options) {
@@ -135,11 +135,7 @@ void FillExtrusionLayer::setFillExtrusionColor(DataDrivenPropertyValue<Color> va
auto impl_ = mutableImpl();
impl_->paint.template get<FillExtrusionColor>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void FillExtrusionLayer::setFillExtrusionColorTransition(const TransitionOptions& options) {
@@ -166,7 +162,7 @@ void FillExtrusionLayer::setFillExtrusionTranslate(PropertyValue<std::array<floa
auto impl_ = mutableImpl();
impl_->paint.template get<FillExtrusionTranslate>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void FillExtrusionLayer::setFillExtrusionTranslateTransition(const TransitionOptions& options) {
@@ -193,7 +189,7 @@ void FillExtrusionLayer::setFillExtrusionTranslateAnchor(PropertyValue<Translate
auto impl_ = mutableImpl();
impl_->paint.template get<FillExtrusionTranslateAnchor>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void FillExtrusionLayer::setFillExtrusionTranslateAnchorTransition(const TransitionOptions& options) {
@@ -220,7 +216,7 @@ void FillExtrusionLayer::setFillExtrusionPattern(PropertyValue<std::string> valu
auto impl_ = mutableImpl();
impl_->paint.template get<FillExtrusionPattern>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void FillExtrusionLayer::setFillExtrusionPatternTransition(const TransitionOptions& options) {
@@ -247,11 +243,7 @@ void FillExtrusionLayer::setFillExtrusionHeight(DataDrivenPropertyValue<float> v
auto impl_ = mutableImpl();
impl_->paint.template get<FillExtrusionHeight>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void FillExtrusionLayer::setFillExtrusionHeightTransition(const TransitionOptions& options) {
@@ -278,11 +270,7 @@ void FillExtrusionLayer::setFillExtrusionBase(DataDrivenPropertyValue<float> val
auto impl_ = mutableImpl();
impl_->paint.template get<FillExtrusionBase>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void FillExtrusionLayer::setFillExtrusionBaseTransition(const TransitionOptions& options) {
diff --git a/src/mbgl/style/layers/fill_layer.cpp b/src/mbgl/style/layers/fill_layer.cpp
index b98c325451..65975752db 100644
--- a/src/mbgl/style/layers/fill_layer.cpp
+++ b/src/mbgl/style/layers/fill_layer.cpp
@@ -57,7 +57,7 @@ void FillLayer::setFilter(const Filter& filter) {
auto impl_ = mutableImpl();
impl_->filter = filter;
baseImpl = std::move(impl_);
- observer->onLayerFilterChanged(*this);
+ observer->onLayerChanged(*this);
}
const Filter& FillLayer::getFilter() const {
@@ -72,7 +72,7 @@ void FillLayer::setVisibility(VisibilityType value) {
auto impl_ = mutableImpl();
impl_->visibility = value;
baseImpl = std::move(impl_);
- observer->onLayerVisibilityChanged(*this);
+ observer->onLayerChanged(*this);
}
// Zoom range
@@ -108,7 +108,7 @@ void FillLayer::setFillAntialias(PropertyValue<bool> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<FillAntialias>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void FillLayer::setFillAntialiasTransition(const TransitionOptions& options) {
@@ -135,11 +135,7 @@ void FillLayer::setFillOpacity(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<FillOpacity>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void FillLayer::setFillOpacityTransition(const TransitionOptions& options) {
@@ -166,11 +162,7 @@ void FillLayer::setFillColor(DataDrivenPropertyValue<Color> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<FillColor>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void FillLayer::setFillColorTransition(const TransitionOptions& options) {
@@ -197,11 +189,7 @@ void FillLayer::setFillOutlineColor(DataDrivenPropertyValue<Color> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<FillOutlineColor>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void FillLayer::setFillOutlineColorTransition(const TransitionOptions& options) {
@@ -228,7 +216,7 @@ void FillLayer::setFillTranslate(PropertyValue<std::array<float, 2>> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<FillTranslate>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void FillLayer::setFillTranslateTransition(const TransitionOptions& options) {
@@ -255,7 +243,7 @@ void FillLayer::setFillTranslateAnchor(PropertyValue<TranslateAnchorType> value)
auto impl_ = mutableImpl();
impl_->paint.template get<FillTranslateAnchor>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void FillLayer::setFillTranslateAnchorTransition(const TransitionOptions& options) {
@@ -282,7 +270,7 @@ void FillLayer::setFillPattern(PropertyValue<std::string> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<FillPattern>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void FillLayer::setFillPatternTransition(const TransitionOptions& options) {
diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs
index b9c3e64cb4..573aabda8b 100644
--- a/src/mbgl/style/layers/layer.cpp.ejs
+++ b/src/mbgl/style/layers/layer.cpp.ejs
@@ -76,7 +76,7 @@ void <%- camelize(type) %>Layer::setFilter(const Filter& filter) {
auto impl_ = mutableImpl();
impl_->filter = filter;
baseImpl = std::move(impl_);
- observer->onLayerFilterChanged(*this);
+ observer->onLayerChanged(*this);
}
const Filter& <%- camelize(type) %>Layer::getFilter() const {
@@ -93,7 +93,7 @@ void <%- camelize(type) %>Layer::setVisibility(VisibilityType value) {
auto impl_ = mutableImpl();
impl_->visibility = value;
baseImpl = std::move(impl_);
- observer->onLayerVisibilityChanged(*this);
+ observer->onLayerChanged(*this);
}
// Zoom range
@@ -127,7 +127,7 @@ void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(<%- propertyV
auto impl_ = mutableImpl();
impl_->layout.get<<%- camelize(property.name) %>>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "<%- property.name %>");
+ observer->onLayerChanged(*this);
}
<% } -%>
@@ -147,15 +147,7 @@ void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(<%- propertyV
auto impl_ = mutableImpl();
impl_->paint.template get<<%- camelize(property.name) %>>().value = value;
baseImpl = std::move(impl_);
-<% if (isDataDriven(property)) { -%>
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
-<% } else { -%>
- observer->onLayerPaintPropertyChanged(*this);
-<% } -%>
+ observer->onLayerChanged(*this);
}
void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>Transition(const TransitionOptions& options) {
diff --git a/src/mbgl/style/layers/line_layer.cpp b/src/mbgl/style/layers/line_layer.cpp
index 96f1fa4d11..cf3f81f613 100644
--- a/src/mbgl/style/layers/line_layer.cpp
+++ b/src/mbgl/style/layers/line_layer.cpp
@@ -58,7 +58,7 @@ void LineLayer::setFilter(const Filter& filter) {
auto impl_ = mutableImpl();
impl_->filter = filter;
baseImpl = std::move(impl_);
- observer->onLayerFilterChanged(*this);
+ observer->onLayerChanged(*this);
}
const Filter& LineLayer::getFilter() const {
@@ -73,7 +73,7 @@ void LineLayer::setVisibility(VisibilityType value) {
auto impl_ = mutableImpl();
impl_->visibility = value;
baseImpl = std::move(impl_);
- observer->onLayerVisibilityChanged(*this);
+ observer->onLayerChanged(*this);
}
// Zoom range
@@ -106,7 +106,7 @@ void LineLayer::setLineCap(PropertyValue<LineCapType> value) {
auto impl_ = mutableImpl();
impl_->layout.get<LineCap>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "line-cap");
+ observer->onLayerChanged(*this);
}
PropertyValue<LineJoinType> LineLayer::getDefaultLineJoin() {
return LineJoin::defaultValue();
@@ -122,7 +122,7 @@ void LineLayer::setLineJoin(PropertyValue<LineJoinType> value) {
auto impl_ = mutableImpl();
impl_->layout.get<LineJoin>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "line-join");
+ observer->onLayerChanged(*this);
}
PropertyValue<float> LineLayer::getDefaultLineMiterLimit() {
return LineMiterLimit::defaultValue();
@@ -138,7 +138,7 @@ void LineLayer::setLineMiterLimit(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->layout.get<LineMiterLimit>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "line-miter-limit");
+ observer->onLayerChanged(*this);
}
PropertyValue<float> LineLayer::getDefaultLineRoundLimit() {
return LineRoundLimit::defaultValue();
@@ -154,7 +154,7 @@ void LineLayer::setLineRoundLimit(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->layout.get<LineRoundLimit>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "line-round-limit");
+ observer->onLayerChanged(*this);
}
// Paint properties
@@ -173,11 +173,7 @@ void LineLayer::setLineOpacity(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<LineOpacity>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void LineLayer::setLineOpacityTransition(const TransitionOptions& options) {
@@ -204,11 +200,7 @@ void LineLayer::setLineColor(DataDrivenPropertyValue<Color> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<LineColor>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void LineLayer::setLineColorTransition(const TransitionOptions& options) {
@@ -235,7 +227,7 @@ void LineLayer::setLineTranslate(PropertyValue<std::array<float, 2>> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<LineTranslate>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void LineLayer::setLineTranslateTransition(const TransitionOptions& options) {
@@ -262,7 +254,7 @@ void LineLayer::setLineTranslateAnchor(PropertyValue<TranslateAnchorType> value)
auto impl_ = mutableImpl();
impl_->paint.template get<LineTranslateAnchor>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void LineLayer::setLineTranslateAnchorTransition(const TransitionOptions& options) {
@@ -289,7 +281,7 @@ void LineLayer::setLineWidth(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<LineWidth>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void LineLayer::setLineWidthTransition(const TransitionOptions& options) {
@@ -316,11 +308,7 @@ void LineLayer::setLineGapWidth(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<LineGapWidth>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void LineLayer::setLineGapWidthTransition(const TransitionOptions& options) {
@@ -347,11 +335,7 @@ void LineLayer::setLineOffset(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<LineOffset>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void LineLayer::setLineOffsetTransition(const TransitionOptions& options) {
@@ -378,11 +362,7 @@ void LineLayer::setLineBlur(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<LineBlur>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void LineLayer::setLineBlurTransition(const TransitionOptions& options) {
@@ -409,7 +389,7 @@ void LineLayer::setLineDasharray(PropertyValue<std::vector<float>> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<LineDasharray>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void LineLayer::setLineDasharrayTransition(const TransitionOptions& options) {
@@ -436,7 +416,7 @@ void LineLayer::setLinePattern(PropertyValue<std::string> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<LinePattern>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void LineLayer::setLinePatternTransition(const TransitionOptions& options) {
diff --git a/src/mbgl/style/layers/raster_layer.cpp b/src/mbgl/style/layers/raster_layer.cpp
index a7a32768b6..a9a8d273fa 100644
--- a/src/mbgl/style/layers/raster_layer.cpp
+++ b/src/mbgl/style/layers/raster_layer.cpp
@@ -50,7 +50,7 @@ void RasterLayer::setVisibility(VisibilityType value) {
auto impl_ = mutableImpl();
impl_->visibility = value;
baseImpl = std::move(impl_);
- observer->onLayerVisibilityChanged(*this);
+ observer->onLayerChanged(*this);
}
// Zoom range
@@ -86,7 +86,7 @@ void RasterLayer::setRasterOpacity(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<RasterOpacity>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void RasterLayer::setRasterOpacityTransition(const TransitionOptions& options) {
@@ -113,7 +113,7 @@ void RasterLayer::setRasterHueRotate(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<RasterHueRotate>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void RasterLayer::setRasterHueRotateTransition(const TransitionOptions& options) {
@@ -140,7 +140,7 @@ void RasterLayer::setRasterBrightnessMin(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<RasterBrightnessMin>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void RasterLayer::setRasterBrightnessMinTransition(const TransitionOptions& options) {
@@ -167,7 +167,7 @@ void RasterLayer::setRasterBrightnessMax(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<RasterBrightnessMax>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void RasterLayer::setRasterBrightnessMaxTransition(const TransitionOptions& options) {
@@ -194,7 +194,7 @@ void RasterLayer::setRasterSaturation(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<RasterSaturation>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void RasterLayer::setRasterSaturationTransition(const TransitionOptions& options) {
@@ -221,7 +221,7 @@ void RasterLayer::setRasterContrast(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<RasterContrast>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void RasterLayer::setRasterContrastTransition(const TransitionOptions& options) {
@@ -248,7 +248,7 @@ void RasterLayer::setRasterFadeDuration(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<RasterFadeDuration>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void RasterLayer::setRasterFadeDurationTransition(const TransitionOptions& options) {
diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp
index b2f9ca754f..182b4b0a48 100644
--- a/src/mbgl/style/layers/symbol_layer.cpp
+++ b/src/mbgl/style/layers/symbol_layer.cpp
@@ -58,7 +58,7 @@ void SymbolLayer::setFilter(const Filter& filter) {
auto impl_ = mutableImpl();
impl_->filter = filter;
baseImpl = std::move(impl_);
- observer->onLayerFilterChanged(*this);
+ observer->onLayerChanged(*this);
}
const Filter& SymbolLayer::getFilter() const {
@@ -73,7 +73,7 @@ void SymbolLayer::setVisibility(VisibilityType value) {
auto impl_ = mutableImpl();
impl_->visibility = value;
baseImpl = std::move(impl_);
- observer->onLayerVisibilityChanged(*this);
+ observer->onLayerChanged(*this);
}
// Zoom range
@@ -106,7 +106,7 @@ void SymbolLayer::setSymbolPlacement(PropertyValue<SymbolPlacementType> value) {
auto impl_ = mutableImpl();
impl_->layout.get<SymbolPlacement>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "symbol-placement");
+ observer->onLayerChanged(*this);
}
PropertyValue<float> SymbolLayer::getDefaultSymbolSpacing() {
return SymbolSpacing::defaultValue();
@@ -122,7 +122,7 @@ void SymbolLayer::setSymbolSpacing(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->layout.get<SymbolSpacing>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "symbol-spacing");
+ observer->onLayerChanged(*this);
}
PropertyValue<bool> SymbolLayer::getDefaultSymbolAvoidEdges() {
return SymbolAvoidEdges::defaultValue();
@@ -138,7 +138,7 @@ void SymbolLayer::setSymbolAvoidEdges(PropertyValue<bool> value) {
auto impl_ = mutableImpl();
impl_->layout.get<SymbolAvoidEdges>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "symbol-avoid-edges");
+ observer->onLayerChanged(*this);
}
PropertyValue<bool> SymbolLayer::getDefaultIconAllowOverlap() {
return IconAllowOverlap::defaultValue();
@@ -154,7 +154,7 @@ void SymbolLayer::setIconAllowOverlap(PropertyValue<bool> value) {
auto impl_ = mutableImpl();
impl_->layout.get<IconAllowOverlap>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "icon-allow-overlap");
+ observer->onLayerChanged(*this);
}
PropertyValue<bool> SymbolLayer::getDefaultIconIgnorePlacement() {
return IconIgnorePlacement::defaultValue();
@@ -170,7 +170,7 @@ void SymbolLayer::setIconIgnorePlacement(PropertyValue<bool> value) {
auto impl_ = mutableImpl();
impl_->layout.get<IconIgnorePlacement>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "icon-ignore-placement");
+ observer->onLayerChanged(*this);
}
PropertyValue<bool> SymbolLayer::getDefaultIconOptional() {
return IconOptional::defaultValue();
@@ -186,7 +186,7 @@ void SymbolLayer::setIconOptional(PropertyValue<bool> value) {
auto impl_ = mutableImpl();
impl_->layout.get<IconOptional>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "icon-optional");
+ observer->onLayerChanged(*this);
}
PropertyValue<AlignmentType> SymbolLayer::getDefaultIconRotationAlignment() {
return IconRotationAlignment::defaultValue();
@@ -202,7 +202,7 @@ void SymbolLayer::setIconRotationAlignment(PropertyValue<AlignmentType> value) {
auto impl_ = mutableImpl();
impl_->layout.get<IconRotationAlignment>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "icon-rotation-alignment");
+ observer->onLayerChanged(*this);
}
DataDrivenPropertyValue<float> SymbolLayer::getDefaultIconSize() {
return IconSize::defaultValue();
@@ -218,7 +218,7 @@ void SymbolLayer::setIconSize(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->layout.get<IconSize>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "icon-size");
+ observer->onLayerChanged(*this);
}
PropertyValue<IconTextFitType> SymbolLayer::getDefaultIconTextFit() {
return IconTextFit::defaultValue();
@@ -234,7 +234,7 @@ void SymbolLayer::setIconTextFit(PropertyValue<IconTextFitType> value) {
auto impl_ = mutableImpl();
impl_->layout.get<IconTextFit>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "icon-text-fit");
+ observer->onLayerChanged(*this);
}
PropertyValue<std::array<float, 4>> SymbolLayer::getDefaultIconTextFitPadding() {
return IconTextFitPadding::defaultValue();
@@ -250,7 +250,7 @@ void SymbolLayer::setIconTextFitPadding(PropertyValue<std::array<float, 4>> valu
auto impl_ = mutableImpl();
impl_->layout.get<IconTextFitPadding>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "icon-text-fit-padding");
+ observer->onLayerChanged(*this);
}
DataDrivenPropertyValue<std::string> SymbolLayer::getDefaultIconImage() {
return IconImage::defaultValue();
@@ -266,7 +266,7 @@ void SymbolLayer::setIconImage(DataDrivenPropertyValue<std::string> value) {
auto impl_ = mutableImpl();
impl_->layout.get<IconImage>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "icon-image");
+ observer->onLayerChanged(*this);
}
DataDrivenPropertyValue<float> SymbolLayer::getDefaultIconRotate() {
return IconRotate::defaultValue();
@@ -282,7 +282,7 @@ void SymbolLayer::setIconRotate(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->layout.get<IconRotate>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "icon-rotate");
+ observer->onLayerChanged(*this);
}
PropertyValue<float> SymbolLayer::getDefaultIconPadding() {
return IconPadding::defaultValue();
@@ -298,7 +298,7 @@ void SymbolLayer::setIconPadding(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->layout.get<IconPadding>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "icon-padding");
+ observer->onLayerChanged(*this);
}
PropertyValue<bool> SymbolLayer::getDefaultIconKeepUpright() {
return IconKeepUpright::defaultValue();
@@ -314,7 +314,7 @@ void SymbolLayer::setIconKeepUpright(PropertyValue<bool> value) {
auto impl_ = mutableImpl();
impl_->layout.get<IconKeepUpright>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "icon-keep-upright");
+ observer->onLayerChanged(*this);
}
DataDrivenPropertyValue<std::array<float, 2>> SymbolLayer::getDefaultIconOffset() {
return IconOffset::defaultValue();
@@ -330,7 +330,7 @@ void SymbolLayer::setIconOffset(DataDrivenPropertyValue<std::array<float, 2>> va
auto impl_ = mutableImpl();
impl_->layout.get<IconOffset>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "icon-offset");
+ observer->onLayerChanged(*this);
}
PropertyValue<AlignmentType> SymbolLayer::getDefaultTextPitchAlignment() {
return TextPitchAlignment::defaultValue();
@@ -346,7 +346,7 @@ void SymbolLayer::setTextPitchAlignment(PropertyValue<AlignmentType> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextPitchAlignment>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-pitch-alignment");
+ observer->onLayerChanged(*this);
}
PropertyValue<AlignmentType> SymbolLayer::getDefaultTextRotationAlignment() {
return TextRotationAlignment::defaultValue();
@@ -362,7 +362,7 @@ void SymbolLayer::setTextRotationAlignment(PropertyValue<AlignmentType> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextRotationAlignment>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-rotation-alignment");
+ observer->onLayerChanged(*this);
}
DataDrivenPropertyValue<std::string> SymbolLayer::getDefaultTextField() {
return TextField::defaultValue();
@@ -378,7 +378,7 @@ void SymbolLayer::setTextField(DataDrivenPropertyValue<std::string> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextField>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-field");
+ observer->onLayerChanged(*this);
}
PropertyValue<std::vector<std::string>> SymbolLayer::getDefaultTextFont() {
return TextFont::defaultValue();
@@ -394,7 +394,7 @@ void SymbolLayer::setTextFont(PropertyValue<std::vector<std::string>> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextFont>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-font");
+ observer->onLayerChanged(*this);
}
DataDrivenPropertyValue<float> SymbolLayer::getDefaultTextSize() {
return TextSize::defaultValue();
@@ -410,7 +410,7 @@ void SymbolLayer::setTextSize(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextSize>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-size");
+ observer->onLayerChanged(*this);
}
PropertyValue<float> SymbolLayer::getDefaultTextMaxWidth() {
return TextMaxWidth::defaultValue();
@@ -426,7 +426,7 @@ void SymbolLayer::setTextMaxWidth(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextMaxWidth>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-max-width");
+ observer->onLayerChanged(*this);
}
PropertyValue<float> SymbolLayer::getDefaultTextLineHeight() {
return TextLineHeight::defaultValue();
@@ -442,7 +442,7 @@ void SymbolLayer::setTextLineHeight(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextLineHeight>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-line-height");
+ observer->onLayerChanged(*this);
}
PropertyValue<float> SymbolLayer::getDefaultTextLetterSpacing() {
return TextLetterSpacing::defaultValue();
@@ -458,7 +458,7 @@ void SymbolLayer::setTextLetterSpacing(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextLetterSpacing>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-letter-spacing");
+ observer->onLayerChanged(*this);
}
PropertyValue<TextJustifyType> SymbolLayer::getDefaultTextJustify() {
return TextJustify::defaultValue();
@@ -474,7 +474,7 @@ void SymbolLayer::setTextJustify(PropertyValue<TextJustifyType> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextJustify>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-justify");
+ observer->onLayerChanged(*this);
}
PropertyValue<TextAnchorType> SymbolLayer::getDefaultTextAnchor() {
return TextAnchor::defaultValue();
@@ -490,7 +490,7 @@ void SymbolLayer::setTextAnchor(PropertyValue<TextAnchorType> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextAnchor>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-anchor");
+ observer->onLayerChanged(*this);
}
PropertyValue<float> SymbolLayer::getDefaultTextMaxAngle() {
return TextMaxAngle::defaultValue();
@@ -506,7 +506,7 @@ void SymbolLayer::setTextMaxAngle(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextMaxAngle>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-max-angle");
+ observer->onLayerChanged(*this);
}
DataDrivenPropertyValue<float> SymbolLayer::getDefaultTextRotate() {
return TextRotate::defaultValue();
@@ -522,7 +522,7 @@ void SymbolLayer::setTextRotate(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextRotate>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-rotate");
+ observer->onLayerChanged(*this);
}
PropertyValue<float> SymbolLayer::getDefaultTextPadding() {
return TextPadding::defaultValue();
@@ -538,7 +538,7 @@ void SymbolLayer::setTextPadding(PropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextPadding>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-padding");
+ observer->onLayerChanged(*this);
}
PropertyValue<bool> SymbolLayer::getDefaultTextKeepUpright() {
return TextKeepUpright::defaultValue();
@@ -554,7 +554,7 @@ void SymbolLayer::setTextKeepUpright(PropertyValue<bool> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextKeepUpright>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-keep-upright");
+ observer->onLayerChanged(*this);
}
DataDrivenPropertyValue<TextTransformType> SymbolLayer::getDefaultTextTransform() {
return TextTransform::defaultValue();
@@ -570,7 +570,7 @@ void SymbolLayer::setTextTransform(DataDrivenPropertyValue<TextTransformType> va
auto impl_ = mutableImpl();
impl_->layout.get<TextTransform>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-transform");
+ observer->onLayerChanged(*this);
}
DataDrivenPropertyValue<std::array<float, 2>> SymbolLayer::getDefaultTextOffset() {
return TextOffset::defaultValue();
@@ -586,7 +586,7 @@ void SymbolLayer::setTextOffset(DataDrivenPropertyValue<std::array<float, 2>> va
auto impl_ = mutableImpl();
impl_->layout.get<TextOffset>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-offset");
+ observer->onLayerChanged(*this);
}
PropertyValue<bool> SymbolLayer::getDefaultTextAllowOverlap() {
return TextAllowOverlap::defaultValue();
@@ -602,7 +602,7 @@ void SymbolLayer::setTextAllowOverlap(PropertyValue<bool> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextAllowOverlap>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-allow-overlap");
+ observer->onLayerChanged(*this);
}
PropertyValue<bool> SymbolLayer::getDefaultTextIgnorePlacement() {
return TextIgnorePlacement::defaultValue();
@@ -618,7 +618,7 @@ void SymbolLayer::setTextIgnorePlacement(PropertyValue<bool> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextIgnorePlacement>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-ignore-placement");
+ observer->onLayerChanged(*this);
}
PropertyValue<bool> SymbolLayer::getDefaultTextOptional() {
return TextOptional::defaultValue();
@@ -634,7 +634,7 @@ void SymbolLayer::setTextOptional(PropertyValue<bool> value) {
auto impl_ = mutableImpl();
impl_->layout.get<TextOptional>() = value;
baseImpl = std::move(impl_);
- observer->onLayerLayoutPropertyChanged(*this, "text-optional");
+ observer->onLayerChanged(*this);
}
// Paint properties
@@ -653,11 +653,7 @@ void SymbolLayer::setIconOpacity(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<IconOpacity>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void SymbolLayer::setIconOpacityTransition(const TransitionOptions& options) {
@@ -684,11 +680,7 @@ void SymbolLayer::setIconColor(DataDrivenPropertyValue<Color> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<IconColor>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void SymbolLayer::setIconColorTransition(const TransitionOptions& options) {
@@ -715,11 +707,7 @@ void SymbolLayer::setIconHaloColor(DataDrivenPropertyValue<Color> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<IconHaloColor>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void SymbolLayer::setIconHaloColorTransition(const TransitionOptions& options) {
@@ -746,11 +734,7 @@ void SymbolLayer::setIconHaloWidth(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<IconHaloWidth>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void SymbolLayer::setIconHaloWidthTransition(const TransitionOptions& options) {
@@ -777,11 +761,7 @@ void SymbolLayer::setIconHaloBlur(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<IconHaloBlur>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void SymbolLayer::setIconHaloBlurTransition(const TransitionOptions& options) {
@@ -808,7 +788,7 @@ void SymbolLayer::setIconTranslate(PropertyValue<std::array<float, 2>> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<IconTranslate>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void SymbolLayer::setIconTranslateTransition(const TransitionOptions& options) {
@@ -835,7 +815,7 @@ void SymbolLayer::setIconTranslateAnchor(PropertyValue<TranslateAnchorType> valu
auto impl_ = mutableImpl();
impl_->paint.template get<IconTranslateAnchor>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void SymbolLayer::setIconTranslateAnchorTransition(const TransitionOptions& options) {
@@ -862,11 +842,7 @@ void SymbolLayer::setTextOpacity(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<TextOpacity>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void SymbolLayer::setTextOpacityTransition(const TransitionOptions& options) {
@@ -893,11 +869,7 @@ void SymbolLayer::setTextColor(DataDrivenPropertyValue<Color> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<TextColor>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void SymbolLayer::setTextColorTransition(const TransitionOptions& options) {
@@ -924,11 +896,7 @@ void SymbolLayer::setTextHaloColor(DataDrivenPropertyValue<Color> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<TextHaloColor>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void SymbolLayer::setTextHaloColorTransition(const TransitionOptions& options) {
@@ -955,11 +923,7 @@ void SymbolLayer::setTextHaloWidth(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<TextHaloWidth>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void SymbolLayer::setTextHaloWidthTransition(const TransitionOptions& options) {
@@ -986,11 +950,7 @@ void SymbolLayer::setTextHaloBlur(DataDrivenPropertyValue<float> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<TextHaloBlur>().value = value;
baseImpl = std::move(impl_);
- if (value.isDataDriven()) {
- observer->onLayerDataDrivenPaintPropertyChanged(*this);
- } else {
- observer->onLayerPaintPropertyChanged(*this);
- }
+ observer->onLayerChanged(*this);
}
void SymbolLayer::setTextHaloBlurTransition(const TransitionOptions& options) {
@@ -1017,7 +977,7 @@ void SymbolLayer::setTextTranslate(PropertyValue<std::array<float, 2>> value) {
auto impl_ = mutableImpl();
impl_->paint.template get<TextTranslate>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void SymbolLayer::setTextTranslateTransition(const TransitionOptions& options) {
@@ -1044,7 +1004,7 @@ void SymbolLayer::setTextTranslateAnchor(PropertyValue<TranslateAnchorType> valu
auto impl_ = mutableImpl();
impl_->paint.template get<TextTranslateAnchor>().value = value;
baseImpl = std::move(impl_);
- observer->onLayerPaintPropertyChanged(*this);
+ observer->onLayerChanged(*this);
}
void SymbolLayer::setTextTranslateAnchorTransition(const TransitionOptions& options) {
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index 4acafba0ee..98d774f974 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -782,23 +782,7 @@ void Style::onSpriteError(std::exception_ptr error) {
observer->onResourceError(error);
}
-void Style::onLayerFilterChanged(Layer&) {
- observer->onUpdate(Update::Repaint);
-}
-
-void Style::onLayerVisibilityChanged(Layer&) {
- observer->onUpdate(Update::Repaint);
-}
-
-void Style::onLayerPaintPropertyChanged(Layer&) {
- observer->onUpdate(Update::Repaint);
-}
-
-void Style::onLayerDataDrivenPaintPropertyChanged(Layer&) {
- observer->onUpdate(Update::Repaint);
-}
-
-void Style::onLayerLayoutPropertyChanged(Layer&, const char *) {
+void Style::onLayerChanged(Layer&) {
observer->onUpdate(Update::Repaint);
}
diff --git a/src/mbgl/style/style.hpp b/src/mbgl/style/style.hpp
index 9138637894..a947fce44f 100644
--- a/src/mbgl/style/style.hpp
+++ b/src/mbgl/style/style.hpp
@@ -164,11 +164,7 @@ private:
void onTileError(RenderSource&, const OverscaledTileID&, std::exception_ptr) override;
// LayerObserver implementation.
- void onLayerFilterChanged(Layer&) override;
- void onLayerVisibilityChanged(Layer&) override;
- void onLayerPaintPropertyChanged(Layer&) override;
- void onLayerDataDrivenPaintPropertyChanged(Layer&) override;
- void onLayerLayoutPropertyChanged(Layer&, const char *) override;
+ void onLayerChanged(Layer&) override;
// LightObserver implementation.
void onLightChanged(const Light&) override;
diff --git a/test/src/mbgl/test/stub_layer_observer.hpp b/test/src/mbgl/test/stub_layer_observer.hpp
index 9acd4b077a..0fa413aefe 100644
--- a/test/src/mbgl/test/stub_layer_observer.hpp
+++ b/test/src/mbgl/test/stub_layer_observer.hpp
@@ -10,29 +10,9 @@ using namespace mbgl::style;
*/
class StubLayerObserver : public style::LayerObserver {
public:
- void onLayerFilterChanged(Layer& layer) override {
- if (layerFilterChanged) layerFilterChanged(layer);
+ void onLayerChanged(Layer& layer) override {
+ if (layerChanged) layerChanged(layer);
}
- void onLayerVisibilityChanged(Layer& layer) override {
- if (layerVisibilityChanged) layerVisibilityChanged(layer);
- }
-
- void onLayerPaintPropertyChanged(Layer& layer) override {
- if (layerPaintPropertyChanged) layerPaintPropertyChanged(layer);
- }
-
- void onLayerDataDrivenPaintPropertyChanged(Layer& layer) override {
- if (layerDataDrivenPaintPropertyChanged) layerDataDrivenPaintPropertyChanged(layer);
- }
-
- void onLayerLayoutPropertyChanged(Layer& layer, const char * property) override {
- if (layerLayoutPropertyChanged) layerLayoutPropertyChanged(layer, property);
- }
-
- std::function<void (Layer&)> layerFilterChanged;
- std::function<void (Layer&)> layerVisibilityChanged;
- std::function<void (Layer&)> layerPaintPropertyChanged;
- std::function<void (Layer&)> layerDataDrivenPaintPropertyChanged;
- std::function<void (Layer&, const char *)> layerLayoutPropertyChanged;
+ std::function<void (Layer&)> layerChanged;
};
diff --git a/test/style/style_layer.test.cpp b/test/style/style_layer.test.cpp
index 2a8379bf20..7d0eb318c0 100644
--- a/test/style/style_layer.test.cpp
+++ b/test/style/style_layer.test.cpp
@@ -207,7 +207,7 @@ TEST(Layer, Observer) {
// Notifies observer on filter change.
bool filterChanged = false;
- observer.layerFilterChanged = [&] (Layer& layer_) {
+ observer.layerChanged = [&] (Layer& layer_) {
EXPECT_EQ(layer.get(), &layer_);
filterChanged = true;
};
@@ -216,7 +216,7 @@ TEST(Layer, Observer) {
// Notifies observer on visibility change.
bool visibilityChanged = false;
- observer.layerVisibilityChanged = [&] (Layer& layer_) {
+ observer.layerChanged = [&] (Layer& layer_) {
EXPECT_EQ(layer.get(), &layer_);
visibilityChanged = true;
};
@@ -225,7 +225,7 @@ TEST(Layer, Observer) {
// Notifies observer on paint property change.
bool paintPropertyChanged = false;
- observer.layerPaintPropertyChanged = [&] (Layer& layer_) {
+ observer.layerChanged = [&] (Layer& layer_) {
EXPECT_EQ(layer.get(), &layer_);
paintPropertyChanged = true;
};
@@ -234,7 +234,7 @@ TEST(Layer, Observer) {
// Notifies observer on layout property change.
bool layoutPropertyChanged = false;
- observer.layerLayoutPropertyChanged = [&] (Layer& layer_, const char *) {
+ observer.layerChanged = [&] (Layer& layer_) {
EXPECT_EQ(layer.get(), &layer_);
layoutPropertyChanged = true;
};
@@ -243,16 +243,28 @@ TEST(Layer, Observer) {
// Does not notify observer on no-op visibility change.
visibilityChanged = false;
+ observer.layerChanged = [&] (Layer& layer_) {
+ EXPECT_EQ(layer.get(), &layer_);
+ visibilityChanged = true;
+ };
layer->setVisibility(VisibilityType::None);
EXPECT_FALSE(visibilityChanged);
// Does not notify observer on no-op paint property change.
paintPropertyChanged = false;
+ observer.layerChanged = [&] (Layer& layer_) {
+ EXPECT_EQ(layer.get(), &layer_);
+ paintPropertyChanged = true;
+ };
layer->setLineColor(color);
EXPECT_FALSE(paintPropertyChanged);
// Does not notify observer on no-op layout property change.
layoutPropertyChanged = false;
+ observer.layerChanged = [&] (Layer& layer_) {
+ EXPECT_EQ(layer.get(), &layer_);
+ layoutPropertyChanged = true;
+ };
layer->setLineCap(lineCap);
EXPECT_FALSE(layoutPropertyChanged);
}