diff options
Diffstat (limited to 'platform/darwin/src/MGLBackgroundStyleLayer.mm')
-rw-r--r-- | platform/darwin/src/MGLBackgroundStyleLayer.mm | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm new file mode 100644 index 0000000000..66e308bb1f --- /dev/null +++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm @@ -0,0 +1,57 @@ +// This file is generated. +// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. + +#import "MGLStyleLayer_Private.hpp" +#import "MGLStyleAttributeValue.h" +#import "MGLBackgroundStyleLayer.h" + +#include <mbgl/style/layers/background_layer.hpp> + +@interface MGLBackgroundStyleLayer () + +@property (nonatomic) mbgl::style::BackgroundLayer *layer; +@property (nonatomic, readwrite) NSString *layerIdentifier; +@property (nonatomic, readwrite) NSString *sourceIdentifier; + +@end + +@implementation MGLBackgroundStyleLayer + +@synthesize mapView; + +- (instancetype)initWithLayerIdentifier:(NSString *)layerIdentifier sourceIdentifier:(NSString *)sourceIdentifier { + if (self = [super init]) { + _layerIdentifier = layerIdentifier; + _sourceIdentifier = sourceIdentifier; + _layer = new mbgl::style::BackgroundLayer(layerIdentifier.UTF8String); + } + return self; +} + +#pragma mark - Accessing the Paint Attributes + +- (void)setBackgroundColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)backgroundColor { + self.layer->setBackgroundColor(backgroundColor.mbgl_colorPropertyValue); +} + +- (id <MGLStyleAttributeValue>)backgroundColor { + return [MGLStyleAttribute mbgl_colorPropertyValueWith:self.layer->getBackgroundColor()]; +} + +- (void)setBackgroundPattern:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)backgroundPattern { + self.layer->setBackgroundPattern(backgroundPattern.mbgl_stringPropertyValue); +} + +- (id <MGLStyleAttributeValue>)backgroundPattern { + return [MGLStyleAttribute mbgl_stringPropertyValueWith:self.layer->getBackgroundPattern()]; +} + +- (void)setBackgroundOpacity:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)backgroundOpacity { + self.layer->setBackgroundOpacity(backgroundOpacity.mbgl_floatPropertyValue); +} + +- (id <MGLStyleAttributeValue>)backgroundOpacity { + return [MGLStyleAttribute mbgl_numberPropertyValueWith:self.layer->getBackgroundOpacity()]; +} + +@end |