diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-08-29 12:00:08 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-09-06 14:29:22 -0700 |
commit | fe2a26225f3746381b36ad8b6c6a3ce7727bf655 (patch) | |
tree | 62507ffd6a28654a377469d35e21719ff7a12fdc /src/mbgl/style/layers/circle_layer.cpp | |
parent | 3a48c60813b18c092c8d8d75c80a318bdd8859bb (diff) | |
download | qtlocation-mapboxgl-fe2a26225f3746381b36ad8b6c6a3ce7727bf655.tar.gz |
[core, ios, android, qt] Observe style layer mutations rather than requiring SDKs to use Map::update
This paves the way for updates to filter and layout properties to trigger a source reload, without each SDK having to participate in the implementation.
Diffstat (limited to 'src/mbgl/style/layers/circle_layer.cpp')
-rw-r--r-- | src/mbgl/style/layers/circle_layer.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mbgl/style/layers/circle_layer.cpp b/src/mbgl/style/layers/circle_layer.cpp index 5fa29d9d37..a2b8d316d6 100644 --- a/src/mbgl/style/layers/circle_layer.cpp +++ b/src/mbgl/style/layers/circle_layer.cpp @@ -50,6 +50,7 @@ const std::string& CircleLayer::getSourceLayer() const { void CircleLayer::setFilter(const Filter& filter) { impl->filter = filter; + impl->observer->onLayerFilterChanged(*this); } const Filter& CircleLayer::getFilter() const { @@ -70,7 +71,10 @@ PropertyValue<float> CircleLayer::getCircleRadius(const optional<std::string>& k } void CircleLayer::setCircleRadius(PropertyValue<float> value, const optional<std::string>& klass) { + if (value == getCircleRadius(klass)) + return; impl->paint.circleRadius.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<Color> CircleLayer::getDefaultCircleColor() { @@ -82,7 +86,10 @@ PropertyValue<Color> CircleLayer::getCircleColor(const optional<std::string>& kl } void CircleLayer::setCircleColor(PropertyValue<Color> value, const optional<std::string>& klass) { + if (value == getCircleColor(klass)) + return; impl->paint.circleColor.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<float> CircleLayer::getDefaultCircleBlur() { @@ -94,7 +101,10 @@ PropertyValue<float> CircleLayer::getCircleBlur(const optional<std::string>& kla } void CircleLayer::setCircleBlur(PropertyValue<float> value, const optional<std::string>& klass) { + if (value == getCircleBlur(klass)) + return; impl->paint.circleBlur.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<float> CircleLayer::getDefaultCircleOpacity() { @@ -106,7 +116,10 @@ PropertyValue<float> CircleLayer::getCircleOpacity(const optional<std::string>& } void CircleLayer::setCircleOpacity(PropertyValue<float> value, const optional<std::string>& klass) { + if (value == getCircleOpacity(klass)) + return; impl->paint.circleOpacity.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<std::array<float, 2>> CircleLayer::getDefaultCircleTranslate() { @@ -118,7 +131,10 @@ PropertyValue<std::array<float, 2>> CircleLayer::getCircleTranslate(const option } void CircleLayer::setCircleTranslate(PropertyValue<std::array<float, 2>> value, const optional<std::string>& klass) { + if (value == getCircleTranslate(klass)) + return; impl->paint.circleTranslate.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<TranslateAnchorType> CircleLayer::getDefaultCircleTranslateAnchor() { @@ -130,7 +146,10 @@ PropertyValue<TranslateAnchorType> CircleLayer::getCircleTranslateAnchor(const o } void CircleLayer::setCircleTranslateAnchor(PropertyValue<TranslateAnchorType> value, const optional<std::string>& klass) { + if (value == getCircleTranslateAnchor(klass)) + return; impl->paint.circleTranslateAnchor.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<CirclePitchScaleType> CircleLayer::getDefaultCirclePitchScale() { @@ -142,7 +161,10 @@ PropertyValue<CirclePitchScaleType> CircleLayer::getCirclePitchScale(const optio } void CircleLayer::setCirclePitchScale(PropertyValue<CirclePitchScaleType> value, const optional<std::string>& klass) { + if (value == getCirclePitchScale(klass)) + return; impl->paint.circlePitchScale.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } } // namespace style |