summaryrefslogtreecommitdiff
path: root/platform/darwin
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin')
-rw-r--r--platform/darwin/scripts/generate-style-code.js141
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.h16
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.mm32
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.h34
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.mm72
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.h32
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.mm72
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.h63
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.mm134
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.h30
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.mm72
-rw-r--r--platform/darwin/src/MGLStyleAttribute.h25
-rw-r--r--platform/darwin/src/MGLStyleAttribute.mm112
-rw-r--r--platform/darwin/src/MGLStyleAttributeFunction.mm309
-rw-r--r--platform/darwin/src/MGLStyleAttributeValue.h5
-rw-r--r--platform/darwin/src/MGLStyleAttributeValue_Private.h24
-rw-r--r--platform/darwin/src/MGLStyleLayer.h.ejs6
-rw-r--r--platform/darwin/src/MGLStyleLayer.mm.ejs22
-rw-r--r--platform/darwin/src/MGLStyleLayer_Private.h18
-rw-r--r--platform/darwin/src/MGLStyleValue.h (renamed from platform/darwin/src/MGLStyleAttributeFunction.h)17
-rw-r--r--platform/darwin/src/MGLStyleValue.mm71
-rw-r--r--platform/darwin/src/MGLStyleValue_Private.h (renamed from platform/darwin/src/MGLStyleAttributeFunction_Private.h)90
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.h218
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.mm482
-rw-r--r--platform/darwin/src/NSArray+MGLStyleAttributeAdditions.h7
-rw-r--r--platform/darwin/src/NSArray+MGLStyleAttributeAdditions.mm36
-rw-r--r--platform/darwin/src/NSArray+MGLStyleAttributeAdditions_Private.h9
-rw-r--r--platform/darwin/src/NSColor+MGLStyleAttributeAdditions.h7
-rw-r--r--platform/darwin/src/NSColor+MGLStyleAttributeAdditions.m5
-rw-r--r--platform/darwin/src/NSColor+MGLStyleAttributeAdditions_Private.h9
-rw-r--r--platform/darwin/src/NSNumber+MGLStyleAttributeAdditions.h7
-rw-r--r--platform/darwin/src/NSNumber+MGLStyleAttributeAdditions.mm22
-rw-r--r--platform/darwin/src/NSNumber+MGLStyleAttributeAdditions_Private.h13
-rw-r--r--platform/darwin/src/NSString+MGLStyleAttributeAdditions.h7
-rw-r--r--platform/darwin/src/NSString+MGLStyleAttributeAdditions.mm17
-rw-r--r--platform/darwin/src/NSString+MGLStyleAttributeAdditions_Private.h11
-rw-r--r--platform/darwin/src/NSValue+MGLStyleAttributeAdditions.h10
-rw-r--r--platform/darwin/src/NSValue+MGLStyleAttributeAdditions.mm19
-rw-r--r--platform/darwin/src/NSValue+MGLStyleAttributeAdditions_Private.h15
-rw-r--r--platform/darwin/src/UIColor+MGLStyleAttributeAdditions_Private.h9
-rw-r--r--platform/darwin/test/MGLCircleStyleLayerTests.m6
-rw-r--r--platform/darwin/test/MGLFillStyleLayerTests.m3
-rw-r--r--platform/darwin/test/MGLLineStyleLayerTests.m9
-rw-r--r--platform/darwin/test/MGLRuntimeStylingHelper.h38
-rw-r--r--platform/darwin/test/MGLRuntimeStylingHelper.m120
-rw-r--r--platform/darwin/test/MGLSymbolStyleLayerTests.m30
46 files changed, 982 insertions, 1524 deletions
diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js
index 0c8b704e91..4bcfe54d32 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 <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>` : `id <MGLStyleAttributeValue>`;
-};
-
-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<NSNumber *> *';
+ case 'font':
+ return 'NSArray<NSString *> *';
+ 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<float>', objCType, 'float'];
+ case 'font':
+ return ['std::vector<std::string>', objCType, 'std::string'];
+ case 'padding':
+ return ['std::array<float, 4>', objCType];
+ case 'offset':
+ case 'translate':
+ return ['std::array<float, 2>', 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 1a4c64dedf..1c167fc91c 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 <MGLStyleAttributeValue> backgroundColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> backgroundColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> backgroundPattern;
+@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *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 <MGLStyleAttributeValue> backgroundOpacity;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *backgroundOpacity;
@end
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm
index 032aa196ee..33a105e5d5 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer.mm
+++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm
@@ -4,7 +4,7 @@
#import "MGLSource.h"
#import "NSPredicate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
-#import "MGLStyleAttributeValue.h"
+#import "MGLStyleValue_Private.h"
#import "MGLBackgroundStyleLayer.h"
#include <mbgl/style/layers/background_layer.hpp>
@@ -27,28 +27,34 @@
#pragma mark - Accessing the Paint Attributes
-- (void)setBackgroundColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)backgroundColor {
- self.layer->setBackgroundColor(backgroundColor.mbgl_colorPropertyValue);
+- (void)setBackgroundColor:(MGLStyleValue<MGLColor *> *)backgroundColor {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(backgroundColor);
+ self.layer->setBackgroundColor(mbglValue);
}
-- (id <MGLStyleAttributeValue>)backgroundColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getBackgroundColor() ?: self.layer->getDefaultBackgroundColor()];
+- (MGLStyleValue<MGLColor *> *)backgroundColor {
+ auto propertyValue = self.layer->getBackgroundColor() ?: self.layer->getDefaultBackgroundColor();
+ return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
-- (void)setBackgroundPattern:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)backgroundPattern {
- self.layer->setBackgroundPattern(backgroundPattern.mbgl_stringPropertyValue);
+- (void)setBackgroundPattern:(MGLStyleValue<NSString *> *)backgroundPattern {
+ auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(backgroundPattern);
+ self.layer->setBackgroundPattern(mbglValue);
}
-- (id <MGLStyleAttributeValue>)backgroundPattern {
- return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getBackgroundPattern() ?: self.layer->getDefaultBackgroundPattern()];
+- (MGLStyleValue<NSString *> *)backgroundPattern {
+ auto propertyValue = self.layer->getBackgroundPattern() ?: self.layer->getDefaultBackgroundPattern();
+ return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
-- (void)setBackgroundOpacity:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)backgroundOpacity {
- self.layer->setBackgroundOpacity(backgroundOpacity.mbgl_floatPropertyValue);
+- (void)setBackgroundOpacity:(MGLStyleValue<NSNumber *> *)backgroundOpacity {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(backgroundOpacity);
+ self.layer->setBackgroundOpacity(mbglValue);
}
-- (id <MGLStyleAttributeValue>)backgroundOpacity {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getBackgroundOpacity() ?: self.layer->getDefaultBackgroundOpacity()];
+- (MGLStyleValue<NSNumber *> *)backgroundOpacity {
+ auto propertyValue = self.layer->getBackgroundOpacity() ?: self.layer->getDefaultBackgroundOpacity();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
@end
diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h
index 9a45f7280c..6006250cdf 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 <MGLStyleAttributeValue> circleRadius;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> circleColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> circleColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> circleBlur;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> circleOpacity;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> circleTranslate;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> circleTranslateAnchor;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> circlePitchScale;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *circlePitchScale;
@end
diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm
index 31fa795d54..8fe97a0537 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 <mbgl/style/layers/circle_layer.hpp>
@@ -48,60 +48,74 @@
#pragma mark - Accessing the Paint Attributes
-- (void)setCircleRadius:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)circleRadius {
- self.layer->setCircleRadius(circleRadius.mbgl_floatPropertyValue);
+- (void)setCircleRadius:(MGLStyleValue<NSNumber *> *)circleRadius {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(circleRadius);
+ self.layer->setCircleRadius(mbglValue);
}
-- (id <MGLStyleAttributeValue>)circleRadius {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getCircleRadius() ?: self.layer->getDefaultCircleRadius()];
+- (MGLStyleValue<NSNumber *> *)circleRadius {
+ auto propertyValue = self.layer->getCircleRadius() ?: self.layer->getDefaultCircleRadius();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setCircleColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)circleColor {
- self.layer->setCircleColor(circleColor.mbgl_colorPropertyValue);
+- (void)setCircleColor:(MGLStyleValue<MGLColor *> *)circleColor {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(circleColor);
+ self.layer->setCircleColor(mbglValue);
}
-- (id <MGLStyleAttributeValue>)circleColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getCircleColor() ?: self.layer->getDefaultCircleColor()];
+- (MGLStyleValue<MGLColor *> *)circleColor {
+ auto propertyValue = self.layer->getCircleColor() ?: self.layer->getDefaultCircleColor();
+ return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
-- (void)setCircleBlur:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)circleBlur {
- self.layer->setCircleBlur(circleBlur.mbgl_floatPropertyValue);
+- (void)setCircleBlur:(MGLStyleValue<NSNumber *> *)circleBlur {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(circleBlur);
+ self.layer->setCircleBlur(mbglValue);
}
-- (id <MGLStyleAttributeValue>)circleBlur {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getCircleBlur() ?: self.layer->getDefaultCircleBlur()];
+- (MGLStyleValue<NSNumber *> *)circleBlur {
+ auto propertyValue = self.layer->getCircleBlur() ?: self.layer->getDefaultCircleBlur();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setCircleOpacity:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)circleOpacity {
- self.layer->setCircleOpacity(circleOpacity.mbgl_floatPropertyValue);
+- (void)setCircleOpacity:(MGLStyleValue<NSNumber *> *)circleOpacity {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(circleOpacity);
+ self.layer->setCircleOpacity(mbglValue);
}
-- (id <MGLStyleAttributeValue>)circleOpacity {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getCircleOpacity() ?: self.layer->getDefaultCircleOpacity()];
+- (MGLStyleValue<NSNumber *> *)circleOpacity {
+ auto propertyValue = self.layer->getCircleOpacity() ?: self.layer->getDefaultCircleOpacity();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setCircleTranslate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)circleTranslate {
- self.layer->setCircleTranslate(circleTranslate.mbgl_offsetPropertyValue);
+- (void)setCircleTranslate:(MGLStyleValue<NSValue *> *)circleTranslate {
+ auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(circleTranslate);
+ self.layer->setCircleTranslate(mbglValue);
}
-- (id <MGLStyleAttributeValue>)circleTranslate {
- return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getCircleTranslate() ?: self.layer->getDefaultCircleTranslate()];
+- (MGLStyleValue<NSValue *> *)circleTranslate {
+ auto propertyValue = self.layer->getCircleTranslate() ?: self.layer->getDefaultCircleTranslate();
+ return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setCircleTranslateAnchor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)circleTranslateAnchor {
- MGLSetEnumProperty(circleTranslateAnchor, CircleTranslateAnchor, TranslateAnchorType, MGLCircleTranslateAnchor);
+- (void)setCircleTranslateAnchor:(MGLStyleValue<NSValue *> *)circleTranslateAnchor {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toPropertyValue(circleTranslateAnchor);
+ self.layer->setCircleTranslateAnchor(mbglValue);
}
-- (id <MGLStyleAttributeValue>)circleTranslateAnchor {
- MGLGetEnumProperty(CircleTranslateAnchor, TranslateAnchorType, MGLCircleTranslateAnchor);
+- (MGLStyleValue<NSValue *> *)circleTranslateAnchor {
+ auto propertyValue = self.layer->getCircleTranslateAnchor() ?: self.layer->getDefaultCircleTranslateAnchor();
+ return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setCirclePitchScale:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)circlePitchScale {
- MGLSetEnumProperty(circlePitchScale, CirclePitchScale, CirclePitchScaleType, MGLCirclePitchScale);
+- (void)setCirclePitchScale:(MGLStyleValue<NSValue *> *)circlePitchScale {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::CirclePitchScaleType, NSValue *>().toPropertyValue(circlePitchScale);
+ self.layer->setCirclePitchScale(mbglValue);
}
-- (id <MGLStyleAttributeValue>)circlePitchScale {
- MGLGetEnumProperty(CirclePitchScale, CirclePitchScaleType, MGLCirclePitchScale);
+- (MGLStyleValue<NSValue *> *)circlePitchScale {
+ auto propertyValue = self.layer->getCirclePitchScale() ?: self.layer->getDefaultCirclePitchScale();
+ return MGLStyleValueTransformer<mbgl::style::CirclePitchScaleType, NSValue *>().toStyleValue(propertyValue);
}
@end
diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h
index d9ce1abace..712bfea998 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 <MGLStyleAttributeValue> fillAntialias;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> fillOpacity;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> fillColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> fillColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> fillOutlineColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> fillTranslate;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> fillTranslateAnchor;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> fillPattern;
+@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *fillPattern;
@end
diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm
index a2320f4fda..e16e3b2652 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 <mbgl/style/layers/fill_layer.hpp>
@@ -48,60 +48,74 @@
#pragma mark - Accessing the Paint Attributes
-- (void)setFillAntialias:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillAntialias {
- self.layer->setFillAntialias(fillAntialias.mbgl_boolPropertyValue);
+- (void)setFillAntialias:(MGLStyleValue<NSNumber *> *)fillAntialias {
+ auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(fillAntialias);
+ self.layer->setFillAntialias(mbglValue);
}
-- (id <MGLStyleAttributeValue>)fillAntialias {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getFillAntialias() ?: self.layer->getDefaultFillAntialias()];
+- (MGLStyleValue<NSNumber *> *)fillAntialias {
+ auto propertyValue = self.layer->getFillAntialias() ?: self.layer->getDefaultFillAntialias();
+ return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setFillOpacity:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillOpacity {
- self.layer->setFillOpacity(fillOpacity.mbgl_floatPropertyValue);
+- (void)setFillOpacity:(MGLStyleValue<NSNumber *> *)fillOpacity {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(fillOpacity);
+ self.layer->setFillOpacity(mbglValue);
}
-- (id <MGLStyleAttributeValue>)fillOpacity {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getFillOpacity() ?: self.layer->getDefaultFillOpacity()];
+- (MGLStyleValue<NSNumber *> *)fillOpacity {
+ auto propertyValue = self.layer->getFillOpacity() ?: self.layer->getDefaultFillOpacity();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setFillColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillColor {
- self.layer->setFillColor(fillColor.mbgl_colorPropertyValue);
+- (void)setFillColor:(MGLStyleValue<MGLColor *> *)fillColor {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(fillColor);
+ self.layer->setFillColor(mbglValue);
}
-- (id <MGLStyleAttributeValue>)fillColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getFillColor() ?: self.layer->getDefaultFillColor()];
+- (MGLStyleValue<MGLColor *> *)fillColor {
+ auto propertyValue = self.layer->getFillColor() ?: self.layer->getDefaultFillColor();
+ return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
-- (void)setFillOutlineColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillOutlineColor {
- self.layer->setFillOutlineColor(fillOutlineColor.mbgl_colorPropertyValue);
+- (void)setFillOutlineColor:(MGLStyleValue<MGLColor *> *)fillOutlineColor {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(fillOutlineColor);
+ self.layer->setFillOutlineColor(mbglValue);
}
-- (id <MGLStyleAttributeValue>)fillOutlineColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getFillOutlineColor() ?: self.layer->getDefaultFillOutlineColor()];
+- (MGLStyleValue<MGLColor *> *)fillOutlineColor {
+ auto propertyValue = self.layer->getFillOutlineColor() ?: self.layer->getDefaultFillOutlineColor();
+ return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
-- (void)setFillTranslate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillTranslate {
- self.layer->setFillTranslate(fillTranslate.mbgl_offsetPropertyValue);
+- (void)setFillTranslate:(MGLStyleValue<NSValue *> *)fillTranslate {
+ auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(fillTranslate);
+ self.layer->setFillTranslate(mbglValue);
}
-- (id <MGLStyleAttributeValue>)fillTranslate {
- return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getFillTranslate() ?: self.layer->getDefaultFillTranslate()];
+- (MGLStyleValue<NSValue *> *)fillTranslate {
+ auto propertyValue = self.layer->getFillTranslate() ?: self.layer->getDefaultFillTranslate();
+ return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setFillTranslateAnchor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillTranslateAnchor {
- MGLSetEnumProperty(fillTranslateAnchor, FillTranslateAnchor, TranslateAnchorType, MGLFillTranslateAnchor);
+- (void)setFillTranslateAnchor:(MGLStyleValue<NSValue *> *)fillTranslateAnchor {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toPropertyValue(fillTranslateAnchor);
+ self.layer->setFillTranslateAnchor(mbglValue);
}
-- (id <MGLStyleAttributeValue>)fillTranslateAnchor {
- MGLGetEnumProperty(FillTranslateAnchor, TranslateAnchorType, MGLFillTranslateAnchor);
+- (MGLStyleValue<NSValue *> *)fillTranslateAnchor {
+ auto propertyValue = self.layer->getFillTranslateAnchor() ?: self.layer->getDefaultFillTranslateAnchor();
+ return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setFillPattern:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillPattern {
- self.layer->setFillPattern(fillPattern.mbgl_stringPropertyValue);
+- (void)setFillPattern:(MGLStyleValue<NSString *> *)fillPattern {
+ auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(fillPattern);
+ self.layer->setFillPattern(mbglValue);
}
-- (id <MGLStyleAttributeValue>)fillPattern {
- return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getFillPattern() ?: self.layer->getDefaultFillPattern()];
+- (MGLStyleValue<NSString *> *)fillPattern {
+ auto propertyValue = self.layer->getFillPattern() ?: self.layer->getDefaultFillPattern();
+ return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
@end
diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h
index cee33e1388..663e927718 100644
--- a/platform/darwin/src/MGLLineStyleLayer.h
+++ b/platform/darwin/src/MGLLineStyleLayer.h
@@ -1,9 +1,8 @@
// 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"
-#import "MGLStyleAttributeFunction.h"
NS_ASSUME_NONNULL_BEGIN
@@ -76,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 <MGLStyleAttributeValue> lineCap;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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) MGLStyleValue <NSValue *> *lineJoin;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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) MGLStyleValue <NSNumber *> *lineMiterLimit;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> lineRoundLimit;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> lineOpacity;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> lineColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> lineColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *lineColor;
#endif
/**
@@ -139,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 <MGLStyleAttributeValue> lineTranslate;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> lineTranslateAnchor;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> lineWidth;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> lineGapWidth;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> lineOffset;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> lineBlur;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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.
@@ -195,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 <MGLStyleAttributeValue> lineDasharray;
+@property (nonatomic, null_resettable) MGLStyleValue<NSArray<NSNumber *> *> *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 <MGLStyleAttributeValue> linePattern;
+@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *linePattern;
@end
diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm
index 2d202290da..57724a0600 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 <mbgl/style/layers/line_layer.hpp>
@@ -48,122 +48,146 @@
#pragma mark - Accessing the Layout Attributes
-- (void)setLineCap:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineCap {
- MGLSetEnumProperty(lineCap, LineCap, LineCapType, MGLLineCap);
+- (void)setLineCap:(MGLStyleValue<NSValue *> *)lineCap {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::LineCapType, NSValue *>().toPropertyValue(lineCap);
+ self.layer->setLineCap(mbglValue);
}
-- (id <MGLStyleAttributeValue>)lineCap {
- MGLGetEnumProperty(LineCap, LineCapType, MGLLineCap);
+- (MGLStyleValue<NSValue *> *)lineCap {
+ auto propertyValue = self.layer->getLineCap() ?: self.layer->getDefaultLineCap();
+ return MGLStyleValueTransformer<mbgl::style::LineCapType, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setLineJoin:(MGLStyleValue <NSValue *> *)lineJoin {
- auto propertyValue = MGLStyleValueTransformer<mbgl::style::LineJoinType, NSValue *>().toPropertyValue(lineJoin);
- self.layer->setLineJoin(propertyValue);
+- (void)setLineJoin:(MGLStyleValue<NSValue *> *)lineJoin {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::LineJoinType, NSValue *>().toPropertyValue(lineJoin);
+ self.layer->setLineJoin(mbglValue);
}
-- (MGLStyleValue <NSValue *> *)lineJoin {
+- (MGLStyleValue<NSValue *> *)lineJoin {
auto propertyValue = self.layer->getLineJoin() ?: self.layer->getDefaultLineJoin();
return MGLStyleValueTransformer<mbgl::style::LineJoinType, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setLineMiterLimit:(MGLStyleValue <NSNumber *> *)lineMiterLimit {
+- (void)setLineMiterLimit:(MGLStyleValue<NSNumber *> *)lineMiterLimit {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(lineMiterLimit);
self.layer->setLineMiterLimit(mbglValue);
}
-- (MGLStyleValue <NSNumber *> *)lineMiterLimit {
+- (MGLStyleValue<NSNumber *> *)lineMiterLimit {
auto propertyValue = self.layer->getLineMiterLimit() ?: self.layer->getDefaultLineMiterLimit();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setLineRoundLimit:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineRoundLimit {
- self.layer->setLineRoundLimit(lineRoundLimit.mbgl_floatPropertyValue);
+- (void)setLineRoundLimit:(MGLStyleValue<NSNumber *> *)lineRoundLimit {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(lineRoundLimit);
+ self.layer->setLineRoundLimit(mbglValue);
}
-- (id <MGLStyleAttributeValue>)lineRoundLimit {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineRoundLimit() ?: self.layer->getDefaultLineRoundLimit()];
+- (MGLStyleValue<NSNumber *> *)lineRoundLimit {
+ auto propertyValue = self.layer->getLineRoundLimit() ?: self.layer->getDefaultLineRoundLimit();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
#pragma mark - Accessing the Paint Attributes
-- (void)setLineOpacity:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineOpacity {
- self.layer->setLineOpacity(lineOpacity.mbgl_floatPropertyValue);
+- (void)setLineOpacity:(MGLStyleValue<NSNumber *> *)lineOpacity {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(lineOpacity);
+ self.layer->setLineOpacity(mbglValue);
}
-- (id <MGLStyleAttributeValue>)lineOpacity {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineOpacity() ?: self.layer->getDefaultLineOpacity()];
+- (MGLStyleValue<NSNumber *> *)lineOpacity {
+ auto propertyValue = self.layer->getLineOpacity() ?: self.layer->getDefaultLineOpacity();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setLineColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineColor {
- self.layer->setLineColor(lineColor.mbgl_colorPropertyValue);
+- (void)setLineColor:(MGLStyleValue<MGLColor *> *)lineColor {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(lineColor);
+ self.layer->setLineColor(mbglValue);
}
-- (id <MGLStyleAttributeValue>)lineColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getLineColor() ?: self.layer->getDefaultLineColor()];
+- (MGLStyleValue<MGLColor *> *)lineColor {
+ auto propertyValue = self.layer->getLineColor() ?: self.layer->getDefaultLineColor();
+ return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
-- (void)setLineTranslate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineTranslate {
- self.layer->setLineTranslate(lineTranslate.mbgl_offsetPropertyValue);
+- (void)setLineTranslate:(MGLStyleValue<NSValue *> *)lineTranslate {
+ auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(lineTranslate);
+ self.layer->setLineTranslate(mbglValue);
}
-- (id <MGLStyleAttributeValue>)lineTranslate {
- return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getLineTranslate() ?: self.layer->getDefaultLineTranslate()];
+- (MGLStyleValue<NSValue *> *)lineTranslate {
+ auto propertyValue = self.layer->getLineTranslate() ?: self.layer->getDefaultLineTranslate();
+ return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setLineTranslateAnchor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineTranslateAnchor {
- MGLSetEnumProperty(lineTranslateAnchor, LineTranslateAnchor, TranslateAnchorType, MGLLineTranslateAnchor);
+- (void)setLineTranslateAnchor:(MGLStyleValue<NSValue *> *)lineTranslateAnchor {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toPropertyValue(lineTranslateAnchor);
+ self.layer->setLineTranslateAnchor(mbglValue);
}
-- (id <MGLStyleAttributeValue>)lineTranslateAnchor {
- MGLGetEnumProperty(LineTranslateAnchor, TranslateAnchorType, MGLLineTranslateAnchor);
+- (MGLStyleValue<NSValue *> *)lineTranslateAnchor {
+ auto propertyValue = self.layer->getLineTranslateAnchor() ?: self.layer->getDefaultLineTranslateAnchor();
+ return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setLineWidth:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineWidth {
- self.layer->setLineWidth(lineWidth.mbgl_floatPropertyValue);
+- (void)setLineWidth:(MGLStyleValue<NSNumber *> *)lineWidth {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(lineWidth);
+ self.layer->setLineWidth(mbglValue);
}
-- (id <MGLStyleAttributeValue>)lineWidth {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineWidth() ?: self.layer->getDefaultLineWidth()];
+- (MGLStyleValue<NSNumber *> *)lineWidth {
+ auto propertyValue = self.layer->getLineWidth() ?: self.layer->getDefaultLineWidth();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setLineGapWidth:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineGapWidth {
- self.layer->setLineGapWidth(lineGapWidth.mbgl_floatPropertyValue);
+- (void)setLineGapWidth:(MGLStyleValue<NSNumber *> *)lineGapWidth {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(lineGapWidth);
+ self.layer->setLineGapWidth(mbglValue);
}
-- (id <MGLStyleAttributeValue>)lineGapWidth {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineGapWidth() ?: self.layer->getDefaultLineGapWidth()];
+- (MGLStyleValue<NSNumber *> *)lineGapWidth {
+ auto propertyValue = self.layer->getLineGapWidth() ?: self.layer->getDefaultLineGapWidth();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setLineOffset:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineOffset {
- self.layer->setLineOffset(lineOffset.mbgl_floatPropertyValue);
+- (void)setLineOffset:(MGLStyleValue<NSNumber *> *)lineOffset {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(lineOffset);
+ self.layer->setLineOffset(mbglValue);
}
-- (id <MGLStyleAttributeValue>)lineOffset {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineOffset() ?: self.layer->getDefaultLineOffset()];
+- (MGLStyleValue<NSNumber *> *)lineOffset {
+ auto propertyValue = self.layer->getLineOffset() ?: self.layer->getDefaultLineOffset();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setLineBlur:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineBlur {
- self.layer->setLineBlur(lineBlur.mbgl_floatPropertyValue);
+- (void)setLineBlur:(MGLStyleValue<NSNumber *> *)lineBlur {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(lineBlur);
+ self.layer->setLineBlur(mbglValue);
}
-- (id <MGLStyleAttributeValue>)lineBlur {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineBlur() ?: self.layer->getDefaultLineBlur()];
+- (MGLStyleValue<NSNumber *> *)lineBlur {
+ auto propertyValue = self.layer->getLineBlur() ?: self.layer->getDefaultLineBlur();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setLineDasharray:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineDasharray {
- self.layer->setLineDasharray(lineDasharray.mbgl_numberArrayPropertyValue);
+- (void)setLineDasharray:(MGLStyleValue<NSArray<NSNumber *> *> *)lineDasharray {
+ auto mbglValue = MGLStyleValueTransformer<std::vector<float>, NSArray<NSNumber *> *, float>().toPropertyValue(lineDasharray);
+ self.layer->setLineDasharray(mbglValue);
}
-- (id <MGLStyleAttributeValue>)lineDasharray {
- return [MGLStyleAttribute mbgl_numberArrayWithPropertyValueNumberArray:self.layer->getLineDasharray() ?: self.layer->getDefaultLineDasharray()];
+- (MGLStyleValue<NSArray<NSNumber *> *> *)lineDasharray {
+ auto propertyValue = self.layer->getLineDasharray() ?: self.layer->getDefaultLineDasharray();
+ return MGLStyleValueTransformer<std::vector<float>, NSArray<NSNumber *> *, float>().toStyleValue(propertyValue);
}
-- (void)setLinePattern:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)linePattern {
- self.layer->setLinePattern(linePattern.mbgl_stringPropertyValue);
+- (void)setLinePattern:(MGLStyleValue<NSString *> *)linePattern {
+ auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(linePattern);
+ self.layer->setLinePattern(mbglValue);
}
-- (id <MGLStyleAttributeValue>)linePattern {
- return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getLinePattern() ?: self.layer->getDefaultLinePattern()];
+- (MGLStyleValue<NSString *> *)linePattern {
+ auto propertyValue = self.layer->getLinePattern() ?: self.layer->getDefaultLinePattern();
+ return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
@end
diff --git a/platform/darwin/src/MGLRasterStyleLayer.h b/platform/darwin/src/MGLRasterStyleLayer.h
index 90af43c7a1..afae85001e 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 <MGLStyleAttributeValue> rasterOpacity;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> rasterHueRotate;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> rasterBrightnessMin;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> rasterBrightnessMax;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> rasterSaturation;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> rasterContrast;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> rasterFadeDuration;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterFadeDuration;
@end
diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm
index 01d3bf2bca..f616e89518 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 <mbgl/style/layers/raster_layer.hpp>
@@ -27,60 +27,74 @@
#pragma mark - Accessing the Paint Attributes
-- (void)setRasterOpacity:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)rasterOpacity {
- self.layer->setRasterOpacity(rasterOpacity.mbgl_floatPropertyValue);
+- (void)setRasterOpacity:(MGLStyleValue<NSNumber *> *)rasterOpacity {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(rasterOpacity);
+ self.layer->setRasterOpacity(mbglValue);
}
-- (id <MGLStyleAttributeValue>)rasterOpacity {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterOpacity() ?: self.layer->getDefaultRasterOpacity()];
+- (MGLStyleValue<NSNumber *> *)rasterOpacity {
+ auto propertyValue = self.layer->getRasterOpacity() ?: self.layer->getDefaultRasterOpacity();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setRasterHueRotate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)rasterHueRotate {
- self.layer->setRasterHueRotate(rasterHueRotate.mbgl_floatPropertyValue);
+- (void)setRasterHueRotate:(MGLStyleValue<NSNumber *> *)rasterHueRotate {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(rasterHueRotate);
+ self.layer->setRasterHueRotate(mbglValue);
}
-- (id <MGLStyleAttributeValue>)rasterHueRotate {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterHueRotate() ?: self.layer->getDefaultRasterHueRotate()];
+- (MGLStyleValue<NSNumber *> *)rasterHueRotate {
+ auto propertyValue = self.layer->getRasterHueRotate() ?: self.layer->getDefaultRasterHueRotate();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setRasterBrightnessMin:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)rasterBrightnessMin {
- self.layer->setRasterBrightnessMin(rasterBrightnessMin.mbgl_floatPropertyValue);
+- (void)setRasterBrightnessMin:(MGLStyleValue<NSNumber *> *)rasterBrightnessMin {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(rasterBrightnessMin);
+ self.layer->setRasterBrightnessMin(mbglValue);
}
-- (id <MGLStyleAttributeValue>)rasterBrightnessMin {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterBrightnessMin() ?: self.layer->getDefaultRasterBrightnessMin()];
+- (MGLStyleValue<NSNumber *> *)rasterBrightnessMin {
+ auto propertyValue = self.layer->getRasterBrightnessMin() ?: self.layer->getDefaultRasterBrightnessMin();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setRasterBrightnessMax:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)rasterBrightnessMax {
- self.layer->setRasterBrightnessMax(rasterBrightnessMax.mbgl_floatPropertyValue);
+- (void)setRasterBrightnessMax:(MGLStyleValue<NSNumber *> *)rasterBrightnessMax {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(rasterBrightnessMax);
+ self.layer->setRasterBrightnessMax(mbglValue);
}
-- (id <MGLStyleAttributeValue>)rasterBrightnessMax {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterBrightnessMax() ?: self.layer->getDefaultRasterBrightnessMax()];
+- (MGLStyleValue<NSNumber *> *)rasterBrightnessMax {
+ auto propertyValue = self.layer->getRasterBrightnessMax() ?: self.layer->getDefaultRasterBrightnessMax();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setRasterSaturation:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)rasterSaturation {
- self.layer->setRasterSaturation(rasterSaturation.mbgl_floatPropertyValue);
+- (void)setRasterSaturation:(MGLStyleValue<NSNumber *> *)rasterSaturation {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(rasterSaturation);
+ self.layer->setRasterSaturation(mbglValue);
}
-- (id <MGLStyleAttributeValue>)rasterSaturation {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterSaturation() ?: self.layer->getDefaultRasterSaturation()];
+- (MGLStyleValue<NSNumber *> *)rasterSaturation {
+ auto propertyValue = self.layer->getRasterSaturation() ?: self.layer->getDefaultRasterSaturation();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setRasterContrast:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)rasterContrast {
- self.layer->setRasterContrast(rasterContrast.mbgl_floatPropertyValue);
+- (void)setRasterContrast:(MGLStyleValue<NSNumber *> *)rasterContrast {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(rasterContrast);
+ self.layer->setRasterContrast(mbglValue);
}
-- (id <MGLStyleAttributeValue>)rasterContrast {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterContrast() ?: self.layer->getDefaultRasterContrast()];
+- (MGLStyleValue<NSNumber *> *)rasterContrast {
+ auto propertyValue = self.layer->getRasterContrast() ?: self.layer->getDefaultRasterContrast();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setRasterFadeDuration:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)rasterFadeDuration {
- self.layer->setRasterFadeDuration(rasterFadeDuration.mbgl_floatPropertyValue);
+- (void)setRasterFadeDuration:(MGLStyleValue<NSNumber *> *)rasterFadeDuration {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(rasterFadeDuration);
+ self.layer->setRasterFadeDuration(mbglValue);
}
-- (id <MGLStyleAttributeValue>)rasterFadeDuration {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterFadeDuration() ?: self.layer->getDefaultRasterFadeDuration()];
+- (MGLStyleValue<NSNumber *> *)rasterFadeDuration {
+ auto propertyValue = self.layer->getRasterFadeDuration() ?: self.layer->getDefaultRasterFadeDuration();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
@end
diff --git a/platform/darwin/src/MGLStyleAttribute.h b/platform/darwin/src/MGLStyleAttribute.h
deleted file mode 100644
index 564f44ad00..0000000000
--- a/platform/darwin/src/MGLStyleAttribute.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#import <Foundation/Foundation.h>
-
-#import "MGLStyleAttributeValue.h"
-#import "MGLStyleLayer_Private.h"
-#import "MGLStyleAttributeValue_Private.h"
-
-@interface MGLStyleAttribute : NSObject <MGLStyleAttributeValue>
-
-+ (id <MGLStyleAttributeValue>)mbgl_colorWithPropertyValueColor:(mbgl::style::PropertyValue<mbgl::Color>)property;
-
-+ (id <MGLStyleAttributeValue>)mbgl_numberWithPropertyValueNumber:(mbgl::style::PropertyValue<float>)property;
-
-+ (id <MGLStyleAttributeValue>)mbgl_boolWithPropertyValueBool:(mbgl::style::PropertyValue<bool>)property;
-
-+ (id <MGLStyleAttributeValue>)mbgl_stringWithPropertyValueString:(mbgl::style::PropertyValue<std::string>)property;
-
-+ (id <MGLStyleAttributeValue>)mbgl_offsetWithPropertyValueOffset:(mbgl::style::PropertyValue<std::array<float, 2>>)property;
-
-+ (id <MGLStyleAttributeValue>)mbgl_paddingWithPropertyValuePadding:(mbgl::style::PropertyValue<std::array<float, 4>>)property;
-
-+ (id <MGLStyleAttributeValue>)mbgl_stringArrayWithPropertyValueStringArray:(mbgl::style::PropertyValue<std::vector<std::string>>)property;
-
-+ (id <MGLStyleAttributeValue>)mbgl_numberArrayWithPropertyValueNumberArray:(mbgl::style::PropertyValue<std::vector<float>>)property;
-
-@end
diff --git a/platform/darwin/src/MGLStyleAttribute.mm b/platform/darwin/src/MGLStyleAttribute.mm
deleted file mode 100644
index 9e3c22914b..0000000000
--- 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<MGLStyleAttributeValue>)mbgl_colorWithPropertyValueColor:(mbgl::style::PropertyValue<mbgl::Color>)property
-{
- if (property.isConstant()) {
- return [MGLColor mbgl_colorWithColor:property.asConstant()];
- } else if (property.isFunction()) {
- return [MGLStyleAttributeFunction functionWithColorPropertyValue:property.asFunction()];
- } else {
- return nil;
- }
-}
-
-+ (id <MGLStyleAttributeValue>)mbgl_numberWithPropertyValueNumber:(mbgl::style::PropertyValue<float>)property
-{
- if (property.isConstant()) {
- return @(property.asConstant());
- } else if (property.isFunction()) {
- return [MGLStyleAttributeFunction functionWithNumberPropertyValue:property.asFunction()];
- } else {
- return nil;
- }
-}
-
-+ (id<MGLStyleAttributeValue>)mbgl_boolWithPropertyValueBool:(mbgl::style::PropertyValue<bool>)property
-{
- if (property.isConstant()) {
- return @(property.asConstant());
- } else if (property.isFunction()) {
- return [MGLStyleAttributeFunction functionWithBoolPropertyValue:property.asFunction()];
- } else {
- return nil;
- }
-}
-
-+ (id<MGLStyleAttributeValue>)mbgl_stringWithPropertyValueString:(mbgl::style::PropertyValue<std::string>)property
-{
- if (property.isConstant()) {
- return @(property.asConstant().c_str());
- } else if (property.isFunction()) {
- return [MGLStyleAttributeFunction functionWithStringPropertyValue:property.asFunction()];
- } else {
- return nil;
- }
-}
-
-+ (id<MGLStyleAttributeValue>)mbgl_offsetWithPropertyValueOffset:(mbgl::style::PropertyValue<std::array<float, 2> >)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<MGLStyleAttributeValue>)mbgl_paddingWithPropertyValuePadding:(mbgl::style::PropertyValue<std::array<float, 4> >)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<MGLStyleAttributeValue>)mbgl_stringArrayWithPropertyValueStringArray:(mbgl::style::PropertyValue<std::vector<std::string> >)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<MGLStyleAttributeValue>)mbgl_numberArrayWithPropertyValueNumberArray:(mbgl::style::PropertyValue<std::vector<float> >)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.mm b/platform/darwin/src/MGLStyleAttributeFunction.mm
deleted file mode 100644
index 337e299127..0000000000
--- a/platform/darwin/src/MGLStyleAttributeFunction.mm
+++ /dev/null
@@ -1,309 +0,0 @@
-#import "MGLStyleAttributeFunction.h"
-
-#import "MGLStyleLayer_Private.h"
-#import "MGLStyleAttributeValue_Private.h"
-#import "MGLStyleAttributeFunction_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;
-}
-
-@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 {
- if (self = [super init]) {
- _base = 1;
- }
- return self;
-}
-
-- (instancetype)initWithBase:(CGFloat)base stops:(NSDictionary *)stops {
- if (self = [self init]) {
- _base = base;
- _stops = stops;
- }
- return self;
-}
-
-@end
-
-
-
-
-
-@interface MGLStyleAttributeFunction() <MGLStyleAttributeValue_Private>
-@end
-
-@implementation MGLStyleAttributeFunction
-
-- (instancetype)init
-{
- if (self = [super init]) {
- _base = @1;
- }
- return self;
-}
-
-- (BOOL)isFunction
-{
- return YES;
-}
-
-- (mbgl::style::PropertyValue<mbgl::Color>)mbgl_colorPropertyValue
-{
- __block std::vector<std::pair<float, mbgl::Color>> 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<mbgl::Color>({{stops}}, _base.floatValue);
-}
-
-- (mbgl::style::PropertyValue<float>)mbgl_floatPropertyValue
-{
- __block std::vector<std::pair<float, float>> 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<float>({{stops}}, _base.floatValue);
-}
-
-- (mbgl::style::PropertyValue<bool>)mbgl_boolPropertyValue
-{
- __block std::vector<std::pair<float, bool>> 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<bool>({{stops}}, _base.floatValue);
-}
-
-- (mbgl::style::PropertyValue<std::string>)mbgl_stringPropertyValue
-{
- __block std::vector<std::pair<float, std::string>> 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<std::string>({{stops}}, _base.floatValue);
-}
-
-- (mbgl::style::PropertyValue<std::vector<std::string> >)mbgl_stringArrayPropertyValue
-{
- __block std::vector<std::pair<float, std::vector<std::string>>> stops;
- [self.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, NSArray * _Nonnull strings, BOOL * _Nonnull stop) {
- NSAssert([strings isKindOfClass:[NSArray class]], @"Stops should be NSArray");
- std::vector<std::string>convertedStrings;
- for (NSString *string in strings) {
- convertedStrings.emplace_back(string.UTF8String);
- }
- stops.emplace_back(zoomKey.floatValue, convertedStrings);
- }];
- return mbgl::style::Function<std::vector<std::string>>({{stops}}, _base.floatValue);
-}
-
-- (mbgl::style::PropertyValue<std::vector<float> >)mbgl_numberArrayPropertyValue
-{
- __block std::vector<std::pair<float, std::vector<float>>> stops;
- [self.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, NSArray * _Nonnull numbers, BOOL * _Nonnull stop) {
- NSAssert([numbers isKindOfClass:[NSArray class]], @"Stops should be NSArray");
- std::vector<float>convertedNumbers;
- for (NSNumber *number in numbers) {
- convertedNumbers.emplace_back(number.floatValue);
- }
- stops.emplace_back(zoomKey.floatValue, convertedNumbers);
- }];
- return mbgl::style::Function<std::vector<float>>({{stops}}, _base.floatValue);
-}
-
-- (mbgl::style::PropertyValue<std::array<float, 4> >)mbgl_paddingPropertyValue
-{
- __block std::vector<std::pair<float, std::array<float, 4>>> 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<std::array<float, 4>>({{stops}}, _base.floatValue);
-}
-
-- (mbgl::style::PropertyValue<std::array<float, 2> >)mbgl_offsetPropertyValue
-{
- __block std::vector<std::pair<float, std::array<float, 2>>> 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<std::array<float, 2>>({{stops}}, _base.floatValue);
-}
-
-+ (instancetype)functionWithColorPropertyValue:(mbgl::style::Function<mbgl::Color>)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<float>)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<bool>)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<std::string>)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<std::array<float, 2> >)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<std::array<float, 4> >)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<std::vector<std::string> >)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<std::vector<float> >)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/MGLStyleAttributeValue.h b/platform/darwin/src/MGLStyleAttributeValue.h
deleted file mode 100644
index 00829b0dca..0000000000
--- a/platform/darwin/src/MGLStyleAttributeValue.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#import <Foundation/Foundation.h>
-
-@protocol MGLStyleAttributeValue <NSObject>
-@optional
-@end
diff --git a/platform/darwin/src/MGLStyleAttributeValue_Private.h b/platform/darwin/src/MGLStyleAttributeValue_Private.h
deleted file mode 100644
index 4b8fd1cc01..0000000000
--- a/platform/darwin/src/MGLStyleAttributeValue_Private.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#import <Foundation/Foundation.h>
-
-#import "MGLStyleAttributeFunction_Private.h"
-
-#include <array>
-
-@protocol MGLStyleAttributeValue_Private <NSObject>
-- (BOOL)isFunction;
-@optional
-
-// Convert darwin types to mbgl types
-- (mbgl::style::PropertyValue<mbgl::Color>)mbgl_colorPropertyValue;
-- (mbgl::style::PropertyValue<float>)mbgl_floatPropertyValue;
-- (mbgl::style::PropertyValue<bool>)mbgl_boolPropertyValue;
-- (mbgl::style::PropertyValue<std::string>)mbgl_stringPropertyValue;
-- (mbgl::style::PropertyValue<std::array<float, 2>>)mbgl_offsetPropertyValue;
-- (mbgl::style::PropertyValue<std::array<float, 4>>)mbgl_paddingPropertyValue;
-- (mbgl::style::PropertyValue<std::vector<std::string> >)mbgl_stringArrayPropertyValue;
-- (mbgl::style::PropertyValue<std::vector<float> >)mbgl_numberArrayPropertyValue;
-
-// Convert mbgl types to darwin types
-- (id <MGLStyleAttributeValue>)mbgl_colorPropertyValueWith:(mbgl::style::PropertyValue<mbgl::Color>)color;
-
-@end
diff --git a/platform/darwin/src/MGLStyleLayer.h.ejs b/platform/darwin/src/MGLStyleLayer.h.ejs
index eb799f13be..b97d070b90 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 8d3bba9958..3678e9ec52 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 <mbgl/style/layers/<%- type %>_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 a499775a52..5fa01856ea 100644
--- a/platform/darwin/src/MGLStyleLayer_Private.h
+++ b/platform/darwin/src/MGLStyleLayer_Private.h
@@ -1,23 +1,9 @@
#import <Foundation/Foundation.h>
-#include <mbgl/style/layer.hpp>
#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 <mbgl/style/layer.hpp>
@interface MGLStyleLayer (Private)
diff --git a/platform/darwin/src/MGLStyleAttributeFunction.h b/platform/darwin/src/MGLStyleValue.h
index a676a8a715..1f19a5e028 100644
--- a/platform/darwin/src/MGLStyleAttributeFunction.h
+++ b/platform/darwin/src/MGLStyleValue.h
@@ -1,18 +1,5 @@
#import <Foundation/Foundation.h>
-
-#import "MGLTypes.h"
-#import "MGLStyleAttributeValue.h"
-
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface MGLStyleAttributeFunction : NSObject <MGLStyleAttributeValue>
-
-@property (nonatomic, copy) NS_DICTIONARY_OF(NSNumber *, id) *stops;
-
-@property (nonatomic, copy, nullable) NSNumber *base;
-
-@end
+#import <CoreGraphics/CoreGraphics.h>
@interface MGLStyleValue<T> : NSObject
@@ -43,5 +30,3 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) NSDictionary<NSNumber *, MGLStyleValue<T> *> *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 0000000000..f8d5fd3a5d
--- /dev/null
+++ b/platform/darwin/src/MGLStyleValue.mm
@@ -0,0 +1,71 @@
+#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];
+}
+
+- (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 {
+ if (self = [super init]) {
+ _base = 1;
+ }
+ return self;
+}
+
+- (instancetype)initWithBase:(CGFloat)base stops:(NSDictionary *)stops {
+ if (self = [self init]) {
+ _base = base;
+ _stops = stops;
+ }
+ return self;
+}
+
+@end
diff --git a/platform/darwin/src/MGLStyleAttributeFunction_Private.h b/platform/darwin/src/MGLStyleValue_Private.h
index 94a610c62a..e48db02bf1 100644
--- a/platform/darwin/src/MGLStyleAttributeFunction_Private.h
+++ b/platform/darwin/src/MGLStyleValue_Private.h
@@ -1,6 +1,9 @@
-#import "MGLStyleAttributeFunction.h"
+#import <Foundation/Foundation.h>
-#import "NSValue+MGLStyleAttributeAdditions_Private.h"
+#import "MGLStyleValue.h"
+
+#import "NSValue+MGLStyleAttributeAdditions.h"
+#import "MGLTypes.h"
#if TARGET_OS_IPHONE
#import "UIColor+MGLAdditions.h"
@@ -8,82 +11,9 @@
#import "NSColor+MGLAdditions.h"
#endif
-#include <mbgl/util/color.hpp>
-#include <mbgl/util/variant.hpp>
-#include <mbgl/style/function.hpp>
-#include <mbgl/style/property_value.hpp>
-
#include <array>
-#define MGLSetEnumProperty(name, Name, MBGLType, ObjCType) \
- if (name.isFunction) { \
- NSAssert([name isKindOfClass:[MGLStyleAttributeFunction class]], @"" #name @" should be a function"); \
- \
- __block std::vector<std::pair<float, mbgl::style::MBGLType>> 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<mbgl::style::MBGLType>(value)); \
- }]; \
- auto function = mbgl::style::Function<mbgl::style::MBGLType> { \
- 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<mbgl::style::MBGLType>(value) }); \
- } else { \
- self.layer->set##Name({}); \
- }
-
-#define MGLGetEnumProperty(Name, MBGLType, ObjCType) \
- const char *type = @encode(ObjCType); \
- mbgl::style::PropertyValue<mbgl::style::MBGLType> property = self.layer->get##Name() ?: self.layer->getDefault##Name(); \
- if (property.isConstant()) { \
- ObjCType value = static_cast<ObjCType>(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<ObjCType>(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<mbgl::Color>)property;
-
-+ (instancetype)functionWithNumberPropertyValue:(mbgl::style::Function<float>)property;
-
-+ (instancetype)functionWithBoolPropertyValue:(mbgl::style::Function<bool>)property;
-
-+ (instancetype)functionWithStringPropertyValue:(mbgl::style::Function<std::string>)property;
-
-+ (instancetype)functionWithOffsetPropertyValue:(mbgl::style::Function<std::array<float, 2>>)property;
-
-+ (instancetype)functionWithPaddingPropertyValue:(mbgl::style::Function<std::array<float, 4>>)property;
-
-+ (instancetype)functionWithStringArrayPropertyValue:(mbgl::style::Function<std::vector<std::string>>)property;
-
-+ (instancetype)functionWithNumberArrayPropertyValue:(mbgl::style::Function<std::vector<float>>)property;
-
-+ (instancetype)functionWithEnumProperyValue:(mbgl::style::Function<bool>)property type:(const char *)type;
-
-@end
-
-template <typename MBGLType, typename ObjCType>
+template <typename MBGLType, typename ObjCType, typename MBGLElement = MBGLType>
class MGLStyleValueTransformer {
public:
@@ -167,7 +97,7 @@ private:
return [MGLColor mbgl_colorWithColor:mbglStopValue];
}
- ObjCType toMGLRawStyleValue(const std::vector<MBGLType> &mbglStopValue) {
+ ObjCType toMGLRawStyleValue(const std::vector<MBGLElement> &mbglStopValue) {
NSMutableArray *array = [NSMutableArray arrayWithCapacity:mbglStopValue.size()];
for (const auto &mbglElement: mbglStopValue) {
[array addObject:toMGLRawStyleValue(mbglElement)];
@@ -182,7 +112,7 @@ private:
}
void getMBGLValue(NSNumber *rawValue, float &mbglValue) {
- mbglValue = !!rawValue.boolValue;
+ mbglValue = rawValue.floatValue;
}
void getMBGLValue(NSString *rawValue, std::string &mbglValue) {
@@ -209,10 +139,10 @@ private:
mbglValue = rawValue.mbgl_color;
}
- void getMBGLValue(ObjCType rawValue, std::vector<MBGLType> &mbglValue) {
+ void getMBGLValue(ObjCType rawValue, std::vector<MBGLElement> &mbglValue) {
mbglValue.reserve(rawValue.count);
for (id obj in rawValue) {
- MBGLType mbglElement;
+ MBGLElement mbglElement;
getMBGLValue(obj, mbglElement);
mbglValue.push_back(mbglElement);
}
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h
index f8a130d54e..3fcecedca3 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 <MGLStyleAttributeValue> symbolPlacement;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> symbolSpacing;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> symbolAvoidEdges;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> iconAllowOverlap;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> iconIgnorePlacement;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> iconOptional;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> iconRotationAlignment;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> iconSize;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> iconTextFit;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> iconTextFitPadding;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *iconTextFitPadding;
/**
A string with {tokens} replaced, referencing the data property to pull from.
*/
-@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconImage;
+@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *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 <MGLStyleAttributeValue> iconRotate;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> iconPadding;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> iconKeepUpright;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> iconOffset;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> textPitchAlignment;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> textRotationAlignment;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> textField;
+@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *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 <MGLStyleAttributeValue> textFont;
+@property (nonatomic, null_resettable) MGLStyleValue<NSArray<NSString *> *> *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 <MGLStyleAttributeValue> textSize;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> textMaxWidth;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> textLineHeight;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> textLetterSpacing;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> textJustify;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> textAnchor;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> textMaxAngle;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> textRotate;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> textPadding;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> textKeepUpright;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> textTransform;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> textOffset;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> textAllowOverlap;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> textIgnorePlacement;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> textOptional;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> iconOpacity;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> iconColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> iconColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> iconHaloColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> iconHaloColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> iconHaloWidth;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> iconHaloBlur;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> iconTranslate;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> iconTranslateAnchor;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> textOpacity;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> textColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> textColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> textHaloColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> textHaloColor;
+@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *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 <MGLStyleAttributeValue> textHaloWidth;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> textHaloBlur;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *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 <MGLStyleAttributeValue> textTranslate;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *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 <MGLStyleAttributeValue> textTranslateAnchor;
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textTranslateAnchor;
@end
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm
index 01ac10f66f..a4c56fe297 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 <mbgl/style/layers/symbol_layer.hpp>
@@ -48,390 +48,486 @@
#pragma mark - Accessing the Layout Attributes
-- (void)setSymbolPlacement:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)symbolPlacement {
- MGLSetEnumProperty(symbolPlacement, SymbolPlacement, SymbolPlacementType, MGLSymbolPlacement);
+- (void)setSymbolPlacement:(MGLStyleValue<NSValue *> *)symbolPlacement {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::SymbolPlacementType, NSValue *>().toPropertyValue(symbolPlacement);
+ self.layer->setSymbolPlacement(mbglValue);
}
-- (id <MGLStyleAttributeValue>)symbolPlacement {
- MGLGetEnumProperty(SymbolPlacement, SymbolPlacementType, MGLSymbolPlacement);
+- (MGLStyleValue<NSValue *> *)symbolPlacement {
+ auto propertyValue = self.layer->getSymbolPlacement() ?: self.layer->getDefaultSymbolPlacement();
+ return MGLStyleValueTransformer<mbgl::style::SymbolPlacementType, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setSymbolSpacing:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)symbolSpacing {
- self.layer->setSymbolSpacing(symbolSpacing.mbgl_floatPropertyValue);
+- (void)setSymbolSpacing:(MGLStyleValue<NSNumber *> *)symbolSpacing {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(symbolSpacing);
+ self.layer->setSymbolSpacing(mbglValue);
}
-- (id <MGLStyleAttributeValue>)symbolSpacing {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getSymbolSpacing() ?: self.layer->getDefaultSymbolSpacing()];
+- (MGLStyleValue<NSNumber *> *)symbolSpacing {
+ auto propertyValue = self.layer->getSymbolSpacing() ?: self.layer->getDefaultSymbolSpacing();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setSymbolAvoidEdges:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)symbolAvoidEdges {
- self.layer->setSymbolAvoidEdges(symbolAvoidEdges.mbgl_boolPropertyValue);
+- (void)setSymbolAvoidEdges:(MGLStyleValue<NSNumber *> *)symbolAvoidEdges {
+ auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(symbolAvoidEdges);
+ self.layer->setSymbolAvoidEdges(mbglValue);
}
-- (id <MGLStyleAttributeValue>)symbolAvoidEdges {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getSymbolAvoidEdges() ?: self.layer->getDefaultSymbolAvoidEdges()];
+- (MGLStyleValue<NSNumber *> *)symbolAvoidEdges {
+ auto propertyValue = self.layer->getSymbolAvoidEdges() ?: self.layer->getDefaultSymbolAvoidEdges();
+ return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setIconAllowOverlap:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconAllowOverlap {
- self.layer->setIconAllowOverlap(iconAllowOverlap.mbgl_boolPropertyValue);
+- (void)setIconAllowOverlap:(MGLStyleValue<NSNumber *> *)iconAllowOverlap {
+ auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(iconAllowOverlap);
+ self.layer->setIconAllowOverlap(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconAllowOverlap {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconAllowOverlap() ?: self.layer->getDefaultIconAllowOverlap()];
+- (MGLStyleValue<NSNumber *> *)iconAllowOverlap {
+ auto propertyValue = self.layer->getIconAllowOverlap() ?: self.layer->getDefaultIconAllowOverlap();
+ return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setIconIgnorePlacement:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconIgnorePlacement {
- self.layer->setIconIgnorePlacement(iconIgnorePlacement.mbgl_boolPropertyValue);
+- (void)setIconIgnorePlacement:(MGLStyleValue<NSNumber *> *)iconIgnorePlacement {
+ auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(iconIgnorePlacement);
+ self.layer->setIconIgnorePlacement(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconIgnorePlacement {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconIgnorePlacement() ?: self.layer->getDefaultIconIgnorePlacement()];
+- (MGLStyleValue<NSNumber *> *)iconIgnorePlacement {
+ auto propertyValue = self.layer->getIconIgnorePlacement() ?: self.layer->getDefaultIconIgnorePlacement();
+ return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setIconOptional:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconOptional {
- self.layer->setIconOptional(iconOptional.mbgl_boolPropertyValue);
+- (void)setIconOptional:(MGLStyleValue<NSNumber *> *)iconOptional {
+ auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(iconOptional);
+ self.layer->setIconOptional(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconOptional {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconOptional() ?: self.layer->getDefaultIconOptional()];
+- (MGLStyleValue<NSNumber *> *)iconOptional {
+ auto propertyValue = self.layer->getIconOptional() ?: self.layer->getDefaultIconOptional();
+ return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setIconRotationAlignment:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconRotationAlignment {
- MGLSetEnumProperty(iconRotationAlignment, IconRotationAlignment, AlignmentType, MGLIconRotationAlignment);
+- (void)setIconRotationAlignment:(MGLStyleValue<NSValue *> *)iconRotationAlignment {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toPropertyValue(iconRotationAlignment);
+ self.layer->setIconRotationAlignment(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconRotationAlignment {
- MGLGetEnumProperty(IconRotationAlignment, AlignmentType, MGLIconRotationAlignment);
+- (MGLStyleValue<NSValue *> *)iconRotationAlignment {
+ auto propertyValue = self.layer->getIconRotationAlignment() ?: self.layer->getDefaultIconRotationAlignment();
+ return MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setIconSize:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconSize {
- self.layer->setIconSize(iconSize.mbgl_floatPropertyValue);
+- (void)setIconSize:(MGLStyleValue<NSNumber *> *)iconSize {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconSize);
+ self.layer->setIconSize(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconSize {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconSize() ?: self.layer->getDefaultIconSize()];
+- (MGLStyleValue<NSNumber *> *)iconSize {
+ auto propertyValue = self.layer->getIconSize() ?: self.layer->getDefaultIconSize();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setIconTextFit:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconTextFit {
- MGLSetEnumProperty(iconTextFit, IconTextFit, IconTextFitType, MGLIconTextFit);
+- (void)setIconTextFit:(MGLStyleValue<NSValue *> *)iconTextFit {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::IconTextFitType, NSValue *>().toPropertyValue(iconTextFit);
+ self.layer->setIconTextFit(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconTextFit {
- MGLGetEnumProperty(IconTextFit, IconTextFitType, MGLIconTextFit);
+- (MGLStyleValue<NSValue *> *)iconTextFit {
+ auto propertyValue = self.layer->getIconTextFit() ?: self.layer->getDefaultIconTextFit();
+ return MGLStyleValueTransformer<mbgl::style::IconTextFitType, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setIconTextFitPadding:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconTextFitPadding {
- self.layer->setIconTextFitPadding(iconTextFitPadding.mbgl_paddingPropertyValue);
+- (void)setIconTextFitPadding:(MGLStyleValue<NSValue *> *)iconTextFitPadding {
+ auto mbglValue = MGLStyleValueTransformer<std::array<float, 4>, NSValue *>().toPropertyValue(iconTextFitPadding);
+ self.layer->setIconTextFitPadding(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconTextFitPadding {
- return [MGLStyleAttribute mbgl_paddingWithPropertyValuePadding:self.layer->getIconTextFitPadding() ?: self.layer->getDefaultIconTextFitPadding()];
+- (MGLStyleValue<NSValue *> *)iconTextFitPadding {
+ auto propertyValue = self.layer->getIconTextFitPadding() ?: self.layer->getDefaultIconTextFitPadding();
+ return MGLStyleValueTransformer<std::array<float, 4>, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setIconImage:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconImage {
- self.layer->setIconImage(iconImage.mbgl_stringPropertyValue);
+- (void)setIconImage:(MGLStyleValue<NSString *> *)iconImage {
+ auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(iconImage);
+ self.layer->setIconImage(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconImage {
- return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getIconImage() ?: self.layer->getDefaultIconImage()];
+- (MGLStyleValue<NSString *> *)iconImage {
+ auto propertyValue = self.layer->getIconImage() ?: self.layer->getDefaultIconImage();
+ return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
-- (void)setIconRotate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconRotate {
- self.layer->setIconRotate(iconRotate.mbgl_floatPropertyValue);
+- (void)setIconRotate:(MGLStyleValue<NSNumber *> *)iconRotate {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconRotate);
+ self.layer->setIconRotate(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconRotate {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconRotate() ?: self.layer->getDefaultIconRotate()];
+- (MGLStyleValue<NSNumber *> *)iconRotate {
+ auto propertyValue = self.layer->getIconRotate() ?: self.layer->getDefaultIconRotate();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setIconPadding:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconPadding {
- self.layer->setIconPadding(iconPadding.mbgl_floatPropertyValue);
+- (void)setIconPadding:(MGLStyleValue<NSNumber *> *)iconPadding {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconPadding);
+ self.layer->setIconPadding(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconPadding {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconPadding() ?: self.layer->getDefaultIconPadding()];
+- (MGLStyleValue<NSNumber *> *)iconPadding {
+ auto propertyValue = self.layer->getIconPadding() ?: self.layer->getDefaultIconPadding();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setIconKeepUpright:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconKeepUpright {
- self.layer->setIconKeepUpright(iconKeepUpright.mbgl_boolPropertyValue);
+- (void)setIconKeepUpright:(MGLStyleValue<NSNumber *> *)iconKeepUpright {
+ auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(iconKeepUpright);
+ self.layer->setIconKeepUpright(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconKeepUpright {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconKeepUpright() ?: self.layer->getDefaultIconKeepUpright()];
+- (MGLStyleValue<NSNumber *> *)iconKeepUpright {
+ auto propertyValue = self.layer->getIconKeepUpright() ?: self.layer->getDefaultIconKeepUpright();
+ return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setIconOffset:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconOffset {
- self.layer->setIconOffset(iconOffset.mbgl_offsetPropertyValue);
+- (void)setIconOffset:(MGLStyleValue<NSValue *> *)iconOffset {
+ auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(iconOffset);
+ self.layer->setIconOffset(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconOffset {
- return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getIconOffset() ?: self.layer->getDefaultIconOffset()];
+- (MGLStyleValue<NSValue *> *)iconOffset {
+ auto propertyValue = self.layer->getIconOffset() ?: self.layer->getDefaultIconOffset();
+ return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setTextPitchAlignment:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textPitchAlignment {
- MGLSetEnumProperty(textPitchAlignment, TextPitchAlignment, AlignmentType, MGLTextPitchAlignment);
+- (void)setTextPitchAlignment:(MGLStyleValue<NSValue *> *)textPitchAlignment {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toPropertyValue(textPitchAlignment);
+ self.layer->setTextPitchAlignment(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textPitchAlignment {
- MGLGetEnumProperty(TextPitchAlignment, AlignmentType, MGLTextPitchAlignment);
+- (MGLStyleValue<NSValue *> *)textPitchAlignment {
+ auto propertyValue = self.layer->getTextPitchAlignment() ?: self.layer->getDefaultTextPitchAlignment();
+ return MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setTextRotationAlignment:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textRotationAlignment {
- MGLSetEnumProperty(textRotationAlignment, TextRotationAlignment, AlignmentType, MGLTextRotationAlignment);
+- (void)setTextRotationAlignment:(MGLStyleValue<NSValue *> *)textRotationAlignment {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toPropertyValue(textRotationAlignment);
+ self.layer->setTextRotationAlignment(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textRotationAlignment {
- MGLGetEnumProperty(TextRotationAlignment, AlignmentType, MGLTextRotationAlignment);
+- (MGLStyleValue<NSValue *> *)textRotationAlignment {
+ auto propertyValue = self.layer->getTextRotationAlignment() ?: self.layer->getDefaultTextRotationAlignment();
+ return MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setTextField:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textField {
- self.layer->setTextField(textField.mbgl_stringPropertyValue);
+- (void)setTextField:(MGLStyleValue<NSString *> *)textField {
+ auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(textField);
+ self.layer->setTextField(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textField {
- return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getTextField() ?: self.layer->getDefaultTextField()];
+- (MGLStyleValue<NSString *> *)textField {
+ auto propertyValue = self.layer->getTextField() ?: self.layer->getDefaultTextField();
+ return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
-- (void)setTextFont:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textFont {
- self.layer->setTextFont(textFont.mbgl_stringArrayPropertyValue);
+- (void)setTextFont:(MGLStyleValue<NSArray<NSString *> *> *)textFont {
+ auto mbglValue = MGLStyleValueTransformer<std::vector<std::string>, NSArray<NSString *> *, std::string>().toPropertyValue(textFont);
+ self.layer->setTextFont(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textFont {
- return [MGLStyleAttribute mbgl_stringArrayWithPropertyValueStringArray:self.layer->getTextFont() ?: self.layer->getDefaultTextFont()];
+- (MGLStyleValue<NSArray<NSString *> *> *)textFont {
+ auto propertyValue = self.layer->getTextFont() ?: self.layer->getDefaultTextFont();
+ return MGLStyleValueTransformer<std::vector<std::string>, NSArray<NSString *> *, std::string>().toStyleValue(propertyValue);
}
-- (void)setTextSize:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textSize {
- self.layer->setTextSize(textSize.mbgl_floatPropertyValue);
+- (void)setTextSize:(MGLStyleValue<NSNumber *> *)textSize {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textSize);
+ self.layer->setTextSize(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textSize {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextSize() ?: self.layer->getDefaultTextSize()];
+- (MGLStyleValue<NSNumber *> *)textSize {
+ auto propertyValue = self.layer->getTextSize() ?: self.layer->getDefaultTextSize();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setTextMaxWidth:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textMaxWidth {
- self.layer->setTextMaxWidth(textMaxWidth.mbgl_floatPropertyValue);
+- (void)setTextMaxWidth:(MGLStyleValue<NSNumber *> *)textMaxWidth {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textMaxWidth);
+ self.layer->setTextMaxWidth(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textMaxWidth {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextMaxWidth() ?: self.layer->getDefaultTextMaxWidth()];
+- (MGLStyleValue<NSNumber *> *)textMaxWidth {
+ auto propertyValue = self.layer->getTextMaxWidth() ?: self.layer->getDefaultTextMaxWidth();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setTextLineHeight:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textLineHeight {
- self.layer->setTextLineHeight(textLineHeight.mbgl_floatPropertyValue);
+- (void)setTextLineHeight:(MGLStyleValue<NSNumber *> *)textLineHeight {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textLineHeight);
+ self.layer->setTextLineHeight(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textLineHeight {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextLineHeight() ?: self.layer->getDefaultTextLineHeight()];
+- (MGLStyleValue<NSNumber *> *)textLineHeight {
+ auto propertyValue = self.layer->getTextLineHeight() ?: self.layer->getDefaultTextLineHeight();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setTextLetterSpacing:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textLetterSpacing {
- self.layer->setTextLetterSpacing(textLetterSpacing.mbgl_floatPropertyValue);
+- (void)setTextLetterSpacing:(MGLStyleValue<NSNumber *> *)textLetterSpacing {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textLetterSpacing);
+ self.layer->setTextLetterSpacing(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textLetterSpacing {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextLetterSpacing() ?: self.layer->getDefaultTextLetterSpacing()];
+- (MGLStyleValue<NSNumber *> *)textLetterSpacing {
+ auto propertyValue = self.layer->getTextLetterSpacing() ?: self.layer->getDefaultTextLetterSpacing();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setTextJustify:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textJustify {
- MGLSetEnumProperty(textJustify, TextJustify, TextJustifyType, MGLTextJustify);
+- (void)setTextJustify:(MGLStyleValue<NSValue *> *)textJustify {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextJustifyType, NSValue *>().toPropertyValue(textJustify);
+ self.layer->setTextJustify(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textJustify {
- MGLGetEnumProperty(TextJustify, TextJustifyType, MGLTextJustify);
+- (MGLStyleValue<NSValue *> *)textJustify {
+ auto propertyValue = self.layer->getTextJustify() ?: self.layer->getDefaultTextJustify();
+ return MGLStyleValueTransformer<mbgl::style::TextJustifyType, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setTextAnchor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textAnchor {
- MGLSetEnumProperty(textAnchor, TextAnchor, TextAnchorType, MGLTextAnchor);
+- (void)setTextAnchor:(MGLStyleValue<NSValue *> *)textAnchor {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextAnchorType, NSValue *>().toPropertyValue(textAnchor);
+ self.layer->setTextAnchor(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textAnchor {
- MGLGetEnumProperty(TextAnchor, TextAnchorType, MGLTextAnchor);
+- (MGLStyleValue<NSValue *> *)textAnchor {
+ auto propertyValue = self.layer->getTextAnchor() ?: self.layer->getDefaultTextAnchor();
+ return MGLStyleValueTransformer<mbgl::style::TextAnchorType, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setTextMaxAngle:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textMaxAngle {
- self.layer->setTextMaxAngle(textMaxAngle.mbgl_floatPropertyValue);
+- (void)setTextMaxAngle:(MGLStyleValue<NSNumber *> *)textMaxAngle {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textMaxAngle);
+ self.layer->setTextMaxAngle(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textMaxAngle {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextMaxAngle() ?: self.layer->getDefaultTextMaxAngle()];
+- (MGLStyleValue<NSNumber *> *)textMaxAngle {
+ auto propertyValue = self.layer->getTextMaxAngle() ?: self.layer->getDefaultTextMaxAngle();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setTextRotate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textRotate {
- self.layer->setTextRotate(textRotate.mbgl_floatPropertyValue);
+- (void)setTextRotate:(MGLStyleValue<NSNumber *> *)textRotate {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textRotate);
+ self.layer->setTextRotate(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textRotate {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextRotate() ?: self.layer->getDefaultTextRotate()];
+- (MGLStyleValue<NSNumber *> *)textRotate {
+ auto propertyValue = self.layer->getTextRotate() ?: self.layer->getDefaultTextRotate();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setTextPadding:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textPadding {
- self.layer->setTextPadding(textPadding.mbgl_floatPropertyValue);
+- (void)setTextPadding:(MGLStyleValue<NSNumber *> *)textPadding {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textPadding);
+ self.layer->setTextPadding(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textPadding {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextPadding() ?: self.layer->getDefaultTextPadding()];
+- (MGLStyleValue<NSNumber *> *)textPadding {
+ auto propertyValue = self.layer->getTextPadding() ?: self.layer->getDefaultTextPadding();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setTextKeepUpright:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textKeepUpright {
- self.layer->setTextKeepUpright(textKeepUpright.mbgl_boolPropertyValue);
+- (void)setTextKeepUpright:(MGLStyleValue<NSNumber *> *)textKeepUpright {
+ auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(textKeepUpright);
+ self.layer->setTextKeepUpright(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textKeepUpright {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextKeepUpright() ?: self.layer->getDefaultTextKeepUpright()];
+- (MGLStyleValue<NSNumber *> *)textKeepUpright {
+ auto propertyValue = self.layer->getTextKeepUpright() ?: self.layer->getDefaultTextKeepUpright();
+ return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setTextTransform:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textTransform {
- MGLSetEnumProperty(textTransform, TextTransform, TextTransformType, MGLTextTransform);
+- (void)setTextTransform:(MGLStyleValue<NSValue *> *)textTransform {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextTransformType, NSValue *>().toPropertyValue(textTransform);
+ self.layer->setTextTransform(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textTransform {
- MGLGetEnumProperty(TextTransform, TextTransformType, MGLTextTransform);
+- (MGLStyleValue<NSValue *> *)textTransform {
+ auto propertyValue = self.layer->getTextTransform() ?: self.layer->getDefaultTextTransform();
+ return MGLStyleValueTransformer<mbgl::style::TextTransformType, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setTextOffset:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textOffset {
- self.layer->setTextOffset(textOffset.mbgl_offsetPropertyValue);
+- (void)setTextOffset:(MGLStyleValue<NSValue *> *)textOffset {
+ auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(textOffset);
+ self.layer->setTextOffset(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textOffset {
- return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getTextOffset() ?: self.layer->getDefaultTextOffset()];
+- (MGLStyleValue<NSValue *> *)textOffset {
+ auto propertyValue = self.layer->getTextOffset() ?: self.layer->getDefaultTextOffset();
+ return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setTextAllowOverlap:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textAllowOverlap {
- self.layer->setTextAllowOverlap(textAllowOverlap.mbgl_boolPropertyValue);
+- (void)setTextAllowOverlap:(MGLStyleValue<NSNumber *> *)textAllowOverlap {
+ auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(textAllowOverlap);
+ self.layer->setTextAllowOverlap(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textAllowOverlap {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextAllowOverlap() ?: self.layer->getDefaultTextAllowOverlap()];
+- (MGLStyleValue<NSNumber *> *)textAllowOverlap {
+ auto propertyValue = self.layer->getTextAllowOverlap() ?: self.layer->getDefaultTextAllowOverlap();
+ return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setTextIgnorePlacement:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textIgnorePlacement {
- self.layer->setTextIgnorePlacement(textIgnorePlacement.mbgl_boolPropertyValue);
+- (void)setTextIgnorePlacement:(MGLStyleValue<NSNumber *> *)textIgnorePlacement {
+ auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(textIgnorePlacement);
+ self.layer->setTextIgnorePlacement(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textIgnorePlacement {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextIgnorePlacement() ?: self.layer->getDefaultTextIgnorePlacement()];
+- (MGLStyleValue<NSNumber *> *)textIgnorePlacement {
+ auto propertyValue = self.layer->getTextIgnorePlacement() ?: self.layer->getDefaultTextIgnorePlacement();
+ return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setTextOptional:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textOptional {
- self.layer->setTextOptional(textOptional.mbgl_boolPropertyValue);
+- (void)setTextOptional:(MGLStyleValue<NSNumber *> *)textOptional {
+ auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(textOptional);
+ self.layer->setTextOptional(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textOptional {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextOptional() ?: self.layer->getDefaultTextOptional()];
+- (MGLStyleValue<NSNumber *> *)textOptional {
+ auto propertyValue = self.layer->getTextOptional() ?: self.layer->getDefaultTextOptional();
+ return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
#pragma mark - Accessing the Paint Attributes
-- (void)setIconOpacity:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconOpacity {
- self.layer->setIconOpacity(iconOpacity.mbgl_floatPropertyValue);
+- (void)setIconOpacity:(MGLStyleValue<NSNumber *> *)iconOpacity {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconOpacity);
+ self.layer->setIconOpacity(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconOpacity {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconOpacity() ?: self.layer->getDefaultIconOpacity()];
+- (MGLStyleValue<NSNumber *> *)iconOpacity {
+ auto propertyValue = self.layer->getIconOpacity() ?: self.layer->getDefaultIconOpacity();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setIconColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconColor {
- self.layer->setIconColor(iconColor.mbgl_colorPropertyValue);
+- (void)setIconColor:(MGLStyleValue<MGLColor *> *)iconColor {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(iconColor);
+ self.layer->setIconColor(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getIconColor() ?: self.layer->getDefaultIconColor()];
+- (MGLStyleValue<MGLColor *> *)iconColor {
+ auto propertyValue = self.layer->getIconColor() ?: self.layer->getDefaultIconColor();
+ return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
-- (void)setIconHaloColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconHaloColor {
- self.layer->setIconHaloColor(iconHaloColor.mbgl_colorPropertyValue);
+- (void)setIconHaloColor:(MGLStyleValue<MGLColor *> *)iconHaloColor {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(iconHaloColor);
+ self.layer->setIconHaloColor(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconHaloColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getIconHaloColor() ?: self.layer->getDefaultIconHaloColor()];
+- (MGLStyleValue<MGLColor *> *)iconHaloColor {
+ auto propertyValue = self.layer->getIconHaloColor() ?: self.layer->getDefaultIconHaloColor();
+ return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
-- (void)setIconHaloWidth:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconHaloWidth {
- self.layer->setIconHaloWidth(iconHaloWidth.mbgl_floatPropertyValue);
+- (void)setIconHaloWidth:(MGLStyleValue<NSNumber *> *)iconHaloWidth {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconHaloWidth);
+ self.layer->setIconHaloWidth(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconHaloWidth {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconHaloWidth() ?: self.layer->getDefaultIconHaloWidth()];
+- (MGLStyleValue<NSNumber *> *)iconHaloWidth {
+ auto propertyValue = self.layer->getIconHaloWidth() ?: self.layer->getDefaultIconHaloWidth();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setIconHaloBlur:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconHaloBlur {
- self.layer->setIconHaloBlur(iconHaloBlur.mbgl_floatPropertyValue);
+- (void)setIconHaloBlur:(MGLStyleValue<NSNumber *> *)iconHaloBlur {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconHaloBlur);
+ self.layer->setIconHaloBlur(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconHaloBlur {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconHaloBlur() ?: self.layer->getDefaultIconHaloBlur()];
+- (MGLStyleValue<NSNumber *> *)iconHaloBlur {
+ auto propertyValue = self.layer->getIconHaloBlur() ?: self.layer->getDefaultIconHaloBlur();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setIconTranslate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconTranslate {
- self.layer->setIconTranslate(iconTranslate.mbgl_offsetPropertyValue);
+- (void)setIconTranslate:(MGLStyleValue<NSValue *> *)iconTranslate {
+ auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(iconTranslate);
+ self.layer->setIconTranslate(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconTranslate {
- return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getIconTranslate() ?: self.layer->getDefaultIconTranslate()];
+- (MGLStyleValue<NSValue *> *)iconTranslate {
+ auto propertyValue = self.layer->getIconTranslate() ?: self.layer->getDefaultIconTranslate();
+ return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setIconTranslateAnchor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconTranslateAnchor {
- MGLSetEnumProperty(iconTranslateAnchor, IconTranslateAnchor, TranslateAnchorType, MGLIconTranslateAnchor);
+- (void)setIconTranslateAnchor:(MGLStyleValue<NSValue *> *)iconTranslateAnchor {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toPropertyValue(iconTranslateAnchor);
+ self.layer->setIconTranslateAnchor(mbglValue);
}
-- (id <MGLStyleAttributeValue>)iconTranslateAnchor {
- MGLGetEnumProperty(IconTranslateAnchor, TranslateAnchorType, MGLIconTranslateAnchor);
+- (MGLStyleValue<NSValue *> *)iconTranslateAnchor {
+ auto propertyValue = self.layer->getIconTranslateAnchor() ?: self.layer->getDefaultIconTranslateAnchor();
+ return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setTextOpacity:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textOpacity {
- self.layer->setTextOpacity(textOpacity.mbgl_floatPropertyValue);
+- (void)setTextOpacity:(MGLStyleValue<NSNumber *> *)textOpacity {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textOpacity);
+ self.layer->setTextOpacity(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textOpacity {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextOpacity() ?: self.layer->getDefaultTextOpacity()];
+- (MGLStyleValue<NSNumber *> *)textOpacity {
+ auto propertyValue = self.layer->getTextOpacity() ?: self.layer->getDefaultTextOpacity();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setTextColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textColor {
- self.layer->setTextColor(textColor.mbgl_colorPropertyValue);
+- (void)setTextColor:(MGLStyleValue<MGLColor *> *)textColor {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(textColor);
+ self.layer->setTextColor(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getTextColor() ?: self.layer->getDefaultTextColor()];
+- (MGLStyleValue<MGLColor *> *)textColor {
+ auto propertyValue = self.layer->getTextColor() ?: self.layer->getDefaultTextColor();
+ return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
-- (void)setTextHaloColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textHaloColor {
- self.layer->setTextHaloColor(textHaloColor.mbgl_colorPropertyValue);
+- (void)setTextHaloColor:(MGLStyleValue<MGLColor *> *)textHaloColor {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(textHaloColor);
+ self.layer->setTextHaloColor(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textHaloColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getTextHaloColor() ?: self.layer->getDefaultTextHaloColor()];
+- (MGLStyleValue<MGLColor *> *)textHaloColor {
+ auto propertyValue = self.layer->getTextHaloColor() ?: self.layer->getDefaultTextHaloColor();
+ return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
-- (void)setTextHaloWidth:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textHaloWidth {
- self.layer->setTextHaloWidth(textHaloWidth.mbgl_floatPropertyValue);
+- (void)setTextHaloWidth:(MGLStyleValue<NSNumber *> *)textHaloWidth {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textHaloWidth);
+ self.layer->setTextHaloWidth(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textHaloWidth {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextHaloWidth() ?: self.layer->getDefaultTextHaloWidth()];
+- (MGLStyleValue<NSNumber *> *)textHaloWidth {
+ auto propertyValue = self.layer->getTextHaloWidth() ?: self.layer->getDefaultTextHaloWidth();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setTextHaloBlur:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textHaloBlur {
- self.layer->setTextHaloBlur(textHaloBlur.mbgl_floatPropertyValue);
+- (void)setTextHaloBlur:(MGLStyleValue<NSNumber *> *)textHaloBlur {
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textHaloBlur);
+ self.layer->setTextHaloBlur(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textHaloBlur {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextHaloBlur() ?: self.layer->getDefaultTextHaloBlur()];
+- (MGLStyleValue<NSNumber *> *)textHaloBlur {
+ auto propertyValue = self.layer->getTextHaloBlur() ?: self.layer->getDefaultTextHaloBlur();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setTextTranslate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textTranslate {
- self.layer->setTextTranslate(textTranslate.mbgl_offsetPropertyValue);
+- (void)setTextTranslate:(MGLStyleValue<NSValue *> *)textTranslate {
+ auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(textTranslate);
+ self.layer->setTextTranslate(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textTranslate {
- return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getTextTranslate() ?: self.layer->getDefaultTextTranslate()];
+- (MGLStyleValue<NSValue *> *)textTranslate {
+ auto propertyValue = self.layer->getTextTranslate() ?: self.layer->getDefaultTextTranslate();
+ return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
-- (void)setTextTranslateAnchor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textTranslateAnchor {
- MGLSetEnumProperty(textTranslateAnchor, TextTranslateAnchor, TranslateAnchorType, MGLTextTranslateAnchor);
+- (void)setTextTranslateAnchor:(MGLStyleValue<NSValue *> *)textTranslateAnchor {
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toPropertyValue(textTranslateAnchor);
+ self.layer->setTextTranslateAnchor(mbglValue);
}
-- (id <MGLStyleAttributeValue>)textTranslateAnchor {
- MGLGetEnumProperty(TextTranslateAnchor, TranslateAnchorType, MGLTextTranslateAnchor);
+- (MGLStyleValue<NSValue *> *)textTranslateAnchor {
+ auto propertyValue = self.layer->getTextTranslateAnchor() ?: self.layer->getDefaultTextTranslateAnchor();
+ return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toStyleValue(propertyValue);
}
@end
diff --git a/platform/darwin/src/NSArray+MGLStyleAttributeAdditions.h b/platform/darwin/src/NSArray+MGLStyleAttributeAdditions.h
deleted file mode 100644
index fa5193acf0..0000000000
--- a/platform/darwin/src/NSArray+MGLStyleAttributeAdditions.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#import <Foundation/Foundation.h>
-
-#import "MGLStyleAttributeValue.h"
-
-@interface NSArray (MGLStyleAttributeAdditions) <MGLStyleAttributeValue>
-
-@end
diff --git a/platform/darwin/src/NSArray+MGLStyleAttributeAdditions.mm b/platform/darwin/src/NSArray+MGLStyleAttributeAdditions.mm
deleted file mode 100644
index fb60cf0f72..0000000000
--- 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 <array>
-
-@interface NSArray(Private) <MGLStyleAttributeValue_Private>
-@end
-
-@implementation NSArray (MGLStyleAttributeAdditions)
-
-- (mbgl::style::PropertyValue<std::vector<std::string> >)mbgl_stringArrayPropertyValue
-{
- std::vector<std::string>fonts;
-
- for (NSString *font in self) {
- fonts.emplace_back(font.UTF8String);
- }
-
- return {{fonts}};
-}
-
-- (mbgl::style::PropertyValue<std::vector<float> >)mbgl_numberArrayPropertyValue
-{
- std::vector<float>values;
-
- 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 1be02c01d2..0000000000
--- a/platform/darwin/src/NSArray+MGLStyleAttributeAdditions_Private.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#import <Foundation/Foundation.h>
-
-#import "MGLStyleAttributeValue.h"
-
-#include <mbgl/style/property_value.hpp>
-
-@interface NSArray (MGLStyleAttributeAdditions_Private) <MGLStyleAttributeValue>
-
-@end
diff --git a/platform/darwin/src/NSColor+MGLStyleAttributeAdditions.h b/platform/darwin/src/NSColor+MGLStyleAttributeAdditions.h
deleted file mode 100644
index 5a4f7af006..0000000000
--- a/platform/darwin/src/NSColor+MGLStyleAttributeAdditions.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#import <Cocoa/Cocoa.h>
-
-#import "MGLStyleAttributeValue.h"
-
-@interface NSColor (MGLStyleAttributeAdditions) <MGLStyleAttributeValue>
-
-@end
diff --git a/platform/darwin/src/NSColor+MGLStyleAttributeAdditions.m b/platform/darwin/src/NSColor+MGLStyleAttributeAdditions.m
deleted file mode 100644
index ac330343c8..0000000000
--- 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 9a714cbd83..0000000000
--- a/platform/darwin/src/NSColor+MGLStyleAttributeAdditions_Private.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#import <Foundation/Foundation.h>
-
-#import "MGLStyleAttributeValue.h"
-
-#include <mbgl/style/property_value.hpp>
-
-@interface NSColor (MGLStyleAttributeAdditions_Private) <MGLStyleAttributeValue>
-
-@end
diff --git a/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions.h b/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions.h
deleted file mode 100644
index 162b5e94f5..0000000000
--- a/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#import <Foundation/Foundation.h>
-
-#import "MGLStyleAttributeValue.h"
-
-@interface NSNumber (MGLStyleAttributeAdditions) <MGLStyleAttributeValue>
-
-@end
diff --git a/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions.mm b/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions.mm
deleted file mode 100644
index 163105d2fa..0000000000
--- a/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions.mm
+++ /dev/null
@@ -1,22 +0,0 @@
-#import "NSNumber+MGLStyleAttributeAdditions.h"
-
-#include <mbgl/style/property_value.hpp>
-
-@implementation NSNumber (MGLStyleAttributeAdditions)
-
-- (NSNumber *)numberValue
-{
- return self;
-}
-
-- (mbgl::style::PropertyValue<bool>)mbgl_boolPropertyValue
-{
- return mbgl::style::PropertyValue<bool> { !!self.boolValue };
-}
-
-- (mbgl::style::PropertyValue<float>)mbgl_floatPropertyValue
-{
- return mbgl::style::PropertyValue<float> { 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 73e40bb3ad..0000000000
--- a/platform/darwin/src/NSNumber+MGLStyleAttributeAdditions_Private.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#import <Foundation/Foundation.h>
-
-#import "MGLStyleAttributeValue.h"
-
-#include <mbgl/style/property_value.hpp>
-
-@interface NSNumber (MGLStyleAttributeAdditions_Private) <MGLStyleAttributeValue>
-
-- (mbgl::style::PropertyValue<bool>)mbgl_booleanPropertyValue;
-
-- (mbgl::style::PropertyValue<float>)mbgl_numberPropertyValue;
-
-@end
diff --git a/platform/darwin/src/NSString+MGLStyleAttributeAdditions.h b/platform/darwin/src/NSString+MGLStyleAttributeAdditions.h
deleted file mode 100644
index 2126335922..0000000000
--- a/platform/darwin/src/NSString+MGLStyleAttributeAdditions.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#import <Foundation/Foundation.h>
-
-#import "MGLStyleAttributeValue.h"
-
-@interface NSString (MGLStyleAttributeAdditions) <MGLStyleAttributeValue>
-
-@end
diff --git a/platform/darwin/src/NSString+MGLStyleAttributeAdditions.mm b/platform/darwin/src/NSString+MGLStyleAttributeAdditions.mm
deleted file mode 100644
index ff88f5501a..0000000000
--- 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<std::string>)mbgl_stringPropertyValue
-{
- return mbgl::style::PropertyValue<std::string> {{ 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 8e401e2996..0000000000
--- a/platform/darwin/src/NSString+MGLStyleAttributeAdditions_Private.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#import <Foundation/Foundation.h>
-
-#import "MGLStyleAttributeValue.h"
-
-#include <mbgl/style/property_value.hpp>
-
-@interface NSString (MGLStyleAttributeAdditions_Private) <MGLStyleAttributeValue>
-
-- (mbgl::style::PropertyValue<std::string>)mbgl_stringPropertyValue;
-
-@end
diff --git a/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.h b/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.h
index 0ee0c78f87..60c1ee4075 100644
--- a/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.h
+++ b/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.h
@@ -1,7 +1,13 @@
#import <Foundation/Foundation.h>
-#import "MGLStyleAttributeValue.h"
+#include <array>
-@interface NSValue (MGLStyleAttributeValue) <MGLStyleAttributeValue>
+@interface NSValue (MGLStyleAttributeAdditions)
+
++ (instancetype)mgl_valueWithOffsetArray:(std::array<float, 2>)offsetArray;
++ (instancetype)mgl_valueWithPaddingArray:(std::array<float, 4>)paddingArray;
+
+- (std::array<float, 2>)mgl_offsetArrayValue;
+- (std::array<float, 4>)mgl_paddingArrayValue;
@end
diff --git a/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.mm b/platform/darwin/src/NSValue+MGLStyleAttributeAdditions.mm
index 83266e7db5..59afe559d7 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 <array>
-
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#define MGLEdgeInsets UIEdgeInsets
@@ -32,16 +28,6 @@
return [NSValue value:&insets withObjCType:@encode(MGLEdgeInsets)];
}
-- (BOOL)isFunction
-{
- return NO;
-}
-
-- (mbgl::style::PropertyValue<std::array<float, 2>>)mbgl_offsetPropertyValue
-{
- return { self.mgl_offsetArrayValue };
-}
-
- (std::array<float, 2>)mgl_offsetArrayValue
{
NSAssert(strcmp(self.objCType, @encode(CGVector)) == 0, @"Value does not represent a CGVector");
@@ -53,11 +39,6 @@
};
}
-- (mbgl::style::PropertyValue<std::array<float, 4>>)mbgl_paddingPropertyValue
-{
- return { self.mgl_paddingArrayValue };
-}
-
- (std::array<float, 4>)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 28a9b10908..0000000000
--- a/platform/darwin/src/NSValue+MGLStyleAttributeAdditions_Private.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#import <Foundation/Foundation.h>
-
-#import "MGLStyleAttributeValue.h"
-
-#include <mbgl/style/property_value.hpp>
-
-@interface NSValue (MGLStyleAttributeAdditions_Private) <MGLStyleAttributeValue>
-
-+ (instancetype)mgl_valueWithOffsetArray:(std::array<float, 2>)offsetArray;
-+ (instancetype)mgl_valueWithPaddingArray:(std::array<float, 4>)paddingArray;
-
-- (std::array<float, 2>)mgl_offsetArrayValue;
-- (std::array<float, 4>)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 ef886dca5d..0000000000
--- a/platform/darwin/src/UIColor+MGLStyleAttributeAdditions_Private.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#import <UIKit/UIKit.h>
-
-#import "MGLStyleAttributeValue.h"
-
-#include <mbgl/style/property_value.hpp>
-
-@interface UIColor (MGLStyleAttributeAdditions_Private) <MGLStyleAttributeValue>
-
-@end
diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.m b/platform/darwin/test/MGLCircleStyleLayerTests.m
index 995802ff18..54ba8be6c1 100644
--- a/platform/darwin/test/MGLCircleStyleLayerTests.m
+++ b/platform/darwin/test/MGLCircleStyleLayerTests.m
@@ -31,8 +31,10 @@
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 21c2a9de40..7b31207902 100644
--- a/platform/darwin/test/MGLFillStyleLayerTests.m
+++ b/platform/darwin/test/MGLFillStyleLayerTests.m
@@ -31,7 +31,8 @@
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 79f0619f8a..801bc12ff8 100644
--- a/platform/darwin/test/MGLLineStyleLayerTests.m
+++ b/platform/darwin/test/MGLLineStyleLayerTests.m
@@ -33,14 +33,17 @@
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 6626d13901..8857dba9c5 100644
--- a/platform/darwin/test/MGLRuntimeStylingHelper.h
+++ b/platform/darwin/test/MGLRuntimeStylingHelper.h
@@ -1,35 +1,35 @@
#import <Foundation/Foundation.h>
#import "MGLTypes.h"
-#import "MGLStyleAttributeFunction.h"
+#import "MGLStyleValue.h"
@interface MGLRuntimeStylingHelper : NSObject
-+ (NSArray *)testPadding;
-+ (MGLStyleAttributeFunction *)testPaddingFunction;
++ (MGLStyleConstantValue<NSValue *> *)testPadding;
++ (MGLStyleFunction<NSValue *> *)testPaddingFunction;
-+ (NSArray *)testOffset;
-+ (MGLStyleAttributeFunction *)testOffsetFunction;
++ (MGLStyleConstantValue<NSValue *> *)testOffset;
++ (MGLStyleFunction<NSValue *> *)testOffsetFunction;
-+ (NSArray *)testFont;
-+ (MGLStyleAttributeFunction *)testFontFunction;
++ (MGLStyleConstantValue<NSArray<NSString *> *> *)testFont;
++ (MGLStyleFunction<NSArray<NSString *> *> *)testFontFunction;
-+ (NSArray *)testDashArray;
-+ (MGLStyleAttributeFunction *)testDashArrayFunction;
++ (MGLStyleConstantValue<NSArray<NSNumber *> *> *)testDashArray;
++ (MGLStyleFunction<NSArray<NSNumber *> *> *)testDashArrayFunction;
-+ (NSNumber *)testNumber;
-+ (MGLStyleAttributeFunction *)testNumberFunction;
++ (MGLStyleConstantValue<NSNumber *> *)testNumber;
++ (MGLStyleFunction<NSNumber *> *)testNumberFunction;
-+ (NSNumber *)testBool;
-+ (MGLStyleAttributeFunction *)testBoolFunction;
++ (MGLStyleConstantValue<NSNumber *> *)testBool;
++ (MGLStyleFunction<NSNumber *> *)testBoolFunction;
-+ (NSString *)testString;
-+ (MGLStyleAttributeFunction *)testStringFunction;
++ (MGLStyleConstantValue<NSString *> *)testString;
++ (MGLStyleFunction<NSString *> *)testStringFunction;
-+ (MGLColor *)testColor;
-+ (MGLStyleAttributeFunction *)testColorFunction;
++ (MGLStyleConstantValue<MGLColor *> *)testColor;
++ (MGLStyleFunction<MGLColor *> *)testColorFunction;
-+ (NSValue *)testEnum:(NSUInteger)value type:(const char *)type;
-+ (MGLStyleAttributeFunction *)testEnumFunction:(NSUInteger)value type:(const char *)type;
++ (MGLStyleConstantValue<NSValue *> *)testEnum:(NSUInteger)value type:(const char *)type;
++ (MGLStyleFunction<NSValue *> *)testEnumFunction:(NSUInteger)value type:(const char *)type;
@end
diff --git a/platform/darwin/test/MGLRuntimeStylingHelper.m b/platform/darwin/test/MGLRuntimeStylingHelper.m
index 29e80086ec..955c664f2c 100644
--- a/platform/darwin/test/MGLRuntimeStylingHelper.m
+++ b/platform/darwin/test/MGLRuntimeStylingHelper.m
@@ -10,7 +10,7 @@
@implementation MGLRuntimeStylingHelper
-+ (NSValue *)testPadding
++ (MGLStyleConstantValue<NSValue *> *)testPadding
{
MGLEdgeInsets insets = {
.top = 1,
@@ -18,129 +18,105 @@
.bottom = 1,
.right = 1,
};
- return [NSValue value:&insets withObjCType:@encode(MGLEdgeInsets)];
+ return [MGLStyleConstantValue<NSValue *> valueWithRawValue:[NSValue value:&insets withObjCType:@encode(MGLEdgeInsets)]];
}
-+ (MGLStyleAttributeFunction *)testPaddingFunction
++ (MGLStyleFunction<NSValue *> *)testPaddingFunction
{
- MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init];
- function.stops = @{
- @(18): self.testPadding,
- };
- return function;
+ return [MGLStyleFunction<NSValue *> functionWithStops:@{@(18): self.testPadding}];
}
-+ (NSValue *)testOffset
++ (MGLStyleConstantValue<NSValue *> *)testOffset
{
CGVector vector = CGVectorMake(1, 1);
- return [NSValue value:&vector withObjCType:@encode(CGVector)];
+ return [MGLStyleConstantValue<NSValue *> valueWithRawValue:[NSValue value:&vector withObjCType:@encode(CGVector)]];
}
-+ (MGLStyleAttributeFunction *)testOffsetFunction
++ (MGLStyleFunction<NSValue *> *)testOffsetFunction
{
- MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init];
- function.stops = @{
- @(18): self.testOffset,
- };
- return function;
+ return [MGLStyleFunction<NSValue *> valueWithStops:@{ @(18): self.testOffset }];
}
-+ (NSArray *)testFont
++ (MGLStyleConstantValue<NSArray<NSString *> *> *)testFont
{
- return @[@"Open Sans Regular", @"Arial Unicode MS Regular"];
+ return [MGLStyleConstantValue<NSArray<NSString *> *> valueWithRawValue:@[@"Open Sans Regular", @"Arial Unicode MS Regular"]];
}
-+ (MGLStyleAttributeFunction *)testFontFunction
++ (MGLStyleFunction<NSArray<NSString *> *> *)testFontFunction
{
- MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init];
- function.stops = @{
- @(18): self.testFont,
- };
- return function;
+ return [MGLStyleFunction<NSArray<NSString *> *> valueWithStops:@{ @18: self.testFont }];
}
-+ (NSArray *)testDashArray
++ (MGLStyleConstantValue<NSArray<NSNumber *> *> *)testDashArray
{
- return @[@1, @2];
+ return [MGLStyleConstantValue<NSArray<NSNumber *> *> valueWithRawValue:@[@1, @2]];
}
-+ (MGLStyleAttributeFunction *)testDashArrayFunction
++ (MGLStyleFunction<NSArray<NSNumber *> *> *)testDashArrayFunction
{
- MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init];
- function.stops = @{
- @(18): self.testDashArray,
- };
- return function;
+ return [MGLStyleFunction<NSArray<NSNumber *> *> valueWithStops:@{
+ @18: self.testDashArray,
+ }];
}
-+ (NSNumber *)testNumber
++ (MGLStyleConstantValue<NSNumber *> *)testNumber
{
- return @1;
+ return [MGLStyleConstantValue<NSNumber *> valueWithRawValue:@1];
}
-+ (MGLStyleAttributeFunction *)testNumberFunction
++ (MGLStyleFunction<NSNumber *> *)testNumberFunction
{
- MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init];
- function.stops = @{
- @(18): self.testNumber,
- };
- return function;
+ return [MGLStyleFunction<NSNumber *> valueWithStops:@{
+ @18: self.testNumber,
+ }];
}
-+ (NSNumber *)testBool
++ (MGLStyleConstantValue<NSNumber *> *)testBool
{
- return @YES;
+ return [MGLStyleConstantValue<NSNumber *> valueWithRawValue:@YES];
}
-+ (MGLStyleAttributeFunction *)testBoolFunction
++ (MGLStyleFunction<NSNumber *> *)testBoolFunction
{
- MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init];
- function.stops = @{
- @(18): self.testBool,
- };
- return function;
+ return [MGLStyleFunction<NSNumber *> valueWithStops:@{
+ @18: self.testBool,
+ }];
}
-+ (NSString *)testString
++ (MGLStyleConstantValue<NSString *> *)testString
{
- return @"test";
+ return [MGLStyleConstantValue<NSString *> valueWithRawValue:@"test"];
}
-+ (MGLStyleAttributeFunction *)testStringFunction
++ (MGLStyleFunction<NSString *> *)testStringFunction
{
- MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init];
- function.stops = @{
- @(18): self.testString,
- };
- return function;
+ return [MGLStyleFunction<NSString *> valueWithStops:@{
+ @18: self.testString,
+ }];
}
-+ (MGLColor *)testColor
++ (MGLStyleConstantValue<MGLColor *> *)testColor
{
- return [MGLColor redColor];
+ return [MGLStyleConstantValue<MGLColor *> valueWithRawValue:[MGLColor redColor]];
}
-+ (MGLStyleAttributeFunction *)testColorFunction
++ (MGLStyleFunction<MGLColor *> *)testColorFunction
{
- MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init];
- function.stops = @{
- @(18): self.testColor,
- };
- return function;
+ return [MGLStyleFunction<MGLColor *> valueWithStops:@{
+ @18: self.testColor,
+ }];
}
-+ (NSValue *)testEnum:(NSUInteger)value type:(const char *)type
++ (MGLStyleConstantValue<NSValue *> *)testEnum:(NSUInteger)value type:(const char *)type
{
- return [NSValue value:&value withObjCType:type];
+ return [MGLStyleConstantValue<NSValue *> valueWithRawValue:[NSValue value:&value withObjCType:type]];
}
-+ (MGLStyleAttributeFunction *)testEnumFunction:(NSUInteger)value type:(const char *)type
++ (MGLStyleFunction<NSValue *> *)testEnumFunction:(NSUInteger)value type:(const char *)type
{
- MGLStyleAttributeFunction *function = [[MGLStyleAttributeFunction alloc] init];
- function.stops = @{
- @(18): [self testEnum:value type:type],
- };
- return function;
+ return [MGLStyleFunction<NSValue *> valueWithStops:@{
+ @18: [self testEnum:value type:type],
+ }];
}
@end
diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.m b/platform/darwin/test/MGLSymbolStyleLayerTests.m
index 208c30a630..f60ae7c2a8 100644
--- a/platform/darwin/test/MGLSymbolStyleLayerTests.m
+++ b/platform/darwin/test/MGLSymbolStyleLayerTests.m
@@ -67,36 +67,44 @@
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 @@
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];