diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js index 0c8b704e91a..4bcfe54d32f 100644 --- a/platform/darwin/scripts/generate-style-code.js +++ b/platform/darwin/scripts/generate-style-code.js @@ -44,7 +44,8 @@ global.testGetterImplementation = function (property, layerType, isFunction) { if (isFunction) { return `XCTAssertEqualObjects(gLayer.${objCName(property)}, ${value});`; } - return `XCTAssert([(NSValue *)gLayer.${objCName(property)} isEqualToValue:${value}], @"%@ is not equal to %@", gLayer.${objCName(property)}, ${value});`; + return `XCTAssert([gLayer.${objCName(property)} isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.${objCName(property)}, ${value});`; } return `XCTAssertEqualObjects(gLayer.${objCName(property)}, ${value});`; } @@ -129,7 +130,7 @@ global.propertyReqs = function (property, layoutPropertiesByName, type) { return '`' + camelizeWithLeadingLowercase(req['!']) + '` is set to `nil`'; } else { let name = Object.keys(req)[0]; - return '`' + camelizeWithLeadingLowercase(name) + '` is set to ' + describeValue(req[name], layoutPropertiesByName[name], type); + return '`' + camelizeWithLeadingLowercase(name) + '` is set to an `MGLStyleValue` object containing ' + describeValue(req[name], layoutPropertiesByName[name], type); } }).join(', and ') + '. Otherwise, it is ignored.'; }; @@ -204,109 +205,93 @@ global.describeValue = function (value, property, layerType) { }; global.propertyDefault = function (property, layerType) { - return describeValue(property.default, property, layerType); + return 'an `MGLStyleValue` object containing ' + describeValue(property.default, property, layerType); }; -global.propertyType = function (property, _private) { - return _private ? `id ` : `id `; -}; - -global.initLayer = function (layerType) { - if (layerType == "background") { - return `_layer = new mbgl::style::${camelize(layerType)}Layer(identifier.UTF8String);` - } else { - return `_layer = new mbgl::style::${camelize(layerType)}Layer(identifier.UTF8String, source.identifier.UTF8String);` - } -} - -global.setSourceLayer = function() { - return `_layer->setSourceLayer(sourceLayer.UTF8String);` -} - -global.setterImplementation = function(property, layerType) { - let implementation = ''; +global.propertyType = function (property) { switch (property.type) { case 'boolean': - implementation = `self.layer->set${camelize(property.name)}(${objCName(property)}.mbgl_boolPropertyValue);`; - break; + return 'NSNumber *'; case 'number': - implementation = `self.layer->set${camelize(property.name)}(${objCName(property)}.mbgl_floatPropertyValue);`; - break; + return 'NSNumber *'; case 'string': - implementation = `self.layer->set${camelize(property.name)}(${objCName(property)}.mbgl_stringPropertyValue);`; - break; + return 'NSString *'; case 'enum': - let objCType = global.objCType(layerType, property.name); - implementation = `MGLSetEnumProperty(${objCName(property)}, ${camelize(property.name)}, ${mbglType(property)}, ${objCType});`; - break; + return 'NSValue *'; case 'color': - implementation = `self.layer->set${camelize(property.name)}(${objCName(property)}.mbgl_colorPropertyValue);`; - break; + return 'MGLColor *'; case 'array': - implementation = arraySetterImplementation(property); - break; - default: throw new Error(`unknown type for ${property.name}`) - } - return implementation; -} - -global.mbglType = function(property) { - let mbglType = camelize(property.name) + 'Type'; - if (/-translate-anchor$/.test(property.name)) { - mbglType = 'TranslateAnchorType'; - } - if (/-(rotation|pitch)-alignment$/.test(property.name)) { - mbglType = 'AlignmentType'; + switch (arrayType(property)) { + case 'dasharray': + return 'NSArray *'; + case 'font': + return 'NSArray *'; + case 'padding': + return 'NSValue *'; + case 'offset': + case 'translate': + return 'NSValue *'; + default: + throw new Error(`unknown array type for ${property.name}`); + } + default: + throw new Error(`unknown type for ${property.name}`); } - return mbglType; -} - -global.arraySetterImplementation = function(property) { - return `self.layer->set${camelize(property.name)}(${objCName(property)}.mbgl_${convertedType(property)}PropertyValue);`; -} +}; -global.styleAttributeFactory = function (property, layerType) { +global.valueTransformerArguments = function (property) { + let objCType = propertyType(property); switch (property.type) { case 'boolean': - return 'mbgl_boolWithPropertyValueBool'; + return ['bool', objCType]; case 'number': - return 'mbgl_numberWithPropertyValueNumber'; + return ['float', objCType]; case 'string': - return 'mbgl_stringWithPropertyValueString'; + return ['std::string', objCType]; case 'enum': - throw new Error('Use MGLGetEnumProperty() for enums.'); + return [`mbgl::style::${mbglType(property)}`, objCType]; case 'color': - return 'mbgl_colorWithPropertyValueColor'; + return ['mbgl::Color', objCType]; case 'array': - return `mbgl_${convertedType(property)}WithPropertyValue${camelize(convertedType(property))}`; + switch (arrayType(property)) { + case 'dasharray': + return ['std::vector', objCType, 'float']; + case 'font': + return ['std::vector', objCType, 'std::string']; + case 'padding': + return ['std::array', objCType]; + case 'offset': + case 'translate': + return ['std::array', objCType]; + default: + throw new Error(`unknown array type for ${property.name}`); + } default: throw new Error(`unknown type for ${property.name}`); } }; -global.getterImplementation = function(property, layerType) { - if (property.type === 'enum') { - let objCType = global.objCType(layerType, property.name); - return `MGLGetEnumProperty(${camelize(property.name)}, ${mbglType(property)}, ${objCType});`; +global.initLayer = function (layerType) { + if (layerType == "background") { + return `_layer = new mbgl::style::${camelize(layerType)}Layer(identifier.UTF8String);` + } else { + return `_layer = new mbgl::style::${camelize(layerType)}Layer(identifier.UTF8String, source.identifier.UTF8String);` } - let rawValue = `self.layer->get${camelize(property.name)}() ?: self.layer->getDefault${camelize(property.name)}()`; - return `return [MGLStyleAttribute ${styleAttributeFactory(property, layerType)}:${rawValue}];`; } -global.convertedType = function(property) { - switch (arrayType(property)) { - case 'dasharray': - return 'numberArray'; - case 'font': - return 'stringArray'; - case 'padding': - return 'padding'; - case 'offset': - case 'translate': - return 'offset'; - default: - throw new Error(`unknown array type for ${property.name}`); +global.setSourceLayer = function() { + return `_layer->setSourceLayer(sourceLayer.UTF8String);` +} + +global.mbglType = function(property) { + let mbglType = camelize(property.name) + 'Type'; + if (/-translate-anchor$/.test(property.name)) { + mbglType = 'TranslateAnchorType'; } + if (/-(rotation|pitch)-alignment$/.test(property.name)) { + mbglType = 'AlignmentType'; + } + return mbglType; } const layerH = ejs.compile(fs.readFileSync('platform/darwin/src/MGLStyleLayer.h.ejs', 'utf8'), { strict: true }); diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.h b/platform/darwin/src/MGLBackgroundStyleLayer.h index 1a4c64dedfe..1c167fc91c6 100644 --- a/platform/darwin/src/MGLBackgroundStyleLayer.h +++ b/platform/darwin/src/MGLBackgroundStyleLayer.h @@ -1,7 +1,7 @@ // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. -#import "MGLStyleAttributeValue.h" +#import "MGLStyleValue.h" #import "MGLStyleLayer.h" NS_ASSUME_NONNULL_BEGIN @@ -22,33 +22,33 @@ NS_ASSUME_NONNULL_BEGIN /** The color with which the background will be drawn. - The default value of this property is `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `backgroundPattern` is set to `nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id backgroundColor; +@property (nonatomic, null_resettable) MGLStyleValue *backgroundColor; #else /** The color with which the background will be drawn. - The default value of this property is `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `backgroundPattern` is set to `nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id backgroundColor; +@property (nonatomic, null_resettable) MGLStyleValue *backgroundColor; #endif /** Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). */ -@property (nonatomic, null_resettable) id backgroundPattern; +@property (nonatomic, null_resettable) MGLStyleValue *backgroundPattern; /** The opacity at which the background will be drawn. - The default value of this property is an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id backgroundOpacity; +@property (nonatomic, null_resettable) MGLStyleValue *backgroundOpacity; @end diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm index 032aa196ee3..33a105e5d53 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 @@ -27,28 +27,34 @@ - (instancetype)initWithIdentifier:(NSString *)identifier #pragma mark - Accessing the Paint Attributes -- (void)setBackgroundColor:(id )backgroundColor { - self.layer->setBackgroundColor(backgroundColor.mbgl_colorPropertyValue); +- (void)setBackgroundColor:(MGLStyleValue *)backgroundColor { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(backgroundColor); + self.layer->setBackgroundColor(mbglValue); } -- (id )backgroundColor { - return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getBackgroundColor() ?: self.layer->getDefaultBackgroundColor()]; +- (MGLStyleValue *)backgroundColor { + auto propertyValue = self.layer->getBackgroundColor() ?: self.layer->getDefaultBackgroundColor(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setBackgroundPattern:(id )backgroundPattern { - self.layer->setBackgroundPattern(backgroundPattern.mbgl_stringPropertyValue); +- (void)setBackgroundPattern:(MGLStyleValue *)backgroundPattern { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(backgroundPattern); + self.layer->setBackgroundPattern(mbglValue); } -- (id )backgroundPattern { - return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getBackgroundPattern() ?: self.layer->getDefaultBackgroundPattern()]; +- (MGLStyleValue *)backgroundPattern { + auto propertyValue = self.layer->getBackgroundPattern() ?: self.layer->getDefaultBackgroundPattern(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setBackgroundOpacity:(id )backgroundOpacity { - self.layer->setBackgroundOpacity(backgroundOpacity.mbgl_floatPropertyValue); +- (void)setBackgroundOpacity:(MGLStyleValue *)backgroundOpacity { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(backgroundOpacity); + self.layer->setBackgroundOpacity(mbglValue); } -- (id )backgroundOpacity { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getBackgroundOpacity() ?: self.layer->getDefaultBackgroundOpacity()]; +- (MGLStyleValue *)backgroundOpacity { + auto propertyValue = self.layer->getBackgroundOpacity() ?: self.layer->getDefaultBackgroundOpacity(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } @end diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h index 9a45f7280cc..6006250cdf0 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.h +++ b/platform/darwin/src/MGLCircleStyleLayer.h @@ -1,7 +1,7 @@ // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. -#import "MGLStyleAttributeValue.h" +#import "MGLStyleValue.h" #import "MGLVectorStyleLayer.h" NS_ASSUME_NONNULL_BEGIN @@ -53,64 +53,64 @@ typedef NS_ENUM(NSUInteger, MGLCirclePitchScale) { This property is measured in points. - The default value of this property is an `NSNumber` object containing the float `5`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `5`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id circleRadius; +@property (nonatomic, null_resettable) MGLStyleValue *circleRadius; #if TARGET_OS_IPHONE /** The fill color of the circle. - The default value of this property is `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id circleColor; +@property (nonatomic, null_resettable) MGLStyleValue *circleColor; #else /** The fill color of the circle. - The default value of this property is `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id circleColor; +@property (nonatomic, null_resettable) MGLStyleValue *circleColor; #endif /** Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity. - The default value of this property is an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id circleBlur; +@property (nonatomic, null_resettable) MGLStyleValue *circleBlur; /** The opacity at which the circle will be drawn. - The default value of this property is an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id circleOpacity; +@property (nonatomic, null_resettable) MGLStyleValue *circleOpacity; /** The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. This property is measured in points. - The default value of this property is an `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id circleTranslate; +@property (nonatomic, null_resettable) MGLStyleValue *circleTranslate; /** Controls the translation reference point. - The default value of this property is an `NSValue` object containing `MGLCircleTranslateAnchorMap`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLCircleTranslateAnchorMap`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `circleTranslate` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id circleTranslateAnchor; +@property (nonatomic, null_resettable) MGLStyleValue *circleTranslateAnchor; /** Controls the scaling behavior of the circle when the map is pitched. - The default value of this property is an `NSValue` object containing `MGLCirclePitchScaleMap`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLCirclePitchScaleMap`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id circlePitchScale; +@property (nonatomic, null_resettable) MGLStyleValue *circlePitchScale; @end diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm index 31fa795d540..8fe97a05370 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.mm +++ b/platform/darwin/src/MGLCircleStyleLayer.mm @@ -4,7 +4,7 @@ #import "MGLSource.h" #import "NSPredicate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" -#import "MGLStyleAttributeValue.h" +#import "MGLStyleValue_Private.h" #import "MGLCircleStyleLayer.h" #include @@ -48,60 +48,74 @@ - (NSPredicate *)predicate #pragma mark - Accessing the Paint Attributes -- (void)setCircleRadius:(id )circleRadius { - self.layer->setCircleRadius(circleRadius.mbgl_floatPropertyValue); +- (void)setCircleRadius:(MGLStyleValue *)circleRadius { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(circleRadius); + self.layer->setCircleRadius(mbglValue); } -- (id )circleRadius { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getCircleRadius() ?: self.layer->getDefaultCircleRadius()]; +- (MGLStyleValue *)circleRadius { + auto propertyValue = self.layer->getCircleRadius() ?: self.layer->getDefaultCircleRadius(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setCircleColor:(id )circleColor { - self.layer->setCircleColor(circleColor.mbgl_colorPropertyValue); +- (void)setCircleColor:(MGLStyleValue *)circleColor { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(circleColor); + self.layer->setCircleColor(mbglValue); } -- (id )circleColor { - return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getCircleColor() ?: self.layer->getDefaultCircleColor()]; +- (MGLStyleValue *)circleColor { + auto propertyValue = self.layer->getCircleColor() ?: self.layer->getDefaultCircleColor(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setCircleBlur:(id )circleBlur { - self.layer->setCircleBlur(circleBlur.mbgl_floatPropertyValue); +- (void)setCircleBlur:(MGLStyleValue *)circleBlur { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(circleBlur); + self.layer->setCircleBlur(mbglValue); } -- (id )circleBlur { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getCircleBlur() ?: self.layer->getDefaultCircleBlur()]; +- (MGLStyleValue *)circleBlur { + auto propertyValue = self.layer->getCircleBlur() ?: self.layer->getDefaultCircleBlur(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setCircleOpacity:(id )circleOpacity { - self.layer->setCircleOpacity(circleOpacity.mbgl_floatPropertyValue); +- (void)setCircleOpacity:(MGLStyleValue *)circleOpacity { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(circleOpacity); + self.layer->setCircleOpacity(mbglValue); } -- (id )circleOpacity { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getCircleOpacity() ?: self.layer->getDefaultCircleOpacity()]; +- (MGLStyleValue *)circleOpacity { + auto propertyValue = self.layer->getCircleOpacity() ?: self.layer->getDefaultCircleOpacity(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setCircleTranslate:(id )circleTranslate { - self.layer->setCircleTranslate(circleTranslate.mbgl_offsetPropertyValue); +- (void)setCircleTranslate:(MGLStyleValue *)circleTranslate { + auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(circleTranslate); + self.layer->setCircleTranslate(mbglValue); } -- (id )circleTranslate { - return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getCircleTranslate() ?: self.layer->getDefaultCircleTranslate()]; +- (MGLStyleValue *)circleTranslate { + auto propertyValue = self.layer->getCircleTranslate() ?: self.layer->getDefaultCircleTranslate(); + return MGLStyleValueTransformer, NSValue *>().toStyleValue(propertyValue); } -- (void)setCircleTranslateAnchor:(id )circleTranslateAnchor { - MGLSetEnumProperty(circleTranslateAnchor, CircleTranslateAnchor, TranslateAnchorType, MGLCircleTranslateAnchor); +- (void)setCircleTranslateAnchor:(MGLStyleValue *)circleTranslateAnchor { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(circleTranslateAnchor); + self.layer->setCircleTranslateAnchor(mbglValue); } -- (id )circleTranslateAnchor { - MGLGetEnumProperty(CircleTranslateAnchor, TranslateAnchorType, MGLCircleTranslateAnchor); +- (MGLStyleValue *)circleTranslateAnchor { + auto propertyValue = self.layer->getCircleTranslateAnchor() ?: self.layer->getDefaultCircleTranslateAnchor(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setCirclePitchScale:(id )circlePitchScale { - MGLSetEnumProperty(circlePitchScale, CirclePitchScale, CirclePitchScaleType, MGLCirclePitchScale); +- (void)setCirclePitchScale:(MGLStyleValue *)circlePitchScale { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(circlePitchScale); + self.layer->setCirclePitchScale(mbglValue); } -- (id )circlePitchScale { - MGLGetEnumProperty(CirclePitchScale, CirclePitchScaleType, MGLCirclePitchScale); +- (MGLStyleValue *)circlePitchScale { + auto propertyValue = self.layer->getCirclePitchScale() ?: self.layer->getDefaultCirclePitchScale(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } @end diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h index d9ce1abacec..712bfea9980 100644 --- a/platform/darwin/src/MGLFillStyleLayer.h +++ b/platform/darwin/src/MGLFillStyleLayer.h @@ -1,7 +1,7 @@ // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. -#import "MGLStyleAttributeValue.h" +#import "MGLStyleValue.h" #import "MGLVectorStyleLayer.h" NS_ASSUME_NONNULL_BEGIN @@ -35,66 +35,66 @@ typedef NS_ENUM(NSUInteger, MGLFillTranslateAnchor) { /** Whether or not the fill should be antialiased. - The default value of this property is an `NSNumber` object containing `YES`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `YES`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id fillAntialias; +@property (nonatomic, null_resettable) MGLStyleValue *fillAntialias; /** The opacity of the entire fill layer. In contrast to the `fillColor`, this value will also affect the 1pt stroke around the fill, if the stroke is used. - The default value of this property is an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id fillOpacity; +@property (nonatomic, null_resettable) MGLStyleValue *fillOpacity; #if TARGET_OS_IPHONE /** The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the color's opacity will not affect the opacity of the 1pt stroke, if it is used. - The default value of this property is `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `fillPattern` is set to `nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id fillColor; +@property (nonatomic, null_resettable) MGLStyleValue *fillColor; #else /** The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the color's opacity will not affect the opacity of the 1pt stroke, if it is used. - The default value of this property is `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `fillPattern` is set to `nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id fillColor; +@property (nonatomic, null_resettable) MGLStyleValue *fillColor; #endif /** The outline color of the fill. Matches the value of `fillColor` if unspecified. - This property is only applied to the style if `fillPattern` is set to `nil`, and `fillAntialias` is set to an `NSNumber` object containing `YES`. Otherwise, it is ignored. + This property is only applied to the style if `fillPattern` is set to `nil`, and `fillAntialias` is set to an `MGLStyleValue` object containing an `NSNumber` object containing `YES`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id fillOutlineColor; +@property (nonatomic, null_resettable) MGLStyleValue *fillOutlineColor; /** The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. This property is measured in points. - The default value of this property is an `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id fillTranslate; +@property (nonatomic, null_resettable) MGLStyleValue *fillTranslate; /** Controls the translation reference point. - The default value of this property is an `NSValue` object containing `MGLFillTranslateAnchorMap`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLFillTranslateAnchorMap`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `fillTranslate` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id fillTranslateAnchor; +@property (nonatomic, null_resettable) MGLStyleValue *fillTranslateAnchor; /** Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). */ -@property (nonatomic, null_resettable) id fillPattern; +@property (nonatomic, null_resettable) MGLStyleValue *fillPattern; @end diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm index a2320f4fdac..e16e3b26522 100644 --- a/platform/darwin/src/MGLFillStyleLayer.mm +++ b/platform/darwin/src/MGLFillStyleLayer.mm @@ -4,7 +4,7 @@ #import "MGLSource.h" #import "NSPredicate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" -#import "MGLStyleAttributeValue.h" +#import "MGLStyleValue_Private.h" #import "MGLFillStyleLayer.h" #include @@ -48,60 +48,74 @@ - (NSPredicate *)predicate #pragma mark - Accessing the Paint Attributes -- (void)setFillAntialias:(id )fillAntialias { - self.layer->setFillAntialias(fillAntialias.mbgl_boolPropertyValue); +- (void)setFillAntialias:(MGLStyleValue *)fillAntialias { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(fillAntialias); + self.layer->setFillAntialias(mbglValue); } -- (id )fillAntialias { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getFillAntialias() ?: self.layer->getDefaultFillAntialias()]; +- (MGLStyleValue *)fillAntialias { + auto propertyValue = self.layer->getFillAntialias() ?: self.layer->getDefaultFillAntialias(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setFillOpacity:(id )fillOpacity { - self.layer->setFillOpacity(fillOpacity.mbgl_floatPropertyValue); +- (void)setFillOpacity:(MGLStyleValue *)fillOpacity { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(fillOpacity); + self.layer->setFillOpacity(mbglValue); } -- (id )fillOpacity { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getFillOpacity() ?: self.layer->getDefaultFillOpacity()]; +- (MGLStyleValue *)fillOpacity { + auto propertyValue = self.layer->getFillOpacity() ?: self.layer->getDefaultFillOpacity(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setFillColor:(id )fillColor { - self.layer->setFillColor(fillColor.mbgl_colorPropertyValue); +- (void)setFillColor:(MGLStyleValue *)fillColor { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(fillColor); + self.layer->setFillColor(mbglValue); } -- (id )fillColor { - return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getFillColor() ?: self.layer->getDefaultFillColor()]; +- (MGLStyleValue *)fillColor { + auto propertyValue = self.layer->getFillColor() ?: self.layer->getDefaultFillColor(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setFillOutlineColor:(id )fillOutlineColor { - self.layer->setFillOutlineColor(fillOutlineColor.mbgl_colorPropertyValue); +- (void)setFillOutlineColor:(MGLStyleValue *)fillOutlineColor { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(fillOutlineColor); + self.layer->setFillOutlineColor(mbglValue); } -- (id )fillOutlineColor { - return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getFillOutlineColor() ?: self.layer->getDefaultFillOutlineColor()]; +- (MGLStyleValue *)fillOutlineColor { + auto propertyValue = self.layer->getFillOutlineColor() ?: self.layer->getDefaultFillOutlineColor(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setFillTranslate:(id )fillTranslate { - self.layer->setFillTranslate(fillTranslate.mbgl_offsetPropertyValue); +- (void)setFillTranslate:(MGLStyleValue *)fillTranslate { + auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(fillTranslate); + self.layer->setFillTranslate(mbglValue); } -- (id )fillTranslate { - return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getFillTranslate() ?: self.layer->getDefaultFillTranslate()]; +- (MGLStyleValue *)fillTranslate { + auto propertyValue = self.layer->getFillTranslate() ?: self.layer->getDefaultFillTranslate(); + return MGLStyleValueTransformer, NSValue *>().toStyleValue(propertyValue); } -- (void)setFillTranslateAnchor:(id )fillTranslateAnchor { - MGLSetEnumProperty(fillTranslateAnchor, FillTranslateAnchor, TranslateAnchorType, MGLFillTranslateAnchor); +- (void)setFillTranslateAnchor:(MGLStyleValue *)fillTranslateAnchor { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(fillTranslateAnchor); + self.layer->setFillTranslateAnchor(mbglValue); } -- (id )fillTranslateAnchor { - MGLGetEnumProperty(FillTranslateAnchor, TranslateAnchorType, MGLFillTranslateAnchor); +- (MGLStyleValue *)fillTranslateAnchor { + auto propertyValue = self.layer->getFillTranslateAnchor() ?: self.layer->getDefaultFillTranslateAnchor(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setFillPattern:(id )fillPattern { - self.layer->setFillPattern(fillPattern.mbgl_stringPropertyValue); +- (void)setFillPattern:(MGLStyleValue *)fillPattern { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(fillPattern); + self.layer->setFillPattern(mbglValue); } -- (id )fillPattern { - return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getFillPattern() ?: self.layer->getDefaultFillPattern()]; +- (MGLStyleValue *)fillPattern { + auto propertyValue = self.layer->getFillPattern() ?: self.layer->getDefaultFillPattern(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } @end diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index 5fb9693e787..663e9277182 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -1,7 +1,7 @@ // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. -#import "MGLStyleAttributeValue.h" +#import "MGLStyleValue.h" #import "MGLVectorStyleLayer.h" NS_ASSUME_NONNULL_BEGIN @@ -75,62 +75,62 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { /** The display of line endings. - The default value of this property is an `NSValue` object containing `MGLLineCapButt`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLLineCapButt`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id lineCap; +@property (nonatomic, null_resettable) MGLStyleValue *lineCap; /** The display of lines when joining. - The default value of this property is an `NSValue` object containing `MGLLineJoinMiter`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLLineJoinMiter`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id lineJoin; +@property (nonatomic, null_resettable) MGLStyleValue *lineJoin; /** Used to automatically convert miter joins to bevel joins for sharp angles. - The default value of this property is an `NSNumber` object containing the float `2`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `2`. Set this property to `nil` to reset it to the default value. - This property is only applied to the style if `lineJoin` is set to an `NSValue` object containing `MGLLineJoinMiter`. Otherwise, it is ignored. + This property is only applied to the style if `lineJoin` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLLineJoinMiter`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id lineMiterLimit; +@property (nonatomic, null_resettable) MGLStyleValue *lineMiterLimit; /** Used to automatically convert round joins to miter joins for shallow angles. - The default value of this property is an `NSNumber` object containing the float `1.05`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1.05`. Set this property to `nil` to reset it to the default value. - This property is only applied to the style if `lineJoin` is set to an `NSValue` object containing `MGLLineJoinRound`. Otherwise, it is ignored. + This property is only applied to the style if `lineJoin` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLLineJoinRound`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id lineRoundLimit; +@property (nonatomic, null_resettable) MGLStyleValue *lineRoundLimit; #pragma mark - Accessing the Paint Attributes /** The opacity at which the line will be drawn. - The default value of this property is an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id lineOpacity; +@property (nonatomic, null_resettable) MGLStyleValue *lineOpacity; #if TARGET_OS_IPHONE /** The color with which the line will be drawn. - The default value of this property is `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `linePattern` is set to `nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id lineColor; +@property (nonatomic, null_resettable) MGLStyleValue *lineColor; #else /** The color with which the line will be drawn. - The default value of this property is `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `linePattern` is set to `nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id lineColor; +@property (nonatomic, null_resettable) MGLStyleValue *lineColor; #endif /** @@ -138,54 +138,54 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { This property is measured in points. - The default value of this property is an `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id lineTranslate; +@property (nonatomic, null_resettable) MGLStyleValue *lineTranslate; /** Controls the translation reference point. - The default value of this property is an `NSValue` object containing `MGLLineTranslateAnchorMap`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLLineTranslateAnchorMap`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `lineTranslate` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id lineTranslateAnchor; +@property (nonatomic, null_resettable) MGLStyleValue *lineTranslateAnchor; /** Stroke thickness. This property is measured in points. - The default value of this property is an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id lineWidth; +@property (nonatomic, null_resettable) MGLStyleValue *lineWidth; /** Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap. This property is measured in points. - The default value of this property is an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id lineGapWidth; +@property (nonatomic, null_resettable) MGLStyleValue *lineGapWidth; /** The line's offset. For linear features, a positive value offsets the line to the right, relative to the direction of the line, and a negative value to the left. For polygon features, a positive value results in an inset, and a negative value results in an outset. This property is measured in points. - The default value of this property is an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id lineOffset; +@property (nonatomic, null_resettable) MGLStyleValue *lineOffset; /** Blur applied to the line, in points. This property is measured in points. - The default value of this property is an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id lineBlur; +@property (nonatomic, null_resettable) MGLStyleValue *lineBlur; /** Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to points, multiply the length by the current line width. @@ -194,12 +194,12 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { This property is only applied to the style if `linePattern` is set to `nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id lineDasharray; +@property (nonatomic, null_resettable) MGLStyleValue *> *lineDasharray; /** Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512). */ -@property (nonatomic, null_resettable) id linePattern; +@property (nonatomic, null_resettable) MGLStyleValue *linePattern; @end diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm index 9577b0d777e..57724a0600e 100644 --- a/platform/darwin/src/MGLLineStyleLayer.mm +++ b/platform/darwin/src/MGLLineStyleLayer.mm @@ -4,7 +4,7 @@ #import "MGLSource.h" #import "NSPredicate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" -#import "MGLStyleAttributeValue.h" +#import "MGLStyleValue_Private.h" #import "MGLLineStyleLayer.h" #include @@ -48,118 +48,146 @@ - (NSPredicate *)predicate #pragma mark - Accessing the Layout Attributes -- (void)setLineCap:(id )lineCap { - MGLSetEnumProperty(lineCap, LineCap, LineCapType, MGLLineCap); +- (void)setLineCap:(MGLStyleValue *)lineCap { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(lineCap); + self.layer->setLineCap(mbglValue); } -- (id )lineCap { - MGLGetEnumProperty(LineCap, LineCapType, MGLLineCap); +- (MGLStyleValue *)lineCap { + auto propertyValue = self.layer->getLineCap() ?: self.layer->getDefaultLineCap(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setLineJoin:(id )lineJoin { - MGLSetEnumProperty(lineJoin, LineJoin, LineJoinType, MGLLineJoin); +- (void)setLineJoin:(MGLStyleValue *)lineJoin { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(lineJoin); + self.layer->setLineJoin(mbglValue); } -- (id )lineJoin { - MGLGetEnumProperty(LineJoin, LineJoinType, MGLLineJoin); +- (MGLStyleValue *)lineJoin { + auto propertyValue = self.layer->getLineJoin() ?: self.layer->getDefaultLineJoin(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setLineMiterLimit:(id )lineMiterLimit { - self.layer->setLineMiterLimit(lineMiterLimit.mbgl_floatPropertyValue); +- (void)setLineMiterLimit:(MGLStyleValue *)lineMiterLimit { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(lineMiterLimit); + self.layer->setLineMiterLimit(mbglValue); } -- (id )lineMiterLimit { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineMiterLimit() ?: self.layer->getDefaultLineMiterLimit()]; +- (MGLStyleValue *)lineMiterLimit { + auto propertyValue = self.layer->getLineMiterLimit() ?: self.layer->getDefaultLineMiterLimit(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setLineRoundLimit:(id )lineRoundLimit { - self.layer->setLineRoundLimit(lineRoundLimit.mbgl_floatPropertyValue); +- (void)setLineRoundLimit:(MGLStyleValue *)lineRoundLimit { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(lineRoundLimit); + self.layer->setLineRoundLimit(mbglValue); } -- (id )lineRoundLimit { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineRoundLimit() ?: self.layer->getDefaultLineRoundLimit()]; +- (MGLStyleValue *)lineRoundLimit { + auto propertyValue = self.layer->getLineRoundLimit() ?: self.layer->getDefaultLineRoundLimit(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } #pragma mark - Accessing the Paint Attributes -- (void)setLineOpacity:(id )lineOpacity { - self.layer->setLineOpacity(lineOpacity.mbgl_floatPropertyValue); +- (void)setLineOpacity:(MGLStyleValue *)lineOpacity { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(lineOpacity); + self.layer->setLineOpacity(mbglValue); } -- (id )lineOpacity { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineOpacity() ?: self.layer->getDefaultLineOpacity()]; +- (MGLStyleValue *)lineOpacity { + auto propertyValue = self.layer->getLineOpacity() ?: self.layer->getDefaultLineOpacity(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setLineColor:(id )lineColor { - self.layer->setLineColor(lineColor.mbgl_colorPropertyValue); +- (void)setLineColor:(MGLStyleValue *)lineColor { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(lineColor); + self.layer->setLineColor(mbglValue); } -- (id )lineColor { - return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getLineColor() ?: self.layer->getDefaultLineColor()]; +- (MGLStyleValue *)lineColor { + auto propertyValue = self.layer->getLineColor() ?: self.layer->getDefaultLineColor(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setLineTranslate:(id )lineTranslate { - self.layer->setLineTranslate(lineTranslate.mbgl_offsetPropertyValue); +- (void)setLineTranslate:(MGLStyleValue *)lineTranslate { + auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(lineTranslate); + self.layer->setLineTranslate(mbglValue); } -- (id )lineTranslate { - return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getLineTranslate() ?: self.layer->getDefaultLineTranslate()]; +- (MGLStyleValue *)lineTranslate { + auto propertyValue = self.layer->getLineTranslate() ?: self.layer->getDefaultLineTranslate(); + return MGLStyleValueTransformer, NSValue *>().toStyleValue(propertyValue); } -- (void)setLineTranslateAnchor:(id )lineTranslateAnchor { - MGLSetEnumProperty(lineTranslateAnchor, LineTranslateAnchor, TranslateAnchorType, MGLLineTranslateAnchor); +- (void)setLineTranslateAnchor:(MGLStyleValue *)lineTranslateAnchor { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(lineTranslateAnchor); + self.layer->setLineTranslateAnchor(mbglValue); } -- (id )lineTranslateAnchor { - MGLGetEnumProperty(LineTranslateAnchor, TranslateAnchorType, MGLLineTranslateAnchor); +- (MGLStyleValue *)lineTranslateAnchor { + auto propertyValue = self.layer->getLineTranslateAnchor() ?: self.layer->getDefaultLineTranslateAnchor(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setLineWidth:(id )lineWidth { - self.layer->setLineWidth(lineWidth.mbgl_floatPropertyValue); +- (void)setLineWidth:(MGLStyleValue *)lineWidth { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(lineWidth); + self.layer->setLineWidth(mbglValue); } -- (id )lineWidth { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineWidth() ?: self.layer->getDefaultLineWidth()]; +- (MGLStyleValue *)lineWidth { + auto propertyValue = self.layer->getLineWidth() ?: self.layer->getDefaultLineWidth(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setLineGapWidth:(id )lineGapWidth { - self.layer->setLineGapWidth(lineGapWidth.mbgl_floatPropertyValue); +- (void)setLineGapWidth:(MGLStyleValue *)lineGapWidth { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(lineGapWidth); + self.layer->setLineGapWidth(mbglValue); } -- (id )lineGapWidth { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineGapWidth() ?: self.layer->getDefaultLineGapWidth()]; +- (MGLStyleValue *)lineGapWidth { + auto propertyValue = self.layer->getLineGapWidth() ?: self.layer->getDefaultLineGapWidth(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setLineOffset:(id )lineOffset { - self.layer->setLineOffset(lineOffset.mbgl_floatPropertyValue); +- (void)setLineOffset:(MGLStyleValue *)lineOffset { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(lineOffset); + self.layer->setLineOffset(mbglValue); } -- (id )lineOffset { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineOffset() ?: self.layer->getDefaultLineOffset()]; +- (MGLStyleValue *)lineOffset { + auto propertyValue = self.layer->getLineOffset() ?: self.layer->getDefaultLineOffset(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setLineBlur:(id )lineBlur { - self.layer->setLineBlur(lineBlur.mbgl_floatPropertyValue); +- (void)setLineBlur:(MGLStyleValue *)lineBlur { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(lineBlur); + self.layer->setLineBlur(mbglValue); } -- (id )lineBlur { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineBlur() ?: self.layer->getDefaultLineBlur()]; +- (MGLStyleValue *)lineBlur { + auto propertyValue = self.layer->getLineBlur() ?: self.layer->getDefaultLineBlur(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setLineDasharray:(id )lineDasharray { - self.layer->setLineDasharray(lineDasharray.mbgl_numberArrayPropertyValue); +- (void)setLineDasharray:(MGLStyleValue *> *)lineDasharray { + auto mbglValue = MGLStyleValueTransformer, NSArray *, float>().toPropertyValue(lineDasharray); + self.layer->setLineDasharray(mbglValue); } -- (id )lineDasharray { - return [MGLStyleAttribute mbgl_numberArrayWithPropertyValueNumberArray:self.layer->getLineDasharray() ?: self.layer->getDefaultLineDasharray()]; +- (MGLStyleValue *> *)lineDasharray { + auto propertyValue = self.layer->getLineDasharray() ?: self.layer->getDefaultLineDasharray(); + return MGLStyleValueTransformer, NSArray *, float>().toStyleValue(propertyValue); } -- (void)setLinePattern:(id )linePattern { - self.layer->setLinePattern(linePattern.mbgl_stringPropertyValue); +- (void)setLinePattern:(MGLStyleValue *)linePattern { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(linePattern); + self.layer->setLinePattern(mbglValue); } -- (id )linePattern { - return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getLinePattern() ?: self.layer->getDefaultLinePattern()]; +- (MGLStyleValue *)linePattern { + auto propertyValue = self.layer->getLinePattern() ?: self.layer->getDefaultLinePattern(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } @end diff --git a/platform/darwin/src/MGLRasterStyleLayer.h b/platform/darwin/src/MGLRasterStyleLayer.h index 90af43c7a1e..afae85001e3 100644 --- a/platform/darwin/src/MGLRasterStyleLayer.h +++ b/platform/darwin/src/MGLRasterStyleLayer.h @@ -1,7 +1,7 @@ // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. -#import "MGLStyleAttributeValue.h" +#import "MGLStyleValue.h" #import "MGLForegroundStyleLayer.h" NS_ASSUME_NONNULL_BEGIN @@ -19,55 +19,55 @@ NS_ASSUME_NONNULL_BEGIN /** The opacity at which the image will be drawn. - The default value of this property is an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id rasterOpacity; +@property (nonatomic, null_resettable) MGLStyleValue *rasterOpacity; /** Rotates hues around the color wheel. This property is measured in degrees. - The default value of this property is an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id rasterHueRotate; +@property (nonatomic, null_resettable) MGLStyleValue *rasterHueRotate; /** Increase or reduce the brightness of the image. The value is the minimum brightness. - The default value of this property is an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id rasterBrightnessMin; +@property (nonatomic, null_resettable) MGLStyleValue *rasterBrightnessMin; /** Increase or reduce the brightness of the image. The value is the maximum brightness. - The default value of this property is an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id rasterBrightnessMax; +@property (nonatomic, null_resettable) MGLStyleValue *rasterBrightnessMax; /** Increase or reduce the saturation of the image. - The default value of this property is an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id rasterSaturation; +@property (nonatomic, null_resettable) MGLStyleValue *rasterSaturation; /** Increase or reduce the contrast of the image. - The default value of this property is an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id rasterContrast; +@property (nonatomic, null_resettable) MGLStyleValue *rasterContrast; /** Fade duration when a new tile is added. This property is measured in milliseconds. - The default value of this property is an `NSNumber` object containing the float `300`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `300`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id rasterFadeDuration; +@property (nonatomic, null_resettable) MGLStyleValue *rasterFadeDuration; @end diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm index 01d3bf2bcac..f616e895181 100644 --- a/platform/darwin/src/MGLRasterStyleLayer.mm +++ b/platform/darwin/src/MGLRasterStyleLayer.mm @@ -4,7 +4,7 @@ #import "MGLSource.h" #import "NSPredicate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" -#import "MGLStyleAttributeValue.h" +#import "MGLStyleValue_Private.h" #import "MGLRasterStyleLayer.h" #include @@ -27,60 +27,74 @@ - (instancetype)initWithIdentifier:(NSString *)identifier source:(MGLSource *)so #pragma mark - Accessing the Paint Attributes -- (void)setRasterOpacity:(id )rasterOpacity { - self.layer->setRasterOpacity(rasterOpacity.mbgl_floatPropertyValue); +- (void)setRasterOpacity:(MGLStyleValue *)rasterOpacity { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(rasterOpacity); + self.layer->setRasterOpacity(mbglValue); } -- (id )rasterOpacity { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterOpacity() ?: self.layer->getDefaultRasterOpacity()]; +- (MGLStyleValue *)rasterOpacity { + auto propertyValue = self.layer->getRasterOpacity() ?: self.layer->getDefaultRasterOpacity(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setRasterHueRotate:(id )rasterHueRotate { - self.layer->setRasterHueRotate(rasterHueRotate.mbgl_floatPropertyValue); +- (void)setRasterHueRotate:(MGLStyleValue *)rasterHueRotate { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(rasterHueRotate); + self.layer->setRasterHueRotate(mbglValue); } -- (id )rasterHueRotate { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterHueRotate() ?: self.layer->getDefaultRasterHueRotate()]; +- (MGLStyleValue *)rasterHueRotate { + auto propertyValue = self.layer->getRasterHueRotate() ?: self.layer->getDefaultRasterHueRotate(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setRasterBrightnessMin:(id )rasterBrightnessMin { - self.layer->setRasterBrightnessMin(rasterBrightnessMin.mbgl_floatPropertyValue); +- (void)setRasterBrightnessMin:(MGLStyleValue *)rasterBrightnessMin { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(rasterBrightnessMin); + self.layer->setRasterBrightnessMin(mbglValue); } -- (id )rasterBrightnessMin { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterBrightnessMin() ?: self.layer->getDefaultRasterBrightnessMin()]; +- (MGLStyleValue *)rasterBrightnessMin { + auto propertyValue = self.layer->getRasterBrightnessMin() ?: self.layer->getDefaultRasterBrightnessMin(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setRasterBrightnessMax:(id )rasterBrightnessMax { - self.layer->setRasterBrightnessMax(rasterBrightnessMax.mbgl_floatPropertyValue); +- (void)setRasterBrightnessMax:(MGLStyleValue *)rasterBrightnessMax { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(rasterBrightnessMax); + self.layer->setRasterBrightnessMax(mbglValue); } -- (id )rasterBrightnessMax { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterBrightnessMax() ?: self.layer->getDefaultRasterBrightnessMax()]; +- (MGLStyleValue *)rasterBrightnessMax { + auto propertyValue = self.layer->getRasterBrightnessMax() ?: self.layer->getDefaultRasterBrightnessMax(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setRasterSaturation:(id )rasterSaturation { - self.layer->setRasterSaturation(rasterSaturation.mbgl_floatPropertyValue); +- (void)setRasterSaturation:(MGLStyleValue *)rasterSaturation { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(rasterSaturation); + self.layer->setRasterSaturation(mbglValue); } -- (id )rasterSaturation { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterSaturation() ?: self.layer->getDefaultRasterSaturation()]; +- (MGLStyleValue *)rasterSaturation { + auto propertyValue = self.layer->getRasterSaturation() ?: self.layer->getDefaultRasterSaturation(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setRasterContrast:(id )rasterContrast { - self.layer->setRasterContrast(rasterContrast.mbgl_floatPropertyValue); +- (void)setRasterContrast:(MGLStyleValue *)rasterContrast { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(rasterContrast); + self.layer->setRasterContrast(mbglValue); } -- (id )rasterContrast { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterContrast() ?: self.layer->getDefaultRasterContrast()]; +- (MGLStyleValue *)rasterContrast { + auto propertyValue = self.layer->getRasterContrast() ?: self.layer->getDefaultRasterContrast(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setRasterFadeDuration:(id )rasterFadeDuration { - self.layer->setRasterFadeDuration(rasterFadeDuration.mbgl_floatPropertyValue); +- (void)setRasterFadeDuration:(MGLStyleValue *)rasterFadeDuration { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(rasterFadeDuration); + self.layer->setRasterFadeDuration(mbglValue); } -- (id )rasterFadeDuration { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterFadeDuration() ?: self.layer->getDefaultRasterFadeDuration()]; +- (MGLStyleValue *)rasterFadeDuration { + auto propertyValue = self.layer->getRasterFadeDuration() ?: self.layer->getDefaultRasterFadeDuration(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } @end diff --git a/platform/darwin/src/MGLStyleAttribute.h b/platform/darwin/src/MGLStyleAttribute.h deleted file mode 100644 index 564f44ad00b..00000000000 --- a/platform/darwin/src/MGLStyleAttribute.h +++ /dev/null @@ -1,25 +0,0 @@ -#import - -#import "MGLStyleAttributeValue.h" -#import "MGLStyleLayer_Private.h" -#import "MGLStyleAttributeValue_Private.h" - -@interface MGLStyleAttribute : NSObject - -+ (id )mbgl_colorWithPropertyValueColor:(mbgl::style::PropertyValue)property; - -+ (id )mbgl_numberWithPropertyValueNumber:(mbgl::style::PropertyValue)property; - -+ (id )mbgl_boolWithPropertyValueBool:(mbgl::style::PropertyValue)property; - -+ (id )mbgl_stringWithPropertyValueString:(mbgl::style::PropertyValue)property; - -+ (id )mbgl_offsetWithPropertyValueOffset:(mbgl::style::PropertyValue>)property; - -+ (id )mbgl_paddingWithPropertyValuePadding:(mbgl::style::PropertyValue>)property; - -+ (id )mbgl_stringArrayWithPropertyValueStringArray:(mbgl::style::PropertyValue>)property; - -+ (id )mbgl_numberArrayWithPropertyValueNumberArray:(mbgl::style::PropertyValue>)property; - -@end diff --git a/platform/darwin/src/MGLStyleAttribute.mm b/platform/darwin/src/MGLStyleAttribute.mm deleted file mode 100644 index 9e3c22914b8..00000000000 --- a/platform/darwin/src/MGLStyleAttribute.mm +++ /dev/null @@ -1,112 +0,0 @@ -#import "MGLStyleAttribute.h" - -#import "MGLStyleAttributeValue_Private.h" -#import "MGLStyleAttributeFunction_Private.h" -#import "NSValue+MGLStyleAttributeAdditions_Private.h" - -@interface MGLStyleAttribute() -@end - -@implementation MGLStyleAttribute - -+ (id)mbgl_colorWithPropertyValueColor:(mbgl::style::PropertyValue)property -{ - if (property.isConstant()) { - return [MGLColor mbgl_colorWithColor:property.asConstant()]; - } else if (property.isFunction()) { - return [MGLStyleAttributeFunction functionWithColorPropertyValue:property.asFunction()]; - } else { - return nil; - } -} - -+ (id )mbgl_numberWithPropertyValueNumber:(mbgl::style::PropertyValue)property -{ - if (property.isConstant()) { - return @(property.asConstant()); - } else if (property.isFunction()) { - return [MGLStyleAttributeFunction functionWithNumberPropertyValue:property.asFunction()]; - } else { - return nil; - } -} - -+ (id)mbgl_boolWithPropertyValueBool:(mbgl::style::PropertyValue)property -{ - if (property.isConstant()) { - return @(property.asConstant()); - } else if (property.isFunction()) { - return [MGLStyleAttributeFunction functionWithBoolPropertyValue:property.asFunction()]; - } else { - return nil; - } -} - -+ (id)mbgl_stringWithPropertyValueString:(mbgl::style::PropertyValue)property -{ - if (property.isConstant()) { - return @(property.asConstant().c_str()); - } else if (property.isFunction()) { - return [MGLStyleAttributeFunction functionWithStringPropertyValue:property.asFunction()]; - } else { - return nil; - } -} - -+ (id)mbgl_offsetWithPropertyValueOffset:(mbgl::style::PropertyValue >)property -{ - if (property.isConstant()) { - auto offset = property.asConstant(); - return [NSValue mgl_valueWithOffsetArray:offset]; - } else if (property.isFunction()) { - return [MGLStyleAttributeFunction functionWithOffsetPropertyValue:property.asFunction()]; - } else { - return nil; - } -} - -+ (id)mbgl_paddingWithPropertyValuePadding:(mbgl::style::PropertyValue >)property -{ - if (property.isConstant()) { - auto padding = property.asConstant(); - return [NSValue mgl_valueWithPaddingArray:padding]; - } else if (property.isFunction()) { - return [MGLStyleAttributeFunction functionWithPaddingPropertyValue:property.asFunction()]; - } else { - return nil; - } -} - -+ (id)mbgl_stringArrayWithPropertyValueStringArray:(mbgl::style::PropertyValue >)property -{ - if (property.isConstant()) { - auto strings = property.asConstant(); - NSMutableArray *convertedStrings = [[NSMutableArray alloc] initWithCapacity:strings.size()]; - for (auto string : strings) { - [convertedStrings addObject:@(string.c_str())]; - } - return convertedStrings; - } else if (property.isFunction()) { - return [MGLStyleAttributeFunction functionWithStringArrayPropertyValue:property.asFunction()]; - } else { - return nil; - } -} - -+ (id)mbgl_numberArrayWithPropertyValueNumberArray:(mbgl::style::PropertyValue >)property -{ - if (property.isConstant()) { - auto numbers = property.asConstant(); - NSMutableArray *convertedNumbers = [NSMutableArray arrayWithCapacity:numbers.size()]; - for (auto number : numbers) { - [convertedNumbers addObject:@(number)]; - } - return convertedNumbers; - } else if (property.isFunction()) { - return [MGLStyleAttributeFunction functionWithNumberArrayPropertyValue:property.asFunction()]; - } else { - return nil; - } -} - -@end diff --git a/platform/darwin/src/MGLStyleAttributeFunction.h b/platform/darwin/src/MGLStyleAttributeFunction.h deleted file mode 100644 index e636c1addd8..00000000000 --- a/platform/darwin/src/MGLStyleAttributeFunction.h +++ /dev/null @@ -1,17 +0,0 @@ -#import - -#import "MGLTypes.h" -#import "MGLStyleAttributeValue.h" - - -NS_ASSUME_NONNULL_BEGIN - -@interface MGLStyleAttributeFunction : NSObject - -@property (nonatomic, copy) NS_DICTIONARY_OF(NSNumber *, id) *stops; - -@property (nonatomic, copy, nullable) NSNumber *base; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLStyleAttributeFunction.mm b/platform/darwin/src/MGLStyleAttributeFunction.mm deleted file mode 100644 index 7eec5c23690..00000000000 --- a/platform/darwin/src/MGLStyleAttributeFunction.mm +++ /dev/null @@ -1,247 +0,0 @@ -#import "MGLStyleAttributeFunction.h" - -#import "MGLStyleLayer_Private.h" -#import "MGLStyleAttributeValue_Private.h" -#import "MGLStyleAttributeFunction_Private.h" - -@interface MGLStyleAttributeFunction() -@end - -@implementation MGLStyleAttributeFunction - -- (instancetype)init -{ - if (self = [super init]) { - _base = @1; - } - return self; -} - -- (BOOL)isFunction -{ - return YES; -} - -- (mbgl::style::PropertyValue)mbgl_colorPropertyValue -{ - __block std::vector> stops; - [self.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, MGLColor * _Nonnull color, BOOL * _Nonnull stop) { - NSAssert([color isKindOfClass:[MGLColor class]], @"Stops should be colors"); - stops.emplace_back(zoomKey.floatValue, color.mbgl_color); - }]; - return mbgl::style::Function({{stops}}, _base.floatValue); -} - -- (mbgl::style::PropertyValue)mbgl_floatPropertyValue -{ - __block std::vector> stops; - [self.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, NSNumber * _Nonnull number, BOOL * _Nonnull stop) { - NSAssert([number isKindOfClass:[NSNumber class]], @"Stops should be NSNumbers"); - stops.emplace_back(zoomKey.floatValue, number.floatValue); - }]; - return mbgl::style::Function({{stops}}, _base.floatValue); -} - -- (mbgl::style::PropertyValue)mbgl_boolPropertyValue -{ - __block std::vector> stops; - [self.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, NSNumber * _Nonnull number, BOOL * _Nonnull stop) { - NSAssert([number isKindOfClass:[NSNumber class]], @"Stops should be NSNumbers"); - stops.emplace_back(zoomKey.floatValue, number.boolValue); - }]; - return mbgl::style::Function({{stops}}, _base.floatValue); -} - -- (mbgl::style::PropertyValue)mbgl_stringPropertyValue -{ - __block std::vector> stops; - [self.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, NSString * _Nonnull string, BOOL * _Nonnull stop) { - NSAssert([string isKindOfClass:[NSString class]], @"Stops should be strings"); - stops.emplace_back(zoomKey.floatValue, string.UTF8String); - }]; - return mbgl::style::Function({{stops}}, _base.floatValue); -} - -- (mbgl::style::PropertyValue >)mbgl_stringArrayPropertyValue -{ - __block std::vector>> stops; - [self.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, NSArray * _Nonnull strings, BOOL * _Nonnull stop) { - NSAssert([strings isKindOfClass:[NSArray class]], @"Stops should be NSArray"); - std::vectorconvertedStrings; - for (NSString *string in strings) { - convertedStrings.emplace_back(string.UTF8String); - } - stops.emplace_back(zoomKey.floatValue, convertedStrings); - }]; - return mbgl::style::Function>({{stops}}, _base.floatValue); -} - -- (mbgl::style::PropertyValue >)mbgl_numberArrayPropertyValue -{ - __block std::vector>> stops; - [self.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, NSArray * _Nonnull numbers, BOOL * _Nonnull stop) { - NSAssert([numbers isKindOfClass:[NSArray class]], @"Stops should be NSArray"); - std::vectorconvertedNumbers; - for (NSNumber *number in numbers) { - convertedNumbers.emplace_back(number.floatValue); - } - stops.emplace_back(zoomKey.floatValue, convertedNumbers); - }]; - return mbgl::style::Function>({{stops}}, _base.floatValue); -} - -- (mbgl::style::PropertyValue >)mbgl_paddingPropertyValue -{ - __block std::vector>> stops; - [self.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, NSValue * _Nonnull padding, BOOL * _Nonnull stop) { - NSAssert([padding isKindOfClass:[NSValue class]], @"Stops should be NSValue"); - stops.emplace_back(zoomKey.floatValue, padding.mgl_paddingArrayValue); - }]; - return mbgl::style::Function>({{stops}}, _base.floatValue); -} - -- (mbgl::style::PropertyValue >)mbgl_offsetPropertyValue -{ - __block std::vector>> stops; - [self.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, NSValue * _Nonnull offset, BOOL * _Nonnull stop) { - NSAssert([offset isKindOfClass:[NSValue class]], @"Stops should be NSValue"); - stops.emplace_back(zoomKey.floatValue, offset.mgl_offsetArrayValue); - }]; - return mbgl::style::Function>({{stops}}, _base.floatValue); -} - -+ (instancetype)functionWithColorPropertyValue:(mbgl::style::Function)property -{ - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - auto stops = property.getStops(); - NSMutableDictionary *convertedStops = [NSMutableDictionary dictionaryWithCapacity:stops.size()]; - for (auto stop : stops) { - convertedStops[@(stop.first)] = [MGLColor mbgl_colorWithColor:stop.second]; - } - function.base = @(property.getBase()); - function.stops = convertedStops; - return function; -} - -+ (instancetype)functionWithNumberPropertyValue:(mbgl::style::Function)property -{ - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - auto stops = property.getStops(); - NSMutableDictionary *convertedStops = [NSMutableDictionary dictionaryWithCapacity:stops.size()]; - for (auto stop : stops) { - convertedStops[@(stop.first)] = @(stop.second); - } - function.base = @(property.getBase()); - function.stops = convertedStops; - return function; -} - -+ (instancetype)functionWithBoolPropertyValue:(mbgl::style::Function)property -{ - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - auto stops = property.getStops(); - NSMutableDictionary *convertedStops = [NSMutableDictionary dictionaryWithCapacity:stops.size()]; - for (auto stop : stops) { - convertedStops[@(stop.first)] = @(stop.second); - } - function.base = @(property.getBase()); - function.stops = convertedStops; - return function; -} - -+ (instancetype)functionWithStringPropertyValue:(mbgl::style::Function)property -{ - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - auto stops = property.getStops(); - NSMutableDictionary *convertedStops = [NSMutableDictionary dictionaryWithCapacity:stops.size()]; - for (auto stop : stops) { - convertedStops[@(stop.first)] = @(stop.second.c_str()); - } - function.base = @(property.getBase()); - function.stops = convertedStops; - return function; -} - -+ (instancetype)functionWithOffsetPropertyValue:(mbgl::style::Function >)property -{ - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - auto stops = property.getStops(); - NSMutableDictionary *convertedStops = [NSMutableDictionary dictionaryWithCapacity:stops.size()]; - for (auto stop : stops) { - convertedStops[@(stop.first)] = [NSValue mgl_valueWithOffsetArray:stop.second]; - } - function.base = @(property.getBase()); - function.stops = convertedStops; - return function; -} - -+ (instancetype)functionWithPaddingPropertyValue:(mbgl::style::Function >)property -{ - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - auto stops = property.getStops(); - NSMutableDictionary *convertedStops = [NSMutableDictionary dictionaryWithCapacity:stops.size()]; - for (auto stop : stops) { - convertedStops[@(stop.first)] = [NSValue mgl_valueWithPaddingArray:stop.second]; - } - function.base = @(property.getBase()); - function.stops = convertedStops; - return function; -} - -+ (instancetype)functionWithStringArrayPropertyValue:(mbgl::style::Function >)property -{ - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - auto stops = property.getStops(); - NSMutableDictionary *convertedStops = [NSMutableDictionary dictionaryWithCapacity:stops.size()]; - for (auto stop : stops) { - auto strings = stop.second; - NSMutableArray *convertedStrings = [NSMutableArray arrayWithCapacity:strings.size()]; - for (auto const& string: strings) { - [convertedStrings addObject:@(string.c_str())]; - } - convertedStops[@(stop.first)] = convertedStrings; - } - function.base = @(property.getBase()); - function.stops = convertedStops; - return function; -} - -+ (instancetype)functionWithNumberArrayPropertyValue:(mbgl::style::Function >)property -{ - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - auto stops = property.getStops(); - NSMutableDictionary *convertedStops = [NSMutableDictionary dictionaryWithCapacity:stops.size()]; - for (auto stop : stops) { - auto numbers = stop.second; - NSMutableArray *convertedNumbers = [NSMutableArray arrayWithCapacity:numbers.size()]; - for (auto const& number: numbers) { - [convertedNumbers addObject:@(number)]; - } - convertedStops[@(stop.first)] = convertedNumbers; - } - function.base = @(property.getBase()); - function.stops = convertedStops; - return function; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"<%@: %p, base = %@; stops = %@>", - NSStringFromClass([self class]), (void *)self, - self.base, - self.stops]; -} - -- (BOOL)isEqual:(MGLStyleAttributeFunction *)other -{ - return ([other isKindOfClass:[self class]] - && (other.base == self.base || [other.base isEqualToNumber:self.base]) - && [other.stops isEqualToDictionary:self.stops]); -} - -- (NSUInteger)hash -{ - return self.base.hash + self.stops.hash; -} - -@end diff --git a/platform/darwin/src/MGLStyleAttributeFunction_Private.h b/platform/darwin/src/MGLStyleAttributeFunction_Private.h deleted file mode 100644 index 92dec0d4a27..00000000000 --- a/platform/darwin/src/MGLStyleAttributeFunction_Private.h +++ /dev/null @@ -1,73 +0,0 @@ -#import "MGLStyleAttributeFunction.h" - -#include -#include -#include - -#define MGLSetEnumProperty(name, Name, MBGLType, ObjCType) \ - if (name.isFunction) { \ - NSAssert([name isKindOfClass:[MGLStyleAttributeFunction class]], @"" #name @" should be a function"); \ - \ - __block std::vector> stops; \ - [[(MGLStyleAttributeFunction *)name stops] enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull key, NSValue * _Nonnull obj, BOOL * _Nonnull stop) { \ - NSAssert([obj isKindOfClass:[NSValue class]], @"Stops in " #name @" should be NSValues"); \ - ObjCType value; \ - [obj getValue:&value]; \ - stops.emplace_back(key.floatValue, static_cast(value)); \ - }]; \ - auto function = mbgl::style::Function { \ - stops, \ - [(MGLStyleAttributeFunction *)name base].floatValue, \ - }; \ - self.layer->set##Name(function); \ - } else if (name) { \ - NSAssert([name isKindOfClass:[NSValue class]], @"" #name @"should be an NSValue"); \ - ObjCType value; \ - [(NSValue *)name getValue:&value]; \ - self.layer->set##Name({ static_cast(value) }); \ - } else { \ - self.layer->set##Name({}); \ - } - -#define MGLGetEnumProperty(Name, MBGLType, ObjCType) \ - const char *type = @encode(ObjCType); \ - mbgl::style::PropertyValue property = self.layer->get##Name() ?: self.layer->getDefault##Name(); \ - if (property.isConstant()) { \ - ObjCType value = static_cast(property.asConstant()); \ - return [NSValue value:&value withObjCType:type]; \ - } else if (property.isFunction()) { \ - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; \ - auto stops = property.asFunction().getStops(); \ - NSMutableDictionary *convertedStops = [NSMutableDictionary dictionaryWithCapacity:stops.size()]; \ - for (auto stop : stops) { \ - ObjCType value = static_cast(stop.second); \ - convertedStops[@(stop.first)] = [NSValue value:&value withObjCType:type]; \ - } \ - function.base = @(property.asFunction().getBase()); \ - function.stops = convertedStops; \ - return function; \ - } else { \ - return nil; \ - } - -@interface MGLStyleAttributeFunction(Private) - -+ (instancetype)functionWithColorPropertyValue:(mbgl::style::Function)property; - -+ (instancetype)functionWithNumberPropertyValue:(mbgl::style::Function)property; - -+ (instancetype)functionWithBoolPropertyValue:(mbgl::style::Function)property; - -+ (instancetype)functionWithStringPropertyValue:(mbgl::style::Function)property; - -+ (instancetype)functionWithOffsetPropertyValue:(mbgl::style::Function>)property; - -+ (instancetype)functionWithPaddingPropertyValue:(mbgl::style::Function>)property; - -+ (instancetype)functionWithStringArrayPropertyValue:(mbgl::style::Function>)property; - -+ (instancetype)functionWithNumberArrayPropertyValue:(mbgl::style::Function>)property; - -+ (instancetype)functionWithEnumProperyValue:(mbgl::style::Function)property type:(const char *)type; - -@end; diff --git a/platform/darwin/src/MGLStyleAttributeValue.h b/platform/darwin/src/MGLStyleAttributeValue.h deleted file mode 100644 index cd339238891..00000000000 --- a/platform/darwin/src/MGLStyleAttributeValue.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@protocol MGLStyleAttributeValue -@optional -@end \ No newline at end of file diff --git a/platform/darwin/src/MGLStyleAttributeValue_Private.h b/platform/darwin/src/MGLStyleAttributeValue_Private.h deleted file mode 100644 index 4b8fd1cc01a..00000000000 --- a/platform/darwin/src/MGLStyleAttributeValue_Private.h +++ /dev/null @@ -1,24 +0,0 @@ -#import - -#import "MGLStyleAttributeFunction_Private.h" - -#include - -@protocol MGLStyleAttributeValue_Private -- (BOOL)isFunction; -@optional - -// Convert darwin types to mbgl types -- (mbgl::style::PropertyValue)mbgl_colorPropertyValue; -- (mbgl::style::PropertyValue)mbgl_floatPropertyValue; -- (mbgl::style::PropertyValue)mbgl_boolPropertyValue; -- (mbgl::style::PropertyValue)mbgl_stringPropertyValue; -- (mbgl::style::PropertyValue>)mbgl_offsetPropertyValue; -- (mbgl::style::PropertyValue>)mbgl_paddingPropertyValue; -- (mbgl::style::PropertyValue >)mbgl_stringArrayPropertyValue; -- (mbgl::style::PropertyValue >)mbgl_numberArrayPropertyValue; - -// Convert mbgl types to darwin types -- (id )mbgl_colorPropertyValueWith:(mbgl::style::PropertyValue)color; - -@end diff --git a/platform/darwin/src/MGLStyleLayer.h.ejs b/platform/darwin/src/MGLStyleLayer.h.ejs index eb799f13be2..b97d070b900 100644 --- a/platform/darwin/src/MGLStyleLayer.h.ejs +++ b/platform/darwin/src/MGLStyleLayer.h.ejs @@ -8,7 +8,7 @@ // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. -#import "MGLStyleAttributeValue.h" +#import "MGLStyleValue.h" #import "MGL<%- (type === 'background' ? '' : (type === 'raster' ? 'Foreground' : @@ -92,7 +92,7 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) { <%- propertyReqs(property, layoutPropertiesByName, type) %> <% } -%> */ -@property (nonatomic<% if (!property.required) { %>, null_resettable<% } %>) <%- propertyType(property, false, type) %> <%- camelizeWithLeadingLowercase(property.name) %>; +@property (nonatomic<% if (!property.required) { %>, null_resettable<% } %>) MGLStyleValue<<%- propertyType(property, true) %>> *<%- camelizeWithLeadingLowercase(property.name) %>; <% } -%> <% } -%> @@ -110,7 +110,7 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) { <%- propertyReqs(property, paintPropertiesByName, type) %> <% } -%> */ -@property (nonatomic<% if (!property.required) { %>, null_resettable<% } %>) <%- propertyType(property, false, type) %> <%- camelizeWithLeadingLowercase(property.name) %>; +@property (nonatomic<% if (!property.required) { %>, null_resettable<% } %>) MGLStyleValue<<%- propertyType(property, true) %>> *<%- camelizeWithLeadingLowercase(property.name) %>; <% } -%> <% } -%> diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs index 8d3bba99584..3678e9ec52a 100644 --- a/platform/darwin/src/MGLStyleLayer.mm.ejs +++ b/platform/darwin/src/MGLStyleLayer.mm.ejs @@ -9,7 +9,7 @@ #import "MGLSource.h" #import "NSPredicate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" -#import "MGLStyleAttributeValue.h" +#import "MGLStyleValue_Private.h" #import "MGL<%- camelize(type) %>StyleLayer.h" #include _layer.hpp> @@ -67,12 +67,14 @@ #pragma mark - Accessing the Layout Attributes <% for (const property of layoutProperties) { -%> -- (void)set<%- camelize(property.name) %>:(<%- propertyType(property, true, type) %>)<%- objCName(property) %> { - <%- setterImplementation(property, type) %> +- (void)set<%- camelize(property.name) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- objCName(property) %> { + auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue(<%- objCName(property) %>); + self.layer->set<%- camelize(property.name) %>(mbglValue); } -- (<%- propertyType(property, false, type) %>)<%- objCName(property) %> { - <%- getterImplementation(property, type) %> +- (MGLStyleValue<<%- propertyType(property, true) %>> *)<%- objCName(property) %> { + auto propertyValue = self.layer->get<%- camelize(property.name) %>() ?: self.layer->getDefault<%- camelize(property.name) %>(); + return MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toStyleValue(propertyValue); } <% } -%> @@ -81,12 +83,14 @@ #pragma mark - Accessing the Paint Attributes <% for (const property of paintProperties) { -%> -- (void)set<%- camelize(property.name) %>:(<%- propertyType(property, true, type) %>)<%- objCName(property) %> { - <%- setterImplementation(property, type) %> +- (void)set<%- camelize(property.name) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- objCName(property) %> { + auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue(<%- objCName(property) %>); + self.layer->set<%- camelize(property.name) %>(mbglValue); } -- (<%- propertyType(property, false, type) %>)<%- objCName(property) %> { - <%- getterImplementation(property, type) %> +- (MGLStyleValue<<%- propertyType(property, true) %>> *)<%- objCName(property) %> { + auto propertyValue = self.layer->get<%- camelize(property.name) %>() ?: self.layer->getDefault<%- camelize(property.name) %>(); + return MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toStyleValue(propertyValue); } <% } -%> diff --git a/platform/darwin/src/MGLStyleLayer_Private.h b/platform/darwin/src/MGLStyleLayer_Private.h index a499775a527..5fa01856eaf 100644 --- a/platform/darwin/src/MGLStyleLayer_Private.h +++ b/platform/darwin/src/MGLStyleLayer_Private.h @@ -1,23 +1,9 @@ #import -#include #import "MGLStyleLayer.h" -#import "MGLStyleAttribute.h" - -#import "NSNumber+MGLStyleAttributeAdditions_Private.h" -#import "NSArray+MGLStyleAttributeAdditions_Private.h" -#import "NSString+MGLStyleAttributeAdditions_Private.h" -#import "NSValue+MGLStyleAttributeAdditions_Private.h" -#import "MGLStyleAttributeFunction_Private.h" -#import "MGLStyleAttributeValue_Private.h" +#import "MGLStyleValue_Private.h" -#if TARGET_OS_IPHONE - #import "UIColor+MGLAdditions.h" - #import "UIColor+MGLStyleAttributeAdditions_Private.h" -#else - #import "NSColor+MGLAdditions.h" - #import "NSColor+MGLStyleAttributeAdditions_Private.h" -#endif +#include @interface MGLStyleLayer (Private) diff --git a/platform/darwin/src/MGLStyleValue.h b/platform/darwin/src/MGLStyleValue.h new file mode 100644 index 00000000000..eb0eaf5340d --- /dev/null +++ b/platform/darwin/src/MGLStyleValue.h @@ -0,0 +1,176 @@ +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + An `MGLStyleValue` object is a generic container for a style attribute value. + The layout and paint attribute properties of `MGLStyleLayer` can be set to + `MGLStyleValue` objects. + + The `MGLStyleValue` class itself represents a class cluster. Under the hood, a + particular `MGLStyleValue` object may be either an `MGLStyleConstantValue` to + represent a constant value or an `MGLStyleFunction` to represent a value + function. Do not initialize an `MGLStyleValue` object directly; instead, use + one of the class factory methods to create an `MGLStyleValue` object. + + The `MGLStyleValue` class takes a generic parameter `T` that indicates the + Foundation class being wrapped by this class. Common values for `T` include: + +
    +
  • `NSNumber` (for Boolean values, floating-point numbers, and enumerations)
  • +
  • `NSValue` (for `CGVector`, `NSEdgeInset`, and `UIEdgeInset`s)
  • +
  • `NSString`
  • +
  • `NSColor` or `UIColor`
  • +
  • `NSArray`
  • +
+ */ +@interface MGLStyleValue : NSObject + +#pragma mark Creating a Style Value + +/** + Creates and returns an `MGLStyleConstantValue` object containing a raw value. + + @param rawValue The constant value contained by the object. + @return An `MGLStyleConstantValue` object containing `rawValue`, which is + treated as a constant value. + */ ++ (instancetype)valueWithRawValue:(T)rawValue; + +/** + Creates and returns an `MGLStyleFunction` object representing a linear zoom + level function with any number of stops. + + @param stops A dictionary associating zoom levels with style values. + @return An `MGLStyleFunction` object with the given stops. + */ ++ (instancetype)valueWithStops:(NSDictionary *> *)stops; + +/** + Creates and returns an `MGLStyleFunction` object representing a zoom level + function with an exponential base and any number of stops. + + @param base The exponential base of the interpolation curve. + @param stops A dictionary associating zoom levels with style values. + @return An `MGLStyleFunction` object with the given base and stops. + */ ++ (instancetype)valueWithBase:(CGFloat)base stops:(NSDictionary *> *)stops; + +@end + +/** + An `MGLStyleConstantValue` object is a generic container for a style attribute + value that remains constant as the zoom level changes. The layout and paint + attribute properties of `MGLStyleLayer` objects can be set to + `MGLStyleConstantValue` objects. + + The `MGLStyleConstantValue` class takes a generic parameter `T` that indicates + the Foundation class being wrapped by this class. + */ +@interface MGLStyleConstantValue : MGLStyleValue + +#pragma mark Creating a Style Constant Value + +/** + Creates and returns an `MGLStyleConstantValue` object containing a raw value. + + @param rawValue The constant value contained by the object. + @return An `MGLStyleConstantValue` object containing `rawValue`, which is + treated as a constant value. + */ ++ (instancetype)valueWithRawValue:(T)rawValue; + +#pragma mark Initializing a Style Constant Value + +- (instancetype)init NS_UNAVAILABLE; + +/** + Returns an `MGLStyleConstantValue` object containing a raw value. + + @param rawValue The value contained by the receiver. + @return An `MGLStyleConstantValue` object containing `rawValue`. + */ +- (instancetype)initWithRawValue:(T)rawValue NS_DESIGNATED_INITIALIZER; + +#pragma mark Accessing the Underlying Value + +/** + The raw value contained by the receiver. + */ +@property (nonatomic) T rawValue; + +@end + +/** + An `MGLStyleFunction` is a value function defining a style value that changes + as the zoom level changes. The layout and paint attribute properties of an + `MGLStyleLayer` object can be set to `MGLStyleFunction` objects. Use a zoom + level function to create the illusion of depth and control data density. + + The `MGLStyleFunction` class takes a generic parameter `T` that indicates the + Foundation class being wrapped by this class. + */ +@interface MGLStyleFunction : MGLStyleValue + +#pragma mark Creating a Style Function + +/** + Creates and returns an `MGLStyleFunction` object representing a linear zoom + level function with any number of stops. + + @param stops A dictionary associating zoom levels with style values. + @return An `MGLStyleFunction` object with the given stops. + */ ++ (instancetype)functionWithStops:(NSDictionary *> *)stops; + +/** + Creates and returns an `MGLStyleFunction` object representing a zoom level + function with an exponential base and any number of stops. + + @param base The exponential base of the interpolation curve. + @param stops A dictionary associating zoom levels with style values. + @return An `MGLStyleFunction` object with the given base and stops. + */ ++ (instancetype)functionWithBase:(CGFloat)base stops:(NSDictionary *> *)stops; + +#pragma mark Initializing a Style Function + +/** + Returns an `MGLStyleFunction` object representing a zoom level function with an + exponential base and any number of stops. + + @param base The exponential base of the interpolation curve. + @param stops A dictionary associating zoom levels with style values. + @return An `MGLStyleFunction` object with the given base and stops. + */ +- (instancetype)initWithBase:(CGFloat)base stops:(NSDictionary *> *)stops NS_DESIGNATED_INITIALIZER; + +#pragma mark Accessing the Parameters of a Function + +/** + The exponential base of the function’s interpolation curve. + + The exponential base controls the rate at which the function’s output values + increase. A value of 1 causes the function to increase linearly by zoom level. + A higher exponential base causes the function’s output values to vary + exponentially, increasing more rapidly towards the high end of the function’s + range. The default value of this property is 1, for a linear curve. + */ +@property (nonatomic) CGFloat base; + +/** + A dictionary associating zoom levels with style values. + + Each of the function’s stops is represented by one key-value pair in the + dictionary. Each key in the dictionary is an `NSNumber` object containing a + floating-point zoom level. Each value in the dictionary is an `MGLStyleValue` + object containing the value of the style attribute when the map is at the + associated zoom level. An `MGLStyleFunction` object may not be used recursively + as a stop value. + */ +@property (nonatomic, copy) NSDictionary *> *stops; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLStyleValue.mm b/platform/darwin/src/MGLStyleValue.mm new file mode 100644 index 00000000000..43b51d67886 --- /dev/null +++ b/platform/darwin/src/MGLStyleValue.mm @@ -0,0 +1,88 @@ +#import "MGLStyleValue_Private.h" + +@implementation MGLStyleValue + ++ (instancetype)valueWithRawValue:(id)rawValue { + return [MGLStyleConstantValue valueWithRawValue:rawValue]; +} + ++ (instancetype)valueWithBase:(CGFloat)base stops:(NSDictionary *)stops { + return [MGLStyleFunction functionWithBase:base stops:stops]; +} + ++ (instancetype)valueWithStops:(NSDictionary *)stops { + return [MGLStyleFunction functionWithStops:stops]; +} + +@end + +@implementation MGLStyleConstantValue + ++ (instancetype)valueWithRawValue:(id)rawValue { + return [[self alloc] initWithRawValue:rawValue]; +} + +- (instancetype)initWithRawValue:(id)rawValue { + if (self = [super init]) { + _rawValue = rawValue; + } + return self; +} + +- (NSString *)description { + return [self.rawValue description]; +} + +- (NSString *)debugDescription { + return [self.rawValue debugDescription]; +} + +- (BOOL)isEqual:(MGLStyleConstantValue *)other { + return [other isKindOfClass:[self class]] && [other.rawValue isEqual:self.rawValue]; +} + +- (NSUInteger)hash { + return [self.rawValue hash]; +} + +@end + +@implementation MGLStyleFunction + ++ (instancetype)functionWithBase:(CGFloat)base stops:(NSDictionary *)stops { + return [[self alloc] initWithBase:base stops:stops]; +} + ++ (instancetype)functionWithStops:(NSDictionary *)stops { + return [[self alloc] initWithBase:1 stops:stops]; +} + +- (instancetype)init { + return [self initWithBase:1 stops:@{}]; +} + +- (instancetype)initWithBase:(CGFloat)base stops:(NSDictionary *)stops { + if (self = [super init]) { + _base = base; + _stops = stops; + } + return self; +} + +- (NSString *)description { + return [NSString stringWithFormat:@"<%@: %p, base = %f; stops = %@>", + NSStringFromClass([self class]), (void *)self, + self.base, + self.stops]; +} + +- (BOOL)isEqual:(MGLStyleFunction *)other { + return ([other isKindOfClass:[self class]] && other.base == self.base + && [other.stops isEqualToDictionary:self.stops]); +} + +- (NSUInteger)hash { + return self.base + self.stops.hash; +} + +@end diff --git a/platform/darwin/src/MGLStyleValue_Private.h b/platform/darwin/src/MGLStyleValue_Private.h new file mode 100644 index 00000000000..fdad07aafa0 --- /dev/null +++ b/platform/darwin/src/MGLStyleValue_Private.h @@ -0,0 +1,156 @@ +#import + +#import "MGLStyleValue.h" + +#import "NSValue+MGLStyleAttributeAdditions.h" +#import "MGLTypes.h" + +#if TARGET_OS_IPHONE + #import "UIColor+MGLAdditions.h" +#else + #import "NSColor+MGLAdditions.h" +#endif + +#include + +template +class MGLStyleValueTransformer { +public: + + MGLStyleValue *toStyleValue(const mbgl::style::PropertyValue &mbglValue) { + if (mbglValue.isConstant()) { + return toStyleConstantValue(mbglValue.asConstant()); + } else if (mbglValue.isFunction()) { + return toStyleFunction(mbglValue.asFunction()); + } else { + return nil; + } + } + + mbgl::style::PropertyValue toPropertyValue(MGLStyleValue *value) { + if ([value isKindOfClass:[MGLStyleConstantValue class]]) { + MBGLType mbglValue; + getMBGLValue([(MGLStyleConstantValue *)value rawValue], mbglValue); + return mbglValue; + } else if ([value isKindOfClass:[MGLStyleFunction class]]) { + MGLStyleFunction *function = (MGLStyleFunction *)value; + __block std::vector> mbglStops; + [function.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, MGLStyleValue * _Nonnull stopValue, BOOL * _Nonnull stop) { + NSCAssert([stopValue isKindOfClass:[MGLStyleValue class]], @"Stops should be MGLStyleValues"); + auto mbglStopValue = toPropertyValue(stopValue); + NSCAssert(mbglStopValue.isConstant(), @"Stops must be constant"); + mbglStops.emplace_back(zoomKey.floatValue, mbglStopValue.asConstant()); + }]; + return mbgl::style::Function({{mbglStops}}, function.base); + } else if (value) { + [NSException raise:@"MGLAbstractClassException" format: + @"The style value %@ cannot be applied to the style. " + @"Make sure the style value was created as a member of a concrete subclass of MGLStyleValue.", + NSStringFromClass([value class])]; + return {}; + } else { + return {}; + } + } + +private: + + MGLStyleConstantValue *toStyleConstantValue(const MBGLType mbglValue) { + auto rawValue = toMGLRawStyleValue(mbglValue); + return [MGLStyleConstantValue valueWithRawValue:rawValue]; + } + + MGLStyleFunction *toStyleFunction(const mbgl::style::Function &mbglFunction) { + const auto &mbglStops = mbglFunction.getStops(); + NSMutableDictionary *stops = [NSMutableDictionary dictionaryWithCapacity:mbglStops.size()]; + for (const auto &mbglStop : mbglStops) { + auto rawValue = toMGLRawStyleValue(mbglStop.second); + stops[@(mbglStop.first)] = [MGLStyleValue valueWithRawValue:rawValue]; + } + return [MGLStyleFunction functionWithBase:mbglFunction.getBase() stops:stops]; + } + + NSNumber *toMGLRawStyleValue(const bool mbglStopValue) { + return @(mbglStopValue); + } + + NSNumber *toMGLRawStyleValue(const float mbglStopValue) { + return @(mbglStopValue); + } + + NSString *toMGLRawStyleValue(const std::string &mbglStopValue) { + return @(mbglStopValue.c_str()); + } + + // Offsets + NSValue *toMGLRawStyleValue(const std::array &mbglStopValue) { + return [NSValue mgl_valueWithOffsetArray:mbglStopValue]; + } + + // Padding + NSValue *toMGLRawStyleValue(const std::array &mbglStopValue) { + return [NSValue mgl_valueWithPaddingArray:mbglStopValue]; + } + + // Enumerations + template ::value>::type> + ObjCType toMGLRawStyleValue(const MBGLType &mbglStopValue) { + NSUInteger rawValue = static_cast(mbglStopValue); + return [NSValue value:&rawValue withObjCType:@encode(NSUInteger)]; + } + + MGLColor *toMGLRawStyleValue(const mbgl::Color mbglStopValue) { + return [MGLColor mgl_colorWithColor:mbglStopValue]; + } + + ObjCType toMGLRawStyleValue(const std::vector &mbglStopValue) { + NSMutableArray *array = [NSMutableArray arrayWithCapacity:mbglStopValue.size()]; + for (const auto &mbglElement: mbglStopValue) { + [array addObject:toMGLRawStyleValue(mbglElement)]; + } + return array; + } + +private: + + void getMBGLValue(NSNumber *rawValue, bool &mbglValue) { + mbglValue = !!rawValue.boolValue; + } + + void getMBGLValue(NSNumber *rawValue, float &mbglValue) { + mbglValue = rawValue.floatValue; + } + + void getMBGLValue(NSString *rawValue, std::string &mbglValue) { + mbglValue = rawValue.UTF8String; + } + + // Offsets + void getMBGLValue(NSValue *rawValue, std::array &mbglValue) { + mbglValue = rawValue.mgl_offsetArrayValue; + } + + // Padding + void getMBGLValue(NSValue *rawValue, std::array &mbglValue) { + mbglValue = rawValue.mgl_paddingArrayValue; + } + + // Enumerations + template ::value>::type> + void getMBGLValue(ObjCType rawValue, MBGLType &mbglValue) { + [rawValue getValue:&mbglValue]; + } + + void getMBGLValue(MGLColor *rawValue, mbgl::Color &mbglValue) { + mbglValue = rawValue.mgl_color; + } + + void getMBGLValue(ObjCType rawValue, std::vector &mbglValue) { + mbglValue.reserve(rawValue.count); + for (id obj in rawValue) { + MBGLElement mbglElement; + getMBGLValue(obj, mbglElement); + mbglValue.push_back(mbglElement); + } + } +}; diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h index f8a130d54e3..3fcecedca3a 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.h +++ b/platform/darwin/src/MGLSymbolStyleLayer.h @@ -1,7 +1,7 @@ // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. -#import "MGLStyleAttributeValue.h" +#import "MGLStyleValue.h" #import "MGLVectorStyleLayer.h" NS_ASSUME_NONNULL_BEGIN @@ -235,372 +235,372 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { /** Label placement relative to its geometry. - The default value of this property is an `NSValue` object containing `MGLSymbolPlacementPoint`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLSymbolPlacementPoint`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id symbolPlacement; +@property (nonatomic, null_resettable) MGLStyleValue *symbolPlacement; /** Distance between two symbol anchors. This property is measured in points. - The default value of this property is an `NSNumber` object containing the float `250`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `250`. Set this property to `nil` to reset it to the default value. - This property is only applied to the style if `symbolPlacement` is set to an `NSValue` object containing `MGLSymbolPlacementLine`. Otherwise, it is ignored. + This property is only applied to the style if `symbolPlacement` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLSymbolPlacementLine`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id symbolSpacing; +@property (nonatomic, null_resettable) MGLStyleValue *symbolSpacing; /** If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer. - The default value of this property is an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id symbolAvoidEdges; +@property (nonatomic, null_resettable) MGLStyleValue *symbolAvoidEdges; /** If true, the icon will be visible even if it collides with other previously drawn symbols. - The default value of this property is an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconAllowOverlap; +@property (nonatomic, null_resettable) MGLStyleValue *iconAllowOverlap; /** If true, other symbols can be visible even if they collide with the icon. - The default value of this property is an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconIgnorePlacement; +@property (nonatomic, null_resettable) MGLStyleValue *iconIgnorePlacement; /** If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not. - The default value of this property is an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`, and `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconOptional; +@property (nonatomic, null_resettable) MGLStyleValue *iconOptional; /** In combination with `symbolPlacement`, determines the rotation behavior of icons. - The default value of this property is an `NSValue` object containing `MGLIconRotationAlignmentAuto`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLIconRotationAlignmentAuto`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconRotationAlignment; +@property (nonatomic, null_resettable) MGLStyleValue *iconRotationAlignment; /** Scale factor for icon. 1 is original size, 3 triples the size. - The default value of this property is an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconSize; +@property (nonatomic, null_resettable) MGLStyleValue *iconSize; /** Scales the icon to fit around the associated text. - The default value of this property is an `NSValue` object containing `MGLIconTextFitNone`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLIconTextFitNone`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`, and `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconTextFit; +@property (nonatomic, null_resettable) MGLStyleValue *iconTextFit; /** Size of the additional area added to dimensions determined by `iconTextFit`, in clockwise order: top, right, bottom, left. This property is measured in points. - The default value of this property is an `NSValue` object containing `NSEdgeInsetsZero` or `UIEdgeInsetsZero`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `NSEdgeInsetsZero` or `UIEdgeInsetsZero`. Set this property to `nil` to reset it to the default value. - This property is only applied to the style if `iconImage` is non-`nil`, and `textField` is non-`nil`, and `iconTextFit` is set to an `NSValue` object containing `MGLIconTextFitBoth`, `MGLIconTextFitWidth`, or `MGLIconTextFitHeight`. Otherwise, it is ignored. + This property is only applied to the style if `iconImage` is non-`nil`, and `textField` is non-`nil`, and `iconTextFit` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLIconTextFitBoth`, `MGLIconTextFitWidth`, or `MGLIconTextFitHeight`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconTextFitPadding; +@property (nonatomic, null_resettable) MGLStyleValue *iconTextFitPadding; /** A string with {tokens} replaced, referencing the data property to pull from. */ -@property (nonatomic, null_resettable) id iconImage; +@property (nonatomic, null_resettable) MGLStyleValue *iconImage; /** Rotates the icon clockwise. This property is measured in degrees. - The default value of this property is an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconRotate; +@property (nonatomic, null_resettable) MGLStyleValue *iconRotate; /** Size of the additional area around the icon bounding box used for detecting symbol collisions. This property is measured in points. - The default value of this property is an `NSNumber` object containing the float `2`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `2`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconPadding; +@property (nonatomic, null_resettable) MGLStyleValue *iconPadding; /** If true, the icon may be flipped to prevent it from being rendered upside-down. - The default value of this property is an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. - This property is only applied to the style if `iconImage` is non-`nil`, and `iconRotationAlignment` is set to an `NSValue` object containing `MGLIconRotationAlignmentMap`, and `symbolPlacement` is set to an `NSValue` object containing `MGLSymbolPlacementLine`. Otherwise, it is ignored. + This property is only applied to the style if `iconImage` is non-`nil`, and `iconRotationAlignment` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLIconRotationAlignmentMap`, and `symbolPlacement` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLSymbolPlacementLine`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconKeepUpright; +@property (nonatomic, null_resettable) MGLStyleValue *iconKeepUpright; /** Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. - The default value of this property is an `NSValue` object containing a `CGVector` struct set to 0 from the left and 0 from the top. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 from the left and 0 from the top. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconOffset; +@property (nonatomic, null_resettable) MGLStyleValue *iconOffset; /** Orientation of text when map is pitched. - The default value of this property is an `NSValue` object containing `MGLTextPitchAlignmentAuto`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLTextPitchAlignmentAuto`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textPitchAlignment; +@property (nonatomic, null_resettable) MGLStyleValue *textPitchAlignment; /** In combination with `symbolPlacement`, determines the rotation behavior of the individual glyphs forming the text. - The default value of this property is an `NSValue` object containing `MGLTextRotationAlignmentAuto`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLTextRotationAlignmentAuto`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textRotationAlignment; +@property (nonatomic, null_resettable) MGLStyleValue *textRotationAlignment; /** Value to use for a text label. Feature properties are specified using tokens like {field_name}. - The default value of this property is the string ``. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing the string ``. Set this property to `nil` to reset it to the default value. */ -@property (nonatomic, null_resettable) id textField; +@property (nonatomic, null_resettable) MGLStyleValue *textField; /** Font stack to use for displaying text. - The default value of this property is the array `Open Sans Regular`, `Arial Unicode MS Regular`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing the array `Open Sans Regular`, `Arial Unicode MS Regular`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textFont; +@property (nonatomic, null_resettable) MGLStyleValue *> *textFont; /** Font size. This property is measured in points. - The default value of this property is an `NSNumber` object containing the float `16`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `16`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textSize; +@property (nonatomic, null_resettable) MGLStyleValue *textSize; /** The maximum line width for text wrapping. This property is measured in ems. - The default value of this property is an `NSNumber` object containing the float `10`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `10`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textMaxWidth; +@property (nonatomic, null_resettable) MGLStyleValue *textMaxWidth; /** Text leading value for multi-line text. This property is measured in ems. - The default value of this property is an `NSNumber` object containing the float `1.2`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1.2`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textLineHeight; +@property (nonatomic, null_resettable) MGLStyleValue *textLineHeight; /** Text tracking amount. This property is measured in ems. - The default value of this property is an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textLetterSpacing; +@property (nonatomic, null_resettable) MGLStyleValue *textLetterSpacing; /** Text justification options. - The default value of this property is an `NSValue` object containing `MGLTextJustifyCenter`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLTextJustifyCenter`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textJustify; +@property (nonatomic, null_resettable) MGLStyleValue *textJustify; /** Part of the text placed closest to the anchor. - The default value of this property is an `NSValue` object containing `MGLTextAnchorCenter`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLTextAnchorCenter`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textAnchor; +@property (nonatomic, null_resettable) MGLStyleValue *textAnchor; /** Maximum angle change between adjacent characters. This property is measured in degrees. - The default value of this property is an `NSNumber` object containing the float `45`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `45`. Set this property to `nil` to reset it to the default value. - This property is only applied to the style if `textField` is non-`nil`, and `symbolPlacement` is set to an `NSValue` object containing `MGLSymbolPlacementLine`. Otherwise, it is ignored. + This property is only applied to the style if `textField` is non-`nil`, and `symbolPlacement` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLSymbolPlacementLine`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textMaxAngle; +@property (nonatomic, null_resettable) MGLStyleValue *textMaxAngle; /** Rotates the text clockwise. This property is measured in degrees. - The default value of this property is an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textRotate; +@property (nonatomic, null_resettable) MGLStyleValue *textRotate; /** Size of the additional area around the text bounding box used for detecting symbol collisions. This property is measured in points. - The default value of this property is an `NSNumber` object containing the float `2`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `2`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textPadding; +@property (nonatomic, null_resettable) MGLStyleValue *textPadding; /** If true, the text may be flipped vertically to prevent it from being rendered upside-down. - The default value of this property is an `NSNumber` object containing `YES`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `YES`. Set this property to `nil` to reset it to the default value. - This property is only applied to the style if `textField` is non-`nil`, and `textRotationAlignment` is set to an `NSValue` object containing `MGLTextRotationAlignmentMap`, and `symbolPlacement` is set to an `NSValue` object containing `MGLSymbolPlacementLine`. Otherwise, it is ignored. + This property is only applied to the style if `textField` is non-`nil`, and `textRotationAlignment` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLTextRotationAlignmentMap`, and `symbolPlacement` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLSymbolPlacementLine`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textKeepUpright; +@property (nonatomic, null_resettable) MGLStyleValue *textKeepUpright; /** Specifies how to capitalize text, similar to the CSS `text-transform` property. - The default value of this property is an `NSValue` object containing `MGLTextTransformNone`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLTextTransformNone`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textTransform; +@property (nonatomic, null_resettable) MGLStyleValue *textTransform; /** Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up. This property is measured in ems. - The default value of this property is an `NSValue` object containing a `CGVector` struct set to 0 ems from the left and 0 ems from the top. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 ems from the left and 0 ems from the top. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textOffset; +@property (nonatomic, null_resettable) MGLStyleValue *textOffset; /** If true, the text will be visible even if it collides with other previously drawn symbols. - The default value of this property is an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textAllowOverlap; +@property (nonatomic, null_resettable) MGLStyleValue *textAllowOverlap; /** If true, other symbols can be visible even if they collide with the text. - The default value of this property is an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textIgnorePlacement; +@property (nonatomic, null_resettable) MGLStyleValue *textIgnorePlacement; /** If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not. - The default value of this property is an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`, and `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textOptional; +@property (nonatomic, null_resettable) MGLStyleValue *textOptional; #pragma mark - Accessing the Paint Attributes /** The opacity at which the icon will be drawn. - The default value of this property is an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconOpacity; +@property (nonatomic, null_resettable) MGLStyleValue *iconOpacity; #if TARGET_OS_IPHONE /** The color of the icon. This can only be used with sdf icons. - The default value of this property is `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconColor; +@property (nonatomic, null_resettable) MGLStyleValue *iconColor; #else /** The color of the icon. This can only be used with sdf icons. - The default value of this property is `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconColor; +@property (nonatomic, null_resettable) MGLStyleValue *iconColor; #endif #if TARGET_OS_IPHONE /** The color of the icon's halo. Icon halos can only be used with SDF icons. - The default value of this property is `UIColor.clearColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `UIColor.clearColor`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconHaloColor; +@property (nonatomic, null_resettable) MGLStyleValue *iconHaloColor; #else /** The color of the icon's halo. Icon halos can only be used with SDF icons. - The default value of this property is `NSColor.clearColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `NSColor.clearColor`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconHaloColor; +@property (nonatomic, null_resettable) MGLStyleValue *iconHaloColor; #endif /** @@ -608,90 +608,90 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { This property is measured in points. - The default value of this property is an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconHaloWidth; +@property (nonatomic, null_resettable) MGLStyleValue *iconHaloWidth; /** Fade out the halo towards the outside. This property is measured in points. - The default value of this property is an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconHaloBlur; +@property (nonatomic, null_resettable) MGLStyleValue *iconHaloBlur; /** Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up. This property is measured in points. - The default value of this property is an `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconTranslate; +@property (nonatomic, null_resettable) MGLStyleValue *iconTranslate; /** Controls the translation reference point. - The default value of this property is an `NSValue` object containing `MGLIconTranslateAnchorMap`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLIconTranslateAnchorMap`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImage` is non-`nil`, and `iconTranslate` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id iconTranslateAnchor; +@property (nonatomic, null_resettable) MGLStyleValue *iconTranslateAnchor; /** The opacity at which the text will be drawn. - The default value of this property is an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textOpacity; +@property (nonatomic, null_resettable) MGLStyleValue *textOpacity; #if TARGET_OS_IPHONE /** The color with which the text will be drawn. - The default value of this property is `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textColor; +@property (nonatomic, null_resettable) MGLStyleValue *textColor; #else /** The color with which the text will be drawn. - The default value of this property is `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textColor; +@property (nonatomic, null_resettable) MGLStyleValue *textColor; #endif #if TARGET_OS_IPHONE /** The color of the text's halo, which helps it stand out from backgrounds. - The default value of this property is `UIColor.clearColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `UIColor.clearColor`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textHaloColor; +@property (nonatomic, null_resettable) MGLStyleValue *textHaloColor; #else /** The color of the text's halo, which helps it stand out from backgrounds. - The default value of this property is `NSColor.clearColor`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing `NSColor.clearColor`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textHaloColor; +@property (nonatomic, null_resettable) MGLStyleValue *textHaloColor; #endif /** @@ -699,42 +699,42 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { This property is measured in points. - The default value of this property is an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textHaloWidth; +@property (nonatomic, null_resettable) MGLStyleValue *textHaloWidth; /** The halo's fadeout distance towards the outside. This property is measured in points. - The default value of this property is an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textHaloBlur; +@property (nonatomic, null_resettable) MGLStyleValue *textHaloBlur; /** Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up. This property is measured in points. - The default value of this property is an `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textTranslate; +@property (nonatomic, null_resettable) MGLStyleValue *textTranslate; /** Controls the translation reference point. - The default value of this property is an `NSValue` object containing `MGLTextTranslateAnchorMap`. Set this property to `nil` to reset it to the default value. + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLTextTranslateAnchorMap`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `textField` is non-`nil`, and `textTranslate` is non-`nil`. Otherwise, it is ignored. */ -@property (nonatomic, null_resettable) id textTranslateAnchor; +@property (nonatomic, null_resettable) MGLStyleValue *textTranslateAnchor; @end diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm index 01ac10f66fd..a4c56fe2976 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.mm +++ b/platform/darwin/src/MGLSymbolStyleLayer.mm @@ -4,7 +4,7 @@ #import "MGLSource.h" #import "NSPredicate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" -#import "MGLStyleAttributeValue.h" +#import "MGLStyleValue_Private.h" #import "MGLSymbolStyleLayer.h" #include @@ -48,390 +48,486 @@ - (NSPredicate *)predicate #pragma mark - Accessing the Layout Attributes -- (void)setSymbolPlacement:(id )symbolPlacement { - MGLSetEnumProperty(symbolPlacement, SymbolPlacement, SymbolPlacementType, MGLSymbolPlacement); +- (void)setSymbolPlacement:(MGLStyleValue *)symbolPlacement { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(symbolPlacement); + self.layer->setSymbolPlacement(mbglValue); } -- (id )symbolPlacement { - MGLGetEnumProperty(SymbolPlacement, SymbolPlacementType, MGLSymbolPlacement); +- (MGLStyleValue *)symbolPlacement { + auto propertyValue = self.layer->getSymbolPlacement() ?: self.layer->getDefaultSymbolPlacement(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setSymbolSpacing:(id )symbolSpacing { - self.layer->setSymbolSpacing(symbolSpacing.mbgl_floatPropertyValue); +- (void)setSymbolSpacing:(MGLStyleValue *)symbolSpacing { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(symbolSpacing); + self.layer->setSymbolSpacing(mbglValue); } -- (id )symbolSpacing { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getSymbolSpacing() ?: self.layer->getDefaultSymbolSpacing()]; +- (MGLStyleValue *)symbolSpacing { + auto propertyValue = self.layer->getSymbolSpacing() ?: self.layer->getDefaultSymbolSpacing(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setSymbolAvoidEdges:(id )symbolAvoidEdges { - self.layer->setSymbolAvoidEdges(symbolAvoidEdges.mbgl_boolPropertyValue); +- (void)setSymbolAvoidEdges:(MGLStyleValue *)symbolAvoidEdges { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(symbolAvoidEdges); + self.layer->setSymbolAvoidEdges(mbglValue); } -- (id )symbolAvoidEdges { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getSymbolAvoidEdges() ?: self.layer->getDefaultSymbolAvoidEdges()]; +- (MGLStyleValue *)symbolAvoidEdges { + auto propertyValue = self.layer->getSymbolAvoidEdges() ?: self.layer->getDefaultSymbolAvoidEdges(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconAllowOverlap:(id )iconAllowOverlap { - self.layer->setIconAllowOverlap(iconAllowOverlap.mbgl_boolPropertyValue); +- (void)setIconAllowOverlap:(MGLStyleValue *)iconAllowOverlap { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconAllowOverlap); + self.layer->setIconAllowOverlap(mbglValue); } -- (id )iconAllowOverlap { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconAllowOverlap() ?: self.layer->getDefaultIconAllowOverlap()]; +- (MGLStyleValue *)iconAllowOverlap { + auto propertyValue = self.layer->getIconAllowOverlap() ?: self.layer->getDefaultIconAllowOverlap(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconIgnorePlacement:(id )iconIgnorePlacement { - self.layer->setIconIgnorePlacement(iconIgnorePlacement.mbgl_boolPropertyValue); +- (void)setIconIgnorePlacement:(MGLStyleValue *)iconIgnorePlacement { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconIgnorePlacement); + self.layer->setIconIgnorePlacement(mbglValue); } -- (id )iconIgnorePlacement { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconIgnorePlacement() ?: self.layer->getDefaultIconIgnorePlacement()]; +- (MGLStyleValue *)iconIgnorePlacement { + auto propertyValue = self.layer->getIconIgnorePlacement() ?: self.layer->getDefaultIconIgnorePlacement(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconOptional:(id )iconOptional { - self.layer->setIconOptional(iconOptional.mbgl_boolPropertyValue); +- (void)setIconOptional:(MGLStyleValue *)iconOptional { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconOptional); + self.layer->setIconOptional(mbglValue); } -- (id )iconOptional { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconOptional() ?: self.layer->getDefaultIconOptional()]; +- (MGLStyleValue *)iconOptional { + auto propertyValue = self.layer->getIconOptional() ?: self.layer->getDefaultIconOptional(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconRotationAlignment:(id )iconRotationAlignment { - MGLSetEnumProperty(iconRotationAlignment, IconRotationAlignment, AlignmentType, MGLIconRotationAlignment); +- (void)setIconRotationAlignment:(MGLStyleValue *)iconRotationAlignment { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconRotationAlignment); + self.layer->setIconRotationAlignment(mbglValue); } -- (id )iconRotationAlignment { - MGLGetEnumProperty(IconRotationAlignment, AlignmentType, MGLIconRotationAlignment); +- (MGLStyleValue *)iconRotationAlignment { + auto propertyValue = self.layer->getIconRotationAlignment() ?: self.layer->getDefaultIconRotationAlignment(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconSize:(id )iconSize { - self.layer->setIconSize(iconSize.mbgl_floatPropertyValue); +- (void)setIconSize:(MGLStyleValue *)iconSize { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconSize); + self.layer->setIconSize(mbglValue); } -- (id )iconSize { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconSize() ?: self.layer->getDefaultIconSize()]; +- (MGLStyleValue *)iconSize { + auto propertyValue = self.layer->getIconSize() ?: self.layer->getDefaultIconSize(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconTextFit:(id )iconTextFit { - MGLSetEnumProperty(iconTextFit, IconTextFit, IconTextFitType, MGLIconTextFit); +- (void)setIconTextFit:(MGLStyleValue *)iconTextFit { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconTextFit); + self.layer->setIconTextFit(mbglValue); } -- (id )iconTextFit { - MGLGetEnumProperty(IconTextFit, IconTextFitType, MGLIconTextFit); +- (MGLStyleValue *)iconTextFit { + auto propertyValue = self.layer->getIconTextFit() ?: self.layer->getDefaultIconTextFit(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconTextFitPadding:(id )iconTextFitPadding { - self.layer->setIconTextFitPadding(iconTextFitPadding.mbgl_paddingPropertyValue); +- (void)setIconTextFitPadding:(MGLStyleValue *)iconTextFitPadding { + auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(iconTextFitPadding); + self.layer->setIconTextFitPadding(mbglValue); } -- (id )iconTextFitPadding { - return [MGLStyleAttribute mbgl_paddingWithPropertyValuePadding:self.layer->getIconTextFitPadding() ?: self.layer->getDefaultIconTextFitPadding()]; +- (MGLStyleValue *)iconTextFitPadding { + auto propertyValue = self.layer->getIconTextFitPadding() ?: self.layer->getDefaultIconTextFitPadding(); + return MGLStyleValueTransformer, NSValue *>().toStyleValue(propertyValue); } -- (void)setIconImage:(id )iconImage { - self.layer->setIconImage(iconImage.mbgl_stringPropertyValue); +- (void)setIconImage:(MGLStyleValue *)iconImage { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconImage); + self.layer->setIconImage(mbglValue); } -- (id )iconImage { - return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getIconImage() ?: self.layer->getDefaultIconImage()]; +- (MGLStyleValue *)iconImage { + auto propertyValue = self.layer->getIconImage() ?: self.layer->getDefaultIconImage(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconRotate:(id )iconRotate { - self.layer->setIconRotate(iconRotate.mbgl_floatPropertyValue); +- (void)setIconRotate:(MGLStyleValue *)iconRotate { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconRotate); + self.layer->setIconRotate(mbglValue); } -- (id )iconRotate { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconRotate() ?: self.layer->getDefaultIconRotate()]; +- (MGLStyleValue *)iconRotate { + auto propertyValue = self.layer->getIconRotate() ?: self.layer->getDefaultIconRotate(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconPadding:(id )iconPadding { - self.layer->setIconPadding(iconPadding.mbgl_floatPropertyValue); +- (void)setIconPadding:(MGLStyleValue *)iconPadding { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconPadding); + self.layer->setIconPadding(mbglValue); } -- (id )iconPadding { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconPadding() ?: self.layer->getDefaultIconPadding()]; +- (MGLStyleValue *)iconPadding { + auto propertyValue = self.layer->getIconPadding() ?: self.layer->getDefaultIconPadding(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconKeepUpright:(id )iconKeepUpright { - self.layer->setIconKeepUpright(iconKeepUpright.mbgl_boolPropertyValue); +- (void)setIconKeepUpright:(MGLStyleValue *)iconKeepUpright { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconKeepUpright); + self.layer->setIconKeepUpright(mbglValue); } -- (id )iconKeepUpright { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconKeepUpright() ?: self.layer->getDefaultIconKeepUpright()]; +- (MGLStyleValue *)iconKeepUpright { + auto propertyValue = self.layer->getIconKeepUpright() ?: self.layer->getDefaultIconKeepUpright(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconOffset:(id )iconOffset { - self.layer->setIconOffset(iconOffset.mbgl_offsetPropertyValue); +- (void)setIconOffset:(MGLStyleValue *)iconOffset { + auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(iconOffset); + self.layer->setIconOffset(mbglValue); } -- (id )iconOffset { - return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getIconOffset() ?: self.layer->getDefaultIconOffset()]; +- (MGLStyleValue *)iconOffset { + auto propertyValue = self.layer->getIconOffset() ?: self.layer->getDefaultIconOffset(); + return MGLStyleValueTransformer, NSValue *>().toStyleValue(propertyValue); } -- (void)setTextPitchAlignment:(id )textPitchAlignment { - MGLSetEnumProperty(textPitchAlignment, TextPitchAlignment, AlignmentType, MGLTextPitchAlignment); +- (void)setTextPitchAlignment:(MGLStyleValue *)textPitchAlignment { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textPitchAlignment); + self.layer->setTextPitchAlignment(mbglValue); } -- (id )textPitchAlignment { - MGLGetEnumProperty(TextPitchAlignment, AlignmentType, MGLTextPitchAlignment); +- (MGLStyleValue *)textPitchAlignment { + auto propertyValue = self.layer->getTextPitchAlignment() ?: self.layer->getDefaultTextPitchAlignment(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextRotationAlignment:(id )textRotationAlignment { - MGLSetEnumProperty(textRotationAlignment, TextRotationAlignment, AlignmentType, MGLTextRotationAlignment); +- (void)setTextRotationAlignment:(MGLStyleValue *)textRotationAlignment { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textRotationAlignment); + self.layer->setTextRotationAlignment(mbglValue); } -- (id )textRotationAlignment { - MGLGetEnumProperty(TextRotationAlignment, AlignmentType, MGLTextRotationAlignment); +- (MGLStyleValue *)textRotationAlignment { + auto propertyValue = self.layer->getTextRotationAlignment() ?: self.layer->getDefaultTextRotationAlignment(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextField:(id )textField { - self.layer->setTextField(textField.mbgl_stringPropertyValue); +- (void)setTextField:(MGLStyleValue *)textField { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textField); + self.layer->setTextField(mbglValue); } -- (id )textField { - return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getTextField() ?: self.layer->getDefaultTextField()]; +- (MGLStyleValue *)textField { + auto propertyValue = self.layer->getTextField() ?: self.layer->getDefaultTextField(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextFont:(id )textFont { - self.layer->setTextFont(textFont.mbgl_stringArrayPropertyValue); +- (void)setTextFont:(MGLStyleValue *> *)textFont { + auto mbglValue = MGLStyleValueTransformer, NSArray *, std::string>().toPropertyValue(textFont); + self.layer->setTextFont(mbglValue); } -- (id )textFont { - return [MGLStyleAttribute mbgl_stringArrayWithPropertyValueStringArray:self.layer->getTextFont() ?: self.layer->getDefaultTextFont()]; +- (MGLStyleValue *> *)textFont { + auto propertyValue = self.layer->getTextFont() ?: self.layer->getDefaultTextFont(); + return MGLStyleValueTransformer, NSArray *, std::string>().toStyleValue(propertyValue); } -- (void)setTextSize:(id )textSize { - self.layer->setTextSize(textSize.mbgl_floatPropertyValue); +- (void)setTextSize:(MGLStyleValue *)textSize { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textSize); + self.layer->setTextSize(mbglValue); } -- (id )textSize { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextSize() ?: self.layer->getDefaultTextSize()]; +- (MGLStyleValue *)textSize { + auto propertyValue = self.layer->getTextSize() ?: self.layer->getDefaultTextSize(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextMaxWidth:(id )textMaxWidth { - self.layer->setTextMaxWidth(textMaxWidth.mbgl_floatPropertyValue); +- (void)setTextMaxWidth:(MGLStyleValue *)textMaxWidth { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textMaxWidth); + self.layer->setTextMaxWidth(mbglValue); } -- (id )textMaxWidth { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextMaxWidth() ?: self.layer->getDefaultTextMaxWidth()]; +- (MGLStyleValue *)textMaxWidth { + auto propertyValue = self.layer->getTextMaxWidth() ?: self.layer->getDefaultTextMaxWidth(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextLineHeight:(id )textLineHeight { - self.layer->setTextLineHeight(textLineHeight.mbgl_floatPropertyValue); +- (void)setTextLineHeight:(MGLStyleValue *)textLineHeight { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textLineHeight); + self.layer->setTextLineHeight(mbglValue); } -- (id )textLineHeight { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextLineHeight() ?: self.layer->getDefaultTextLineHeight()]; +- (MGLStyleValue *)textLineHeight { + auto propertyValue = self.layer->getTextLineHeight() ?: self.layer->getDefaultTextLineHeight(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextLetterSpacing:(id )textLetterSpacing { - self.layer->setTextLetterSpacing(textLetterSpacing.mbgl_floatPropertyValue); +- (void)setTextLetterSpacing:(MGLStyleValue *)textLetterSpacing { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textLetterSpacing); + self.layer->setTextLetterSpacing(mbglValue); } -- (id )textLetterSpacing { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextLetterSpacing() ?: self.layer->getDefaultTextLetterSpacing()]; +- (MGLStyleValue *)textLetterSpacing { + auto propertyValue = self.layer->getTextLetterSpacing() ?: self.layer->getDefaultTextLetterSpacing(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextJustify:(id )textJustify { - MGLSetEnumProperty(textJustify, TextJustify, TextJustifyType, MGLTextJustify); +- (void)setTextJustify:(MGLStyleValue *)textJustify { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textJustify); + self.layer->setTextJustify(mbglValue); } -- (id )textJustify { - MGLGetEnumProperty(TextJustify, TextJustifyType, MGLTextJustify); +- (MGLStyleValue *)textJustify { + auto propertyValue = self.layer->getTextJustify() ?: self.layer->getDefaultTextJustify(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextAnchor:(id )textAnchor { - MGLSetEnumProperty(textAnchor, TextAnchor, TextAnchorType, MGLTextAnchor); +- (void)setTextAnchor:(MGLStyleValue *)textAnchor { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textAnchor); + self.layer->setTextAnchor(mbglValue); } -- (id )textAnchor { - MGLGetEnumProperty(TextAnchor, TextAnchorType, MGLTextAnchor); +- (MGLStyleValue *)textAnchor { + auto propertyValue = self.layer->getTextAnchor() ?: self.layer->getDefaultTextAnchor(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextMaxAngle:(id )textMaxAngle { - self.layer->setTextMaxAngle(textMaxAngle.mbgl_floatPropertyValue); +- (void)setTextMaxAngle:(MGLStyleValue *)textMaxAngle { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textMaxAngle); + self.layer->setTextMaxAngle(mbglValue); } -- (id )textMaxAngle { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextMaxAngle() ?: self.layer->getDefaultTextMaxAngle()]; +- (MGLStyleValue *)textMaxAngle { + auto propertyValue = self.layer->getTextMaxAngle() ?: self.layer->getDefaultTextMaxAngle(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextRotate:(id )textRotate { - self.layer->setTextRotate(textRotate.mbgl_floatPropertyValue); +- (void)setTextRotate:(MGLStyleValue *)textRotate { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textRotate); + self.layer->setTextRotate(mbglValue); } -- (id )textRotate { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextRotate() ?: self.layer->getDefaultTextRotate()]; +- (MGLStyleValue *)textRotate { + auto propertyValue = self.layer->getTextRotate() ?: self.layer->getDefaultTextRotate(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextPadding:(id )textPadding { - self.layer->setTextPadding(textPadding.mbgl_floatPropertyValue); +- (void)setTextPadding:(MGLStyleValue *)textPadding { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textPadding); + self.layer->setTextPadding(mbglValue); } -- (id )textPadding { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextPadding() ?: self.layer->getDefaultTextPadding()]; +- (MGLStyleValue *)textPadding { + auto propertyValue = self.layer->getTextPadding() ?: self.layer->getDefaultTextPadding(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextKeepUpright:(id )textKeepUpright { - self.layer->setTextKeepUpright(textKeepUpright.mbgl_boolPropertyValue); +- (void)setTextKeepUpright:(MGLStyleValue *)textKeepUpright { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textKeepUpright); + self.layer->setTextKeepUpright(mbglValue); } -- (id )textKeepUpright { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextKeepUpright() ?: self.layer->getDefaultTextKeepUpright()]; +- (MGLStyleValue *)textKeepUpright { + auto propertyValue = self.layer->getTextKeepUpright() ?: self.layer->getDefaultTextKeepUpright(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextTransform:(id )textTransform { - MGLSetEnumProperty(textTransform, TextTransform, TextTransformType, MGLTextTransform); +- (void)setTextTransform:(MGLStyleValue *)textTransform { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textTransform); + self.layer->setTextTransform(mbglValue); } -- (id )textTransform { - MGLGetEnumProperty(TextTransform, TextTransformType, MGLTextTransform); +- (MGLStyleValue *)textTransform { + auto propertyValue = self.layer->getTextTransform() ?: self.layer->getDefaultTextTransform(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextOffset:(id )textOffset { - self.layer->setTextOffset(textOffset.mbgl_offsetPropertyValue); +- (void)setTextOffset:(MGLStyleValue *)textOffset { + auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(textOffset); + self.layer->setTextOffset(mbglValue); } -- (id )textOffset { - return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getTextOffset() ?: self.layer->getDefaultTextOffset()]; +- (MGLStyleValue *)textOffset { + auto propertyValue = self.layer->getTextOffset() ?: self.layer->getDefaultTextOffset(); + return MGLStyleValueTransformer, NSValue *>().toStyleValue(propertyValue); } -- (void)setTextAllowOverlap:(id )textAllowOverlap { - self.layer->setTextAllowOverlap(textAllowOverlap.mbgl_boolPropertyValue); +- (void)setTextAllowOverlap:(MGLStyleValue *)textAllowOverlap { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textAllowOverlap); + self.layer->setTextAllowOverlap(mbglValue); } -- (id )textAllowOverlap { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextAllowOverlap() ?: self.layer->getDefaultTextAllowOverlap()]; +- (MGLStyleValue *)textAllowOverlap { + auto propertyValue = self.layer->getTextAllowOverlap() ?: self.layer->getDefaultTextAllowOverlap(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextIgnorePlacement:(id )textIgnorePlacement { - self.layer->setTextIgnorePlacement(textIgnorePlacement.mbgl_boolPropertyValue); +- (void)setTextIgnorePlacement:(MGLStyleValue *)textIgnorePlacement { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textIgnorePlacement); + self.layer->setTextIgnorePlacement(mbglValue); } -- (id )textIgnorePlacement { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextIgnorePlacement() ?: self.layer->getDefaultTextIgnorePlacement()]; +- (MGLStyleValue *)textIgnorePlacement { + auto propertyValue = self.layer->getTextIgnorePlacement() ?: self.layer->getDefaultTextIgnorePlacement(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextOptional:(id )textOptional { - self.layer->setTextOptional(textOptional.mbgl_boolPropertyValue); +- (void)setTextOptional:(MGLStyleValue *)textOptional { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textOptional); + self.layer->setTextOptional(mbglValue); } -- (id )textOptional { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextOptional() ?: self.layer->getDefaultTextOptional()]; +- (MGLStyleValue *)textOptional { + auto propertyValue = self.layer->getTextOptional() ?: self.layer->getDefaultTextOptional(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } #pragma mark - Accessing the Paint Attributes -- (void)setIconOpacity:(id )iconOpacity { - self.layer->setIconOpacity(iconOpacity.mbgl_floatPropertyValue); +- (void)setIconOpacity:(MGLStyleValue *)iconOpacity { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconOpacity); + self.layer->setIconOpacity(mbglValue); } -- (id )iconOpacity { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconOpacity() ?: self.layer->getDefaultIconOpacity()]; +- (MGLStyleValue *)iconOpacity { + auto propertyValue = self.layer->getIconOpacity() ?: self.layer->getDefaultIconOpacity(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconColor:(id )iconColor { - self.layer->setIconColor(iconColor.mbgl_colorPropertyValue); +- (void)setIconColor:(MGLStyleValue *)iconColor { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconColor); + self.layer->setIconColor(mbglValue); } -- (id )iconColor { - return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getIconColor() ?: self.layer->getDefaultIconColor()]; +- (MGLStyleValue *)iconColor { + auto propertyValue = self.layer->getIconColor() ?: self.layer->getDefaultIconColor(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconHaloColor:(id )iconHaloColor { - self.layer->setIconHaloColor(iconHaloColor.mbgl_colorPropertyValue); +- (void)setIconHaloColor:(MGLStyleValue *)iconHaloColor { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconHaloColor); + self.layer->setIconHaloColor(mbglValue); } -- (id )iconHaloColor { - return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getIconHaloColor() ?: self.layer->getDefaultIconHaloColor()]; +- (MGLStyleValue *)iconHaloColor { + auto propertyValue = self.layer->getIconHaloColor() ?: self.layer->getDefaultIconHaloColor(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconHaloWidth:(id )iconHaloWidth { - self.layer->setIconHaloWidth(iconHaloWidth.mbgl_floatPropertyValue); +- (void)setIconHaloWidth:(MGLStyleValue *)iconHaloWidth { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconHaloWidth); + self.layer->setIconHaloWidth(mbglValue); } -- (id )iconHaloWidth { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconHaloWidth() ?: self.layer->getDefaultIconHaloWidth()]; +- (MGLStyleValue *)iconHaloWidth { + auto propertyValue = self.layer->getIconHaloWidth() ?: self.layer->getDefaultIconHaloWidth(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconHaloBlur:(id )iconHaloBlur { - self.layer->setIconHaloBlur(iconHaloBlur.mbgl_floatPropertyValue); +- (void)setIconHaloBlur:(MGLStyleValue *)iconHaloBlur { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconHaloBlur); + self.layer->setIconHaloBlur(mbglValue); } -- (id )iconHaloBlur { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconHaloBlur() ?: self.layer->getDefaultIconHaloBlur()]; +- (MGLStyleValue *)iconHaloBlur { + auto propertyValue = self.layer->getIconHaloBlur() ?: self.layer->getDefaultIconHaloBlur(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconTranslate:(id )iconTranslate { - self.layer->setIconTranslate(iconTranslate.mbgl_offsetPropertyValue); +- (void)setIconTranslate:(MGLStyleValue *)iconTranslate { + auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(iconTranslate); + self.layer->setIconTranslate(mbglValue); } -- (id )iconTranslate { - return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getIconTranslate() ?: self.layer->getDefaultIconTranslate()]; +- (MGLStyleValue *)iconTranslate { + auto propertyValue = self.layer->getIconTranslate() ?: self.layer->getDefaultIconTranslate(); + return MGLStyleValueTransformer, NSValue *>().toStyleValue(propertyValue); } -- (void)setIconTranslateAnchor:(id )iconTranslateAnchor { - MGLSetEnumProperty(iconTranslateAnchor, IconTranslateAnchor, TranslateAnchorType, MGLIconTranslateAnchor); +- (void)setIconTranslateAnchor:(MGLStyleValue *)iconTranslateAnchor { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(iconTranslateAnchor); + self.layer->setIconTranslateAnchor(mbglValue); } -- (id )iconTranslateAnchor { - MGLGetEnumProperty(IconTranslateAnchor, TranslateAnchorType, MGLIconTranslateAnchor); +- (MGLStyleValue *)iconTranslateAnchor { + auto propertyValue = self.layer->getIconTranslateAnchor() ?: self.layer->getDefaultIconTranslateAnchor(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextOpacity:(id )textOpacity { - self.layer->setTextOpacity(textOpacity.mbgl_floatPropertyValue); +- (void)setTextOpacity:(MGLStyleValue *)textOpacity { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textOpacity); + self.layer->setTextOpacity(mbglValue); } -- (id )textOpacity { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextOpacity() ?: self.layer->getDefaultTextOpacity()]; +- (MGLStyleValue *)textOpacity { + auto propertyValue = self.layer->getTextOpacity() ?: self.layer->getDefaultTextOpacity(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextColor:(id )textColor { - self.layer->setTextColor(textColor.mbgl_colorPropertyValue); +- (void)setTextColor:(MGLStyleValue *)textColor { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textColor); + self.layer->setTextColor(mbglValue); } -- (id )textColor { - return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getTextColor() ?: self.layer->getDefaultTextColor()]; +- (MGLStyleValue *)textColor { + auto propertyValue = self.layer->getTextColor() ?: self.layer->getDefaultTextColor(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextHaloColor:(id )textHaloColor { - self.layer->setTextHaloColor(textHaloColor.mbgl_colorPropertyValue); +- (void)setTextHaloColor:(MGLStyleValue *)textHaloColor { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textHaloColor); + self.layer->setTextHaloColor(mbglValue); } -- (id )textHaloColor { - return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getTextHaloColor() ?: self.layer->getDefaultTextHaloColor()]; +- (MGLStyleValue *)textHaloColor { + auto propertyValue = self.layer->getTextHaloColor() ?: self.layer->getDefaultTextHaloColor(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextHaloWidth:(id )textHaloWidth { - self.layer->setTextHaloWidth(textHaloWidth.mbgl_floatPropertyValue); +- (void)setTextHaloWidth:(MGLStyleValue *)textHaloWidth { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textHaloWidth); + self.layer->setTextHaloWidth(mbglValue); } -- (id )textHaloWidth { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextHaloWidth() ?: self.layer->getDefaultTextHaloWidth()]; +- (MGLStyleValue *)textHaloWidth { + auto propertyValue = self.layer->getTextHaloWidth() ?: self.layer->getDefaultTextHaloWidth(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextHaloBlur:(id )textHaloBlur { - self.layer->setTextHaloBlur(textHaloBlur.mbgl_floatPropertyValue); +- (void)setTextHaloBlur:(MGLStyleValue *)textHaloBlur { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textHaloBlur); + self.layer->setTextHaloBlur(mbglValue); } -- (id )textHaloBlur { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextHaloBlur() ?: self.layer->getDefaultTextHaloBlur()]; +- (MGLStyleValue *)textHaloBlur { + auto propertyValue = self.layer->getTextHaloBlur() ?: self.layer->getDefaultTextHaloBlur(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextTranslate:(id )textTranslate { - self.layer->setTextTranslate(textTranslate.mbgl_offsetPropertyValue); +- (void)setTextTranslate:(MGLStyleValue *)textTranslate { + auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(textTranslate); + self.layer->setTextTranslate(mbglValue); } -- (id )textTranslate { - return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getTextTranslate() ?: self.layer->getDefaultTextTranslate()]; +- (MGLStyleValue *)textTranslate { + auto propertyValue = self.layer->getTextTranslate() ?: self.layer->getDefaultTextTranslate(); + return MGLStyleValueTransformer, NSValue *>().toStyleValue(propertyValue); } -- (void)setTextTranslateAnchor:(id )textTranslateAnchor { - MGLSetEnumProperty(textTranslateAnchor, TextTranslateAnchor, TranslateAnchorType, MGLTextTranslateAnchor); +- (void)setTextTranslateAnchor:(MGLStyleValue *)textTranslateAnchor { + auto mbglValue = MGLStyleValueTransformer().toPropertyValue(textTranslateAnchor); + self.layer->setTextTranslateAnchor(mbglValue); } -- (id )textTranslateAnchor { - MGLGetEnumProperty(TextTranslateAnchor, TranslateAnchorType, MGLTextTranslateAnchor); +- (MGLStyleValue *)textTranslateAnchor { + auto propertyValue = self.layer->getTextTranslateAnchor() ?: self.layer->getDefaultTextTranslateAnchor(); + return MGLStyleValueTransformer().toStyleValue(propertyValue); } @end diff --git a/platform/darwin/src/NSArray+MGLStyleAttributeAdditions.h b/platform/darwin/src/NSArray+MGLStyleAttributeAdditions.h deleted file mode 100644 index fa5193acf05..00000000000 --- a/platform/darwin/src/NSArray+MGLStyleAttributeAdditions.h +++ /dev/null @@ -1,7 +0,0 @@ -#import - -#import "MGLStyleAttributeValue.h" - -@interface NSArray (MGLStyleAttributeAdditions) - -@end diff --git a/platform/darwin/src/NSArray+MGLStyleAttributeAdditions.mm b/platform/darwin/src/NSArray+MGLStyleAttributeAdditions.mm deleted file mode 100644 index fb60cf0f728..00000000000 --- a/platform/darwin/src/NSArray+MGLStyleAttributeAdditions.mm +++ /dev/null @@ -1,36 +0,0 @@ -#import "NSArray+MGLStyleAttributeAdditions.h" - -#import "NSArray+MGLStyleAttributeAdditions_Private.h" -#import "MGLStyleAttributeValue_Private.h" - -#include - -@interface NSArray(Private) -@end - -@implementation NSArray (MGLStyleAttributeAdditions) - -- (mbgl::style::PropertyValue >)mbgl_stringArrayPropertyValue -{ - std::vectorfonts; - - for (NSString *font in self) { - fonts.emplace_back(font.UTF8String); - } - - return {{fonts}}; -} - -- (mbgl::style::PropertyValue >)mbgl_numberArrayPropertyValue -{ - std::vectorvalues; - - for (NSNumber *n in self) { - values.emplace_back(n.floatValue); - } - - return {{values}}; -} - - -@end diff --git a/platform/darwin/src/NSArray+MGLStyleAttributeAdditions_Private.h b/platform/darwin/src/NSArray+MGLStyleAttributeAdditions_Private.h deleted file mode 100644 index 1be02c01d29..00000000000 --- a/platform/darwin/src/NSArray+MGLStyleAttributeAdditions_Private.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -#import "MGLStyleAttributeValue.h" - -#include - -@interface NSArray (MGLStyleAttributeAdditions_Private) - -@end diff --git a/platform/darwin/src/NSColor+MGLStyleAttributeAdditions.h b/platform/darwin/src/NSColor+MGLStyleAttributeAdditions.h deleted file mode 100644 index 5a4f7af0060..00000000000 --- a/platform/darwin/src/NSColor+MGLStyleAttributeAdditions.h +++ /dev/null @@ -1,7 +0,0 @@ -#import - -#import "MGLStyleAttributeValue.h" - -@interface NSColor (MGLStyleAttributeAdditions) - -@end diff --git a/platform/darwin/src/NSColor+MGLStyleAttributeAdditions.m b/platform/darwin/src/NSColor+MGLStyleAttributeAdditions.m deleted file mode 100644 index ac330343c87..00000000000 --- a/platform/darwin/src/NSColor+MGLStyleAttributeAdditions.m +++ /dev/null @@ -1,5 +0,0 @@ -#import "NSColor+MGLStyleAttributeAdditions.h" - -@implementation NSColor (MGLStyleAttributeAdditions) - -@end diff --git a/platform/darwin/src/NSColor+MGLStyleAttributeAdditions_Private.h b/platform/darwin/src/NSColor+MGLStyleAttributeAdditions_Private.h deleted file mode 100644 index 9a714cbd838..00000000000 --- a/platform/darwin/src/NSColor+MGLStyleAttributeAdditions_Private.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -#import "MGLStyleAttributeValue.h" - -#include - -@interface NSColor (MGLStyleAttributeAdditions_Private) - -@end diff --git a/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions.h b/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions.h deleted file mode 100644 index 162b5e94f56..00000000000 --- a/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions.h +++ /dev/null @@ -1,7 +0,0 @@ -#import - -#import "MGLStyleAttributeValue.h" - -@interface NSNumber (MGLStyleAttributeAdditions) - -@end diff --git a/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions.mm b/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions.mm deleted file mode 100644 index 163105d2fa2..00000000000 --- a/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions.mm +++ /dev/null @@ -1,22 +0,0 @@ -#import "NSNumber+MGLStyleAttributeAdditions.h" - -#include - -@implementation NSNumber (MGLStyleAttributeAdditions) - -- (NSNumber *)numberValue -{ - return self; -} - -- (mbgl::style::PropertyValue)mbgl_boolPropertyValue -{ - return mbgl::style::PropertyValue { !!self.boolValue }; -} - -- (mbgl::style::PropertyValue)mbgl_floatPropertyValue -{ - return mbgl::style::PropertyValue { self.floatValue }; -} - -@end diff --git a/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions_Private.h b/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions_Private.h deleted file mode 100644 index 73e40bb3ad4..00000000000 --- a/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions_Private.h +++ /dev/null @@ -1,13 +0,0 @@ -#import - -#import "MGLStyleAttributeValue.h" - -#include - -@interface NSNumber (MGLStyleAttributeAdditions_Private) - -- (mbgl::style::PropertyValue)mbgl_booleanPropertyValue; - -- (mbgl::style::PropertyValue)mbgl_numberPropertyValue; - -@end diff --git a/platform/darwin/src/NSString+MGLStyleAttributeAdditions.h b/platform/darwin/src/NSString+MGLStyleAttributeAdditions.h deleted file mode 100644 index 21263359229..00000000000 --- a/platform/darwin/src/NSString+MGLStyleAttributeAdditions.h +++ /dev/null @@ -1,7 +0,0 @@ -#import - -#import "MGLStyleAttributeValue.h" - -@interface NSString (MGLStyleAttributeAdditions) - -@end diff --git a/platform/darwin/src/NSString+MGLStyleAttributeAdditions.mm b/platform/darwin/src/NSString+MGLStyleAttributeAdditions.mm deleted file mode 100644 index ff88f5501ae..00000000000 --- a/platform/darwin/src/NSString+MGLStyleAttributeAdditions.mm +++ /dev/null @@ -1,17 +0,0 @@ -#import "NSString+MGLStyleAttributeAdditions.h" - -#import "NSString+MGLStyleAttributeAdditions_Private.h" - -@implementation NSString (MGLStyleAttributeAdditions) - -- (BOOL)isFunction -{ - return NO; -} - -- (mbgl::style::PropertyValue)mbgl_stringPropertyValue -{ - return mbgl::style::PropertyValue {{ self.UTF8String }}; -} - -@end diff --git a/platform/darwin/src/NSString+MGLStyleAttributeAdditions_Private.h b/platform/darwin/src/NSString+MGLStyleAttributeAdditions_Private.h deleted file mode 100644 index 8e401e2996d..00000000000 --- a/platform/darwin/src/NSString+MGLStyleAttributeAdditions_Private.h +++ /dev/null @@ -1,11 +0,0 @@ -#import - -#import "MGLStyleAttributeValue.h" - -#include - -@interface NSString (MGLStyleAttributeAdditions_Private) - -- (mbgl::style::PropertyValue)mbgl_stringPropertyValue; - -@end diff --git a/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.h b/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.h index 0ee0c78f876..60c1ee4075b 100644 --- a/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.h +++ b/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.h @@ -1,7 +1,13 @@ #import -#import "MGLStyleAttributeValue.h" +#include -@interface NSValue (MGLStyleAttributeValue) +@interface NSValue (MGLStyleAttributeAdditions) + ++ (instancetype)mgl_valueWithOffsetArray:(std::array)offsetArray; ++ (instancetype)mgl_valueWithPaddingArray:(std::array)paddingArray; + +- (std::array)mgl_offsetArrayValue; +- (std::array)mgl_paddingArrayValue; @end diff --git a/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.mm b/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.mm index 83266e7db58..59afe559d72 100644 --- a/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.mm +++ b/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.mm @@ -1,9 +1,5 @@ #import "NSValue+MGLStyleAttributeAdditions.h" -#import "NSValue+MGLStyleAttributeAdditions_Private.h" - -#include - #if TARGET_OS_IPHONE #import #define MGLEdgeInsets UIEdgeInsets @@ -32,16 +28,6 @@ + (instancetype)mgl_valueWithPaddingArray:(std::array)paddingArray return [NSValue value:&insets withObjCType:@encode(MGLEdgeInsets)]; } -- (BOOL)isFunction -{ - return NO; -} - -- (mbgl::style::PropertyValue>)mbgl_offsetPropertyValue -{ - return { self.mgl_offsetArrayValue }; -} - - (std::array)mgl_offsetArrayValue { NSAssert(strcmp(self.objCType, @encode(CGVector)) == 0, @"Value does not represent a CGVector"); @@ -53,11 +39,6 @@ - (BOOL)isFunction }; } -- (mbgl::style::PropertyValue>)mbgl_paddingPropertyValue -{ - return { self.mgl_paddingArrayValue }; -} - - (std::array)mgl_paddingArrayValue { NSAssert(strcmp(self.objCType, @encode(MGLEdgeInsets)) == 0, @"Value does not represent an NSEdgeInsets/UIEdgeInsets"); diff --git a/platform/darwin/src/NSValue+MGLStyleAttributeAdditions_Private.h b/platform/darwin/src/NSValue+MGLStyleAttributeAdditions_Private.h deleted file mode 100644 index 28a9b10908a..00000000000 --- a/platform/darwin/src/NSValue+MGLStyleAttributeAdditions_Private.h +++ /dev/null @@ -1,15 +0,0 @@ -#import - -#import "MGLStyleAttributeValue.h" - -#include - -@interface NSValue (MGLStyleAttributeAdditions_Private) - -+ (instancetype)mgl_valueWithOffsetArray:(std::array)offsetArray; -+ (instancetype)mgl_valueWithPaddingArray:(std::array)paddingArray; - -- (std::array)mgl_offsetArrayValue; -- (std::array)mgl_paddingArrayValue; - -@end diff --git a/platform/darwin/src/UIColor+MGLStyleAttributeAdditions_Private.h b/platform/darwin/src/UIColor+MGLStyleAttributeAdditions_Private.h deleted file mode 100644 index ef886dca5dd..00000000000 --- a/platform/darwin/src/UIColor+MGLStyleAttributeAdditions_Private.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -#import "MGLStyleAttributeValue.h" - -#include - -@interface UIColor (MGLStyleAttributeAdditions_Private) - -@end diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.m b/platform/darwin/test/MGLCircleStyleLayerTests.m index 995802ff183..54ba8be6c10 100644 --- a/platform/darwin/test/MGLCircleStyleLayerTests.m +++ b/platform/darwin/test/MGLCircleStyleLayerTests.m @@ -31,8 +31,10 @@ - (void)testCircleLayer { XCTAssertEqualObjects(gLayer.circleBlur, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.circleOpacity, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.circleTranslate, [MGLRuntimeStylingHelper testOffset]); - XCTAssert([(NSValue *)gLayer.circleTranslateAnchor isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLCircleTranslateAnchorViewport type:@encode(MGLCircleTranslateAnchor)]], @"%@ is not equal to %@", gLayer.circleTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLCircleTranslateAnchorViewport type:@encode(MGLCircleTranslateAnchor)]); - XCTAssert([(NSValue *)gLayer.circlePitchScale isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLCirclePitchScaleViewport type:@encode(MGLCirclePitchScale)]], @"%@ is not equal to %@", gLayer.circlePitchScale, [MGLRuntimeStylingHelper testEnum:MGLCirclePitchScaleViewport type:@encode(MGLCirclePitchScale)]); + XCTAssert([gLayer.circleTranslateAnchor isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.circleTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLCircleTranslateAnchorViewport type:@encode(MGLCircleTranslateAnchor)]); + XCTAssert([gLayer.circlePitchScale isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.circlePitchScale, [MGLRuntimeStylingHelper testEnum:MGLCirclePitchScaleViewport type:@encode(MGLCirclePitchScale)]); layer.circleRadius = [MGLRuntimeStylingHelper testNumberFunction]; layer.circleColor = [MGLRuntimeStylingHelper testColorFunction]; diff --git a/platform/darwin/test/MGLFillStyleLayerTests.m b/platform/darwin/test/MGLFillStyleLayerTests.m index 21c2a9de405..7b312079027 100644 --- a/platform/darwin/test/MGLFillStyleLayerTests.m +++ b/platform/darwin/test/MGLFillStyleLayerTests.m @@ -31,7 +31,8 @@ - (void)testFillLayer { XCTAssertEqualObjects(gLayer.fillColor, [MGLRuntimeStylingHelper testColor]); XCTAssertEqualObjects(gLayer.fillOutlineColor, [MGLRuntimeStylingHelper testColor]); XCTAssertEqualObjects(gLayer.fillTranslate, [MGLRuntimeStylingHelper testOffset]); - XCTAssert([(NSValue *)gLayer.fillTranslateAnchor isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLFillTranslateAnchorViewport type:@encode(MGLFillTranslateAnchor)]], @"%@ is not equal to %@", gLayer.fillTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLFillTranslateAnchorViewport type:@encode(MGLFillTranslateAnchor)]); + XCTAssert([gLayer.fillTranslateAnchor isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.fillTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLFillTranslateAnchorViewport type:@encode(MGLFillTranslateAnchor)]); XCTAssertEqualObjects(gLayer.fillPattern, [MGLRuntimeStylingHelper testString]); layer.fillAntialias = [MGLRuntimeStylingHelper testBoolFunction]; diff --git a/platform/darwin/test/MGLLineStyleLayerTests.m b/platform/darwin/test/MGLLineStyleLayerTests.m index 79f0619f8a7..801bc12ff88 100644 --- a/platform/darwin/test/MGLLineStyleLayerTests.m +++ b/platform/darwin/test/MGLLineStyleLayerTests.m @@ -33,14 +33,17 @@ - (void)testLineLayer { MGLLineStyleLayer *gLayer = (MGLLineStyleLayer *)[self.mapView.style layerWithIdentifier:@"layerID"]; XCTAssertTrue([gLayer isKindOfClass:[MGLLineStyleLayer class]]); - XCTAssert([(NSValue *)gLayer.lineCap isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLLineCapSquare type:@encode(MGLLineCap)]], @"%@ is not equal to %@", gLayer.lineCap, [MGLRuntimeStylingHelper testEnum:MGLLineCapSquare type:@encode(MGLLineCap)]); - XCTAssert([(NSValue *)gLayer.lineJoin isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLLineJoinMiter type:@encode(MGLLineJoin)]], @"%@ is not equal to %@", gLayer.lineJoin, [MGLRuntimeStylingHelper testEnum:MGLLineJoinMiter type:@encode(MGLLineJoin)]); + XCTAssert([gLayer.lineCap isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.lineCap, [MGLRuntimeStylingHelper testEnum:MGLLineCapSquare type:@encode(MGLLineCap)]); + XCTAssert([gLayer.lineJoin isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.lineJoin, [MGLRuntimeStylingHelper testEnum:MGLLineJoinMiter type:@encode(MGLLineJoin)]); XCTAssertEqualObjects(gLayer.lineMiterLimit, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.lineRoundLimit, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.lineOpacity, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.lineColor, [MGLRuntimeStylingHelper testColor]); XCTAssertEqualObjects(gLayer.lineTranslate, [MGLRuntimeStylingHelper testOffset]); - XCTAssert([(NSValue *)gLayer.lineTranslateAnchor isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLLineTranslateAnchorViewport type:@encode(MGLLineTranslateAnchor)]], @"%@ is not equal to %@", gLayer.lineTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLLineTranslateAnchorViewport type:@encode(MGLLineTranslateAnchor)]); + XCTAssert([gLayer.lineTranslateAnchor isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.lineTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLLineTranslateAnchorViewport type:@encode(MGLLineTranslateAnchor)]); XCTAssertEqualObjects(gLayer.lineWidth, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.lineGapWidth, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.lineOffset, [MGLRuntimeStylingHelper testNumber]); diff --git a/platform/darwin/test/MGLRuntimeStylingHelper.h b/platform/darwin/test/MGLRuntimeStylingHelper.h index 6626d13901f..8857dba9c53 100644 --- a/platform/darwin/test/MGLRuntimeStylingHelper.h +++ b/platform/darwin/test/MGLRuntimeStylingHelper.h @@ -1,35 +1,35 @@ #import #import "MGLTypes.h" -#import "MGLStyleAttributeFunction.h" +#import "MGLStyleValue.h" @interface MGLRuntimeStylingHelper : NSObject -+ (NSArray *)testPadding; -+ (MGLStyleAttributeFunction *)testPaddingFunction; ++ (MGLStyleConstantValue *)testPadding; ++ (MGLStyleFunction *)testPaddingFunction; -+ (NSArray *)testOffset; -+ (MGLStyleAttributeFunction *)testOffsetFunction; ++ (MGLStyleConstantValue *)testOffset; ++ (MGLStyleFunction *)testOffsetFunction; -+ (NSArray *)testFont; -+ (MGLStyleAttributeFunction *)testFontFunction; ++ (MGLStyleConstantValue *> *)testFont; ++ (MGLStyleFunction *> *)testFontFunction; -+ (NSArray *)testDashArray; -+ (MGLStyleAttributeFunction *)testDashArrayFunction; ++ (MGLStyleConstantValue *> *)testDashArray; ++ (MGLStyleFunction *> *)testDashArrayFunction; -+ (NSNumber *)testNumber; -+ (MGLStyleAttributeFunction *)testNumberFunction; ++ (MGLStyleConstantValue *)testNumber; ++ (MGLStyleFunction *)testNumberFunction; -+ (NSNumber *)testBool; -+ (MGLStyleAttributeFunction *)testBoolFunction; ++ (MGLStyleConstantValue *)testBool; ++ (MGLStyleFunction *)testBoolFunction; -+ (NSString *)testString; -+ (MGLStyleAttributeFunction *)testStringFunction; ++ (MGLStyleConstantValue *)testString; ++ (MGLStyleFunction *)testStringFunction; -+ (MGLColor *)testColor; -+ (MGLStyleAttributeFunction *)testColorFunction; ++ (MGLStyleConstantValue *)testColor; ++ (MGLStyleFunction *)testColorFunction; -+ (NSValue *)testEnum:(NSUInteger)value type:(const char *)type; -+ (MGLStyleAttributeFunction *)testEnumFunction:(NSUInteger)value type:(const char *)type; ++ (MGLStyleConstantValue *)testEnum:(NSUInteger)value type:(const char *)type; ++ (MGLStyleFunction *)testEnumFunction:(NSUInteger)value type:(const char *)type; @end diff --git a/platform/darwin/test/MGLRuntimeStylingHelper.m b/platform/darwin/test/MGLRuntimeStylingHelper.m index 29e80086ec6..955c664f2c8 100644 --- a/platform/darwin/test/MGLRuntimeStylingHelper.m +++ b/platform/darwin/test/MGLRuntimeStylingHelper.m @@ -10,7 +10,7 @@ @implementation MGLRuntimeStylingHelper -+ (NSValue *)testPadding ++ (MGLStyleConstantValue *)testPadding { MGLEdgeInsets insets = { .top = 1, @@ -18,129 +18,105 @@ + (NSValue *)testPadding .bottom = 1, .right = 1, }; - return [NSValue value:&insets withObjCType:@encode(MGLEdgeInsets)]; + return [MGLStyleConstantValue valueWithRawValue:[NSValue value:&insets withObjCType:@encode(MGLEdgeInsets)]]; } -+ (MGLStyleAttributeFunction *)testPaddingFunction ++ (MGLStyleFunction *)testPaddingFunction { - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - function.stops = @{ - @(18): self.testPadding, - }; - return function; + return [MGLStyleFunction functionWithStops:@{@(18): self.testPadding}]; } -+ (NSValue *)testOffset ++ (MGLStyleConstantValue *)testOffset { CGVector vector = CGVectorMake(1, 1); - return [NSValue value:&vector withObjCType:@encode(CGVector)]; + return [MGLStyleConstantValue valueWithRawValue:[NSValue value:&vector withObjCType:@encode(CGVector)]]; } -+ (MGLStyleAttributeFunction *)testOffsetFunction ++ (MGLStyleFunction *)testOffsetFunction { - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - function.stops = @{ - @(18): self.testOffset, - }; - return function; + return [MGLStyleFunction valueWithStops:@{ @(18): self.testOffset }]; } -+ (NSArray *)testFont ++ (MGLStyleConstantValue *> *)testFont { - return @[@"Open Sans Regular", @"Arial Unicode MS Regular"]; + return [MGLStyleConstantValue *> valueWithRawValue:@[@"Open Sans Regular", @"Arial Unicode MS Regular"]]; } -+ (MGLStyleAttributeFunction *)testFontFunction ++ (MGLStyleFunction *> *)testFontFunction { - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - function.stops = @{ - @(18): self.testFont, - }; - return function; + return [MGLStyleFunction *> valueWithStops:@{ @18: self.testFont }]; } -+ (NSArray *)testDashArray ++ (MGLStyleConstantValue *> *)testDashArray { - return @[@1, @2]; + return [MGLStyleConstantValue *> valueWithRawValue:@[@1, @2]]; } -+ (MGLStyleAttributeFunction *)testDashArrayFunction ++ (MGLStyleFunction *> *)testDashArrayFunction { - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - function.stops = @{ - @(18): self.testDashArray, - }; - return function; + return [MGLStyleFunction *> valueWithStops:@{ + @18: self.testDashArray, + }]; } -+ (NSNumber *)testNumber ++ (MGLStyleConstantValue *)testNumber { - return @1; + return [MGLStyleConstantValue valueWithRawValue:@1]; } -+ (MGLStyleAttributeFunction *)testNumberFunction ++ (MGLStyleFunction *)testNumberFunction { - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - function.stops = @{ - @(18): self.testNumber, - }; - return function; + return [MGLStyleFunction valueWithStops:@{ + @18: self.testNumber, + }]; } -+ (NSNumber *)testBool ++ (MGLStyleConstantValue *)testBool { - return @YES; + return [MGLStyleConstantValue valueWithRawValue:@YES]; } -+ (MGLStyleAttributeFunction *)testBoolFunction ++ (MGLStyleFunction *)testBoolFunction { - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - function.stops = @{ - @(18): self.testBool, - }; - return function; + return [MGLStyleFunction valueWithStops:@{ + @18: self.testBool, + }]; } -+ (NSString *)testString ++ (MGLStyleConstantValue *)testString { - return @"test"; + return [MGLStyleConstantValue valueWithRawValue:@"test"]; } -+ (MGLStyleAttributeFunction *)testStringFunction ++ (MGLStyleFunction *)testStringFunction { - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - function.stops = @{ - @(18): self.testString, - }; - return function; + return [MGLStyleFunction valueWithStops:@{ + @18: self.testString, + }]; } -+ (MGLColor *)testColor ++ (MGLStyleConstantValue *)testColor { - return [MGLColor redColor]; + return [MGLStyleConstantValue valueWithRawValue:[MGLColor redColor]]; } -+ (MGLStyleAttributeFunction *)testColorFunction ++ (MGLStyleFunction *)testColorFunction { - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - function.stops = @{ - @(18): self.testColor, - }; - return function; + return [MGLStyleFunction valueWithStops:@{ + @18: self.testColor, + }]; } -+ (NSValue *)testEnum:(NSUInteger)value type:(const char *)type ++ (MGLStyleConstantValue *)testEnum:(NSUInteger)value type:(const char *)type { - return [NSValue value:&value withObjCType:type]; + return [MGLStyleConstantValue valueWithRawValue:[NSValue value:&value withObjCType:type]]; } -+ (MGLStyleAttributeFunction *)testEnumFunction:(NSUInteger)value type:(const char *)type ++ (MGLStyleFunction *)testEnumFunction:(NSUInteger)value type:(const char *)type { - MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init]; - function.stops = @{ - @(18): [self testEnum:value type:type], - }; - return function; + return [MGLStyleFunction valueWithStops:@{ + @18: [self testEnum:value type:type], + }]; } @end diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.m b/platform/darwin/test/MGLSymbolStyleLayerTests.m index 208c30a6301..f60ae7c2a87 100644 --- a/platform/darwin/test/MGLSymbolStyleLayerTests.m +++ b/platform/darwin/test/MGLSymbolStyleLayerTests.m @@ -67,36 +67,44 @@ - (void)testSymbolLayer { MGLSymbolStyleLayer *gLayer = (MGLSymbolStyleLayer *)[self.mapView.style layerWithIdentifier:@"layerID"]; XCTAssertTrue([gLayer isKindOfClass:[MGLSymbolStyleLayer class]]); - XCTAssert([(NSValue *)gLayer.symbolPlacement isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLSymbolPlacementLine type:@encode(MGLSymbolPlacement)]], @"%@ is not equal to %@", gLayer.symbolPlacement, [MGLRuntimeStylingHelper testEnum:MGLSymbolPlacementLine type:@encode(MGLSymbolPlacement)]); + XCTAssert([gLayer.symbolPlacement isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.symbolPlacement, [MGLRuntimeStylingHelper testEnum:MGLSymbolPlacementLine type:@encode(MGLSymbolPlacement)]); XCTAssertEqualObjects(gLayer.symbolSpacing, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.symbolAvoidEdges, [MGLRuntimeStylingHelper testBool]); XCTAssertEqualObjects(gLayer.iconAllowOverlap, [MGLRuntimeStylingHelper testBool]); XCTAssertEqualObjects(gLayer.iconIgnorePlacement, [MGLRuntimeStylingHelper testBool]); XCTAssertEqualObjects(gLayer.iconOptional, [MGLRuntimeStylingHelper testBool]); - XCTAssert([(NSValue *)gLayer.iconRotationAlignment isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLIconRotationAlignmentAuto type:@encode(MGLIconRotationAlignment)]], @"%@ is not equal to %@", gLayer.iconRotationAlignment, [MGLRuntimeStylingHelper testEnum:MGLIconRotationAlignmentAuto type:@encode(MGLIconRotationAlignment)]); + XCTAssert([gLayer.iconRotationAlignment isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.iconRotationAlignment, [MGLRuntimeStylingHelper testEnum:MGLIconRotationAlignmentAuto type:@encode(MGLIconRotationAlignment)]); XCTAssertEqualObjects(gLayer.iconSize, [MGLRuntimeStylingHelper testNumber]); - XCTAssert([(NSValue *)gLayer.iconTextFit isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLIconTextFitBoth type:@encode(MGLIconTextFit)]], @"%@ is not equal to %@", gLayer.iconTextFit, [MGLRuntimeStylingHelper testEnum:MGLIconTextFitBoth type:@encode(MGLIconTextFit)]); + XCTAssert([gLayer.iconTextFit isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.iconTextFit, [MGLRuntimeStylingHelper testEnum:MGLIconTextFitBoth type:@encode(MGLIconTextFit)]); XCTAssertEqualObjects(gLayer.iconTextFitPadding, [MGLRuntimeStylingHelper testPadding]); XCTAssertEqualObjects(gLayer.iconImage, [MGLRuntimeStylingHelper testString]); XCTAssertEqualObjects(gLayer.iconRotate, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.iconPadding, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.iconKeepUpright, [MGLRuntimeStylingHelper testBool]); XCTAssertEqualObjects(gLayer.iconOffset, [MGLRuntimeStylingHelper testOffset]); - XCTAssert([(NSValue *)gLayer.textPitchAlignment isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLTextPitchAlignmentAuto type:@encode(MGLTextPitchAlignment)]], @"%@ is not equal to %@", gLayer.textPitchAlignment, [MGLRuntimeStylingHelper testEnum:MGLTextPitchAlignmentAuto type:@encode(MGLTextPitchAlignment)]); - XCTAssert([(NSValue *)gLayer.textRotationAlignment isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLTextRotationAlignmentAuto type:@encode(MGLTextRotationAlignment)]], @"%@ is not equal to %@", gLayer.textRotationAlignment, [MGLRuntimeStylingHelper testEnum:MGLTextRotationAlignmentAuto type:@encode(MGLTextRotationAlignment)]); + XCTAssert([gLayer.textPitchAlignment isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.textPitchAlignment, [MGLRuntimeStylingHelper testEnum:MGLTextPitchAlignmentAuto type:@encode(MGLTextPitchAlignment)]); + XCTAssert([gLayer.textRotationAlignment isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.textRotationAlignment, [MGLRuntimeStylingHelper testEnum:MGLTextRotationAlignmentAuto type:@encode(MGLTextRotationAlignment)]); XCTAssertEqualObjects(gLayer.textField, [MGLRuntimeStylingHelper testString]); XCTAssertEqualObjects(gLayer.textFont, [MGLRuntimeStylingHelper testFont]); XCTAssertEqualObjects(gLayer.textSize, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.textMaxWidth, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.textLineHeight, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.textLetterSpacing, [MGLRuntimeStylingHelper testNumber]); - XCTAssert([(NSValue *)gLayer.textJustify isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLTextJustifyRight type:@encode(MGLTextJustify)]], @"%@ is not equal to %@", gLayer.textJustify, [MGLRuntimeStylingHelper testEnum:MGLTextJustifyRight type:@encode(MGLTextJustify)]); - XCTAssert([(NSValue *)gLayer.textAnchor isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLTextAnchorBottomRight type:@encode(MGLTextAnchor)]], @"%@ is not equal to %@", gLayer.textAnchor, [MGLRuntimeStylingHelper testEnum:MGLTextAnchorBottomRight type:@encode(MGLTextAnchor)]); + XCTAssert([gLayer.textJustify isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.textJustify, [MGLRuntimeStylingHelper testEnum:MGLTextJustifyRight type:@encode(MGLTextJustify)]); + XCTAssert([gLayer.textAnchor isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.textAnchor, [MGLRuntimeStylingHelper testEnum:MGLTextAnchorBottomRight type:@encode(MGLTextAnchor)]); XCTAssertEqualObjects(gLayer.textMaxAngle, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.textRotate, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.textPadding, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.textKeepUpright, [MGLRuntimeStylingHelper testBool]); - XCTAssert([(NSValue *)gLayer.textTransform isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLTextTransformLowercase type:@encode(MGLTextTransform)]], @"%@ is not equal to %@", gLayer.textTransform, [MGLRuntimeStylingHelper testEnum:MGLTextTransformLowercase type:@encode(MGLTextTransform)]); + XCTAssert([gLayer.textTransform isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.textTransform, [MGLRuntimeStylingHelper testEnum:MGLTextTransformLowercase type:@encode(MGLTextTransform)]); XCTAssertEqualObjects(gLayer.textOffset, [MGLRuntimeStylingHelper testOffset]); XCTAssertEqualObjects(gLayer.textAllowOverlap, [MGLRuntimeStylingHelper testBool]); XCTAssertEqualObjects(gLayer.textIgnorePlacement, [MGLRuntimeStylingHelper testBool]); @@ -107,14 +115,16 @@ - (void)testSymbolLayer { XCTAssertEqualObjects(gLayer.iconHaloWidth, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.iconHaloBlur, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.iconTranslate, [MGLRuntimeStylingHelper testOffset]); - XCTAssert([(NSValue *)gLayer.iconTranslateAnchor isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLIconTranslateAnchorViewport type:@encode(MGLIconTranslateAnchor)]], @"%@ is not equal to %@", gLayer.iconTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLIconTranslateAnchorViewport type:@encode(MGLIconTranslateAnchor)]); + XCTAssert([gLayer.iconTranslateAnchor isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.iconTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLIconTranslateAnchorViewport type:@encode(MGLIconTranslateAnchor)]); XCTAssertEqualObjects(gLayer.textOpacity, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.textColor, [MGLRuntimeStylingHelper testColor]); XCTAssertEqualObjects(gLayer.textHaloColor, [MGLRuntimeStylingHelper testColor]); XCTAssertEqualObjects(gLayer.textHaloWidth, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.textHaloBlur, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.textTranslate, [MGLRuntimeStylingHelper testOffset]); - XCTAssert([(NSValue *)gLayer.textTranslateAnchor isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLTextTranslateAnchorViewport type:@encode(MGLTextTranslateAnchor)]], @"%@ is not equal to %@", gLayer.textTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLTextTranslateAnchorViewport type:@encode(MGLTextTranslateAnchor)]); + XCTAssert([gLayer.textTranslateAnchor isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.textTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLTextTranslateAnchorViewport type:@encode(MGLTextTranslateAnchor)]); layer.symbolPlacement = [MGLRuntimeStylingHelper testEnumFunction:MGLSymbolPlacementLine type:@encode(MGLSymbolPlacement)]; layer.symbolSpacing = [MGLRuntimeStylingHelper testNumberFunction]; diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 5a0854f6bfb..046f6023844 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -643,33 +643,36 @@ - (void)addAnnotationWithCustomCallout - (void)styleWaterLayer { MGLFillStyleLayer *waterLayer = (MGLFillStyleLayer *)[self.mapView.style layerWithIdentifier:@"water"]; - MGLStyleAttributeFunction *waterColorFunction = [[MGLStyleAttributeFunction alloc] init]; - waterColorFunction.stops = @{@6.0f: [UIColor yellowColor], - @8.0f: [UIColor blueColor], - @10.0f: [UIColor redColor], - @12.0f: [UIColor greenColor], - @14.0f: [UIColor blueColor]}; + MGLStyleValue *waterColorFunction = [MGLStyleValue valueWithStops:@{ + @6.0f: [MGLStyleValue valueWithRawValue:[UIColor yellowColor]], + @8.0f: [MGLStyleValue valueWithRawValue:[UIColor blueColor]], + @10.0f: [MGLStyleValue valueWithRawValue:[UIColor redColor]], + @12.0f: [MGLStyleValue valueWithRawValue:[UIColor greenColor]], + @14.0f: [MGLStyleValue valueWithRawValue:[UIColor blueColor]], + }]; waterLayer.fillColor = waterColorFunction; - MGLStyleAttributeFunction *fillAntialias = [[MGLStyleAttributeFunction alloc] init]; - fillAntialias.stops = @{@11: @YES, - @12: @NO, - @13: @YES, - @14: @NO, - @15: @YES}; + MGLStyleValue *fillAntialias = [MGLStyleValue valueWithStops:@{ + @11: [MGLStyleValue valueWithRawValue:@YES], + @12: [MGLStyleValue valueWithRawValue:@NO], + @13: [MGLStyleValue valueWithRawValue:@YES], + @14: [MGLStyleValue valueWithRawValue:@NO], + @15: [MGLStyleValue valueWithRawValue:@YES], + }]; waterLayer.fillAntialias = fillAntialias; } - (void)styleRoadLayer { MGLLineStyleLayer *roadLayer = (MGLLineStyleLayer *)[self.mapView.style layerWithIdentifier:@"road-primary"]; - roadLayer.lineColor = [UIColor blackColor]; - MGLStyleAttributeFunction *lineWidthFunction = [[MGLStyleAttributeFunction alloc] init]; + roadLayer.lineColor = [MGLStyleValue valueWithRawValue:[UIColor blackColor]]; + MGLStyleValue *lineWidthFunction = [MGLStyleValue valueWithStops:@{}]; - MGLStyleAttributeFunction *roadLineColor = [[MGLStyleAttributeFunction alloc] init]; - roadLineColor.stops = @{@10: [UIColor purpleColor], - @13: [UIColor yellowColor], - @16: [UIColor cyanColor]}; + MGLStyleValue *roadLineColor = [MGLStyleValue valueWithStops:@{ + @10: [MGLStyleValue valueWithRawValue:[UIColor purpleColor]], + @13: [MGLStyleValue valueWithRawValue:[UIColor yellowColor]], + @16: [MGLStyleValue valueWithRawValue:[UIColor cyanColor]], + }]; roadLayer.lineColor = roadLineColor; roadLayer.lineWidth = lineWidthFunction; roadLayer.lineGapWidth = lineWidthFunction; @@ -686,9 +689,10 @@ - (void)styleRasterLayer [self.mapView.style addSource:rasterSource]; MGLRasterStyleLayer *rasterLayer = [[MGLRasterStyleLayer alloc] initWithIdentifier:@"my-raster-layer" source:rasterSource]; - MGLStyleAttributeFunction *opacityFunction = [[MGLStyleAttributeFunction alloc] init]; - opacityFunction.stops = @{@20.0f: @1.0f, - @5.0f: @0.0f}; + MGLStyleValue *opacityFunction = [MGLStyleValue valueWithStops:@{ + @20.0f: [MGLStyleValue valueWithRawValue:@1.0f], + @5.0f: [MGLStyleValue valueWithRawValue:@0.0f], + }]; rasterLayer.rasterOpacity = opacityFunction; [self.mapView.style addLayer:rasterLayer]; } @@ -701,26 +705,26 @@ - (void)styleGeoJSONSource [self.mapView.style addSource:source]; MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"test" source:source]; - fillLayer.fillColor = [UIColor purpleColor]; + fillLayer.fillColor = [MGLStyleValue valueWithRawValue:[UIColor purpleColor]]; [self.mapView.style addLayer:fillLayer]; } - (void)styleSymbolLayer { MGLSymbolStyleLayer *stateLayer = (MGLSymbolStyleLayer *)[self.mapView.style layerWithIdentifier:@"state-label-lg"]; - stateLayer.textColor = [UIColor redColor]; + stateLayer.textColor = [MGLStyleValue valueWithRawValue:[UIColor redColor]]; } - (void)styleBuildingLayer { MGLFillStyleLayer *buildingLayer = (MGLFillStyleLayer *)[self.mapView.style layerWithIdentifier:@"building"]; - buildingLayer.fillColor = [UIColor blackColor]; + buildingLayer.fillColor = [MGLStyleValue valueWithRawValue:[UIColor blackColor]]; } - (void)styleFerryLayer { MGLLineStyleLayer *ferryLineLayer = (MGLLineStyleLayer *)[self.mapView.style layerWithIdentifier:@"ferry"]; - ferryLineLayer.lineColor = [UIColor redColor]; + ferryLineLayer.lineColor = [MGLStyleValue valueWithRawValue:[UIColor redColor]]; } - (void)removeParkLayer @@ -744,8 +748,8 @@ - (void)styleFilteredFill statesLayer.predicate = [NSPredicate predicateWithFormat:@"name == 'Texas'"]; // paint properties - statesLayer.fillColor = [UIColor redColor]; - statesLayer.fillOpacity = @(0.25); + statesLayer.fillColor = [MGLStyleValue valueWithRawValue:[UIColor redColor]]; + statesLayer.fillOpacity = [MGLStyleValue valueWithRawValue:@0.25]; }); } @@ -764,9 +768,9 @@ - (void)styleFilteredLines countiesLayer.predicate = [NSPredicate predicateWithFormat:@"NAME10 == 'Washington'"]; // paint properties - countiesLayer.lineColor = [UIColor redColor]; - countiesLayer.lineOpacity = @(0.75); - countiesLayer.lineWidth = @(5); + countiesLayer.lineColor = [MGLStyleValue valueWithRawValue:[UIColor redColor]]; + countiesLayer.lineOpacity = [MGLStyleValue valueWithRawValue:@0.75]; + countiesLayer.lineWidth = [MGLStyleValue valueWithRawValue:@5]; }); } @@ -785,8 +789,8 @@ - (void)styleNumericFilteredFills regionsLayer.predicate = [NSPredicate predicateWithFormat:@"HRRNUM >= %@ AND HRRNUM < 300", @(200)]; // paint properties - regionsLayer.fillColor = [UIColor blueColor]; - regionsLayer.fillOpacity = @(0.5); + regionsLayer.fillColor = [MGLStyleValue valueWithRawValue:[UIColor blueColor]]; + regionsLayer.fillOpacity = [MGLStyleValue valueWithRawValue:@0.5]; }); } @@ -818,8 +822,8 @@ - (void)styleQuery [self.mapView.style addSource:source]; MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:queryLayerID source:source]; - fillLayer.fillColor = [UIColor blueColor]; - fillLayer.fillOpacity = @(0.5); + fillLayer.fillColor = [MGLStyleConstantValue valueWithRawValue:[UIColor blueColor]]; + fillLayer.fillOpacity = [MGLStyleConstantValue valueWithRawValue:@0.5]; [self.mapView.style addLayer:fillLayer]; }); } diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index 01e660083c1..3c19f5ea414 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -11,34 +11,12 @@ 30E578181DAA85520050F07E /* UIImage+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E578111DAA7D690050F07E /* UIImage+MGLAdditions.h */; }; 30E578191DAA855E0050F07E /* UIImage+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 30E578121DAA7D690050F07E /* UIImage+MGLAdditions.mm */; }; 30E5781A1DAA855E0050F07E /* UIImage+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 30E578121DAA7D690050F07E /* UIImage+MGLAdditions.mm */; }; - 350098AF1D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098AD1D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 350098B01D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098AD1D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 350098B11D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 350098AE1D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.mm */; }; - 350098B21D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 350098AE1D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.mm */; }; 350098BB1D480108004B2AF0 /* MGLVectorSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098B91D480108004B2AF0 /* MGLVectorSource.h */; settings = {ATTRIBUTES = (Public, ); }; }; 350098BC1D480108004B2AF0 /* MGLVectorSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098B91D480108004B2AF0 /* MGLVectorSource.h */; settings = {ATTRIBUTES = (Public, ); }; }; 350098BD1D480108004B2AF0 /* MGLVectorSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 350098BA1D480108004B2AF0 /* MGLVectorSource.mm */; }; 350098BE1D480108004B2AF0 /* MGLVectorSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 350098BA1D480108004B2AF0 /* MGLVectorSource.mm */; }; - 350098C11D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098BF1D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 350098C21D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098BF1D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 350098C31D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 350098C01D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.mm */; }; - 350098C41D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 350098C01D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.mm */; }; - 350098C61D48288B004B2AF0 /* NSNumber+MGLStyleAttributeAdditions_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098C51D48288B004B2AF0 /* NSNumber+MGLStyleAttributeAdditions_Private.h */; }; - 350098C71D48288B004B2AF0 /* NSNumber+MGLStyleAttributeAdditions_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098C51D48288B004B2AF0 /* NSNumber+MGLStyleAttributeAdditions_Private.h */; }; - 350098CA1D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098C81D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 350098CB1D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098C81D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 350098CC1D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 350098C91D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.mm */; }; - 350098CD1D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 350098C91D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.mm */; }; - 350098CF1D482E10004B2AF0 /* NSArray+MGLStyleAttributeAdditions_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098CE1D482E10004B2AF0 /* NSArray+MGLStyleAttributeAdditions_Private.h */; }; - 350098D01D482E10004B2AF0 /* NSArray+MGLStyleAttributeAdditions_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098CE1D482E10004B2AF0 /* NSArray+MGLStyleAttributeAdditions_Private.h */; }; - 350098D31D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098D11D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 350098D41D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098D11D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 350098D51D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 350098D21D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.mm */; }; - 350098D61D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 350098D21D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.mm */; }; - 350098D81D4830D5004B2AF0 /* NSString+MGLStyleAttributeAdditions_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098D71D4830D5004B2AF0 /* NSString+MGLStyleAttributeAdditions_Private.h */; }; - 350098D91D4830D5004B2AF0 /* NSString+MGLStyleAttributeAdditions_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098D71D4830D5004B2AF0 /* NSString+MGLStyleAttributeAdditions_Private.h */; }; - 350098DC1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098DA1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 350098DD1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098DA1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 350098DC1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098DA1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.h */; }; + 350098DD1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 350098DA1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.h */; }; 350098DE1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 350098DB1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.mm */; }; 350098DF1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 350098DB1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.mm */; }; 3510FFEA1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3510FFE81D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.h */; }; @@ -70,10 +48,6 @@ 35305D481D22AA680007D005 /* NSData+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35305D471D22AA450007D005 /* NSData+MGLAdditions.mm */; }; 35305D491D22AA680007D005 /* NSData+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35305D471D22AA450007D005 /* NSData+MGLAdditions.mm */; }; 35305D4A1D22AA6A0007D005 /* NSData+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35305D461D22AA450007D005 /* NSData+MGLAdditions.h */; }; - 3534C7921D4BC95400D874A4 /* MGLStyleAttributeFunction_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 3534C7911D4BC95400D874A4 /* MGLStyleAttributeFunction_Private.h */; }; - 3534C7931D4BC95400D874A4 /* MGLStyleAttributeFunction_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 3534C7911D4BC95400D874A4 /* MGLStyleAttributeFunction_Private.h */; }; - 3534C7951D4BD1D400D874A4 /* MGLStyleAttributeValue_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 3534C7941D4BD1D400D874A4 /* MGLStyleAttributeValue_Private.h */; }; - 3534C7961D4BD1D400D874A4 /* MGLStyleAttributeValue_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 3534C7941D4BD1D400D874A4 /* MGLStyleAttributeValue_Private.h */; }; 3538AA1D1D542239008EC33D /* MGLForegroundStyleLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3538AA1B1D542239008EC33D /* MGLForegroundStyleLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3538AA1E1D542239008EC33D /* MGLForegroundStyleLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3538AA1B1D542239008EC33D /* MGLForegroundStyleLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3538AA1F1D542239008EC33D /* MGLForegroundStyleLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3538AA1C1D542239008EC33D /* MGLForegroundStyleLayer.m */; }; @@ -100,14 +74,8 @@ 354B83981D2E873E005D9406 /* MGLUserLocationAnnotationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 354B83951D2E873E005D9406 /* MGLUserLocationAnnotationView.m */; }; 354B83991D2E873E005D9406 /* MGLUserLocationAnnotationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 354B83951D2E873E005D9406 /* MGLUserLocationAnnotationView.m */; }; 354B839C1D2E9B48005D9406 /* MBXUserLocationAnnotationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 354B839B1D2E9B48005D9406 /* MBXUserLocationAnnotationView.m */; }; - 354D42DC1D4919F900F400A1 /* NSValue+MGLStyleAttributeAdditions_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 354D42DB1D4919F900F400A1 /* NSValue+MGLStyleAttributeAdditions_Private.h */; }; - 354D42DD1D4919F900F400A1 /* NSValue+MGLStyleAttributeAdditions_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 354D42DB1D4919F900F400A1 /* NSValue+MGLStyleAttributeAdditions_Private.h */; }; - 35599DEB1D46F14E0048254D /* MGLStyleAttributeFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 35599DE91D46F14E0048254D /* MGLStyleAttributeFunction.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 35599DEC1D46F14E0048254D /* MGLStyleAttributeFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 35599DE91D46F14E0048254D /* MGLStyleAttributeFunction.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 35599DED1D46F14E0048254D /* MGLStyleAttributeFunction.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35599DEA1D46F14E0048254D /* MGLStyleAttributeFunction.mm */; }; - 35599DEE1D46F14E0048254D /* MGLStyleAttributeFunction.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35599DEA1D46F14E0048254D /* MGLStyleAttributeFunction.mm */; }; - 35599DF01D46F3A60048254D /* MGLStyleAttributeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 35599DEF1D46F3A60048254D /* MGLStyleAttributeValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 35599DF11D46F3A60048254D /* MGLStyleAttributeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 35599DEF1D46F3A60048254D /* MGLStyleAttributeValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 35599DED1D46F14E0048254D /* MGLStyleValue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35599DEA1D46F14E0048254D /* MGLStyleValue.mm */; }; + 35599DEE1D46F14E0048254D /* MGLStyleValue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35599DEA1D46F14E0048254D /* MGLStyleValue.mm */; }; 3566C7661D4A77BA008152BC /* MGLGeoJSONSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 3566C7641D4A77BA008152BC /* MGLGeoJSONSource.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3566C7671D4A77BA008152BC /* MGLGeoJSONSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 3566C7641D4A77BA008152BC /* MGLGeoJSONSource.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3566C7681D4A77BA008152BC /* MGLGeoJSONSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3566C7651D4A77BA008152BC /* MGLGeoJSONSource.mm */; }; @@ -125,12 +93,6 @@ 357579891D502B06000B822E /* MGLCircleStyleLayerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 357579881D502B06000B822E /* MGLCircleStyleLayerTests.m */; }; 3575798B1D502B0C000B822E /* MGLBackgroundStyleLayerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3575798A1D502B0C000B822E /* MGLBackgroundStyleLayerTests.m */; }; 3575798E1D502EC7000B822E /* MGLRuntimeStylingHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 3575798D1D502EC7000B822E /* MGLRuntimeStylingHelper.m */; }; - 3593E5211D529C29006D9365 /* MGLStyleAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 3593E51F1D529C29006D9365 /* MGLStyleAttribute.h */; }; - 3593E5221D529C29006D9365 /* MGLStyleAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 3593E51F1D529C29006D9365 /* MGLStyleAttribute.h */; }; - 3593E5231D529C29006D9365 /* MGLStyleAttribute.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3593E5201D529C29006D9365 /* MGLStyleAttribute.mm */; }; - 3593E5241D529C29006D9365 /* MGLStyleAttribute.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3593E5201D529C29006D9365 /* MGLStyleAttribute.mm */; }; - 3593E5261D529EDC006D9365 /* UIColor+MGLStyleAttributeAdditions_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 3593E5251D529EDC006D9365 /* UIColor+MGLStyleAttributeAdditions_Private.h */; }; - 3593E5271D529EDC006D9365 /* UIColor+MGLStyleAttributeAdditions_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 3593E5251D529EDC006D9365 /* UIColor+MGLStyleAttributeAdditions_Private.h */; }; 359F57461D2FDDA6005217F1 /* MGLUserLocationAnnotationView_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 359F57451D2FDBD5005217F1 /* MGLUserLocationAnnotationView_Private.h */; }; 35B82BF81D6C5F8400B1B721 /* NSPredicate+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35B82BF61D6C5F8400B1B721 /* NSPredicate+MGLAdditions.h */; }; 35B82BF91D6C5F8400B1B721 /* NSPredicate+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35B82BF61D6C5F8400B1B721 /* NSPredicate+MGLAdditions.h */; }; @@ -383,6 +345,10 @@ DAA4E4341CBB730400178DFB /* MGLFaux3DUserLocationAnnotationView.m in Sources */ = {isa = PBXBuildFile; fileRef = DA88484E1CBAFB9800AB86E3 /* MGLFaux3DUserLocationAnnotationView.m */; }; DAA4E4351CBB730400178DFB /* SMCalloutView.m in Sources */ = {isa = PBXBuildFile; fileRef = DA88488A1CBB037E00AB86E3 /* SMCalloutView.m */; }; DAABF73D1CBC59BB005B1825 /* libmbgl-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAABF73B1CBC59BB005B1825 /* libmbgl-core.a */; }; + DAAF722B1DA903C700312FA4 /* MGLStyleValue.h in Headers */ = {isa = PBXBuildFile; fileRef = DAAF72291DA903C700312FA4 /* MGLStyleValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DAAF722C1DA903C700312FA4 /* MGLStyleValue.h in Headers */ = {isa = PBXBuildFile; fileRef = DAAF72291DA903C700312FA4 /* MGLStyleValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DAAF722D1DA903C700312FA4 /* MGLStyleValue_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DAAF722A1DA903C700312FA4 /* MGLStyleValue_Private.h */; }; + DAAF722E1DA903C700312FA4 /* MGLStyleValue_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DAAF722A1DA903C700312FA4 /* MGLStyleValue_Private.h */; }; DABCABAC1CB80692000A7C39 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DABCABAB1CB80692000A7C39 /* main.m */; }; DABCABAF1CB80692000A7C39 /* MBXBenchAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DABCABAE1CB80692000A7C39 /* MBXBenchAppDelegate.m */; }; DABCABB21CB80692000A7C39 /* MBXBenchViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = DABCABB11CB80692000A7C39 /* MBXBenchViewController.mm */; }; @@ -518,19 +484,8 @@ /* Begin PBXFileReference section */ 30E578111DAA7D690050F07E /* UIImage+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIImage+MGLAdditions.h"; path = "src/UIImage+MGLAdditions.h"; sourceTree = SOURCE_ROOT; }; 30E578121DAA7D690050F07E /* UIImage+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "UIImage+MGLAdditions.mm"; path = "src/UIImage+MGLAdditions.mm"; sourceTree = SOURCE_ROOT; }; - 350098AD1D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIColor+MGLStyleAttributeAdditions.h"; path = "src/UIColor+MGLStyleAttributeAdditions.h"; sourceTree = SOURCE_ROOT; }; - 350098AE1D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "UIColor+MGLStyleAttributeAdditions.mm"; path = "src/UIColor+MGLStyleAttributeAdditions.mm"; sourceTree = SOURCE_ROOT; }; 350098B91D480108004B2AF0 /* MGLVectorSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLVectorSource.h; sourceTree = ""; }; 350098BA1D480108004B2AF0 /* MGLVectorSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLVectorSource.mm; sourceTree = ""; }; - 350098BF1D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNumber+MGLStyleAttributeAdditions.h"; sourceTree = ""; }; - 350098C01D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSNumber+MGLStyleAttributeAdditions.mm"; sourceTree = ""; }; - 350098C51D48288B004B2AF0 /* NSNumber+MGLStyleAttributeAdditions_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNumber+MGLStyleAttributeAdditions_Private.h"; sourceTree = ""; }; - 350098C81D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+MGLStyleAttributeAdditions.h"; sourceTree = ""; }; - 350098C91D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSArray+MGLStyleAttributeAdditions.mm"; sourceTree = ""; }; - 350098CE1D482E10004B2AF0 /* NSArray+MGLStyleAttributeAdditions_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+MGLStyleAttributeAdditions_Private.h"; sourceTree = ""; }; - 350098D11D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+MGLStyleAttributeAdditions.h"; sourceTree = ""; }; - 350098D21D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSString+MGLStyleAttributeAdditions.mm"; sourceTree = ""; }; - 350098D71D4830D5004B2AF0 /* NSString+MGLStyleAttributeAdditions_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+MGLStyleAttributeAdditions_Private.h"; sourceTree = ""; }; 350098DA1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSValue+MGLStyleAttributeAdditions.h"; sourceTree = ""; }; 350098DB1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSValue+MGLStyleAttributeAdditions.mm"; sourceTree = ""; }; 3510FFE81D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSComparisonPredicate+MGLAdditions.h"; sourceTree = ""; }; @@ -548,8 +503,6 @@ 35136D4B1D4277FC00C20EFD /* MGLSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLSource.mm; sourceTree = ""; }; 35305D461D22AA450007D005 /* NSData+MGLAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+MGLAdditions.h"; sourceTree = ""; }; 35305D471D22AA450007D005 /* NSData+MGLAdditions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSData+MGLAdditions.mm"; sourceTree = ""; }; - 3534C7911D4BC95400D874A4 /* MGLStyleAttributeFunction_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleAttributeFunction_Private.h; sourceTree = ""; }; - 3534C7941D4BD1D400D874A4 /* MGLStyleAttributeValue_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleAttributeValue_Private.h; sourceTree = ""; }; 3538AA1B1D542239008EC33D /* MGLForegroundStyleLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLForegroundStyleLayer.h; sourceTree = ""; }; 3538AA1C1D542239008EC33D /* MGLForegroundStyleLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLForegroundStyleLayer.m; sourceTree = ""; }; 353933F11D3FB753003F57D7 /* MGLCircleStyleLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCircleStyleLayer.h; sourceTree = ""; }; @@ -565,10 +518,7 @@ 354B83951D2E873E005D9406 /* MGLUserLocationAnnotationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLUserLocationAnnotationView.m; sourceTree = ""; }; 354B839A1D2E9B48005D9406 /* MBXUserLocationAnnotationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBXUserLocationAnnotationView.h; sourceTree = ""; }; 354B839B1D2E9B48005D9406 /* MBXUserLocationAnnotationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBXUserLocationAnnotationView.m; sourceTree = ""; }; - 354D42DB1D4919F900F400A1 /* NSValue+MGLStyleAttributeAdditions_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSValue+MGLStyleAttributeAdditions_Private.h"; sourceTree = ""; }; - 35599DE91D46F14E0048254D /* MGLStyleAttributeFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleAttributeFunction.h; sourceTree = ""; }; - 35599DEA1D46F14E0048254D /* MGLStyleAttributeFunction.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLStyleAttributeFunction.mm; sourceTree = ""; }; - 35599DEF1D46F3A60048254D /* MGLStyleAttributeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleAttributeValue.h; sourceTree = ""; }; + 35599DEA1D46F14E0048254D /* MGLStyleValue.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLStyleValue.mm; sourceTree = ""; }; 3566C7641D4A77BA008152BC /* MGLGeoJSONSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLGeoJSONSource.h; sourceTree = ""; }; 3566C7651D4A77BA008152BC /* MGLGeoJSONSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLGeoJSONSource.mm; sourceTree = ""; }; 3566C76A1D4A8DFA008152BC /* MGLRasterSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLRasterSource.h; sourceTree = ""; }; @@ -582,9 +532,6 @@ 3575798A1D502B0C000B822E /* MGLBackgroundStyleLayerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLBackgroundStyleLayerTests.m; path = ../../darwin/test/MGLBackgroundStyleLayerTests.m; sourceTree = ""; }; 3575798C1D502EC7000B822E /* MGLRuntimeStylingHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLRuntimeStylingHelper.h; path = ../../darwin/test/MGLRuntimeStylingHelper.h; sourceTree = ""; }; 3575798D1D502EC7000B822E /* MGLRuntimeStylingHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLRuntimeStylingHelper.m; path = ../../darwin/test/MGLRuntimeStylingHelper.m; sourceTree = ""; }; - 3593E51F1D529C29006D9365 /* MGLStyleAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleAttribute.h; sourceTree = ""; }; - 3593E5201D529C29006D9365 /* MGLStyleAttribute.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLStyleAttribute.mm; sourceTree = ""; }; - 3593E5251D529EDC006D9365 /* UIColor+MGLStyleAttributeAdditions_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+MGLStyleAttributeAdditions_Private.h"; sourceTree = ""; }; 359F57451D2FDBD5005217F1 /* MGLUserLocationAnnotationView_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLUserLocationAnnotationView_Private.h; sourceTree = ""; }; 35B82BF61D6C5F8400B1B721 /* NSPredicate+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSPredicate+MGLAdditions.h"; sourceTree = ""; }; 35B82BF71D6C5F8400B1B721 /* NSPredicate+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSPredicate+MGLAdditions.mm"; sourceTree = ""; }; @@ -781,6 +728,8 @@ DAA4E4061CBB5CBF00178DFB /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; DAA4E4131CBB71D400178DFB /* libMapbox.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMapbox.a; sourceTree = BUILT_PRODUCTS_DIR; }; DAABF73B1CBC59BB005B1825 /* libmbgl-core.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libmbgl-core.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + DAAF72291DA903C700312FA4 /* MGLStyleValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleValue.h; sourceTree = ""; }; + DAAF722A1DA903C700312FA4 /* MGLStyleValue_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleValue_Private.h; sourceTree = ""; }; DABCABA81CB80692000A7C39 /* Bench GL.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Bench GL.app"; sourceTree = BUILT_PRODUCTS_DIR; }; DABCABAB1CB80692000A7C39 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; DABCABAD1CB80692000A7C39 /* MBXBenchAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MBXBenchAppDelegate.h; sourceTree = ""; }; @@ -909,13 +858,9 @@ 35599DB81D46AD7F0048254D /* Categories */, 353933F01D3FB6BA003F57D7 /* Layers */, 35136D491D4277EA00C20EFD /* Sources */, - 35599DE91D46F14E0048254D /* MGLStyleAttributeFunction.h */, - 3534C7911D4BC95400D874A4 /* MGLStyleAttributeFunction_Private.h */, - 35599DEA1D46F14E0048254D /* MGLStyleAttributeFunction.mm */, - 35599DEF1D46F3A60048254D /* MGLStyleAttributeValue.h */, - 3534C7941D4BD1D400D874A4 /* MGLStyleAttributeValue_Private.h */, - 3593E51F1D529C29006D9365 /* MGLStyleAttribute.h */, - 3593E5201D529C29006D9365 /* MGLStyleAttribute.mm */, + DAAF72291DA903C700312FA4 /* MGLStyleValue.h */, + DAAF722A1DA903C700312FA4 /* MGLStyleValue_Private.h */, + 35599DEA1D46F14E0048254D /* MGLStyleValue.mm */, ); name = Styling; sourceTree = ""; @@ -923,20 +868,7 @@ 35599DB81D46AD7F0048254D /* Categories */ = { isa = PBXGroup; children = ( - 350098AD1D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.h */, - 3593E5251D529EDC006D9365 /* UIColor+MGLStyleAttributeAdditions_Private.h */, - 350098AE1D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.mm */, - 350098BF1D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.h */, - 350098C51D48288B004B2AF0 /* NSNumber+MGLStyleAttributeAdditions_Private.h */, - 350098C01D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.mm */, - 350098C81D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.h */, - 350098CE1D482E10004B2AF0 /* NSArray+MGLStyleAttributeAdditions_Private.h */, - 350098C91D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.mm */, - 350098D11D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.h */, - 350098D71D4830D5004B2AF0 /* NSString+MGLStyleAttributeAdditions_Private.h */, - 350098D21D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.mm */, 350098DA1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.h */, - 354D42DB1D4919F900F400A1 /* NSValue+MGLStyleAttributeAdditions_Private.h */, 350098DB1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.mm */, ); name = Categories; @@ -1454,14 +1386,11 @@ DA8848201CBAFA6200AB86E3 /* MGLOfflinePack_Private.h in Headers */, DA8847FA1CBAFA5100AB86E3 /* MGLPolyline.h in Headers */, 3566C7711D4A9198008152BC /* MGLSource_Private.h in Headers */, - 3593E5211D529C29006D9365 /* MGLStyleAttribute.h in Headers */, - 35599DEB1D46F14E0048254D /* MGLStyleAttributeFunction.h in Headers */, 4018B1C91CDC288A00F666AF /* MGLAnnotationView_Private.h in Headers */, 35E1A4D81D74336F007AA97F /* MGLValueEvaluator.h in Headers */, DA88482C1CBAFA6200AB86E3 /* NSBundle+MGLAdditions.h in Headers */, 7E016D7E1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h in Headers */, 35D13AB71D3D15E300AFB4E0 /* MGLStyleLayer.h in Headers */, - 354D42DC1D4919F900F400A1 /* NSValue+MGLStyleAttributeAdditions_Private.h in Headers */, DA88488E1CBB047F00AB86E3 /* reachability.h in Headers */, 40F887701D7A1E58008ECB67 /* MGLGeoJSONSource_Private.h in Headers */, 350098DC1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.h in Headers */, @@ -1471,8 +1400,6 @@ 35E0CFE61D3E501500188327 /* MGLStyle_Private.h in Headers */, 3510FFF01D6D9D8C00F413B2 /* NSExpression+MGLAdditions.h in Headers */, 353AFA141D65AB17005A69F4 /* NSDate+MGLAdditions.h in Headers */, - 3593E5261D529EDC006D9365 /* UIColor+MGLStyleAttributeAdditions_Private.h in Headers */, - 35599DF01D46F3A60048254D /* MGLStyleAttributeValue.h in Headers */, DA8848531CBAFB9800AB86E3 /* MGLCompactCalloutView.h in Headers */, DA8847FB1CBAFA5100AB86E3 /* MGLShape.h in Headers */, 353933F51D3FB785003F57D7 /* MGLBackgroundStyleLayer.h in Headers */, @@ -1486,24 +1413,22 @@ DA88483E1CBAFB8500AB86E3 /* MGLMapView+MGLCustomStyleLayerAdditions.h in Headers */, 40CF6DBB1DAC3C6600A4D18B /* MGLShape_Private.h in Headers */, 4018B1CA1CDC288E00F666AF /* MGLAnnotationView.h in Headers */, - 350098C61D48288B004B2AF0 /* NSNumber+MGLStyleAttributeAdditions_Private.h in Headers */, 35E79F201D41266300957B9E /* MGLStyleLayer_Private.h in Headers */, 353933FB1D3FB7C0003F57D7 /* MGLRasterStyleLayer.h in Headers */, DA8847EF1CBAFA5100AB86E3 /* MGLAccountManager.h in Headers */, DA8848511CBAFB9800AB86E3 /* MGLAPIClient.h in Headers */, DA35A2C91CCAAAD200E826B2 /* NSValue+MGLAdditions.h in Headers */, - 350098CF1D482E10004B2AF0 /* NSArray+MGLStyleAttributeAdditions_Private.h in Headers */, 3510FFEA1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.h in Headers */, DA6408DB1DA4E7D300908C90 /* MGLVectorStyleLayer.h in Headers */, DD0902AB1DB192A800C5BDCE /* MGLNetworkConfiguration.h in Headers */, DA8848571CBAFB9800AB86E3 /* MGLMapboxEvents.h in Headers */, DA8848311CBAFA6200AB86E3 /* NSString+MGLAdditions.h in Headers */, 353933F81D3FB79F003F57D7 /* MGLLineStyleLayer.h in Headers */, + DAAF722D1DA903C700312FA4 /* MGLStyleValue_Private.h in Headers */, DA8847F41CBAFA5100AB86E3 /* MGLOfflinePack.h in Headers */, DA88482E1CBAFA6200AB86E3 /* NSException+MGLAdditions.h in Headers */, DA8848551CBAFB9800AB86E3 /* MGLLocationManager.h in Headers */, 408AA8571DAEDA1700022900 /* NSDictionary+MGLAdditions.h in Headers */, - 350098C11D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.h in Headers */, DA88483F1CBAFB8500AB86E3 /* MGLUserLocation.h in Headers */, DA88483D1CBAFB8500AB86E3 /* MGLMapView+IBAdditions.h in Headers */, DA17BE301CC4BAC300402C41 /* MGLMapView_Private.h in Headers */, @@ -1514,9 +1439,9 @@ 35CE61821D4165D9004F2359 /* UIColor+MGLAdditions.h in Headers */, 35B82BF81D6C5F8400B1B721 /* NSPredicate+MGLAdditions.h in Headers */, DA35A29E1CC9E94C00E826B2 /* MGLCoordinateFormatter.h in Headers */, + DAAF722B1DA903C700312FA4 /* MGLStyleValue.h in Headers */, DA8847F71CBAFA5100AB86E3 /* MGLOverlay.h in Headers */, DA35A2B11CCA141D00E826B2 /* MGLCompassDirectionFormatter.h in Headers */, - 350098D31D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.h in Headers */, DA88488B1CBB037E00AB86E3 /* SMCalloutView.h in Headers */, DA8847FE1CBAFA5100AB86E3 /* MGLTypes.h in Headers */, DA8847F11CBAFA5100AB86E3 /* MGLGeometry.h in Headers */, @@ -1531,20 +1456,16 @@ DAD1656C1CF41981001FF4B9 /* MGLFeature.h in Headers */, 40EDA1C01CFE0E0200D9EA68 /* MGLAnnotationContainerView.h in Headers */, DA88484F1CBAFB9800AB86E3 /* MGLAnnotationImage_Private.h in Headers */, - 3534C7921D4BC95400D874A4 /* MGLStyleAttributeFunction_Private.h in Headers */, DA8847F21CBAFA5100AB86E3 /* MGLMapCamera.h in Headers */, 3538AA1D1D542239008EC33D /* MGLForegroundStyleLayer.h in Headers */, DA8847F51CBAFA5100AB86E3 /* MGLOfflineRegion.h in Headers */, DA737EE11D056A4E005BDA16 /* MGLMapViewDelegate.h in Headers */, DA8848851CBB033F00AB86E3 /* FABKitProtocol.h in Headers */, DA88481B1CBAFA6200AB86E3 /* MGLGeometry_Private.h in Headers */, - 350098CA1D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.h in Headers */, - 350098AF1D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.h in Headers */, 3510FFF91D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.h in Headers */, 404C26E71D89C55D000AA13D /* MGLTileSet_Private.h in Headers */, DA88485C1CBAFB9800AB86E3 /* MGLFaux3DUserLocationAnnotationView.h in Headers */, DA8848871CBB033F00AB86E3 /* Fabric.h in Headers */, - 350098D81D4830D5004B2AF0 /* NSString+MGLStyleAttributeAdditions_Private.h in Headers */, 35305D4A1D22AA6A0007D005 /* NSData+MGLAdditions.h in Headers */, 359F57461D2FDDA6005217F1 /* MGLUserLocationAnnotationView_Private.h in Headers */, 404C26E21D89B877000AA13D /* MGLTileSet.h in Headers */, @@ -1553,7 +1474,6 @@ DA88482F1CBAFA6200AB86E3 /* NSProcessInfo+MGLAdditions.h in Headers */, DA8848601CBAFC2E00AB86E3 /* Mapbox.h in Headers */, 350098BB1D480108004B2AF0 /* MGLVectorSource.h in Headers */, - 3534C7951D4BD1D400D874A4 /* MGLStyleAttributeValue_Private.h in Headers */, DA8847F61CBAFA5100AB86E3 /* MGLOfflineStorage.h in Headers */, DAD1656E1CF41981001FF4B9 /* MGLFeature_Private.h in Headers */, DA88483C1CBAFB8500AB86E3 /* MGLMapView.h in Headers */, @@ -1570,12 +1490,9 @@ 353933FC1D3FB7C0003F57D7 /* MGLRasterStyleLayer.h in Headers */, 3566C76D1D4A8DFA008152BC /* MGLRasterSource.h in Headers */, DAED38641D62D0FC00D7640F /* NSURL+MGLAdditions.h in Headers */, - 35599DEC1D46F14E0048254D /* MGLStyleAttributeFunction.h in Headers */, DABFB85E1CBE99E500D62B32 /* MGLAnnotation.h in Headers */, - 350098D01D482E10004B2AF0 /* NSArray+MGLStyleAttributeAdditions_Private.h in Headers */, DABFB8641CBE99E500D62B32 /* MGLOfflineStorage.h in Headers */, DAD165791CF4CDFF001FF4B9 /* MGLShapeCollection.h in Headers */, - 350098D41D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.h in Headers */, 3566C7671D4A77BA008152BC /* MGLGeoJSONSource.h in Headers */, DA35A29F1CC9E94C00E826B2 /* MGLCoordinateFormatter.h in Headers */, DABFB8711CBE9A0F00D62B32 /* MGLMapView+MGLCustomStyleLayerAdditions.h in Headers */, @@ -1587,38 +1504,30 @@ DABFB8721CBE9A0F00D62B32 /* MGLUserLocation.h in Headers */, 3566C7721D4A9198008152BC /* MGLSource_Private.h in Headers */, 353933FF1D3FB7DD003F57D7 /* MGLSymbolStyleLayer.h in Headers */, + DAAF722E1DA903C700312FA4 /* MGLStyleValue_Private.h in Headers */, DABFB8661CBE99E500D62B32 /* MGLPointAnnotation.h in Headers */, - 35599DF11D46F3A60048254D /* MGLStyleAttributeValue.h in Headers */, DABFB8621CBE99E500D62B32 /* MGLOfflinePack.h in Headers */, DAD1656D1CF41981001FF4B9 /* MGLFeature.h in Headers */, DA17BE311CC4BDAA00402C41 /* MGLMapView_Private.h in Headers */, DABFB86C1CBE99E500D62B32 /* MGLTypes.h in Headers */, - 350098C21D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.h in Headers */, DABFB8691CBE99E500D62B32 /* MGLShape.h in Headers */, - 350098CB1D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.h in Headers */, 3510FFEB1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.h in Headers */, 35E1A4D91D74336F007AA97F /* MGLValueEvaluator.h in Headers */, 7E016D7F1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h in Headers */, DABFB8701CBE9A0F00D62B32 /* MGLMapView+IBAdditions.h in Headers */, 353AFA151D65AB17005A69F4 /* NSDate+MGLAdditions.h in Headers */, - 350098D91D4830D5004B2AF0 /* NSString+MGLStyleAttributeAdditions_Private.h in Headers */, 3510FFFA1D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.h in Headers */, 35CE61831D4165D9004F2359 /* UIColor+MGLAdditions.h in Headers */, - 350098B01D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.h in Headers */, DABFB8671CBE99E500D62B32 /* MGLPolygon.h in Headers */, - 350098C71D48288B004B2AF0 /* NSNumber+MGLStyleAttributeAdditions_Private.h in Headers */, 404C26E81D89C55D000AA13D /* MGLTileSet_Private.h in Headers */, - 3593E5221D529C29006D9365 /* MGLStyleAttribute.h in Headers */, + DAAF722C1DA903C700312FA4 /* MGLStyleValue.h in Headers */, DABFB8651CBE99E500D62B32 /* MGLOverlay.h in Headers */, 35E79F211D41266300957B9E /* MGLStyleLayer_Private.h in Headers */, 350098DD1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.h in Headers */, - 3534C7961D4BD1D400D874A4 /* MGLStyleAttributeValue_Private.h in Headers */, DABFB8681CBE99E500D62B32 /* MGLPolyline.h in Headers */, - 3534C7931D4BC95400D874A4 /* MGLStyleAttributeFunction_Private.h in Headers */, DABFB86F1CBE9A0F00D62B32 /* MGLMapView.h in Headers */, DA6408DC1DA4E7D300908C90 /* MGLVectorStyleLayer.h in Headers */, 353933F31D3FB753003F57D7 /* MGLCircleStyleLayer.h in Headers */, - 3593E5271D529EDC006D9365 /* UIColor+MGLStyleAttributeAdditions_Private.h in Headers */, 3538AA1E1D542239008EC33D /* MGLForegroundStyleLayer.h in Headers */, 30E578181DAA85520050F07E /* UIImage+MGLAdditions.h in Headers */, 40F887711D7A1E59008ECB67 /* MGLGeoJSONSource_Private.h in Headers */, @@ -1629,7 +1538,6 @@ DABFB86B1CBE99E500D62B32 /* MGLTilePyramidOfflineRegion.h in Headers */, 4018B1CB1CDC288E00F666AF /* MGLAnnotationView.h in Headers */, DABFB85F1CBE99E500D62B32 /* MGLGeometry.h in Headers */, - 354D42DD1D4919F900F400A1 /* NSValue+MGLStyleAttributeAdditions_Private.h in Headers */, 7E016D851D9E890300A29A21 /* MGLPolygon+MGLAdditions.h in Headers */, 353933F61D3FB785003F57D7 /* MGLBackgroundStyleLayer.h in Headers */, DABFB85D1CBE99E500D62B32 /* MGLAccountManager.h in Headers */, @@ -1981,14 +1889,10 @@ 35136D391D42271A00C20EFD /* MGLBackgroundStyleLayer.mm in Sources */, 3510FFEC1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm in Sources */, 7E016D801D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.m in Sources */, - 350098D51D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.mm in Sources */, - 3593E5231D529C29006D9365 /* MGLStyleAttribute.mm in Sources */, - 350098B11D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.mm in Sources */, DAED38651D62D0FC00D7640F /* NSURL+MGLAdditions.m in Sources */, 354B83981D2E873E005D9406 /* MGLUserLocationAnnotationView.m in Sources */, DA88485D1CBAFB9800AB86E3 /* MGLFaux3DUserLocationAnnotationView.m in Sources */, DAD165701CF41981001FF4B9 /* MGLFeature.mm in Sources */, - 350098C31D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.mm in Sources */, 30E578191DAA855E0050F07E /* UIImage+MGLAdditions.mm in Sources */, 40EDA1C11CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */, DA8848541CBAFB9800AB86E3 /* MGLCompactCalloutView.m in Sources */, @@ -2008,9 +1912,8 @@ 35136D4E1D4277FC00C20EFD /* MGLSource.mm in Sources */, DA35A2B81CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m in Sources */, DAD1657A1CF4CDFF001FF4B9 /* MGLShapeCollection.m in Sources */, - 350098CC1D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.mm in Sources */, 35136D451D42275100C20EFD /* MGLSymbolStyleLayer.mm in Sources */, - 35599DED1D46F14E0048254D /* MGLStyleAttributeFunction.mm in Sources */, + 35599DED1D46F14E0048254D /* MGLStyleValue.mm in Sources */, DA8848211CBAFA6200AB86E3 /* MGLOfflinePack.mm in Sources */, DA8848591CBAFB9800AB86E3 /* MGLMapView.mm in Sources */, DA8848501CBAFB9800AB86E3 /* MGLAnnotationImage.m in Sources */, @@ -2057,14 +1960,10 @@ 35136D3A1D42271A00C20EFD /* MGLBackgroundStyleLayer.mm in Sources */, 3510FFED1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm in Sources */, 7E016D811D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.m in Sources */, - 350098D61D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.mm in Sources */, 354B83991D2E873E005D9406 /* MGLUserLocationAnnotationView.m in Sources */, DAA4E4221CBB730400178DFB /* MGLPointAnnotation.mm in Sources */, - 3593E5241D529C29006D9365 /* MGLStyleAttribute.mm in Sources */, - 350098B21D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.mm in Sources */, DAED38661D62D0FC00D7640F /* NSURL+MGLAdditions.m in Sources */, DAD165711CF41981001FF4B9 /* MGLFeature.mm in Sources */, - 350098C41D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.mm in Sources */, 30E5781A1DAA855E0050F07E /* UIImage+MGLAdditions.mm in Sources */, 40EDA1C21CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */, DAA4E4291CBB730400178DFB /* NSBundle+MGLAdditions.m in Sources */, @@ -2084,10 +1983,9 @@ 35136D4F1D4277FC00C20EFD /* MGLSource.mm in Sources */, DA35A2B91CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m in Sources */, DAD1657B1CF4CDFF001FF4B9 /* MGLShapeCollection.m in Sources */, - 350098CD1D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.mm in Sources */, DAA4E4251CBB730400178DFB /* MGLShape.mm in Sources */, 35136D461D42275100C20EFD /* MGLSymbolStyleLayer.mm in Sources */, - 35599DEE1D46F14E0048254D /* MGLStyleAttributeFunction.mm in Sources */, + 35599DEE1D46F14E0048254D /* MGLStyleValue.mm in Sources */, DAA4E42B1CBB730400178DFB /* NSString+MGLAdditions.m in Sources */, DAA4E4261CBB730400178DFB /* MGLStyle.mm in Sources */, DAA4E41D1CBB730400178DFB /* MGLGeometry.mm in Sources */, diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 06a7684f388..88f4d8a970e 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -3080,7 +3080,7 @@ - (double)alphaForShapeAnnotation:(MGLShape *)annotation UIColor *color = (_delegateHasStrokeColorsForShapeAnnotations ? [self.delegate mapView:self strokeColorForShapeAnnotation:annotation] : self.tintColor); - return color.mbgl_color; + return color.mgl_color; } - (mbgl::Color)fillColorForPolygonAnnotation:(MGLPolygon *)annotation @@ -3088,7 +3088,7 @@ - (double)alphaForShapeAnnotation:(MGLShape *)annotation UIColor *color = (_delegateHasFillColorsForShapeAnnotations ? [self.delegate mapView:self fillColorForPolygonAnnotation:annotation] : self.tintColor); - return color.mbgl_color; + return color.mgl_color; } - (CGFloat)lineWidthForPolylineAnnotation:(MGLPolyline *)annotation diff --git a/platform/ios/src/Mapbox.h b/platform/ios/src/Mapbox.h index a187737023b..04892eb6a19 100644 --- a/platform/ios/src/Mapbox.h +++ b/platform/ios/src/Mapbox.h @@ -50,11 +50,5 @@ FOUNDATION_EXPORT const unsigned char MapboxVersionString[]; #import "MGLUserLocation.h" #import "MGLUserLocationAnnotationView.h" #import "NSValue+MGLAdditions.h" -#import "MGLStyleAttributeValue.h" -#import "MGLStyleAttributeFunction.h" -#import "UIColor+MGLStyleAttributeAdditions.h" -#import "NSNumber+MGLStyleAttributeAdditions.h" -#import "NSValue+MGLStyleAttributeAdditions.h" -#import "NSString+MGLStyleAttributeAdditions.h" -#import "NSArray+MGLStyleAttributeAdditions.h" +#import "MGLStyleValue.h" #import "MGLTileSet.h" diff --git a/platform/ios/src/UIColor+MGLAdditions.h b/platform/ios/src/UIColor+MGLAdditions.h index 7cc291c6575..ea415d9db9b 100644 --- a/platform/ios/src/UIColor+MGLAdditions.h +++ b/platform/ios/src/UIColor+MGLAdditions.h @@ -5,10 +5,10 @@ @interface UIColor (MGLAdditions) -- (mbgl::Color)mbgl_color; +- (mbgl::Color)mgl_color; -- (mbgl::style::PropertyValue)mbgl_colorPropertyValue; +- (mbgl::style::PropertyValue)mgl_colorPropertyValue; -+ (UIColor *)mbgl_colorWithColor:(mbgl::Color)color; ++ (UIColor *)mgl_colorWithColor:(mbgl::Color)color; @end diff --git a/platform/ios/src/UIColor+MGLAdditions.mm b/platform/ios/src/UIColor+MGLAdditions.mm index 5a4b4b49f3b..41c066c206f 100644 --- a/platform/ios/src/UIColor+MGLAdditions.mm +++ b/platform/ios/src/UIColor+MGLAdditions.mm @@ -1,24 +1,21 @@ #import "UIColor+MGLAdditions.h" -#import "MGLStyleAttributeValue.h" -#import "MGLStyleAttributeValue_Private.h" - @implementation UIColor (MGLAdditions) -- (mbgl::Color)mbgl_color +- (mbgl::Color)mgl_color { CGFloat r, g, b, a; [self getRed:&r green:&g blue:&b alpha:&a]; return { (float)r, (float)g, (float)b, (float)a }; } -- (mbgl::style::PropertyValue)mbgl_colorPropertyValue +- (mbgl::style::PropertyValue)mgl_colorPropertyValue { - mbgl::Color color = self.mbgl_color; + mbgl::Color color = self.mgl_color; return {{ color.r, color.g, color.b, color.a }}; } -+ (UIColor *)mbgl_colorWithColor:(mbgl::Color)color ++ (UIColor *)mgl_colorWithColor:(mbgl::Color)color { return [UIColor colorWithRed:color.r green:color.g blue:color.b alpha:color.a]; } diff --git a/platform/ios/src/UIColor+MGLStyleAttributeAdditions.h b/platform/ios/src/UIColor+MGLStyleAttributeAdditions.h deleted file mode 100644 index 3637ceab6ce..00000000000 --- a/platform/ios/src/UIColor+MGLStyleAttributeAdditions.h +++ /dev/null @@ -1,7 +0,0 @@ -#import - -#import "MGLStyleAttributeValue.h" - -@interface UIColor (MGLStyleAttributeAdditions) - -@end diff --git a/platform/ios/src/UIColor+MGLStyleAttributeAdditions.mm b/platform/ios/src/UIColor+MGLStyleAttributeAdditions.mm deleted file mode 100644 index 5a9ac3afe99..00000000000 --- a/platform/ios/src/UIColor+MGLStyleAttributeAdditions.mm +++ /dev/null @@ -1,14 +0,0 @@ -#import "UIColor+MGLStyleAttributeAdditions.h" - -#import "MGLStyleAttributeValue.h" -#import "MGLStyleAttributeValue_Private.h" -#import "UIColor+MGLAdditions.h" - -@implementation UIColor (MGLStyleAttributeAdditions) - -- (BOOL)isFunction -{ - return NO; -} - -@end diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m index 505678fcc23..e4fe202f3f2 100644 --- a/platform/macos/app/MapDocument.m +++ b/platform/macos/app/MapDocument.m @@ -494,12 +494,11 @@ - (void)handlePressGesture:(NSPressGestureRecognizer *)gestureRecognizer { - (IBAction)manipulateStyle:(id)sender { MGLFillStyleLayer *fillStyleLayer = (MGLFillStyleLayer *)[self.mapView.style layerWithIdentifier:@"water"]; - MGLStyleAttributeFunction *colorFunction = [[MGLStyleAttributeFunction alloc] init]; - colorFunction.stops = @{ - @0.0: [NSColor redColor], - @10.0: [NSColor yellowColor], - @20.0: [NSColor blackColor], - }; + MGLStyleValue *colorFunction = [MGLStyleValue valueWithStops:@{ + @0.0: [MGLStyleValue valueWithRawValue:[NSColor redColor]], + @10.0: [MGLStyleValue valueWithRawValue:[NSColor yellowColor]], + @20.0: [MGLStyleValue valueWithRawValue:[NSColor blackColor]], + }]; fillStyleLayer.fillColor = colorFunction; NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"]; @@ -508,7 +507,7 @@ - (IBAction)manipulateStyle:(id)sender { [self.mapView.style addSource:source]; MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"test" source:source]; - fillLayer.fillColor = [NSColor greenColor]; + fillLayer.fillColor = [MGLStyleValue valueWithRawValue:[NSColor greenColor]]; fillLayer.predicate = [NSPredicate predicateWithFormat:@"%K == %@", @"type", @"park"]; [self.mapView.style addLayer:fillLayer]; } diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj index f3da3c0f0ef..0d8b4fd22f7 100644 --- a/platform/macos/macos.xcodeproj/project.pbxproj +++ b/platform/macos/macos.xcodeproj/project.pbxproj @@ -10,9 +10,7 @@ 30E5781B1DAA857E0050F07E /* NSImage+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E578141DAA7D920050F07E /* NSImage+MGLAdditions.h */; }; 3508EC641D749D39009B0EE4 /* NSExpression+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3508EC621D749D39009B0EE4 /* NSExpression+MGLAdditions.h */; }; 3508EC651D749D39009B0EE4 /* NSExpression+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3508EC631D749D39009B0EE4 /* NSExpression+MGLAdditions.mm */; }; - 352742781D4C220900A1ECE6 /* MGLStyleAttributeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 352742771D4C220900A1ECE6 /* MGLStyleAttributeValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3527427C1D4C238F00A1ECE6 /* NSColor+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3527427A1D4C238F00A1ECE6 /* NSColor+MGLStyleAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3527427D1D4C238F00A1ECE6 /* NSColor+MGLStyleAttributeAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3527427B1D4C238F00A1ECE6 /* NSColor+MGLStyleAttributeAdditions.m */; }; + 352742781D4C220900A1ECE6 /* MGLStyleValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 352742771D4C220900A1ECE6 /* MGLStyleValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; 352742811D4C243B00A1ECE6 /* MGLSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 3527427F1D4C243B00A1ECE6 /* MGLSource.h */; settings = {ATTRIBUTES = (Public, ); }; }; 352742821D4C243B00A1ECE6 /* MGLSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 352742801D4C243B00A1ECE6 /* MGLSource.mm */; }; 352742851D4C244700A1ECE6 /* MGLRasterSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 352742831D4C244700A1ECE6 /* MGLRasterSource.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -21,9 +19,7 @@ 3527428A1D4C245800A1ECE6 /* MGLGeoJSONSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 352742881D4C245800A1ECE6 /* MGLGeoJSONSource.mm */; }; 3527428D1D4C24AB00A1ECE6 /* MGLCircleStyleLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3527428B1D4C24AB00A1ECE6 /* MGLCircleStyleLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3527428E1D4C24AB00A1ECE6 /* MGLCircleStyleLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3527428C1D4C24AB00A1ECE6 /* MGLCircleStyleLayer.mm */; }; - 3527429F1D4C25BD00A1ECE6 /* MGLStyleAttributeFunction_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 3527429C1D4C25BD00A1ECE6 /* MGLStyleAttributeFunction_Private.h */; }; - 352742A01D4C25BD00A1ECE6 /* MGLStyleAttributeFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 3527429D1D4C25BD00A1ECE6 /* MGLStyleAttributeFunction.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 352742A11D4C25BD00A1ECE6 /* MGLStyleAttributeFunction.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3527429E1D4C25BD00A1ECE6 /* MGLStyleAttributeFunction.mm */; }; + 352742A11D4C25BD00A1ECE6 /* MGLStyleValue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3527429E1D4C25BD00A1ECE6 /* MGLStyleValue.mm */; }; 3529039B1D6C63B80002C7DF /* NSPredicate+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 352903991D6C63B80002C7DF /* NSPredicate+MGLAdditions.h */; }; 3529039C1D6C63B80002C7DF /* NSPredicate+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3529039A1D6C63B80002C7DF /* NSPredicate+MGLAdditions.mm */; }; 3537CA741D3F93A600380318 /* MGLStyle_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 3537CA731D3F93A600380318 /* MGLStyle_Private.h */; }; @@ -38,9 +34,6 @@ 35602C001D3EA9B40050646F /* MGLForegroundStyleLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 35602BFD1D3EA9B40050646F /* MGLForegroundStyleLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 35602C011D3EA9B40050646F /* MGLForegroundStyleLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 35602BFE1D3EA9B40050646F /* MGLForegroundStyleLayer.m */; }; 35724FC41D630502002A4AB4 /* amsterdam.geojson in Resources */ = {isa = PBXBuildFile; fileRef = 358EB3AE1D61F0DB00E46D9C /* amsterdam.geojson */; }; - 3593E52A1D52A628006D9365 /* MGLStyleAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 3593E5281D52A628006D9365 /* MGLStyleAttribute.h */; }; - 3593E52B1D52A628006D9365 /* MGLStyleAttribute.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3593E5291D52A628006D9365 /* MGLStyleAttribute.mm */; }; - 3593E52D1D52A680006D9365 /* NSColor+MGLStyleAttributeAdditions_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 3593E52C1D52A680006D9365 /* NSColor+MGLStyleAttributeAdditions_Private.h */; }; 35C5D8471D6DD66D00E95907 /* NSComparisonPredicate+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35C5D8431D6DD66D00E95907 /* NSComparisonPredicate+MGLAdditions.h */; }; 35C5D8481D6DD66D00E95907 /* NSComparisonPredicate+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35C5D8441D6DD66D00E95907 /* NSComparisonPredicate+MGLAdditions.mm */; }; 35C5D8491D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35C5D8451D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.h */; }; @@ -98,19 +91,9 @@ DA8F25971D51CAC70010E6B5 /* MGLVectorSource.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8F25951D51CAC70010E6B5 /* MGLVectorSource.h */; settings = {ATTRIBUTES = (Public, ); }; }; DA8F25981D51CAC70010E6B5 /* MGLVectorSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA8F25961D51CAC70010E6B5 /* MGLVectorSource.mm */; }; DA8F259A1D51CAD00010E6B5 /* MGLSource_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8F25991D51CAD00010E6B5 /* MGLSource_Private.h */; }; - DA8F259C1D51CB000010E6B5 /* MGLStyleAttributeValue_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8F259B1D51CB000010E6B5 /* MGLStyleAttributeValue_Private.h */; }; - DA8F25A91D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8F259D1D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DA8F25AA1D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA8F259E1D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions.mm */; }; - DA8F25AB1D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8F259F1D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions_Private.h */; }; - DA8F25AC1D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8F25A01D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DA8F25AD1D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA8F25A11D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions.mm */; }; - DA8F25AE1D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8F25A21D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions_Private.h */; }; - DA8F25AF1D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8F25A31D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DA8F25B01D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA8F25A41D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions.mm */; }; - DA8F25B11D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8F25A51D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions_Private.h */; }; - DA8F25B21D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8F25A61D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA8F259C1D51CB000010E6B5 /* MGLStyleValue_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8F259B1D51CB000010E6B5 /* MGLStyleValue_Private.h */; }; + DA8F25B21D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8F25A61D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.h */; }; DA8F25B31D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA8F25A71D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.mm */; }; - DA8F25B41D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8F25A81D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions_Private.h */; }; DAC2ABC51CC6D343006D18C4 /* MGLAnnotationImage_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DAC2ABC41CC6D343006D18C4 /* MGLAnnotationImage_Private.h */; }; DACC22141CF3D3E200D220D9 /* MGLFeature.h in Headers */ = {isa = PBXBuildFile; fileRef = DACC22121CF3D3E200D220D9 /* MGLFeature.h */; settings = {ATTRIBUTES = (Public, ); }; }; DACC22151CF3D3E200D220D9 /* MGLFeature.mm in Sources */ = {isa = PBXBuildFile; fileRef = DACC22131CF3D3E200D220D9 /* MGLFeature.mm */; }; @@ -233,9 +216,7 @@ 30E578141DAA7D920050F07E /* NSImage+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSImage+MGLAdditions.h"; path = "src/NSImage+MGLAdditions.h"; sourceTree = SOURCE_ROOT; }; 3508EC621D749D39009B0EE4 /* NSExpression+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSExpression+MGLAdditions.h"; sourceTree = ""; }; 3508EC631D749D39009B0EE4 /* NSExpression+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSExpression+MGLAdditions.mm"; sourceTree = ""; }; - 352742771D4C220900A1ECE6 /* MGLStyleAttributeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleAttributeValue.h; sourceTree = ""; }; - 3527427A1D4C238F00A1ECE6 /* NSColor+MGLStyleAttributeAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSColor+MGLStyleAttributeAdditions.h"; sourceTree = ""; }; - 3527427B1D4C238F00A1ECE6 /* NSColor+MGLStyleAttributeAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSColor+MGLStyleAttributeAdditions.m"; sourceTree = ""; }; + 352742771D4C220900A1ECE6 /* MGLStyleValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleValue.h; sourceTree = ""; }; 3527427F1D4C243B00A1ECE6 /* MGLSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLSource.h; sourceTree = ""; }; 352742801D4C243B00A1ECE6 /* MGLSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLSource.mm; sourceTree = ""; }; 352742831D4C244700A1ECE6 /* MGLRasterSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLRasterSource.h; sourceTree = ""; }; @@ -244,9 +225,7 @@ 352742881D4C245800A1ECE6 /* MGLGeoJSONSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLGeoJSONSource.mm; sourceTree = ""; }; 3527428B1D4C24AB00A1ECE6 /* MGLCircleStyleLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCircleStyleLayer.h; sourceTree = ""; }; 3527428C1D4C24AB00A1ECE6 /* MGLCircleStyleLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLCircleStyleLayer.mm; sourceTree = ""; }; - 3527429C1D4C25BD00A1ECE6 /* MGLStyleAttributeFunction_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleAttributeFunction_Private.h; sourceTree = ""; }; - 3527429D1D4C25BD00A1ECE6 /* MGLStyleAttributeFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleAttributeFunction.h; sourceTree = ""; }; - 3527429E1D4C25BD00A1ECE6 /* MGLStyleAttributeFunction.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLStyleAttributeFunction.mm; sourceTree = ""; }; + 3527429E1D4C25BD00A1ECE6 /* MGLStyleValue.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLStyleValue.mm; sourceTree = ""; }; 352903991D6C63B80002C7DF /* NSPredicate+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSPredicate+MGLAdditions.h"; sourceTree = ""; }; 3529039A1D6C63B80002C7DF /* NSPredicate+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSPredicate+MGLAdditions.mm"; sourceTree = ""; }; 3537CA731D3F93A600380318 /* MGLStyle_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyle_Private.h; sourceTree = ""; }; @@ -260,9 +239,6 @@ 35602BFD1D3EA9B40050646F /* MGLForegroundStyleLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLForegroundStyleLayer.h; sourceTree = ""; }; 35602BFE1D3EA9B40050646F /* MGLForegroundStyleLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLForegroundStyleLayer.m; sourceTree = ""; }; 358EB3AE1D61F0DB00E46D9C /* amsterdam.geojson */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = amsterdam.geojson; path = ../../darwin/test/amsterdam.geojson; sourceTree = ""; }; - 3593E5281D52A628006D9365 /* MGLStyleAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleAttribute.h; sourceTree = ""; }; - 3593E5291D52A628006D9365 /* MGLStyleAttribute.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLStyleAttribute.mm; sourceTree = ""; }; - 3593E52C1D52A680006D9365 /* NSColor+MGLStyleAttributeAdditions_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSColor+MGLStyleAttributeAdditions_Private.h"; sourceTree = ""; }; 35C5D8431D6DD66D00E95907 /* NSComparisonPredicate+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSComparisonPredicate+MGLAdditions.h"; sourceTree = ""; }; 35C5D8441D6DD66D00E95907 /* NSComparisonPredicate+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSComparisonPredicate+MGLAdditions.mm"; sourceTree = ""; }; 35C5D8451D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSCompoundPredicate+MGLAdditions.h"; sourceTree = ""; }; @@ -338,19 +314,9 @@ DA8F25951D51CAC70010E6B5 /* MGLVectorSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLVectorSource.h; sourceTree = ""; }; DA8F25961D51CAC70010E6B5 /* MGLVectorSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLVectorSource.mm; sourceTree = ""; }; DA8F25991D51CAD00010E6B5 /* MGLSource_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLSource_Private.h; sourceTree = ""; }; - DA8F259B1D51CB000010E6B5 /* MGLStyleAttributeValue_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleAttributeValue_Private.h; sourceTree = ""; }; - DA8F259D1D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNumber+MGLStyleAttributeAdditions.h"; sourceTree = ""; }; - DA8F259E1D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSNumber+MGLStyleAttributeAdditions.mm"; sourceTree = ""; }; - DA8F259F1D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNumber+MGLStyleAttributeAdditions_Private.h"; sourceTree = ""; }; - DA8F25A01D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+MGLStyleAttributeAdditions.h"; sourceTree = ""; }; - DA8F25A11D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSArray+MGLStyleAttributeAdditions.mm"; sourceTree = ""; }; - DA8F25A21D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+MGLStyleAttributeAdditions_Private.h"; sourceTree = ""; }; - DA8F25A31D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+MGLStyleAttributeAdditions.h"; sourceTree = ""; }; - DA8F25A41D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSString+MGLStyleAttributeAdditions.mm"; sourceTree = ""; }; - DA8F25A51D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+MGLStyleAttributeAdditions_Private.h"; sourceTree = ""; }; + DA8F259B1D51CB000010E6B5 /* MGLStyleValue_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleValue_Private.h; sourceTree = ""; }; DA8F25A61D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSValue+MGLStyleAttributeAdditions.h"; sourceTree = ""; }; DA8F25A71D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSValue+MGLStyleAttributeAdditions.mm"; sourceTree = ""; }; - DA8F25A81D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSValue+MGLStyleAttributeAdditions_Private.h"; sourceTree = ""; }; DA8F25B51D51D2240010E6B5 /* MGLRuntimeStylingTests.m.ejs */ = {isa = PBXFileReference; lastKnownFileType = text; path = MGLRuntimeStylingTests.m.ejs; sourceTree = ""; }; DA8F25B61D51D2240010E6B5 /* MGLStyleLayer.h.ejs */ = {isa = PBXFileReference; lastKnownFileType = text; path = MGLStyleLayer.h.ejs; sourceTree = ""; }; DA8F25B71D51D2240010E6B5 /* MGLStyleLayer.mm.ejs */ = {isa = PBXFileReference; lastKnownFileType = text; path = MGLStyleLayer.mm.ejs; sourceTree = ""; }; @@ -509,19 +475,6 @@ 352742791D4C235C00A1ECE6 /* Categories */ = { isa = PBXGroup; children = ( - DA8F25A21D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions_Private.h */, - DA8F25A01D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions.h */, - DA8F25A11D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions.mm */, - 3593E52C1D52A680006D9365 /* NSColor+MGLStyleAttributeAdditions_Private.h */, - 3527427A1D4C238F00A1ECE6 /* NSColor+MGLStyleAttributeAdditions.h */, - 3527427B1D4C238F00A1ECE6 /* NSColor+MGLStyleAttributeAdditions.m */, - DA8F259F1D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions_Private.h */, - DA8F259D1D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions.h */, - DA8F259E1D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions.mm */, - DA8F25A51D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions_Private.h */, - DA8F25A31D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions.h */, - DA8F25A41D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions.mm */, - DA8F25A81D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions_Private.h */, DA8F25A61D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.h */, DA8F25A71D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.mm */, ); @@ -550,13 +503,9 @@ 352742791D4C235C00A1ECE6 /* Categories */, 35136D471D42295400C20EFD /* Layers */, 3527427E1D4C242B00A1ECE6 /* Sources */, - 3527429D1D4C25BD00A1ECE6 /* MGLStyleAttributeFunction.h */, - 3527429C1D4C25BD00A1ECE6 /* MGLStyleAttributeFunction_Private.h */, - 3527429E1D4C25BD00A1ECE6 /* MGLStyleAttributeFunction.mm */, - 3593E5281D52A628006D9365 /* MGLStyleAttribute.h */, - 3593E5291D52A628006D9365 /* MGLStyleAttribute.mm */, - 352742771D4C220900A1ECE6 /* MGLStyleAttributeValue.h */, - DA8F259B1D51CB000010E6B5 /* MGLStyleAttributeValue_Private.h */, + 352742771D4C220900A1ECE6 /* MGLStyleValue.h */, + DA8F259B1D51CB000010E6B5 /* MGLStyleValue_Private.h */, + 3527429E1D4C25BD00A1ECE6 /* MGLStyleValue.mm */, ); name = Styling; sourceTree = ""; @@ -679,6 +628,17 @@ path = ../../darwin/src; sourceTree = ""; }; + DA90B12C1DB43B180073CF55 /* Categories */ = { + isa = PBXGroup; + children = ( + 355BA4EB1D41633E00CCC6D5 /* NSColor+MGLAdditions.h */, + 355BA4EC1D41633E00CCC6D5 /* NSColor+MGLAdditions.mm */, + 405C03961DB0004E001AC280 /* NSImage+MGLAdditions.h */, + 405C03971DB0004E001AC280 /* NSImage+MGLAdditions.mm */, + ); + name = Categories; + sourceTree = ""; + }; DAD1657C1CF4CE6B001FF4B9 /* Formatters */ = { isa = PBXGroup; children = ( @@ -852,8 +812,7 @@ DAE6C39E1CC31E7C00DB3429 /* Kit */ = { isa = PBXGroup; children = ( - 405C03961DB0004E001AC280 /* NSImage+MGLAdditions.h */, - 405C03971DB0004E001AC280 /* NSImage+MGLAdditions.mm */, + DA90B12C1DB43B180073CF55 /* Categories */, DAE6C39F1CC31E9400DB3429 /* MGLAnnotationImage.h */, DAC2ABC41CC6D343006D18C4 /* MGLAnnotationImage_Private.h */, DAE6C3A71CC31EF300DB3429 /* MGLAnnotationImage.m */, @@ -869,8 +828,6 @@ DAE6C3A21CC31E9400DB3429 /* MGLMapViewDelegate.h */, DAE6C3AF1CC31EF300DB3429 /* MGLOpenGLLayer.h */, DAE6C3B01CC31EF300DB3429 /* MGLOpenGLLayer.mm */, - 355BA4EB1D41633E00CCC6D5 /* NSColor+MGLAdditions.h */, - 355BA4EC1D41633E00CCC6D5 /* NSColor+MGLAdditions.mm */, ); name = Kit; path = src; @@ -891,14 +848,11 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 3593E52D1D52A680006D9365 /* NSColor+MGLStyleAttributeAdditions_Private.h in Headers */, DA8F258F1D51CA600010E6B5 /* MGLRasterStyleLayer.h in Headers */, 3508EC641D749D39009B0EE4 /* NSExpression+MGLAdditions.h in Headers */, DAE6C38D1CC31E2A00DB3429 /* MGLOfflineRegion_Private.h in Headers */, 408AA8651DAEEE3400022900 /* MGLPolygon+MGLAdditions.h in Headers */, - DA8F25AB1D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions_Private.h in Headers */, - DA8F259C1D51CB000010E6B5 /* MGLStyleAttributeValue_Private.h in Headers */, - DA8F25B41D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions_Private.h in Headers */, + DA8F259C1D51CB000010E6B5 /* MGLStyleValue_Private.h in Headers */, DAE6C35B1CC31E0400DB3429 /* MGLAnnotation.h in Headers */, DAE6C3B61CC31EF300DB3429 /* MGLMapView_Private.h in Headers */, 3527428D1D4C24AB00A1ECE6 /* MGLCircleStyleLayer.h in Headers */, @@ -907,16 +861,14 @@ 35C5D8471D6DD66D00E95907 /* NSComparisonPredicate+MGLAdditions.h in Headers */, DAE6C3A31CC31E9400DB3429 /* MGLAnnotationImage.h in Headers */, DAE6C3A41CC31E9400DB3429 /* MGLMapView.h in Headers */, - 352742A01D4C25BD00A1ECE6 /* MGLStyleAttributeFunction.h in Headers */, 355BA4ED1D41633E00CCC6D5 /* NSColor+MGLAdditions.h in Headers */, DAE6C3611CC31E0400DB3429 /* MGLOfflineStorage.h in Headers */, - 352742781D4C220900A1ECE6 /* MGLStyleAttributeValue.h in Headers */, + 352742781D4C220900A1ECE6 /* MGLStyleValue.h in Headers */, DAE6C35E1CC31E0400DB3429 /* MGLMultiPoint.h in Headers */, 35602BFF1D3EA9B40050646F /* MGLStyleLayer_Private.h in Headers */, DAE6C3971CC31E2A00DB3429 /* NSBundle+MGLAdditions.h in Headers */, DAED385F1D62CED700D7640F /* NSURL+MGLAdditions.h in Headers */, DAD165741CF4CD7A001FF4B9 /* MGLShapeCollection.h in Headers */, - DA8F25AF1D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions.h in Headers */, DAE6C3631CC31E0400DB3429 /* MGLPointAnnotation.h in Headers */, DAC2ABC51CC6D343006D18C4 /* MGLAnnotationImage_Private.h in Headers */, DAE6C35F1CC31E0400DB3429 /* MGLOfflinePack.h in Headers */, @@ -926,20 +878,16 @@ DAE6C3861CC31E2A00DB3429 /* MGLGeometry_Private.h in Headers */, DAE6C3841CC31E2A00DB3429 /* MGLAccountManager_Private.h in Headers */, DAE6C3691CC31E0400DB3429 /* MGLTypes.h in Headers */, - DA8F25AE1D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions_Private.h in Headers */, DAE6C3991CC31E2A00DB3429 /* NSException+MGLAdditions.h in Headers */, DA8F25871D51C9E10010E6B5 /* MGLBackgroundStyleLayer.h in Headers */, 30E5781B1DAA857E0050F07E /* NSImage+MGLAdditions.h in Headers */, DAE6C3661CC31E0400DB3429 /* MGLShape.h in Headers */, 352742811D4C243B00A1ECE6 /* MGLSource.h in Headers */, DAE6C3C21CC31F4500DB3429 /* Mapbox.h in Headers */, - 3527427C1D4C238F00A1ECE6 /* NSColor+MGLStyleAttributeAdditions.h in Headers */, DAE6C3641CC31E0400DB3429 /* MGLPolygon.h in Headers */, DA35A2BF1CCA9B1A00E826B2 /* MGLClockDirectionFormatter.h in Headers */, 35602BFA1D3EA99F0050646F /* MGLFillStyleLayer.h in Headers */, DA35A2A41CC9EB1A00E826B2 /* MGLCoordinateFormatter.h in Headers */, - DA8F25B11D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions_Private.h in Headers */, - 3593E52A1D52A628006D9365 /* MGLStyleAttribute.h in Headers */, 35C5D8491D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.h in Headers */, DD0902B31DB1AC6400C5BDCE /* MGLNetworkConfiguration.h in Headers */, DAE6C3621CC31E0400DB3429 /* MGLOverlay.h in Headers */, @@ -951,8 +899,6 @@ 408AA8661DAEEE3600022900 /* MGLPolyline+MGLAdditions.h in Headers */, DAE6C3601CC31E0400DB3429 /* MGLOfflineRegion.h in Headers */, DAE6C3681CC31E0400DB3429 /* MGLTilePyramidOfflineRegion.h in Headers */, - DA8F25AC1D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions.h in Headers */, - 3527429F1D4C25BD00A1ECE6 /* MGLStyleAttributeFunction_Private.h in Headers */, DA35A2CF1CCAAED300E826B2 /* NSValue+MGLAdditions.h in Headers */, DAE6C3A61CC31E9400DB3429 /* MGLMapViewDelegate.h in Headers */, DAE6C38B1CC31E2A00DB3429 /* MGLOfflinePack_Private.h in Headers */, @@ -963,7 +909,6 @@ 35602C001D3EA9B40050646F /* MGLForegroundStyleLayer.h in Headers */, DAE6C35D1CC31E0400DB3429 /* MGLMapCamera.h in Headers */, DAE6C3B41CC31EF300DB3429 /* MGLCompassCell.h in Headers */, - DA8F25A91D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions.h in Headers */, 3537CA741D3F93A600380318 /* MGLStyle_Private.h in Headers */, DA8F259A1D51CAD00010E6B5 /* MGLSource_Private.h in Headers */, DA8F25931D51CA750010E6B5 /* MGLSymbolStyleLayer.h in Headers */, @@ -1162,7 +1107,6 @@ 40ABDB561DB0022100372083 /* NSImage+MGLAdditions.mm in Sources */, DAE6C3901CC31E2A00DB3429 /* MGLPointAnnotation.mm in Sources */, DAE6C3981CC31E2A00DB3429 /* NSBundle+MGLAdditions.m in Sources */, - DA8F25AA1D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions.mm in Sources */, DAE6C3B71CC31EF300DB3429 /* MGLMapView.mm in Sources */, 40B77E461DB11BCD003DA2FE /* NSArray+MGLAdditions.mm in Sources */, DAE6C38C1CC31E2A00DB3429 /* MGLOfflinePack.mm in Sources */, @@ -1182,7 +1126,6 @@ 3527428E1D4C24AB00A1ECE6 /* MGLCircleStyleLayer.mm in Sources */, 35602C011D3EA9B40050646F /* MGLForegroundStyleLayer.m in Sources */, 408AA86A1DAEEE5D00022900 /* NSDictionary+MGLAdditions.mm in Sources */, - 3527427D1D4C238F00A1ECE6 /* NSColor+MGLStyleAttributeAdditions.m in Sources */, DA8F25881D51C9E10010E6B5 /* MGLBackgroundStyleLayer.mm in Sources */, DAE6C3B81CC31EF300DB3429 /* MGLMapView+IBAdditions.mm in Sources */, DA35A2D01CCAAED300E826B2 /* NSValue+MGLAdditions.m in Sources */, @@ -1203,9 +1146,7 @@ 35C5D84A1D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.mm in Sources */, 408AA8681DAEEE5200022900 /* MGLPolygon+MGLAdditions.m in Sources */, DAE6C3951CC31E2A00DB3429 /* MGLTilePyramidOfflineRegion.mm in Sources */, - 3593E52B1D52A628006D9365 /* MGLStyleAttribute.mm in Sources */, DAE6C3851CC31E2A00DB3429 /* MGLAccountManager.m in Sources */, - DA8F25B01D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions.mm in Sources */, DAE6C3921CC31E2A00DB3429 /* MGLPolyline.mm in Sources */, 3527428A1D4C245800A1ECE6 /* MGLGeoJSONSource.mm in Sources */, DAE6C3B51CC31EF300DB3429 /* MGLCompassCell.m in Sources */, @@ -1214,12 +1155,11 @@ 35C5D8481D6DD66D00E95907 /* NSComparisonPredicate+MGLAdditions.mm in Sources */, DA35A2AE1CCA091800E826B2 /* MGLCompassDirectionFormatter.m in Sources */, DA8F258C1D51CA540010E6B5 /* MGLLineStyleLayer.mm in Sources */, - DA8F25AD1D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions.mm in Sources */, 408AA8691DAEEE5500022900 /* MGLPolyline+MGLAdditions.m in Sources */, DA8F25941D51CA750010E6B5 /* MGLSymbolStyleLayer.mm in Sources */, 3529039C1D6C63B80002C7DF /* NSPredicate+MGLAdditions.mm in Sources */, DA8F25981D51CAC70010E6B5 /* MGLVectorSource.mm in Sources */, - 352742A11D4C25BD00A1ECE6 /* MGLStyleAttributeFunction.mm in Sources */, + 352742A11D4C25BD00A1ECE6 /* MGLStyleValue.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index bd03af509dd..a8f91a24e75 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -2183,14 +2183,14 @@ - (double)alphaForShapeAnnotation:(MGLShape *)annotation { NSColor *color = (_delegateHasStrokeColorsForShapeAnnotations ? [self.delegate mapView:self strokeColorForShapeAnnotation:annotation] : [NSColor selectedMenuItemColor]); - return color.mbgl_color; + return color.mgl_color; } - (mbgl::Color)fillColorForPolygonAnnotation:(MGLPolygon *)annotation { NSColor *color = (_delegateHasFillColorsForShapeAnnotations ? [self.delegate mapView:self fillColorForPolygonAnnotation:annotation] : [NSColor selectedMenuItemColor]); - return color.mbgl_color; + return color.mgl_color; } - (CGFloat)lineWidthForPolylineAnnotation:(MGLPolyline *)annotation { diff --git a/platform/macos/src/Mapbox.h b/platform/macos/src/Mapbox.h index 6323196ba43..67e37751003 100644 --- a/platform/macos/src/Mapbox.h +++ b/platform/macos/src/Mapbox.h @@ -45,10 +45,4 @@ FOUNDATION_EXPORT const unsigned char MapboxVersionString[]; #import "MGLTilePyramidOfflineRegion.h" #import "MGLTypes.h" #import "NSValue+MGLAdditions.h" -#import "MGLStyleAttributeValue.h" -#import "MGLStyleAttributeFunction.h" -#import "NSColor+MGLStyleAttributeAdditions.h" -#import "NSNumber+MGLStyleAttributeAdditions.h" -#import "NSValue+MGLStyleAttributeAdditions.h" -#import "NSString+MGLStyleAttributeAdditions.h" -#import "NSArray+MGLStyleAttributeAdditions.h" +#import "MGLStyleValue.h" diff --git a/platform/macos/src/NSColor+MGLAdditions.h b/platform/macos/src/NSColor+MGLAdditions.h index 2ba38f7d905..8dd8c1c17c9 100644 --- a/platform/macos/src/NSColor+MGLAdditions.h +++ b/platform/macos/src/NSColor+MGLAdditions.h @@ -8,13 +8,13 @@ /** Converts the color into an mbgl::Color in calibrated RGB space. */ -- (mbgl::Color)mbgl_color; +- (mbgl::Color)mgl_color; /** Instantiates `NSColor` from an `mbgl::Color` */ -+ (NSColor *)mbgl_colorWithColor:(mbgl::Color)color; ++ (NSColor *)mgl_colorWithColor:(mbgl::Color)color; -- (mbgl::style::PropertyValue)mbgl_colorPropertyValue; +- (mbgl::style::PropertyValue)mgl_colorPropertyValue; @end diff --git a/platform/macos/src/NSColor+MGLAdditions.mm b/platform/macos/src/NSColor+MGLAdditions.mm index a75dc488fd9..e347fd17981 100644 --- a/platform/macos/src/NSColor+MGLAdditions.mm +++ b/platform/macos/src/NSColor+MGLAdditions.mm @@ -2,7 +2,7 @@ @implementation NSColor (MGLAdditions) -- (mbgl::Color)mbgl_color +- (mbgl::Color)mgl_color { CGFloat r, g, b, a; @@ -11,14 +11,14 @@ @implementation NSColor (MGLAdditions) return { (float)r, (float)g, (float)b, (float)a }; } -+ (NSColor *)mbgl_colorWithColor:(mbgl::Color)color ++ (NSColor *)mgl_colorWithColor:(mbgl::Color)color { return [NSColor colorWithRed:color.r green:color.g blue:color.b alpha:color.a]; } -- (mbgl::style::PropertyValue)mbgl_colorPropertyValue +- (mbgl::style::PropertyValue)mgl_colorPropertyValue { - mbgl::Color color = self.mbgl_color; + mbgl::Color color = self.mgl_color; return {{ color.r, color.g, color.b, color.a }}; }