Files
MapLibreParticleLab/include/mbgl/style/expression/is_constant.hpp
2017-11-08 12:34:02 -05:00

36 lines
919 B
C++

#pragma once
#include <mbgl/style/expression/expression.hpp>
#include <mbgl/style/expression/compound_expression.hpp>
namespace mbgl {
namespace style {
namespace expression {
template <typename T>
bool isGlobalPropertyConstant(const Expression& expression, const T& properties) {
if (auto e = dynamic_cast<const CompoundExpressionBase*>(&expression)) {
for (const std::string& property : properties) {
if (e->getName() == property) {
return false;
}
}
}
bool isConstant = true;
expression.eachChild([&](const Expression& e) {
if (isConstant && !isGlobalPropertyConstant(e, properties)) {
isConstant = false;
}
});
return isConstant;
};
bool isFeatureConstant(const Expression& expression);
bool isZoomConstant(const Expression& e);
} // namespace expression
} // namespace style
} // namespace mbgl