Files
MapLibreParticleLab/include/mln/style/expression/is_constant.hpp
Bart Louwers 2a8ebc4906 core: rename mbgl directories to mln (#4511)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-08-22 20:50:14 +02:00

39 lines
1.1 KiB
C++

#pragma once
#include <mln/style/expression/expression.hpp>
#include <mln/style/expression/compound_expression.hpp>
namespace mln {
namespace style {
namespace expression {
template <typename T>
bool isGlobalPropertyConstant(const Expression& expression, const T& properties) {
if (expression.getKind() == Kind::CompoundExpression) {
const auto* e = static_cast<const CompoundExpression*>(&expression);
for (const auto& property : properties) {
if (e->getOperator() == 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);
/// Returns true if expression does not depend on information provided by the runtime.
bool isRuntimeConstant(const Expression& e);
} // namespace expression
} // namespace style
} // namespace mln