summaryrefslogtreecommitdiff
path: root/platform/darwin/src/NSPredicate+MGLAdditions.mm
diff options
context:
space:
mode:
authorLucas Wojciechowski <lucas@lucaswoj.com>2018-03-08 15:48:08 -0800
committerTobrun <tobrun@mapbox.com>2018-03-09 11:12:14 +0100
commit8a3deab73373c8f3182e4337a3619ebcc58ecc2c (patch)
tree46774560da0eac1e710dccbf41af2f2e7e8794c4 /platform/darwin/src/NSPredicate+MGLAdditions.mm
parent6179110b6bfe8ee0880a055a31c12a88f9bd9b20 (diff)
downloadqtlocation-mapboxgl-8a3deab73373c8f3182e4337a3619ebcc58ecc2c.tar.gz
[core] Add expression filter support (#11251)
* WIP * WIP * WIP * Remove Filter::operator()(const Feature&) * WIP * WIP * WIP * WIP * Hook up expression filter evaluator * Replace `shared_ptr` with &reference * Fill in implementation of `void operator()(const ExpressionFilter&)` * Fix failing tests * Switch back to a shared_ptr per chat with @anandthakker * Fix benchmark compilation * Shot in the dark to fix CI * Shot in the dark to fix CI (part 2) * Shot in the dark to fix CI (part 3) * In src/mbgl/style/conversion/filter.cpp, add a port of isExpressionFilter and use it to decide in Converter<Filter>::operator() whether to parse the incoming JSON as an ExpressionFilter or one of the legacy filter types * Remove bool Filter::operator()(const GeometryTileFeature&) const * Ensure the map zoom is passed into filtering operations wherever applicable * Add expression filter tests * Addressed PR feedback * Implement `NSPredicate *operator()(mbgl::style::ExpressionFilter filter)` * Fix formatting& nit
Diffstat (limited to 'platform/darwin/src/NSPredicate+MGLAdditions.mm')
-rw-r--r--platform/darwin/src/NSPredicate+MGLAdditions.mm6
1 files changed, 6 insertions, 0 deletions
diff --git a/platform/darwin/src/NSPredicate+MGLAdditions.mm b/platform/darwin/src/NSPredicate+MGLAdditions.mm
index 3ffe200d01..63c8307803 100644
--- a/platform/darwin/src/NSPredicate+MGLAdditions.mm
+++ b/platform/darwin/src/NSPredicate+MGLAdditions.mm
@@ -1,6 +1,7 @@
#import "NSPredicate+MGLAdditions.h"
#import "MGLValueEvaluator.h"
+#import "MGLStyleValue_Private.h"
class FilterEvaluator {
public:
@@ -194,6 +195,11 @@ public:
NSPredicate *operator()(mbgl::style::NotHasIdentifierFilter filter) {
return [NSPredicate predicateWithFormat:@"%K == nil", @"$id"];
}
+
+ NSPredicate *operator()(mbgl::style::ExpressionFilter filter) {
+ id jsonObject = MGLJSONObjectFromMBGLExpression(*filter.expression);
+ return [NSPredicate mgl_predicateWithJSONObject:jsonObject];
+ }
};
@implementation NSPredicate (MGLAdditions)