[ios, macos] Use local GeoJSON for runtime styling demo

Also changed the menu item to something more descriptive.

Fixes #6021.
This commit is contained in:
Minh Nguyễn
2016-08-15 23:34:41 -07:00
committed by Minh Nguyễn
parent bca9d09180
commit 61df0b1bfa
3 changed files with 6 additions and 4 deletions

View File

@@ -203,7 +203,7 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
@"Start World Tour",
@"Add Custom Callout Point",
@"Remove Annotations",
@"Runtime Styling",
@"Manipulate Style",
((_customUserLocationAnnnotationEnabled)
? @"Disable Custom User Dot"
: @"Enable Custom User Dot"),
@@ -479,7 +479,8 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
- (void)styleGeoJSONSource
{
NSURL *geoJSONURL = [NSURL URLWithString:@"https://dl.dropboxusercontent.com/u/5285447/amsterdam.geojson"];
NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"];
NSURL *geoJSONURL = [NSURL fileURLWithPath:filePath];
MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithSourceIdentifier:@"ams" URL:geoJSONURL];
[self.mapView.style addSource:source];

View File

@@ -129,7 +129,7 @@
<action selector="selectFeatures:" target="-1" id="ikt-CZ-yZT"/>
</connections>
</menuItem>
<menuItem title="Runtime styling" id="qZJ-mM-bLj">
<menuItem title="Manipulate Style" id="qZJ-mM-bLj">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="runtimeStyling:" target="-1" id="gN9-lw-fG8"/>

View File

@@ -495,7 +495,8 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
};
fillStyleLayer.fillColor = colorFunction;
NSURL *geoJSONURL = [NSURL URLWithString:@"https://dl.dropboxusercontent.com/u/5285447/amsterdam.geojson"];
NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"];
NSURL *geoJSONURL = [NSURL fileURLWithPath:filePath];
MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithSourceIdentifier:@"ams" URL:geoJSONURL];
[self.mapView.style addSource:source];