diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-12-12 16:04:28 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-12-20 21:05:40 -0800 |
commit | 224fe6b96f18a4e86f7d26e1e5dff5753d9e8483 (patch) | |
tree | 41ab75836358eb274bc422744e93e0efb25ec1db /platform/darwin | |
parent | 117c8ed1d100e2b64841f17714178bd1d9ffc40e (diff) | |
download | qtlocation-mapboxgl-224fe6b96f18a4e86f7d26e1e5dff5753d9e8483.tar.gz |
[ios, macos] Added URL accessor to MGLTileSource
Diffstat (limited to 'platform/darwin')
-rw-r--r-- | platform/darwin/src/MGLRasterSource.mm | 5 | ||||
-rw-r--r-- | platform/darwin/src/MGLTileSource.h | 11 | ||||
-rw-r--r-- | platform/darwin/src/MGLTileSource.mm | 6 | ||||
-rw-r--r-- | platform/darwin/src/MGLVectorSource.mm | 5 |
4 files changed, 27 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLRasterSource.mm b/platform/darwin/src/MGLRasterSource.mm index edca8bced1..9f57bb10a3 100644 --- a/platform/darwin/src/MGLRasterSource.mm +++ b/platform/darwin/src/MGLRasterSource.mm @@ -95,6 +95,11 @@ static const CGFloat MGLRasterSourceRetinaTileSize = 512; super.rawSource = rawSource; } +- (NSURL *)configurationURL { + auto url = self.rawSource->getURL(); + return url ? [NSURL URLWithString:@(url->c_str())] : nil; +} + - (NSString *)attributionHTMLString { auto attribution = self.rawSource->getAttribution(); return attribution ? @(attribution->c_str()) : nil; diff --git a/platform/darwin/src/MGLTileSource.h b/platform/darwin/src/MGLTileSource.h index caf915637e..994375bec0 100644 --- a/platform/darwin/src/MGLTileSource.h +++ b/platform/darwin/src/MGLTileSource.h @@ -162,6 +162,17 @@ typedef NS_ENUM(NSUInteger, MGLTileCoordinateSystem) { */ - (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NS_ARRAY_OF(NSString *) *)tileURLTemplates options:(nullable NS_DICTIONARY_OF(MGLTileSourceOption, id) *)options; +#pragma mark Accessing a Source’s Content + +/** + The URL to the TileJSON configuration file that specifies the contents of the + source. + + If the receiver was initialized using + `-initWithIdentifier:tileURLTemplates:options`, this property is set to `nil`. + */ +@property (nonatomic, copy, nullable, readonly) NSURL *configurationURL; + #pragma mark Accessing Attribution Strings /** diff --git a/platform/darwin/src/MGLTileSource.mm b/platform/darwin/src/MGLTileSource.mm index 522675bc88..1aef81d53c 100644 --- a/platform/darwin/src/MGLTileSource.mm +++ b/platform/darwin/src/MGLTileSource.mm @@ -27,6 +27,12 @@ const MGLTileSourceOption MGLTileSourceOptionTileCoordinateSystem = @"MGLTileSou return [super initWithIdentifier:identifier]; } +- (NSURL *)configurationURL { + [NSException raise:@"MGLAbstractClassException" + format:@"MGLTileSource is an abstract class"]; + return nil; +} + - (NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfos { return [self attributionInfosWithFontSize:0 linkColor:nil]; } diff --git a/platform/darwin/src/MGLVectorSource.mm b/platform/darwin/src/MGLVectorSource.mm index 0eea8dd18c..3ec54ac094 100644 --- a/platform/darwin/src/MGLVectorSource.mm +++ b/platform/darwin/src/MGLVectorSource.mm @@ -69,6 +69,11 @@ super.rawSource = rawSource; } +- (NSURL *)configurationURL { + auto url = self.rawSource->getURL(); + return url ? [NSURL URLWithString:@(url->c_str())] : nil; +} + - (NSString *)attributionHTMLString { auto attribution = self.rawSource->getAttribution(); return attribution ? @(attribution->c_str()) : nil; |