summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2020-02-03 12:32:16 +0200
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2020-02-03 16:45:42 +0300
commit0b727108c8517be7fc2d03d5843aefd94cb789be (patch)
tree234dfe3c13d2c695207325ae2a00997b247cd0f1
parenta600a1c3186cdcbf216ce129fe9037531e0998b3 (diff)
downloadqtlocation-mapboxgl-0b727108c8517be7fc2d03d5843aefd94cb789be.tar.gz
[core] Add getSharedExpression to property expression
New method can be used for aggregating property expressions from multiple properties(layers) into single match / case expression.
-rw-r--r--include/mbgl/style/property_expression.hpp5
-rw-r--r--src/mbgl/style/property_expression.cpp4
2 files changed, 9 insertions, 0 deletions
diff --git a/include/mbgl/style/property_expression.hpp b/include/mbgl/style/property_expression.hpp
index 7dcd818dde..7439ac9ca1 100644
--- a/include/mbgl/style/property_expression.hpp
+++ b/include/mbgl/style/property_expression.hpp
@@ -21,6 +21,11 @@ public:
Range<float> getCoveringStops(const float, const float) const noexcept;
const expression::Expression& getExpression() const noexcept;
+ // Can be used for aggregating property expressions from multiple
+ // properties(layers) into single match / case expression. Method may
+ // be removed if a better way of aggregation is found.
+ std::shared_ptr<const expression::Expression> getSharedExpression() const noexcept;
+
bool useIntegerZoom = false;
protected:
diff --git a/src/mbgl/style/property_expression.cpp b/src/mbgl/style/property_expression.cpp
index d531181e71..8d603e4b15 100644
--- a/src/mbgl/style/property_expression.cpp
+++ b/src/mbgl/style/property_expression.cpp
@@ -54,5 +54,9 @@ const expression::Expression& PropertyExpressionBase::getExpression() const noex
return *expression;
}
+std::shared_ptr<const expression::Expression> PropertyExpressionBase::getSharedExpression() const noexcept {
+ return expression;
+}
+
} // namespace style
} // namespace mbgl