summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2016-10-07 15:23:47 -0400
committerJason Wray <friedbunny@users.noreply.github.com>2016-10-11 13:07:10 -0400
commit5f969e3302457804824c3e6af360c1657a44bda7 (patch)
tree62865f2b6508e23f6fdb70953afc7e8dfacfe232
parent5d85dbd7cd91e66ca791c6e6f73774f4f1323a87 (diff)
downloadqtlocation-mapboxgl-5f969e3302457804824c3e6af360c1657a44bda7.tar.gz
[ios, macos] Add description string for MGLStyle class
Example: <MGLStyle: 0x60800001e0a0; name = "Mapbox Dark", URL = "mapbox://styles/mapbox/dark-v9"> - Adds an internal `URL` property.
-rw-r--r--platform/darwin/src/MGLStyle.mm12
1 files changed, 12 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm
index cd9c4465b5..f1c3e68e3a 100644
--- a/platform/darwin/src/MGLStyle.mm
+++ b/platform/darwin/src/MGLStyle.mm
@@ -34,6 +34,7 @@
@interface MGLStyle()
@property (nonatomic, weak) MGLMapView *mapView;
+@property (readonly, copy, nullable) NSURL *URL;
@end
@implementation MGLStyle
@@ -92,6 +93,10 @@ static NSURL *MGLStyleURL_emerald;
return @(self.mapView.mbglMap->getStyleName().c_str());
}
+- (NSURL *)URL {
+ return [NSURL URLWithString:@(self.mapView.mbglMap->getStyleURL().c_str())];
+}
+
- (MGLStyleLayer *)layerWithIdentifier:(NSString *)identifier
{
auto mbglLayer = self.mapView.mbglMap->getLayer(identifier.UTF8String);
@@ -254,5 +259,12 @@ static NSURL *MGLStyleURL_emerald;
}
}
+- (NSString *)description
+{
+ return [NSString stringWithFormat:@"<%@: %p; name = %@, URL = %@>",
+ NSStringFromClass([self class]), (void *)self,
+ self.name ? [NSString stringWithFormat:@"\"%@\"", self.name] : self.name,
+ self.URL ? [NSString stringWithFormat:@"\"%@\"", self.URL] : self.URL];
+}
@end