summaryrefslogtreecommitdiff
path: root/src/mbgl/style/filter.cpp
blob: 2559eb4816c9db0d0b8364bc51fddaf37e8e019c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <mbgl/style/filter.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>

namespace mbgl {
namespace style {

bool Filter::operator()(const expression::EvaluationContext &context) const {
    
    if (!this->expression) return true;
    
    const expression::EvaluationResult result = (*this->expression)->evaluate(context);
    if (result) {
        const optional<bool> typed = expression::fromExpressionValue<bool>(*result);
        return typed ? *typed : false;
    } else {
        return true;
    }
}

} // namespace style
} // namespace mbgl