summaryrefslogtreecommitdiff
path: root/platform/ios/app/MBXViewController.m
diff options
context:
space:
mode:
authorAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-05-25 14:36:05 -0700
committerAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-06-19 09:50:08 -0700
commitab5b310a9eb7c88935cc457da1af81349fbe8d41 (patch)
treee1485c8aa2f00e2b50daa0aa7f997ddda59c2562 /platform/ios/app/MBXViewController.m
parent7b05606464ac4d57b59b64015629e9578cbebac2 (diff)
downloadqtlocation-mapboxgl-ab5b310a9eb7c88935cc457da1af81349fbe8d41.tar.gz
[iOS][macOS] Add ImageSource bindings
Diffstat (limited to 'platform/ios/app/MBXViewController.m')
-rw-r--r--platform/ios/app/MBXViewController.m20
1 files changed, 20 insertions, 0 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 672bb3b997..756f4d5516 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -72,6 +72,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsRuntimeStylingRows) {
MBXSettingsRuntimeStylingUpdateShapeSourceFeatures,
MBXSettingsRuntimeStylingVectorSource,
MBXSettingsRuntimeStylingRasterSource,
+ MBXSettingsRuntimeStylingImageSource,
MBXSettingsRuntimeStylingCountryLabels,
MBXSettingsRuntimeStylingRouteLine,
MBXSettingsRuntimeStylingDDSPolygon,
@@ -345,6 +346,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
@"Update Shape Source: Features",
@"Style Vector Source",
@"Style Raster Source",
+ @"Style Image Source",
[NSString stringWithFormat:@"Label Countries in %@", (_usingLocaleBasedCountryLabels ? @"Local Language" : [[NSLocale currentLocale] displayNameForKey:NSLocaleIdentifier value:[self bestLanguageForUser]])],
@"Add Route Line",
@"Dynamically Style Polygon",
@@ -585,6 +587,9 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
case MBXSettingsRuntimeStylingRasterSource:
[self styleRasterSource];
break;
+ case MBXSettingsRuntimeStylingImageSource:
+ [self styleImageSource];
+ break;
case MBXSettingsRuntimeStylingCountryLabels:
[self styleCountryLabelsLanguage];
break;
@@ -1308,6 +1313,21 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
[self.mapView.style addLayer:rasterLayer];
}
+- (void)styleImageSource
+{
+ MGLCoordinateQuad coordinateQuad = {
+ { 46.437, -80.425 },
+ { 46.437, -71.516 },
+ { 37.936, -71.516 },
+ { 37.936, -80.425 } };
+
+ MGLImageSource *imageSource = [[MGLImageSource alloc] initWithIdentifier:@"style-image-source-id" coordinates:coordinateQuad imageURL:[NSURL URLWithString:@"https://www.mapbox.com/mapbox-gl-js/assets/radar.gif"]];
+ [self.mapView.style addSource:imageSource];
+
+ MGLRasterStyleLayer *rasterLayer = [[MGLRasterStyleLayer alloc] initWithIdentifier:@"style-raster-image-layer-id" source:imageSource];
+ [self.mapView.style addLayer:rasterLayer];
+}
+
-(void)styleCountryLabelsLanguage
{
NSArray<NSString *> *labelLayers = @[