diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-09-25 12:37:45 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-10-17 11:47:22 -0700 |
commit | 9652028915af6602626939e0b0075333c34bfbfe (patch) | |
tree | 0b299507c1339dcb1f947a496dcd375095f9bc4b /platform/darwin/src/MGLBackgroundStyleLayer.mm | |
parent | 0c8a3feffa94a9594bcaa77fdc18d11a3c482ff5 (diff) | |
download | qtlocation-mapboxgl-9652028915af6602626939e0b0075333c34bfbfe.tar.gz |
[ios, macos] Expand changes to entire API
Diffstat (limited to 'platform/darwin/src/MGLBackgroundStyleLayer.mm')
-rw-r--r-- | platform/darwin/src/MGLBackgroundStyleLayer.mm | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm index 032aa196ee..33a105e5d5 100644 --- a/platform/darwin/src/MGLBackgroundStyleLayer.mm +++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm @@ -4,7 +4,7 @@ #import "MGLSource.h" #import "NSPredicate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" -#import "MGLStyleAttributeValue.h" +#import "MGLStyleValue_Private.h" #import "MGLBackgroundStyleLayer.h" #include <mbgl/style/layers/background_layer.hpp> @@ -27,28 +27,34 @@ #pragma mark - Accessing the Paint Attributes -- (void)setBackgroundColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)backgroundColor { - self.layer->setBackgroundColor(backgroundColor.mbgl_colorPropertyValue); +- (void)setBackgroundColor:(MGLStyleValue<MGLColor *> *)backgroundColor { + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(backgroundColor); + self.layer->setBackgroundColor(mbglValue); } -- (id <MGLStyleAttributeValue>)backgroundColor { - return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getBackgroundColor() ?: self.layer->getDefaultBackgroundColor()]; +- (MGLStyleValue<MGLColor *> *)backgroundColor { + auto propertyValue = self.layer->getBackgroundColor() ?: self.layer->getDefaultBackgroundColor(); + return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue); } -- (void)setBackgroundPattern:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)backgroundPattern { - self.layer->setBackgroundPattern(backgroundPattern.mbgl_stringPropertyValue); +- (void)setBackgroundPattern:(MGLStyleValue<NSString *> *)backgroundPattern { + auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(backgroundPattern); + self.layer->setBackgroundPattern(mbglValue); } -- (id <MGLStyleAttributeValue>)backgroundPattern { - return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getBackgroundPattern() ?: self.layer->getDefaultBackgroundPattern()]; +- (MGLStyleValue<NSString *> *)backgroundPattern { + auto propertyValue = self.layer->getBackgroundPattern() ?: self.layer->getDefaultBackgroundPattern(); + return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue); } -- (void)setBackgroundOpacity:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)backgroundOpacity { - self.layer->setBackgroundOpacity(backgroundOpacity.mbgl_floatPropertyValue); +- (void)setBackgroundOpacity:(MGLStyleValue<NSNumber *> *)backgroundOpacity { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(backgroundOpacity); + self.layer->setBackgroundOpacity(mbglValue); } -- (id <MGLStyleAttributeValue>)backgroundOpacity { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getBackgroundOpacity() ?: self.layer->getDefaultBackgroundOpacity()]; +- (MGLStyleValue<NSNumber *> *)backgroundOpacity { + auto propertyValue = self.layer->getBackgroundOpacity() ?: self.layer->getDefaultBackgroundOpacity(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } @end |