// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`. #import "MGLSource.h" #import "NSPredicate+MGLAdditions.h" #import "NSDate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" #import "MGLStyleValue_Private.h" #import "MGLBackgroundStyleLayer.h" #include #include @interface MGLBackgroundStyleLayer () @property (nonatomic, readonly) mbgl::style::BackgroundLayer *rawLayer; @end @implementation MGLBackgroundStyleLayer - (instancetype)initWithIdentifier:(NSString *)identifier { auto layer = std::make_unique(identifier.UTF8String); return self = [super initWithPendingLayer:std::move(layer)]; } - (mbgl::style::BackgroundLayer *)rawLayer { return (mbgl::style::BackgroundLayer *)super.rawLayer; } #pragma mark - Accessing the Paint Attributes - (void)setBackgroundColor:(MGLStyleValue *)backgroundColor { MGLAssertStyleLayerIsValid(); auto mbglValue = MGLStyleValueTransformer().toInterpolatablePropertyValue(backgroundColor); self.rawLayer->setBackgroundColor(mbglValue); } - (MGLStyleValue *)backgroundColor { MGLAssertStyleLayerIsValid(); auto propertyValue = self.rawLayer->getBackgroundColor(); if (propertyValue.isUndefined()) { return MGLStyleValueTransformer().toStyleValue(self.rawLayer->getDefaultBackgroundColor()); } return MGLStyleValueTransformer().toStyleValue(propertyValue); } - (void)setBackgroundColorTransition:(MGLTransition )transition { MGLAssertStyleLayerIsValid(); mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } }; self.rawLayer->setBackgroundColorTransition(options); } - (MGLTransition)backgroundColorTransition { MGLAssertStyleLayerIsValid(); mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundColorTransition(); MGLTransition transition; transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero())); transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero())); return transition; } - (void)setBackgroundOpacity:(MGLStyleValue *)backgroundOpacity { MGLAssertStyleLayerIsValid(); auto mbglValue = MGLStyleValueTransformer().toInterpolatablePropertyValue(backgroundOpacity); self.rawLayer->setBackgroundOpacity(mbglValue); } - (MGLStyleValue *)backgroundOpacity { MGLAssertStyleLayerIsValid(); auto propertyValue = self.rawLayer->getBackgroundOpacity(); if (propertyValue.isUndefined()) { return MGLStyleValueTransformer().toStyleValue(self.rawLayer->getDefaultBackgroundOpacity()); } return MGLStyleValueTransformer().toStyleValue(propertyValue); } - (void)setBackgroundOpacityTransition:(MGLTransition )transition { MGLAssertStyleLayerIsValid(); mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } }; self.rawLayer->setBackgroundOpacityTransition(options); } - (MGLTransition)backgroundOpacityTransition { MGLAssertStyleLayerIsValid(); mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundOpacityTransition(); MGLTransition transition; transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero())); transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero())); return transition; } - (void)setBackgroundPattern:(MGLStyleValue *)backgroundPattern { MGLAssertStyleLayerIsValid(); auto mbglValue = MGLStyleValueTransformer().toPropertyValue(backgroundPattern); self.rawLayer->setBackgroundPattern(mbglValue); } - (MGLStyleValue *)backgroundPattern { MGLAssertStyleLayerIsValid(); auto propertyValue = self.rawLayer->getBackgroundPattern(); if (propertyValue.isUndefined()) { return MGLStyleValueTransformer().toStyleValue(self.rawLayer->getDefaultBackgroundPattern()); } return MGLStyleValueTransformer().toStyleValue(propertyValue); } - (void)setBackgroundPatternTransition:(MGLTransition )transition { MGLAssertStyleLayerIsValid(); mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } }; self.rawLayer->setBackgroundPatternTransition(options); } - (MGLTransition)backgroundPatternTransition { MGLAssertStyleLayerIsValid(); mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundPatternTransition(); MGLTransition transition; transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero())); transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero())); return transition; } @end