diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-03-05 14:12:37 -0800 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2017-03-09 13:11:23 -0800 |
commit | 12568f21a39dfec7788ebee2815c4c0b2ee964d8 (patch) | |
tree | 6184a8e741c3658c6ef672866f882b1a72c9c51b /platform/darwin/src/MGLShapeSource.mm | |
parent | 0d10d2df1c6d246004e7291511f3aab7a8781d59 (diff) | |
download | qtlocation-mapboxgl-12568f21a39dfec7788ebee2815c4c0b2ee964d8.tar.gz |
[macos, ios] query source features
Diffstat (limited to 'platform/darwin/src/MGLShapeSource.mm')
-rw-r--r-- | platform/darwin/src/MGLShapeSource.mm | 12 |
1 files changed, 12 insertions, 0 deletions
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 <mbgl/map/map.hpp> @@ -135,6 +136,17 @@ const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance = @"MGLSh NSStringFromClass([self class]), (void *)self, self.identifier, self.URL, self.shape]; } +- (NS_ARRAY_OF(id <MGLFeature>) *)featuresMatchingPredicate:(nullable NSPredicate *)predicate { + + mbgl::optional<mbgl::style::Filter> optionalFilter; + if (predicate) { + optionalFilter = predicate.mgl_filter; + } + + std::vector<mbgl::Feature> features = self.rawSource->querySourceFeatures({ {}, optionalFilter }); + return MGLFeaturesFromMBGLFeatures(features); +} + @end mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGLShapeSourceOption, id) *options) { |