diff options
author | Fredrik Karlsson <bjorn.fredrik.karlsson@gmail.com> | 2016-08-17 13:38:02 +0200 |
---|---|---|
committer | Fredrik Karlsson <bjorn.fredrik.karlsson@gmail.com> | 2016-09-02 22:42:05 +0200 |
commit | d77a13eb7320722c48c8a18240adf99615c4b85f (patch) | |
tree | 1017781b310e434f943e4ad38b57f319ad7a3a58 /platform/ios/app | |
parent | 6a39cf5aaece81c7a531b12321dd503004cc45b8 (diff) | |
download | qtlocation-mapboxgl-d77a13eb7320722c48c8a18240adf99615c4b85f.tar.gz |
[ios] Added support for filters (NSPredicate)
[ios, macos] cleaned up filters
[ios] added a filter example
[ios] utest filters
[ios, macos] nested predicates
[ios] refactored
[ios] filter -> NSPredicate
[ios] fixed mbgl::Any/AllFilter -> NSPredicate
[ios] translate nested mbgl::NotIn filters
[ios] cleanup and added more utests
[ios] fixed a bug in the None filter conversion and improved utests
[ios, macos] doc
[macos] added missing category
[ios, macos] additional utests
[ios, macos] updated documentation
Diffstat (limited to 'platform/ios/app')
-rw-r--r-- | platform/ios/app/MBXViewController.m | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 605d6b2da8..bfe3f22382 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -79,6 +79,29 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie self.debugLoggingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"MGLMapboxMetricsDebugLoggingEnabled"]; } +- (void)mapViewDidFinishLoadingMap:(MGLMapView *)mapView +{ + [mapView setCenterCoordinate:CLLocationCoordinate2DMake(52.36, 4.86) zoomLevel:12 animated:NO]; + +#warning DEBUG CODE + + NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"]; + NSURL *url = [NSURL fileURLWithPath:filePath]; + NSData *geoJSONData = [NSData dataWithContentsOfURL:url]; + MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithSourceIdentifier:@"source" geoJSONData:geoJSONData]; + [self.mapView.style addSource:source]; + + MGLFillStyleLayer *parksLayer = [[MGLFillStyleLayer alloc] initWithLayerIdentifier:@"park-layer" sourceIdentifier:@"source"]; + parksLayer.fillColor = [UIColor redColor]; + parksLayer.predicate = [NSPredicate predicateWithFormat:@"name == 'Westerpark'"]; + [self.mapView.style addLayer:parksLayer]; + + MGLFillStyleLayer *singleParkLayer = [[MGLFillStyleLayer alloc] initWithLayerIdentifier:@"single-park-layer" sourceIdentifier:@"source"]; + singleParkLayer.fillColor = [UIColor greenColor]; + singleParkLayer.predicate = [NSPredicate predicateWithFormat:@"name == 'vondelpark'"]; + [self.mapView.style addLayer:singleParkLayer]; +} + - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; |