diff options
Diffstat (limited to 'platform/darwin/src/MGLLineStyleLayer.mm')
-rw-r--r-- | platform/darwin/src/MGLLineStyleLayer.mm | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm index b35d3921f5..6b58edcd61 100644 --- a/platform/darwin/src/MGLLineStyleLayer.mm +++ b/platform/darwin/src/MGLLineStyleLayer.mm @@ -12,36 +12,28 @@ @interface MGLLineStyleLayer () @property (nonatomic) mbgl::style::LineLayer *layer; -@property (nonatomic, readwrite) NSString *layerIdentifier; -@property (nonatomic, readwrite) NSString *sourceIdentifier; -@property (nonatomic, readwrite) NSString *sourceLayerIdentifier; @end @implementation MGLLineStyleLayer -@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::LineLayer(layerIdentifier.UTF8String, source.sourceIdentifier.UTF8String); + if (self = [super initWithIdentifier:identifier source:source]) { + _layer = new mbgl::style::LineLayer(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::LineLayer(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 |