diff options
author | Lucas Wojciechowski <hello@lucaswoj.com> | 2018-05-10 12:37:14 -0700 |
---|---|---|
committer | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2018-05-10 12:37:14 -0700 |
commit | a4e2c1af1fd83b22ef4ee57ab19a15616224f8b8 (patch) | |
tree | 7584634fd01753452d28ea30cdc63e98c8618d43 /src/mbgl/style/filter.cpp | |
parent | ee1008870284d2956c4d246bd8751e032ee91898 (diff) | |
download | qtlocation-mapboxgl-a4e2c1af1fd83b22ef4ee57ab19a15616224f8b8.tar.gz |
[core] Convert "legacy" filters directly into expressions (#11610)
Ports the specialized filter-* expressions from GL JS, adding them to src/mbgl/style/expression/compound_expression.cpp
Diffstat (limited to 'src/mbgl/style/filter.cpp')
-rw-r--r-- | src/mbgl/style/filter.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mbgl/style/filter.cpp b/src/mbgl/style/filter.cpp index 51aa6bcf82..2559eb4816 100644 --- a/src/mbgl/style/filter.cpp +++ b/src/mbgl/style/filter.cpp @@ -1,12 +1,20 @@ #include <mbgl/style/filter.hpp> -#include <mbgl/style/filter_evaluator.hpp> #include <mbgl/tile/geometry_tile_data.hpp> namespace mbgl { namespace style { bool Filter::operator()(const expression::EvaluationContext &context) const { - return FilterBase::visit(*this, FilterEvaluator { context }); + + 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 |