| 1 | #pragma once |
|---|---|
| 2 | |
| 3 | #include <mbgl/style/expression/expression.hpp> |
| 4 | #include <mbgl/style/expression/compound_expression.hpp> |
| 5 | |
| 6 | namespace mbgl { |
| 7 | namespace style { |
| 8 | namespace expression { |
| 9 | |
| 10 | template <typename T> |
| 11 | bool isGlobalPropertyConstant(const Expression& expression, const T& properties) { |
| 12 | if (expression.getKind() == Kind::CompoundExpression) { |
| 13 | auto e = static_cast<const CompoundExpressionBase*>(&expression); |
| 14 | for (const std::string& property : properties) { |
| 15 | if (e->getName() == property) { |
| 16 | return false; |
| 17 | } |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | bool isConstant = true; |
| 22 | expression.eachChild([&](const Expression& e) { |
| 23 | if (isConstant && !isGlobalPropertyConstant(e, properties)) { |
| 24 | isConstant = false; |
| 25 | } |
| 26 | }); |
| 27 | return isConstant; |
| 28 | }; |
| 29 | |
| 30 | bool isFeatureConstant(const Expression& expression); |
| 31 | bool isZoomConstant(const Expression& e); |
| 32 | |
| 33 | |
| 34 | } // namespace expression |
| 35 | } // namespace style |
| 36 | } // namespace mbgl |
| 37 |
