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/line_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/line_layer.cpp')
-rw-r--r-- | src/mbgl/style/layers/line_layer.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/mbgl/style/layers/line_layer.cpp b/src/mbgl/style/layers/line_layer.cpp index dbf4b682ba..100ee7247f 100644 --- a/src/mbgl/style/layers/line_layer.cpp +++ b/src/mbgl/style/layers/line_layer.cpp @@ -50,6 +50,7 @@ const std::string& LineLayer::getSourceLayer() const { void LineLayer::setFilter(const Filter& filter) { impl->filter = filter; + impl->observer->onLayerFilterChanged(*this); } const Filter& LineLayer::getFilter() const { @@ -67,7 +68,10 @@ PropertyValue<LineCapType> LineLayer::getLineCap() const { } void LineLayer::setLineCap(PropertyValue<LineCapType> value) { + if (value == getLineCap()) + return; impl->layout.lineCap.set(value); + impl->observer->onLayerLayoutPropertyChanged(*this); } PropertyValue<LineJoinType> LineLayer::getDefaultLineJoin() { return { LineJoinType::Miter }; @@ -78,7 +82,10 @@ PropertyValue<LineJoinType> LineLayer::getLineJoin() const { } void LineLayer::setLineJoin(PropertyValue<LineJoinType> value) { + if (value == getLineJoin()) + return; impl->layout.lineJoin.set(value); + impl->observer->onLayerLayoutPropertyChanged(*this); } PropertyValue<float> LineLayer::getDefaultLineMiterLimit() { return { 2 }; @@ -89,7 +96,10 @@ PropertyValue<float> LineLayer::getLineMiterLimit() const { } void LineLayer::setLineMiterLimit(PropertyValue<float> value) { + if (value == getLineMiterLimit()) + return; impl->layout.lineMiterLimit.set(value); + impl->observer->onLayerLayoutPropertyChanged(*this); } PropertyValue<float> LineLayer::getDefaultLineRoundLimit() { return { 1 }; @@ -100,7 +110,10 @@ PropertyValue<float> LineLayer::getLineRoundLimit() const { } void LineLayer::setLineRoundLimit(PropertyValue<float> value) { + if (value == getLineRoundLimit()) + return; impl->layout.lineRoundLimit.set(value); + impl->observer->onLayerLayoutPropertyChanged(*this); } // Paint properties @@ -114,7 +127,10 @@ PropertyValue<float> LineLayer::getLineOpacity(const optional<std::string>& klas } void LineLayer::setLineOpacity(PropertyValue<float> value, const optional<std::string>& klass) { + if (value == getLineOpacity(klass)) + return; impl->paint.lineOpacity.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<Color> LineLayer::getDefaultLineColor() { @@ -126,7 +142,10 @@ PropertyValue<Color> LineLayer::getLineColor(const optional<std::string>& klass) } void LineLayer::setLineColor(PropertyValue<Color> value, const optional<std::string>& klass) { + if (value == getLineColor(klass)) + return; impl->paint.lineColor.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<std::array<float, 2>> LineLayer::getDefaultLineTranslate() { @@ -138,7 +157,10 @@ PropertyValue<std::array<float, 2>> LineLayer::getLineTranslate(const optional<s } void LineLayer::setLineTranslate(PropertyValue<std::array<float, 2>> value, const optional<std::string>& klass) { + if (value == getLineTranslate(klass)) + return; impl->paint.lineTranslate.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<TranslateAnchorType> LineLayer::getDefaultLineTranslateAnchor() { @@ -150,7 +172,10 @@ PropertyValue<TranslateAnchorType> LineLayer::getLineTranslateAnchor(const optio } void LineLayer::setLineTranslateAnchor(PropertyValue<TranslateAnchorType> value, const optional<std::string>& klass) { + if (value == getLineTranslateAnchor(klass)) + return; impl->paint.lineTranslateAnchor.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<float> LineLayer::getDefaultLineWidth() { @@ -162,7 +187,10 @@ PropertyValue<float> LineLayer::getLineWidth(const optional<std::string>& klass) } void LineLayer::setLineWidth(PropertyValue<float> value, const optional<std::string>& klass) { + if (value == getLineWidth(klass)) + return; impl->paint.lineWidth.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<float> LineLayer::getDefaultLineGapWidth() { @@ -174,7 +202,10 @@ PropertyValue<float> LineLayer::getLineGapWidth(const optional<std::string>& kla } void LineLayer::setLineGapWidth(PropertyValue<float> value, const optional<std::string>& klass) { + if (value == getLineGapWidth(klass)) + return; impl->paint.lineGapWidth.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<float> LineLayer::getDefaultLineOffset() { @@ -186,7 +217,10 @@ PropertyValue<float> LineLayer::getLineOffset(const optional<std::string>& klass } void LineLayer::setLineOffset(PropertyValue<float> value, const optional<std::string>& klass) { + if (value == getLineOffset(klass)) + return; impl->paint.lineOffset.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<float> LineLayer::getDefaultLineBlur() { @@ -198,7 +232,10 @@ PropertyValue<float> LineLayer::getLineBlur(const optional<std::string>& klass) } void LineLayer::setLineBlur(PropertyValue<float> value, const optional<std::string>& klass) { + if (value == getLineBlur(klass)) + return; impl->paint.lineBlur.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<std::vector<float>> LineLayer::getDefaultLineDasharray() { @@ -210,7 +247,10 @@ PropertyValue<std::vector<float>> LineLayer::getLineDasharray(const optional<std } void LineLayer::setLineDasharray(PropertyValue<std::vector<float>> value, const optional<std::string>& klass) { + if (value == getLineDasharray(klass)) + return; impl->paint.lineDasharray.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } PropertyValue<std::string> LineLayer::getDefaultLinePattern() { @@ -222,7 +262,10 @@ PropertyValue<std::string> LineLayer::getLinePattern(const optional<std::string> } void LineLayer::setLinePattern(PropertyValue<std::string> value, const optional<std::string>& klass) { + if (value == getLinePattern(klass)) + return; impl->paint.linePattern.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } } // namespace style |