diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-11 16:28:19 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-13 10:33:18 -0700 |
commit | e5c6d2838db146bdde68ba365712deb32c61ad67 (patch) | |
tree | dd67748d5907eb480d4c6f86235f13ea636ca14f /platform/darwin | |
parent | 7b041b123cb067d247a727bb3a4563bb2fc575eb (diff) | |
download | qtlocation-mapboxgl-e5c6d2838db146bdde68ba365712deb32c61ad67.tar.gz |
[darwin] Make -[MGLForegroundStyleLayer sourceIdentifier] abstract
It's already overridden by concrete subclasses, and by making it abstract we enable the removal of the private MGLForegroundStyleLayer category.
Diffstat (limited to 'platform/darwin')
-rw-r--r-- | platform/darwin/src/MGLBackgroundStyleLayer.mm | 1 | ||||
-rw-r--r-- | platform/darwin/src/MGLCircleStyleLayer.mm | 3 | ||||
-rw-r--r-- | platform/darwin/src/MGLFillStyleLayer.mm | 3 | ||||
-rw-r--r-- | platform/darwin/src/MGLForegroundStyleLayer.mm | 19 | ||||
-rw-r--r-- | platform/darwin/src/MGLForegroundStyleLayer_Private.h | 20 | ||||
-rw-r--r-- | platform/darwin/src/MGLLineStyleLayer.mm | 3 | ||||
-rw-r--r-- | platform/darwin/src/MGLRasterStyleLayer.mm | 3 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyle.mm | 16 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyleLayer.mm.ejs | 3 | ||||
-rw-r--r-- | platform/darwin/src/MGLSymbolStyleLayer.mm | 3 |
10 files changed, 15 insertions, 59 deletions
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm index 151d4cadaa..47b491fc65 100644 --- a/platform/darwin/src/MGLBackgroundStyleLayer.mm +++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm @@ -5,7 +5,6 @@ #import "NSPredicate+MGLAdditions.h" #import "NSDate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" -#import "MGLForegroundStyleLayer_Private.h" #import "MGLStyleValue_Private.h" #import "MGLBackgroundStyleLayer.h" diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm index 0370f68bda..42961f2e12 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.mm +++ b/platform/darwin/src/MGLCircleStyleLayer.mm @@ -5,7 +5,6 @@ #import "NSPredicate+MGLAdditions.h" #import "NSDate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" -#import "MGLForegroundStyleLayer_Private.h" #import "MGLStyleValue_Private.h" #import "MGLCircleStyleLayer.h" @@ -37,7 +36,7 @@ namespace mbgl { - (instancetype)initWithIdentifier:(NSString *)identifier source:(MGLSource *)source { auto layer = std::make_unique<mbgl::style::CircleLayer>(identifier.UTF8String, source.identifier.UTF8String); - return self = [super initWithPendingLayer:std::move(layer) source:source]; + return self = [super initWithPendingLayer:std::move(layer)]; } - (mbgl::style::CircleLayer *)rawLayer diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm index 1abc36892a..71b01a6661 100644 --- a/platform/darwin/src/MGLFillStyleLayer.mm +++ b/platform/darwin/src/MGLFillStyleLayer.mm @@ -5,7 +5,6 @@ #import "NSPredicate+MGLAdditions.h" #import "NSDate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" -#import "MGLForegroundStyleLayer_Private.h" #import "MGLStyleValue_Private.h" #import "MGLFillStyleLayer.h" @@ -32,7 +31,7 @@ namespace mbgl { - (instancetype)initWithIdentifier:(NSString *)identifier source:(MGLSource *)source { auto layer = std::make_unique<mbgl::style::FillLayer>(identifier.UTF8String, source.identifier.UTF8String); - return self = [super initWithPendingLayer:std::move(layer) source:source]; + return self = [super initWithPendingLayer:std::move(layer)]; } - (mbgl::style::FillLayer *)rawLayer diff --git a/platform/darwin/src/MGLForegroundStyleLayer.mm b/platform/darwin/src/MGLForegroundStyleLayer.mm index 6926dfac1f..6888f89b92 100644 --- a/platform/darwin/src/MGLForegroundStyleLayer.mm +++ b/platform/darwin/src/MGLForegroundStyleLayer.mm @@ -1,22 +1,11 @@ #import "MGLForegroundStyleLayer.h" -#import "MGLForegroundStyleLayer_Private.h" -#import "MGLStyleLayer_Private.h" -#import "MGLSource.h" @implementation MGLForegroundStyleLayer -- (instancetype)initWithRawLayer:(mbgl::style::Layer *)rawLayer source:(MGLSource *)source { - if (self = [super initWithRawLayer:rawLayer]) { - _sourceIdentifier = source.identifier; - } - return self; -} - -- (instancetype)initWithPendingLayer:(std::unique_ptr<mbgl::style::Layer>)pendingLayer source:(MGLSource *)source { - if (self = [super initWithPendingLayer:std::move(pendingLayer)]) { - _sourceIdentifier = source.identifier; - } - return self; +- (NSString *)sourceIdentifier { + [NSException raise:@"MGLAbstractClassException" + format:@"MGLForegroundStyleLayer is an abstract class"]; + return nil; } - (NSString *)description { diff --git a/platform/darwin/src/MGLForegroundStyleLayer_Private.h b/platform/darwin/src/MGLForegroundStyleLayer_Private.h deleted file mode 100644 index 8b8da6c782..0000000000 --- a/platform/darwin/src/MGLForegroundStyleLayer_Private.h +++ /dev/null @@ -1,20 +0,0 @@ -#import "MGLForegroundStyleLayer.h" - -#include <memory> - -NS_ASSUME_NONNULL_BEGIN - -namespace mbgl { - namespace style { - class Layer; - } -} - -@interface MGLForegroundStyleLayer (Private) - -- (instancetype)initWithRawLayer:(mbgl::style::Layer *)rawLayer source:(MGLSource *)source; -- (instancetype)initWithPendingLayer:(std::unique_ptr<mbgl::style::Layer>)pendingLayer source:(MGLSource *)source; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm index b04b238fe2..8b90efd0c4 100644 --- a/platform/darwin/src/MGLLineStyleLayer.mm +++ b/platform/darwin/src/MGLLineStyleLayer.mm @@ -5,7 +5,6 @@ #import "NSPredicate+MGLAdditions.h" #import "NSDate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" -#import "MGLForegroundStyleLayer_Private.h" #import "MGLStyleValue_Private.h" #import "MGLLineStyleLayer.h" @@ -44,7 +43,7 @@ namespace mbgl { - (instancetype)initWithIdentifier:(NSString *)identifier source:(MGLSource *)source { auto layer = std::make_unique<mbgl::style::LineLayer>(identifier.UTF8String, source.identifier.UTF8String); - return self = [super initWithPendingLayer:std::move(layer) source:source]; + return self = [super initWithPendingLayer:std::move(layer)]; } - (mbgl::style::LineLayer *)rawLayer diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm index 8f5415629a..c63fd23529 100644 --- a/platform/darwin/src/MGLRasterStyleLayer.mm +++ b/platform/darwin/src/MGLRasterStyleLayer.mm @@ -5,7 +5,6 @@ #import "NSPredicate+MGLAdditions.h" #import "NSDate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" -#import "MGLForegroundStyleLayer_Private.h" #import "MGLStyleValue_Private.h" #import "MGLRasterStyleLayer.h" @@ -23,7 +22,7 @@ - (instancetype)initWithIdentifier:(NSString *)identifier source:(MGLSource *)source { auto layer = std::make_unique<mbgl::style::RasterLayer>(identifier.UTF8String, source.identifier.UTF8String); - return self = [super initWithPendingLayer:std::move(layer) source:source]; + return self = [super initWithPendingLayer:std::move(layer)]; } - (mbgl::style::RasterLayer *)rawLayer diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index b01d9aa513..0912993825 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -12,7 +12,6 @@ #import "MGLStyle_Private.h" #import "MGLStyleLayer_Private.h" -#import "MGLForegroundStyleLayer_Private.h" #import "MGLSource_Private.h" #import "NSDate+MGLAdditions.h" @@ -332,20 +331,15 @@ static NSURL *MGLStyleURL_emerald; } if (auto fillLayer = rawLayer->as<mbgl::style::FillLayer>()) { - MGLSource *source = [self sourceWithIdentifier:@(fillLayer->getSourceID().c_str())]; - return [[MGLFillStyleLayer alloc] initWithRawLayer:fillLayer source:source]; + return [[MGLFillStyleLayer alloc] initWithRawLayer:fillLayer]; } else if (auto lineLayer = rawLayer->as<mbgl::style::LineLayer>()) { - MGLSource *source = [self sourceWithIdentifier:@(lineLayer->getSourceID().c_str())]; - return [[MGLLineStyleLayer alloc] initWithRawLayer:lineLayer source:source]; + return [[MGLLineStyleLayer alloc] initWithRawLayer:lineLayer]; } else if (auto symbolLayer = rawLayer->as<mbgl::style::SymbolLayer>()) { - MGLSource *source = [self sourceWithIdentifier:@(symbolLayer->getSourceID().c_str())]; - return [[MGLSymbolStyleLayer alloc] initWithRawLayer:symbolLayer source:source]; + return [[MGLSymbolStyleLayer alloc] initWithRawLayer:symbolLayer]; } else if (auto rasterLayer = rawLayer->as<mbgl::style::RasterLayer>()) { - MGLSource *source = [self sourceWithIdentifier:@(rasterLayer->getSourceID().c_str())]; - return [[MGLRasterStyleLayer alloc] initWithRawLayer:rasterLayer source:source]; + return [[MGLRasterStyleLayer alloc] initWithRawLayer:rasterLayer]; } else if (auto circleLayer = rawLayer->as<mbgl::style::CircleLayer>()) { - MGLSource *source = [self sourceWithIdentifier:@(circleLayer->getSourceID().c_str())]; - return [[MGLCircleStyleLayer alloc] initWithRawLayer:circleLayer source:source]; + return [[MGLCircleStyleLayer alloc] initWithRawLayer:circleLayer]; } else if (auto backgroundLayer = rawLayer->as<mbgl::style::BackgroundLayer>()) { return [[MGLBackgroundStyleLayer alloc] initWithRawLayer:backgroundLayer]; } else if (auto customLayer = rawLayer->as<mbgl::style::CustomLayer>()) { diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs index 74b67be74a..da67cbd633 100644 --- a/platform/darwin/src/MGLStyleLayer.mm.ejs +++ b/platform/darwin/src/MGLStyleLayer.mm.ejs @@ -11,7 +11,6 @@ #import "NSPredicate+MGLAdditions.h" #import "NSDate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" -#import "MGLForegroundStyleLayer_Private.h" #import "MGLStyleValue_Private.h" #import "MGL<%- camelize(type) %>StyleLayer.h" @@ -67,7 +66,7 @@ namespace mbgl { - (instancetype)initWithIdentifier:(NSString *)identifier source:(MGLSource *)source { auto layer = std::make_unique<mbgl::style::<%- camelize(type) %>Layer>(identifier.UTF8String, source.identifier.UTF8String); - return self = [super initWithPendingLayer:std::move(layer) source:source]; + return self = [super initWithPendingLayer:std::move(layer)]; } <% } -%> diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm index 502115651c..5a8f8c6084 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.mm +++ b/platform/darwin/src/MGLSymbolStyleLayer.mm @@ -5,7 +5,6 @@ #import "NSPredicate+MGLAdditions.h" #import "NSDate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" -#import "MGLForegroundStyleLayer_Private.h" #import "MGLStyleValue_Private.h" #import "MGLSymbolStyleLayer.h" @@ -91,7 +90,7 @@ namespace mbgl { - (instancetype)initWithIdentifier:(NSString *)identifier source:(MGLSource *)source { auto layer = std::make_unique<mbgl::style::SymbolLayer>(identifier.UTF8String, source.identifier.UTF8String); - return self = [super initWithPendingLayer:std::move(layer) source:source]; + return self = [super initWithPendingLayer:std::move(layer)]; } - (mbgl::style::SymbolLayer *)rawLayer |