summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLCircleStyleLayer.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/MGLCircleStyleLayer.mm')
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.mm30
1 files changed, 11 insertions, 19 deletions
diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm
index 1db7ef875e..6e805a994c 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.mm
+++ b/platform/darwin/src/MGLCircleStyleLayer.mm
@@ -12,36 +12,28 @@
@interface MGLCircleStyleLayer ()
@property (nonatomic) mbgl::style::CircleLayer *layer;
-@property (nonatomic, readwrite) NSString *layerIdentifier;
-@property (nonatomic, readwrite) NSString *sourceIdentifier;
-@property (nonatomic, readwrite) NSString *sourceLayerIdentifier;
@end
@implementation MGLCircleStyleLayer
-@synthesize mapView;
-
-
-- (instancetype)initWithLayerIdentifier:(NSString *)layerIdentifier source:(MGLSource *)source
+- (instancetype)initWithIdentifier:(NSString *)identifier source:(MGLSource *)source
{
- if (self = [super init]) {
- _layerIdentifier = layerIdentifier;
- _sourceIdentifier = source.sourceIdentifier;
- _layer = new mbgl::style::CircleLayer(layerIdentifier.UTF8String, source.sourceIdentifier.UTF8String);
+ if (self = [super initWithIdentifier:identifier source:source]) {
+ _layer = new mbgl::style::CircleLayer(identifier.UTF8String, source.identifier.UTF8String);
}
return self;
}
-- (instancetype)initWithLayerIdentifier:(NSString *)layerIdentifier source:(MGLSource *)source sourceLayer:(NSString *)sourceLayer
+- (NSString *)sourceLayerIdentifier
{
- if (self = [super init]) {
- _layerIdentifier = layerIdentifier;
- _sourceIdentifier = source.sourceIdentifier;
- _layer = new mbgl::style::CircleLayer(layerIdentifier.UTF8String, source.sourceIdentifier.UTF8String);
- _layer->setSourceLayer(sourceLayer.UTF8String);
- }
- return self;
+ auto layerID = self.layer->getSourceLayer();
+ return layerID.empty() ? nil : @(layerID.c_str());
+}
+
+- (void)setSourceLayerIdentifier:(NSString *)sourceLayerIdentifier
+{
+ self.layer->setSourceLayer(sourceLayerIdentifier.UTF8String ?: "");
}
- (void)setPredicate:(NSPredicate *)predicate