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/fill_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/fill_layer.cpp')
-rw-r--r-- | src/mbgl/style/layers/fill_layer.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mbgl/style/layers/fill_layer.cpp b/src/mbgl/style/layers/fill_layer.cpp index 6bc4b892ef..c61de81d1a 100644 --- a/src/mbgl/style/layers/fill_layer.cpp +++ b/src/mbgl/style/layers/fill_layer.cpp @@ -50,6 +50,7 @@ const std::string& FillLayer::getSourceLayer() const { void FillLayer::setFilter(const Filter& filter) { impl->filter = filter; + impl->observer->onLayerFilterChanged(*this); } const Filter& FillLayer::getFilter() const { @@ -70,7 +71,10 @@ PropertyValue<bool> FillLayer::getFillAntialias(const optional<std::string>& kla } void FillLayer::setFillAntialias(PropertyValue<bool> value, const optional<std::string>& klass) { + if (value == getFillAntialias(klass)) + return; impl->paint.fillAntialias.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<float> FillLayer::getDefaultFillOpacity() { @@ -82,7 +86,10 @@ PropertyValue<float> FillLayer::getFillOpacity(const optional<std::string>& klas } void FillLayer::setFillOpacity(PropertyValue<float> value, const optional<std::string>& klass) { + if (value == getFillOpacity(klass)) + return; impl->paint.fillOpacity.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<Color> FillLayer::getDefaultFillColor() { @@ -94,7 +101,10 @@ PropertyValue<Color> FillLayer::getFillColor(const optional<std::string>& klass) } void FillLayer::setFillColor(PropertyValue<Color> value, const optional<std::string>& klass) { + if (value == getFillColor(klass)) + return; impl->paint.fillColor.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<Color> FillLayer::getDefaultFillOutlineColor() { @@ -106,7 +116,10 @@ PropertyValue<Color> FillLayer::getFillOutlineColor(const optional<std::string>& } void FillLayer::setFillOutlineColor(PropertyValue<Color> value, const optional<std::string>& klass) { + if (value == getFillOutlineColor(klass)) + return; impl->paint.fillOutlineColor.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<std::array<float, 2>> FillLayer::getDefaultFillTranslate() { @@ -118,7 +131,10 @@ PropertyValue<std::array<float, 2>> FillLayer::getFillTranslate(const optional<s } void FillLayer::setFillTranslate(PropertyValue<std::array<float, 2>> value, const optional<std::string>& klass) { + if (value == getFillTranslate(klass)) + return; impl->paint.fillTranslate.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<TranslateAnchorType> FillLayer::getDefaultFillTranslateAnchor() { @@ -130,7 +146,10 @@ PropertyValue<TranslateAnchorType> FillLayer::getFillTranslateAnchor(const optio } void FillLayer::setFillTranslateAnchor(PropertyValue<TranslateAnchorType> value, const optional<std::string>& klass) { + if (value == getFillTranslateAnchor(klass)) + return; impl->paint.fillTranslateAnchor.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<std::string> FillLayer::getDefaultFillPattern() { @@ -142,7 +161,10 @@ PropertyValue<std::string> FillLayer::getFillPattern(const optional<std::string> } void FillLayer::setFillPattern(PropertyValue<std::string> value, const optional<std::string>& klass) { + if (value == getFillPattern(klass)) + return; impl->paint.fillPattern.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } } // namespace style |