diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-12-20 12:41:40 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-12-20 12:41:40 -0800 |
commit | a6b1773a44d4ef086eb30967cb041cb64312650a (patch) | |
tree | ec293e38c9ec3ef1f32195f0d5071f73b88497ed /platform/darwin/src/MGLBackgroundStyleLayer.mm | |
parent | dad57df38ef86363da9bff2e62f3fddc5688f0cf (diff) | |
parent | e2fde9cc4eff3de5ab2f513d0c24ad5471d147e6 (diff) | |
download | qtlocation-mapboxgl-a6b1773a44d4ef086eb30967cb041cb64312650a.tar.gz |
Merge branch 'release-ios-v3.4.0' into 1ec5-release-ios-v3.4.0-beta.5-master
Also reran make style-code and manually discarded anything related to fill extrusion layers.
Diffstat (limited to 'platform/darwin/src/MGLBackgroundStyleLayer.mm')
-rw-r--r-- | platform/darwin/src/MGLBackgroundStyleLayer.mm | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm index 253414852a..f6a00de941 100644 --- a/platform/darwin/src/MGLBackgroundStyleLayer.mm +++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm @@ -26,14 +26,24 @@ if (self = [super initWithIdentifier:identifier]) { auto layer = std::make_unique<mbgl::style::BackgroundLayer>(identifier.UTF8String); _pendingLayer = std::move(layer); - _rawLayer = _pendingLayer.get(); + self.rawLayer = _pendingLayer.get(); } return self; } -#pragma mark - Adding to and removing from a map view +- (mbgl::style::BackgroundLayer *)rawLayer +{ + return (mbgl::style::BackgroundLayer *)super.rawLayer; +} -- (void)addToMapView:(MGLMapView *)mapView +- (void)setRawLayer:(mbgl::style::BackgroundLayer *)rawLayer +{ + super.rawLayer = rawLayer; +} + +#pragma mark - Adding to and removing from a map view + +- (void)addToMapView:(MGLMapView *)mapView belowLayer:(MGLStyleLayer *)otherLayer { if (_pendingLayer == nullptr) { [NSException raise:@"MGLRedundantLayerException" @@ -41,11 +51,6 @@ "to the style more than once is invalid.", self, mapView.style]; } - [self addToMapView:mapView belowLayer:nil]; -} - -- (void)addToMapView:(MGLMapView *)mapView belowLayer:(MGLStyleLayer *)otherLayer -{ if (otherLayer) { const mbgl::optional<std::string> belowLayerId{otherLayer.identifier.UTF8String}; mapView.mbglMap->addLayer(std::move(_pendingLayer), belowLayerId); @@ -57,7 +62,7 @@ - (void)removeFromMapView:(MGLMapView *)mapView { _pendingLayer = nullptr; - _rawLayer = nullptr; + self.rawLayer = nullptr; auto removedLayer = mapView.mbglMap->removeLayer(self.identifier.UTF8String); if (!removedLayer) { @@ -72,7 +77,7 @@ removedLayer.release(); _pendingLayer = std::unique_ptr<mbgl::style::BackgroundLayer>(layer); - _rawLayer = _pendingLayer.get(); + self.rawLayer = _pendingLayer.get(); } #pragma mark - Accessing the Paint Attributes @@ -81,13 +86,13 @@ MGLAssertStyleLayerIsValid(); auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(backgroundColor); - _rawLayer->setBackgroundColor(mbglValue); + self.rawLayer->setBackgroundColor(mbglValue); } - (MGLStyleValue<MGLColor *> *)backgroundColor { MGLAssertStyleLayerIsValid(); - auto propertyValue = _rawLayer->getBackgroundColor() ?: _rawLayer->getDefaultBackgroundColor(); + auto propertyValue = self.rawLayer->getBackgroundColor() ?: self.rawLayer->getDefaultBackgroundColor(); return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue); } @@ -95,13 +100,13 @@ MGLAssertStyleLayerIsValid(); auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(backgroundOpacity); - _rawLayer->setBackgroundOpacity(mbglValue); + self.rawLayer->setBackgroundOpacity(mbglValue); } - (MGLStyleValue<NSNumber *> *)backgroundOpacity { MGLAssertStyleLayerIsValid(); - auto propertyValue = _rawLayer->getBackgroundOpacity() ?: _rawLayer->getDefaultBackgroundOpacity(); + auto propertyValue = self.rawLayer->getBackgroundOpacity() ?: self.rawLayer->getDefaultBackgroundOpacity(); return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } @@ -109,13 +114,13 @@ MGLAssertStyleLayerIsValid(); auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(backgroundPattern); - _rawLayer->setBackgroundPattern(mbglValue); + self.rawLayer->setBackgroundPattern(mbglValue); } - (MGLStyleValue<NSString *> *)backgroundPattern { MGLAssertStyleLayerIsValid(); - auto propertyValue = _rawLayer->getBackgroundPattern() ?: _rawLayer->getDefaultBackgroundPattern(); + auto propertyValue = self.rawLayer->getBackgroundPattern() ?: self.rawLayer->getDefaultBackgroundPattern(); return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue); } |