From 12568f21a39dfec7788ebee2815c4c0b2ee964d8 Mon Sep 17 00:00:00 2001 From: Ivo van Dongen Date: Sun, 5 Mar 2017 14:12:37 -0800 Subject: [macos, ios] query source features --- platform/darwin/src/MGLShapeSource.mm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'platform/darwin/src/MGLShapeSource.mm') diff --git a/platform/darwin/src/MGLShapeSource.mm b/platform/darwin/src/MGLShapeSource.mm index b37b01663f..7de2d69af3 100644 --- a/platform/darwin/src/MGLShapeSource.mm +++ b/platform/darwin/src/MGLShapeSource.mm @@ -5,6 +5,7 @@ #import "MGLFeature_Private.h" #import "MGLShape_Private.h" +#import "NSPredicate+MGLAdditions.h" #import "NSURL+MGLAdditions.h" #include @@ -135,6 +136,17 @@ const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance = @"MGLSh NSStringFromClass([self class]), (void *)self, self.identifier, self.URL, self.shape]; } +- (NS_ARRAY_OF(id ) *)featuresMatchingPredicate:(nullable NSPredicate *)predicate { + + mbgl::optional optionalFilter; + if (predicate) { + optionalFilter = predicate.mgl_filter; + } + + std::vector features = self.rawSource->querySourceFeatures({ {}, optionalFilter }); + return MGLFeaturesFromMBGLFeatures(features); +} + @end mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGLShapeSourceOption, id) *options) { -- cgit v1.2.1