summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-08-25 21:59:55 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-08-26 15:40:10 -0700
commit9d368ea98d096c1eed2c1eb7edc4a37ff31b03b7 (patch)
tree602b5aaf36a8d3db50e14b58e668f53ffe8d99a0 /platform
parent8dff7ab2f0fe1f2d1412e79c99285f1a389e6541 (diff)
downloadqtlocation-mapboxgl-9d368ea98d096c1eed2c1eb7edc4a37ff31b03b7.tar.gz
[ios, macos] Mark MGLStyleLayer properties null_resettable
If the property is unset, return the default value. Fixes #6126.
Diffstat (limited to 'platform')
-rw-r--r--platform/darwin/scripts/generate-style-code.js28
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.h10
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.mm6
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.h28
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.mm10
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.h24
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.mm12
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.h52
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.mm22
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.h28
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.mm14
-rw-r--r--platform/darwin/src/MGLStyleAttributeFunction_Private.h2
-rw-r--r--platform/darwin/src/MGLStyleLayer.h.ejs22
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.h188
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.mm76
15 files changed, 266 insertions, 256 deletions
diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js
index 98f85bc66b..0419edd39d 100644
--- a/platform/darwin/scripts/generate-style-code.js
+++ b/platform/darwin/scripts/generate-style-code.js
@@ -258,28 +258,32 @@ global.arraySetterImplementation = function(property) {
return `self.layer->set${camelize(property.name)}(${objCName(property)}.mbgl_${convertedType(property)}PropertyValue);`;
}
-global.getterImplementation = function(property, layerType) {
+global.styleAttributeFactory = function (property, layerType) {
switch (property.type) {
case 'boolean':
- return `return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->get${camelize(property.name)}()];`
+ return 'mbgl_boolWithPropertyValueBool';
case 'number':
- return `return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->get${camelize(property.name)}()];`
+ return 'mbgl_numberWithPropertyValueNumber';
case 'string':
- return `return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->get${camelize(property.name)}()];`
+ return 'mbgl_stringWithPropertyValueString';
case 'enum':
- let objCType = `${prefix}${camelize(layerType)}${suffix}${camelize(property.name)}`;
- return `MGLGetEnumProperty(${camelize(property.name)}, ${mbglType(property)}, ${objCType});`;
+ throw new Error('Use MGLGetEnumProperty() for enums.');
case 'color':
- return `return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->get${camelize(property.name)}()];`
+ return 'mbgl_colorWithPropertyValueColor';
case 'array':
- return arrayGetterImplementation(property);
+ return `mbgl_${convertedType(property)}WithPropertyValue${camelize(convertedType(property))}`;
default:
- throw new Error(`unknown type for ${property.name}`)
+ throw new Error(`unknown type for ${property.name}`);
}
-}
+};
-global.arrayGetterImplementation = function(property) {
- return `return [MGLStyleAttribute mbgl_${convertedType(property)}WithPropertyValue${camelize(convertedType(property))}:self.layer->get${camelize(property.name)}()];`
+global.getterImplementation = function(property, layerType) {
+ if (property.type === 'enum') {
+ let objCType = `${prefix}${camelize(layerType)}${suffix}${camelize(property.name)}`;
+ return `MGLGetEnumProperty(${camelize(property.name)}, ${mbglType(property)}, ${objCType});`;
+ }
+ 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) {
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.h b/platform/darwin/src/MGLBackgroundStyleLayer.h
index 43802bc250..3fbd7e3869 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer.h
+++ b/platform/darwin/src/MGLBackgroundStyleLayer.h
@@ -13,23 +13,23 @@ NS_ASSUME_NONNULL_BEGIN
/**
The color with which the background will be drawn.
- If this property is set to `nil`, the layer uses an implicit default value of `blackColor`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> backgroundColor;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> backgroundColor;
/**
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, nullable) id <MGLStyleAttributeValue> backgroundPattern;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> backgroundPattern;
/**
The opacity at which the background will be drawn.
- If this property is set to `nil`, the layer uses an implicit default value of `1`.
+ The default value of this property is `1`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> backgroundOpacity;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> backgroundOpacity;
@end
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm
index 1a991a65e9..32e2e7847e 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer.mm
+++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm
@@ -37,7 +37,7 @@
}
- (id <MGLStyleAttributeValue>)backgroundColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getBackgroundColor()];
+ return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getBackgroundColor() ?: self.layer->getDefaultBackgroundColor()];
}
- (void)setBackgroundPattern:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)backgroundPattern {
@@ -46,7 +46,7 @@
}
- (id <MGLStyleAttributeValue>)backgroundPattern {
- return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getBackgroundPattern()];
+ return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getBackgroundPattern() ?: self.layer->getDefaultBackgroundPattern()];
}
- (void)setBackgroundOpacity:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)backgroundOpacity {
@@ -55,7 +55,7 @@
}
- (id <MGLStyleAttributeValue>)backgroundOpacity {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getBackgroundOpacity()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getBackgroundOpacity() ?: self.layer->getDefaultBackgroundOpacity()];
}
@end
diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h
index f79b9bb9a5..4c51c453c7 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.h
+++ b/platform/darwin/src/MGLCircleStyleLayer.h
@@ -25,55 +25,55 @@ typedef NS_ENUM(NSUInteger, MGLCircleStyleLayerCirclePitchScale) {
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of `5`.
+ The default value of this property is `5`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> circleRadius;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> circleRadius;
/**
The color of the circle.
- If this property is set to `nil`, the layer uses an implicit default value of `blackColor`.
+ The default value of this property is `blackColor`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> circleColor;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> circleColor;
/**
Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.
- If this property is set to `nil`, the layer uses an implicit default value of `0`.
+ The default value of this property is `0`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> circleBlur;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> circleBlur;
/**
The opacity at which the circle will be drawn.
- If this property is set to `nil`, the layer uses an implicit default value of `1`.
+ The default value of this property is `1`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> circleOpacity;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> circleOpacity;
/**
The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of 0 points from the left and 0 points from the top.
+ The default value of this property is 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, nullable) id <MGLStyleAttributeValue> circleTranslate;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> circleTranslate;
/**
Control whether the translation is relative to the map (north) or viewport (screen)
- If this property is set to `nil`, the layer uses an implicit default value of `MGLCircleStyleLayerCircleTranslateAnchorMap`.
+ The default value of this property is `MGLCircleStyleLayerCircleTranslateAnchorMap`. 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, nullable) id <MGLStyleAttributeValue> circleTranslateAnchor;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> circleTranslateAnchor;
/**
Controls the scaling behavior of the circle when the map is pitched. The value `MGLCircleStyleLayerCirclePitchScaleMap` scales circles according to their apparent distance to the camera. The value `MGLCircleStyleLayerCirclePitchScaleViewport` results in no pitch-related scaling.
- If this property is set to `nil`, the layer uses an implicit default value of `MGLCircleStyleLayerCirclePitchScaleMap`.
+ The default value of this property is `MGLCircleStyleLayerCirclePitchScaleMap`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> circlePitchScale;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> circlePitchScale;
@end
diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm
index d18a89833d..27be01505c 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.mm
+++ b/platform/darwin/src/MGLCircleStyleLayer.mm
@@ -37,7 +37,7 @@
}
- (id <MGLStyleAttributeValue>)circleRadius {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getCircleRadius()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getCircleRadius() ?: self.layer->getDefaultCircleRadius()];
}
- (void)setCircleColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)circleColor {
@@ -46,7 +46,7 @@
}
- (id <MGLStyleAttributeValue>)circleColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getCircleColor()];
+ return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getCircleColor() ?: self.layer->getDefaultCircleColor()];
}
- (void)setCircleBlur:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)circleBlur {
@@ -55,7 +55,7 @@
}
- (id <MGLStyleAttributeValue>)circleBlur {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getCircleBlur()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getCircleBlur() ?: self.layer->getDefaultCircleBlur()];
}
- (void)setCircleOpacity:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)circleOpacity {
@@ -64,7 +64,7 @@
}
- (id <MGLStyleAttributeValue>)circleOpacity {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getCircleOpacity()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getCircleOpacity() ?: self.layer->getDefaultCircleOpacity()];
}
- (void)setCircleTranslate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)circleTranslate {
@@ -73,7 +73,7 @@
}
- (id <MGLStyleAttributeValue>)circleTranslate {
- return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getCircleTranslate()];
+ return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getCircleTranslate() ?: self.layer->getDefaultCircleTranslate()];
}
- (void)setCircleTranslateAnchor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)circleTranslateAnchor {
diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h
index 8526e37a68..c1adc30938 100644
--- a/platform/darwin/src/MGLFillStyleLayer.h
+++ b/platform/darwin/src/MGLFillStyleLayer.h
@@ -18,55 +18,55 @@ typedef NS_ENUM(NSUInteger, MGLFillStyleLayerFillTranslateAnchor) {
/**
Whether or not the fill should be antialiased.
- If this property is set to `nil`, the layer uses an implicit default value of `YES`.
+ The default value of this property is `YES`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> fillAntialias;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> fillAntialias;
/**
The opacity of the entire fill layer. In contrast to the fill-color, this value will also affect the 1pt stroke around the fill, if the stroke is used.
- If this property is set to `nil`, the layer uses an implicit default value of `1`.
+ The default value of this property is `1`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> fillOpacity;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> fillOpacity;
/**
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.
- If this property is set to `nil`, the layer uses an implicit default value of `blackColor`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> fillColor;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> fillColor;
/**
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 `YES`. Otherwise, it is ignored.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> fillOutlineColor;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> fillOutlineColor;
/**
The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of 0 points from the left and 0 points from the top.
+ The default value of this property is 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, nullable) id <MGLStyleAttributeValue> fillTranslate;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> fillTranslate;
/**
Control whether the translation is relative to the map (north) or viewport (screen)
- If this property is set to `nil`, the layer uses an implicit default value of `MGLFillStyleLayerFillTranslateAnchorMap`.
+ The default value of this property is `MGLFillStyleLayerFillTranslateAnchorMap`. 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, nullable) id <MGLStyleAttributeValue> fillTranslateAnchor;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> 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, nullable) id <MGLStyleAttributeValue> fillPattern;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> fillPattern;
@end
diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm
index 8a71a186c5..192235f69e 100644
--- a/platform/darwin/src/MGLFillStyleLayer.mm
+++ b/platform/darwin/src/MGLFillStyleLayer.mm
@@ -37,7 +37,7 @@
}
- (id <MGLStyleAttributeValue>)fillAntialias {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getFillAntialias()];
+ return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getFillAntialias() ?: self.layer->getDefaultFillAntialias()];
}
- (void)setFillOpacity:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillOpacity {
@@ -46,7 +46,7 @@
}
- (id <MGLStyleAttributeValue>)fillOpacity {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getFillOpacity()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getFillOpacity() ?: self.layer->getDefaultFillOpacity()];
}
- (void)setFillColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillColor {
@@ -55,7 +55,7 @@
}
- (id <MGLStyleAttributeValue>)fillColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getFillColor()];
+ return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getFillColor() ?: self.layer->getDefaultFillColor()];
}
- (void)setFillOutlineColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillOutlineColor {
@@ -64,7 +64,7 @@
}
- (id <MGLStyleAttributeValue>)fillOutlineColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getFillOutlineColor()];
+ return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getFillOutlineColor() ?: self.layer->getDefaultFillOutlineColor()];
}
- (void)setFillTranslate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillTranslate {
@@ -73,7 +73,7 @@
}
- (id <MGLStyleAttributeValue>)fillTranslate {
- return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getFillTranslate()];
+ return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getFillTranslate() ?: self.layer->getDefaultFillTranslate()];
}
- (void)setFillTranslateAnchor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillTranslateAnchor {
@@ -91,7 +91,7 @@
}
- (id <MGLStyleAttributeValue>)fillPattern {
- return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getFillPattern()];
+ return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getFillPattern() ?: self.layer->getDefaultFillPattern()];
}
@end
diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h
index e76faee6ad..5dd87c3552 100644
--- a/platform/darwin/src/MGLLineStyleLayer.h
+++ b/platform/darwin/src/MGLLineStyleLayer.h
@@ -30,106 +30,106 @@ typedef NS_ENUM(NSUInteger, MGLLineStyleLayerLineTranslateAnchor) {
/**
The display of line endings.
- If this property is set to `nil`, the layer uses an implicit default value of `MGLLineStyleLayerLineCapButt`.
+ The default value of this property is `MGLLineStyleLayerLineCapButt`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> lineCap;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> lineCap;
/**
The display of lines when joining.
- If this property is set to `nil`, the layer uses an implicit default value of `MGLLineStyleLayerLineJoinMiter`.
+ The default value of this property is `MGLLineStyleLayerLineJoinMiter`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> lineJoin;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> lineJoin;
/**
Used to automatically convert miter joins to bevel joins for sharp angles.
- If this property is set to `nil`, the layer uses an implicit default value of `2`.
+ The default value of this property is `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 `MGLLineStyleLayerLineJoinMiter`. Otherwise, it is ignored.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> lineMiterLimit;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> lineMiterLimit;
/**
Used to automatically convert round joins to miter joins for shallow angles.
- If this property is set to `nil`, the layer uses an implicit default value of `1.05`.
+ The default value of this property is `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 `MGLLineStyleLayerLineJoinRound`. Otherwise, it is ignored.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> lineRoundLimit;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> lineRoundLimit;
#pragma mark - Accessing the Paint Attributes
/**
The opacity at which the line will be drawn.
- If this property is set to `nil`, the layer uses an implicit default value of `1`.
+ The default value of this property is `1`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> lineOpacity;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> lineOpacity;
/**
The color with which the line will be drawn.
- If this property is set to `nil`, the layer uses an implicit default value of `blackColor`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> lineColor;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> lineColor;
/**
The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of 0 points from the left and 0 points from the top.
+ The default value of this property is 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, nullable) id <MGLStyleAttributeValue> lineTranslate;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> lineTranslate;
/**
Control whether the translation is relative to the map (north) or viewport (screen)
- If this property is set to `nil`, the layer uses an implicit default value of `MGLLineStyleLayerLineTranslateAnchorMap`.
+ The default value of this property is `MGLLineStyleLayerLineTranslateAnchorMap`. 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, nullable) id <MGLStyleAttributeValue> lineTranslateAnchor;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> lineTranslateAnchor;
/**
Stroke thickness.
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of `1`.
+ The default value of this property is `1`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> lineWidth;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> 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.
- If this property is set to `nil`, the layer uses an implicit default value of `0`.
+ The default value of this property is `0`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> lineGapWidth;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> lineGapWidth;
/**
The line's offset perpendicular to its direction. Values may be positive or negative, where positive indicates "rightwards" (if you were moving in the direction of the line) and negative indicates "leftwards."
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of `0`.
+ The default value of this property is `0`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> lineOffset;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> lineOffset;
/**
Blur applied to the line, in points.
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of `0`.
+ The default value of this property is `0`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> lineBlur;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> 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.
@@ -138,12 +138,12 @@ typedef NS_ENUM(NSUInteger, MGLLineStyleLayerLineTranslateAnchor) {
This property is only applied to the style if `linePattern` is set to `nil`. Otherwise, it is ignored.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> lineDasharray;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> 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, nullable) id <MGLStyleAttributeValue> linePattern;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> linePattern;
@end
diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm
index 281764242c..ffb0d4e394 100644
--- a/platform/darwin/src/MGLLineStyleLayer.mm
+++ b/platform/darwin/src/MGLLineStyleLayer.mm
@@ -55,7 +55,7 @@
}
- (id <MGLStyleAttributeValue>)lineMiterLimit {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineMiterLimit()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineMiterLimit() ?: self.layer->getDefaultLineMiterLimit()];
}
- (void)setLineRoundLimit:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineRoundLimit {
@@ -64,7 +64,7 @@
}
- (id <MGLStyleAttributeValue>)lineRoundLimit {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineRoundLimit()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineRoundLimit() ?: self.layer->getDefaultLineRoundLimit()];
}
#pragma mark - Accessing the Paint Attributes
@@ -75,7 +75,7 @@
}
- (id <MGLStyleAttributeValue>)lineOpacity {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineOpacity()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineOpacity() ?: self.layer->getDefaultLineOpacity()];
}
- (void)setLineColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineColor {
@@ -84,7 +84,7 @@
}
- (id <MGLStyleAttributeValue>)lineColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getLineColor()];
+ return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getLineColor() ?: self.layer->getDefaultLineColor()];
}
- (void)setLineTranslate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineTranslate {
@@ -93,7 +93,7 @@
}
- (id <MGLStyleAttributeValue>)lineTranslate {
- return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getLineTranslate()];
+ return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getLineTranslate() ?: self.layer->getDefaultLineTranslate()];
}
- (void)setLineTranslateAnchor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineTranslateAnchor {
@@ -111,7 +111,7 @@
}
- (id <MGLStyleAttributeValue>)lineWidth {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineWidth()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineWidth() ?: self.layer->getDefaultLineWidth()];
}
- (void)setLineGapWidth:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineGapWidth {
@@ -120,7 +120,7 @@
}
- (id <MGLStyleAttributeValue>)lineGapWidth {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineGapWidth()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineGapWidth() ?: self.layer->getDefaultLineGapWidth()];
}
- (void)setLineOffset:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineOffset {
@@ -129,7 +129,7 @@
}
- (id <MGLStyleAttributeValue>)lineOffset {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineOffset()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineOffset() ?: self.layer->getDefaultLineOffset()];
}
- (void)setLineBlur:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineBlur {
@@ -138,7 +138,7 @@
}
- (id <MGLStyleAttributeValue>)lineBlur {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineBlur()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getLineBlur() ?: self.layer->getDefaultLineBlur()];
}
- (void)setLineDasharray:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)lineDasharray {
@@ -147,7 +147,7 @@
}
- (id <MGLStyleAttributeValue>)lineDasharray {
- return [MGLStyleAttribute mbgl_numberArrayWithPropertyValueNumberArray:self.layer->getLineDasharray()];
+ return [MGLStyleAttribute mbgl_numberArrayWithPropertyValueNumberArray:self.layer->getLineDasharray() ?: self.layer->getDefaultLineDasharray()];
}
- (void)setLinePattern:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)linePattern {
@@ -156,7 +156,7 @@
}
- (id <MGLStyleAttributeValue>)linePattern {
- return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getLinePattern()];
+ return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getLinePattern() ?: self.layer->getDefaultLinePattern()];
}
@end
diff --git a/platform/darwin/src/MGLRasterStyleLayer.h b/platform/darwin/src/MGLRasterStyleLayer.h
index 9284221cec..5c0fd91307 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.h
+++ b/platform/darwin/src/MGLRasterStyleLayer.h
@@ -13,55 +13,55 @@ NS_ASSUME_NONNULL_BEGIN
/**
The opacity at which the image will be drawn.
- If this property is set to `nil`, the layer uses an implicit default value of `1`.
+ The default value of this property is `1`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> rasterOpacity;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> rasterOpacity;
/**
Rotates hues around the color wheel.
This property is measured in degrees.
- If this property is set to `nil`, the layer uses an implicit default value of `0`.
+ The default value of this property is `0`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> rasterHueRotate;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> rasterHueRotate;
/**
Increase or reduce the brightness of the image. The value is the minimum brightness.
- If this property is set to `nil`, the layer uses an implicit default value of `0`.
+ The default value of this property is `0`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> rasterBrightnessMin;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> rasterBrightnessMin;
/**
Increase or reduce the brightness of the image. The value is the maximum brightness.
- If this property is set to `nil`, the layer uses an implicit default value of `1`.
+ The default value of this property is `1`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> rasterBrightnessMax;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> rasterBrightnessMax;
/**
Increase or reduce the saturation of the image.
- If this property is set to `nil`, the layer uses an implicit default value of `0`.
+ The default value of this property is `0`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> rasterSaturation;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> rasterSaturation;
/**
Increase or reduce the contrast of the image.
- If this property is set to `nil`, the layer uses an implicit default value of `0`.
+ The default value of this property is `0`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> rasterContrast;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> rasterContrast;
/**
Fade duration when a new tile is added.
This property is measured in milliseconds.
- If this property is set to `nil`, the layer uses an implicit default value of `300`.
+ The default value of this property is `300`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> rasterFadeDuration;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> rasterFadeDuration;
@end
diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm
index 291b7d60d8..37368c6577 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.mm
+++ b/platform/darwin/src/MGLRasterStyleLayer.mm
@@ -37,7 +37,7 @@
}
- (id <MGLStyleAttributeValue>)rasterOpacity {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterOpacity()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterOpacity() ?: self.layer->getDefaultRasterOpacity()];
}
- (void)setRasterHueRotate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)rasterHueRotate {
@@ -46,7 +46,7 @@
}
- (id <MGLStyleAttributeValue>)rasterHueRotate {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterHueRotate()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterHueRotate() ?: self.layer->getDefaultRasterHueRotate()];
}
- (void)setRasterBrightnessMin:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)rasterBrightnessMin {
@@ -55,7 +55,7 @@
}
- (id <MGLStyleAttributeValue>)rasterBrightnessMin {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterBrightnessMin()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterBrightnessMin() ?: self.layer->getDefaultRasterBrightnessMin()];
}
- (void)setRasterBrightnessMax:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)rasterBrightnessMax {
@@ -64,7 +64,7 @@
}
- (id <MGLStyleAttributeValue>)rasterBrightnessMax {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterBrightnessMax()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterBrightnessMax() ?: self.layer->getDefaultRasterBrightnessMax()];
}
- (void)setRasterSaturation:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)rasterSaturation {
@@ -73,7 +73,7 @@
}
- (id <MGLStyleAttributeValue>)rasterSaturation {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterSaturation()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterSaturation() ?: self.layer->getDefaultRasterSaturation()];
}
- (void)setRasterContrast:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)rasterContrast {
@@ -82,7 +82,7 @@
}
- (id <MGLStyleAttributeValue>)rasterContrast {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterContrast()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterContrast() ?: self.layer->getDefaultRasterContrast()];
}
- (void)setRasterFadeDuration:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)rasterFadeDuration {
@@ -91,7 +91,7 @@
}
- (id <MGLStyleAttributeValue>)rasterFadeDuration {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterFadeDuration()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getRasterFadeDuration() ?: self.layer->getDefaultRasterFadeDuration()];
}
@end
diff --git a/platform/darwin/src/MGLStyleAttributeFunction_Private.h b/platform/darwin/src/MGLStyleAttributeFunction_Private.h
index a75e17483d..18977fa784 100644
--- a/platform/darwin/src/MGLStyleAttributeFunction_Private.h
+++ b/platform/darwin/src/MGLStyleAttributeFunction_Private.h
@@ -29,7 +29,7 @@
#define MGLGetEnumProperty(Name, MBGLType, ObjCType) \
const char *type = @encode(ObjCType); \
- mbgl::style::PropertyValue<mbgl::style::MBGLType> property = self.layer->get##Name(); \
+ mbgl::style::PropertyValue<mbgl::style::MBGLType> property = self.layer->get##Name() ?: self.layer->getDefault##Name(); \
if (property.isConstant()) { \
return [NSValue value:&property.asConstant() withObjCType:type]; \
} else if (property.isFunction()) { \
diff --git a/platform/darwin/src/MGLStyleLayer.h.ejs b/platform/darwin/src/MGLStyleLayer.h.ejs
index 870c6a45c9..2b36a3067a 100644
--- a/platform/darwin/src/MGLStyleLayer.h.ejs
+++ b/platform/darwin/src/MGLStyleLayer.h.ejs
@@ -40,13 +40,16 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(type) %>StyleLayer<%- camelize(prope
<% for (const property of layoutProperties) { -%>
/**
- <%- propertyDoc(property, type) %><% if ('default' in property) { %>
+ <%- propertyDoc(property, type) %>
+<% if ('default' in property) { -%>
- <% if (property.required) { %>The default value of this property is <%= propertyDefault(property, type) %>.<% } else { %>If this property is set to `nil`, the layer uses an implicit default value of <%= propertyDefault(property, type) %>.<% } %><% } %><% if (property.requires) { %>
+ The default value of this property is <%- propertyDefault(property, type) %>.<% if (!property.required) { %> Set this property to `nil` to reset it to the default value.<% } %>
+<% } if (property.requires) { -%>
- <%= propertyReqs(property, layoutPropertiesByName, type) %><% } %>
+ <%- propertyReqs(property, layoutPropertiesByName, type) %>
+<% } -%>
*/
-@property (nonatomic<% if (!property.required) { %>, nullable<% } %>) <%- propertyType(property, false, type) %> <%- camelizeWithLeadingLowercase(property.name) %>;
+@property (nonatomic<% if (!property.required) { %>, null_resettable<% } %>) <%- propertyType(property, false, type) %> <%- camelizeWithLeadingLowercase(property.name) %>;
<% } -%>
<% } -%>
@@ -54,13 +57,16 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(type) %>StyleLayer<%- camelize(prope
<% for (const property of paintProperties) { -%>
/**
- <%- propertyDoc(property, type) %><% if ('default' in property) { %>
+ <%- propertyDoc(property, type) %>
+<% if ('default' in property) { -%>
- <% if (property.required) { %>The default value of this property is <%= propertyDefault(property, type) %>.<% } else { %>If this property is set to `nil`, the layer uses an implicit default value of <%= propertyDefault(property, type) %>.<% } %><% } %><% if (property.requires) { %>
+ The default value of this property is <%- propertyDefault(property, type) %>.<% if (!property.required) { %> Set this property to `nil` to reset it to the default value.<% } %>
+<% } if (property.requires) { -%>
- <%= propertyReqs(property, paintPropertiesByName, type) %><% } %>
+ <%- propertyReqs(property, paintPropertiesByName, type) %>
+<% } -%>
*/
-@property (nonatomic<% if (!property.required) { %>, nullable<% } %>) <%- propertyType(property, false, type) %> <%- camelizeWithLeadingLowercase(property.name) %>;
+@property (nonatomic<% if (!property.required) { %>, null_resettable<% } %>) <%- propertyType(property, false, type) %> <%- camelizeWithLeadingLowercase(property.name) %>;
<% } -%>
@end
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h
index 85fbdaba3d..3db1bf03b1 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.h
+++ b/platform/darwin/src/MGLSymbolStyleLayer.h
@@ -74,460 +74,460 @@ typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextTranslateAnchor) {
/**
Label placement relative to its geometry. `MGLSymbolStyleLayerSymbolPlacementLine` can only be used on LineStrings and Polygons.
- If this property is set to `nil`, the layer uses an implicit default value of `MGLSymbolStyleLayerSymbolPlacementPoint`.
+ The default value of this property is `MGLSymbolStyleLayerSymbolPlacementPoint`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> symbolPlacement;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> symbolPlacement;
/**
Distance between two symbol anchors.
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of `250`.
+ The default value of this property is `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 `MGLSymbolStyleLayerSymbolPlacementLine`. Otherwise, it is ignored.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> symbolSpacing;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> 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.
- If this property is set to `nil`, the layer uses an implicit default value of `NO`.
+ The default value of this property is `NO`. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> symbolAvoidEdges;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> symbolAvoidEdges;
/**
If true, the icon will be visible even if it collides with other previously drawn symbols.
- If this property is set to `nil`, the layer uses an implicit default value of `NO`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> iconAllowOverlap;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconAllowOverlap;
/**
If true, other symbols can be visible even if they collide with the icon.
- If this property is set to `nil`, the layer uses an implicit default value of `NO`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> iconIgnorePlacement;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconIgnorePlacement;
/**
If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.
- If this property is set to `nil`, the layer uses an implicit default value of `NO`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> iconOptional;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconOptional;
/**
Orientation of icon when map is rotated.
- If this property is set to `nil`, the layer uses an implicit default value of `MGLSymbolStyleLayerIconRotationAlignmentViewport`.
+ The default value of this property is `MGLSymbolStyleLayerIconRotationAlignmentViewport`. 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, nullable) id <MGLStyleAttributeValue> iconRotationAlignment;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconRotationAlignment;
/**
Scale factor for icon. 1 is original size, 3 triples the size.
- If this property is set to `nil`, the layer uses an implicit default value of `1`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> iconSize;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconSize;
/**
Position and scale an icon by the its corresponding text.
- If this property is set to `nil`, the layer uses an implicit default value of `MGLSymbolStyleLayerIconTextFitNone`.
+ The default value of this property is `MGLSymbolStyleLayerIconTextFitNone`. 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, nullable) id <MGLStyleAttributeValue> iconTextFit;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconTextFit;
/**
Size of padding area around the text-fit size in clockwise order: top, right, bottom, left.
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of `NSEdgeInsetsZero` or `UIEdgeInsetsZero`.
+ The default value of this property is `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 `iconTextFit` is non-`nil`, and `textField` is non-`nil`. Otherwise, it is ignored.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> iconTextFitPadding;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconTextFitPadding;
/**
A string with {tokens} replaced, referencing the data property to pull from.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> iconImage;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconImage;
/**
Rotates the icon clockwise.
This property is measured in degrees.
- If this property is set to `nil`, the layer uses an implicit default value of `0`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> iconRotate;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconRotate;
/**
Size of the additional area around the icon bounding box used for detecting symbol collisions.
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of `2`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> iconPadding;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconPadding;
/**
If true, the icon may be flipped to prevent it from being rendered upside-down.
- If this property is set to `nil`, the layer uses an implicit default value of `NO`.
+ The default value of this property is `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 `MGLSymbolStyleLayerIconRotationAlignmentMap`, and `symbolPlacement` is set to `MGLSymbolStyleLayerSymbolPlacementLine`. Otherwise, it is ignored.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> iconKeepUpright;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconKeepUpright;
/**
Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up.
- If this property is set to `nil`, the layer uses an implicit default value of 0 from the left and 0 from the top.
+ The default value of this property is 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, nullable) id <MGLStyleAttributeValue> iconOffset;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconOffset;
/**
Aligns text to the plane of the `MGLSymbolStyleLayerTextPitchAlignmentViewport` or the `MGLSymbolStyleLayerTextPitchAlignmentMap` when the map is pitched. Matches `textRotationAlignment` if unspecified.
This property is only applied to the style if `textField` is non-`nil`. Otherwise, it is ignored.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> textPitchAlignment;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textPitchAlignment;
/**
Orientation of text when map is rotated.
- If this property is set to `nil`, the layer uses an implicit default value of `MGLSymbolStyleLayerTextRotationAlignmentViewport`.
+ The default value of this property is `MGLSymbolStyleLayerTextRotationAlignmentViewport`. 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, nullable) id <MGLStyleAttributeValue> textRotationAlignment;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textRotationAlignment;
/**
Value to use for a text label. Feature properties are specified using tokens like {field_name}.
- If this property is set to `nil`, the layer uses an implicit default value of ``.
+ The default value of this property is ``. Set this property to `nil` to reset it to the default value.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> textField;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textField;
/**
Font stack to use for displaying text.
- If this property is set to `nil`, the layer uses an implicit default value of `Open Sans Regular`, `Arial Unicode MS Regular`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> textFont;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textFont;
/**
Font size.
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of `16`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> textSize;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textSize;
/**
The maximum line width for text wrapping.
This property is measured in ems.
- If this property is set to `nil`, the layer uses an implicit default value of `10`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> textMaxWidth;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textMaxWidth;
/**
Text leading value for multi-line text.
This property is measured in ems.
- If this property is set to `nil`, the layer uses an implicit default value of `1.2`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> textLineHeight;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textLineHeight;
/**
Text tracking amount.
This property is measured in ems.
- If this property is set to `nil`, the layer uses an implicit default value of `0`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> textLetterSpacing;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textLetterSpacing;
/**
Text justification options.
- If this property is set to `nil`, the layer uses an implicit default value of `MGLSymbolStyleLayerTextJustifyCenter`.
+ The default value of this property is `MGLSymbolStyleLayerTextJustifyCenter`. 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, nullable) id <MGLStyleAttributeValue> textJustify;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textJustify;
/**
Part of the text placed closest to the anchor.
- If this property is set to `nil`, the layer uses an implicit default value of `MGLSymbolStyleLayerTextAnchorCenter`.
+ The default value of this property is `MGLSymbolStyleLayerTextAnchorCenter`. 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, nullable) id <MGLStyleAttributeValue> textAnchor;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textAnchor;
/**
Maximum angle change between adjacent characters.
This property is measured in degrees.
- If this property is set to `nil`, the layer uses an implicit default value of `45`.
+ The default value of this property is `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 `MGLSymbolStyleLayerSymbolPlacementLine`. Otherwise, it is ignored.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> textMaxAngle;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textMaxAngle;
/**
Rotates the text clockwise.
This property is measured in degrees.
- If this property is set to `nil`, the layer uses an implicit default value of `0`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> textRotate;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textRotate;
/**
Size of the additional area around the text bounding box used for detecting symbol collisions.
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of `2`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> textPadding;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textPadding;
/**
If true, the text may be flipped vertically to prevent it from being rendered upside-down.
- If this property is set to `nil`, the layer uses an implicit default value of `YES`.
+ The default value of this property is `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 `MGLSymbolStyleLayerTextRotationAlignmentMap`, and `symbolPlacement` is set to `MGLSymbolStyleLayerSymbolPlacementLine`. Otherwise, it is ignored.
*/
-@property (nonatomic, nullable) id <MGLStyleAttributeValue> textKeepUpright;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textKeepUpright;
/**
Specifies how to capitalize text, similar to the CSS `text-transform` property.
- If this property is set to `nil`, the layer uses an implicit default value of `MGLSymbolStyleLayerTextTransformNone`.
+ The default value of this property is `MGLSymbolStyleLayerTextTransformNone`. 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, nullable) id <MGLStyleAttributeValue> textTransform;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> 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.
- If this property is set to `nil`, the layer uses an implicit default value of 0 ems from the left and 0 ems from the top.
+ The default value of this property is 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, nullable) id <MGLStyleAttributeValue> textOffset;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textOffset;
/**
If true, the text will be visible even if it collides with other previously drawn symbols.
- If this property is set to `nil`, the layer uses an implicit default value of `NO`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> textAllowOverlap;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textAllowOverlap;
/**
If true, other symbols can be visible even if they collide with the text.
- If this property is set to `nil`, the layer uses an implicit default value of `NO`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> textIgnorePlacement;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textIgnorePlacement;
/**
If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.
- If this property is set to `nil`, the layer uses an implicit default value of `NO`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> textOptional;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textOptional;
#pragma mark - Accessing the Paint Attributes
/**
The opacity at which the icon will be drawn.
- If this property is set to `nil`, the layer uses an implicit default value of `1`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> iconOpacity;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconOpacity;
/**
The color of the icon. This can only be used with sdf icons.
- If this property is set to `nil`, the layer uses an implicit default value of `blackColor`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> iconColor;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconColor;
/**
The color of the icon's halo. Icon halos can only be used with sdf icons.
- If this property is set to `nil`, the layer uses an implicit default value of `clearColor`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> iconHaloColor;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconHaloColor;
/**
Distance of halo to the icon outline.
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of `0`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> iconHaloWidth;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconHaloWidth;
/**
Fade out the halo towards the outside.
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of `0`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> iconHaloBlur;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> 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.
- If this property is set to `nil`, the layer uses an implicit default value of 0 points from the left and 0 points from the top.
+ The default value of this property is 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, nullable) id <MGLStyleAttributeValue> iconTranslate;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconTranslate;
/**
Control whether the translation is relative to the map (north) or viewport (screen).
- If this property is set to `nil`, the layer uses an implicit default value of `MGLSymbolStyleLayerIconTranslateAnchorMap`.
+ The default value of this property is `MGLSymbolStyleLayerIconTranslateAnchorMap`. 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, nullable) id <MGLStyleAttributeValue> iconTranslateAnchor;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconTranslateAnchor;
/**
The opacity at which the text will be drawn.
- If this property is set to `nil`, the layer uses an implicit default value of `1`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> textOpacity;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textOpacity;
/**
The color with which the text will be drawn.
- If this property is set to `nil`, the layer uses an implicit default value of `blackColor`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> textColor;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textColor;
/**
The color of the text's halo, which helps it stand out from backgrounds.
- If this property is set to `nil`, the layer uses an implicit default value of `clearColor`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> textHaloColor;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textHaloColor;
/**
Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of `0`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> textHaloWidth;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textHaloWidth;
/**
The halo's fadeout distance towards the outside.
This property is measured in points.
- If this property is set to `nil`, the layer uses an implicit default value of `0`.
+ The default value of this property is `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, nullable) id <MGLStyleAttributeValue> textHaloBlur;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> 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.
- If this property is set to `nil`, the layer uses an implicit default value of 0 points from the left and 0 points from the top.
+ The default value of this property is 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, nullable) id <MGLStyleAttributeValue> textTranslate;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textTranslate;
/**
Control whether the translation is relative to the map (north) or viewport (screen).
- If this property is set to `nil`, the layer uses an implicit default value of `MGLSymbolStyleLayerTextTranslateAnchorMap`.
+ The default value of this property is `MGLSymbolStyleLayerTextTranslateAnchorMap`. 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, nullable) id <MGLStyleAttributeValue> textTranslateAnchor;
+@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textTranslateAnchor;
@end
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm
index 88ebfd43e8..159e3c4d0b 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.mm
+++ b/platform/darwin/src/MGLSymbolStyleLayer.mm
@@ -46,7 +46,7 @@
}
- (id <MGLStyleAttributeValue>)symbolSpacing {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getSymbolSpacing()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getSymbolSpacing() ?: self.layer->getDefaultSymbolSpacing()];
}
- (void)setSymbolAvoidEdges:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)symbolAvoidEdges {
@@ -55,7 +55,7 @@
}
- (id <MGLStyleAttributeValue>)symbolAvoidEdges {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getSymbolAvoidEdges()];
+ return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getSymbolAvoidEdges() ?: self.layer->getDefaultSymbolAvoidEdges()];
}
- (void)setIconAllowOverlap:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconAllowOverlap {
@@ -64,7 +64,7 @@
}
- (id <MGLStyleAttributeValue>)iconAllowOverlap {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconAllowOverlap()];
+ return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconAllowOverlap() ?: self.layer->getDefaultIconAllowOverlap()];
}
- (void)setIconIgnorePlacement:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconIgnorePlacement {
@@ -73,7 +73,7 @@
}
- (id <MGLStyleAttributeValue>)iconIgnorePlacement {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconIgnorePlacement()];
+ return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconIgnorePlacement() ?: self.layer->getDefaultIconIgnorePlacement()];
}
- (void)setIconOptional:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconOptional {
@@ -82,7 +82,7 @@
}
- (id <MGLStyleAttributeValue>)iconOptional {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconOptional()];
+ return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconOptional() ?: self.layer->getDefaultIconOptional()];
}
- (void)setIconRotationAlignment:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconRotationAlignment {
@@ -100,7 +100,7 @@
}
- (id <MGLStyleAttributeValue>)iconSize {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconSize()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconSize() ?: self.layer->getDefaultIconSize()];
}
- (void)setIconTextFit:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconTextFit {
@@ -118,7 +118,7 @@
}
- (id <MGLStyleAttributeValue>)iconTextFitPadding {
- return [MGLStyleAttribute mbgl_paddingWithPropertyValuePadding:self.layer->getIconTextFitPadding()];
+ return [MGLStyleAttribute mbgl_paddingWithPropertyValuePadding:self.layer->getIconTextFitPadding() ?: self.layer->getDefaultIconTextFitPadding()];
}
- (void)setIconImage:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconImage {
@@ -127,7 +127,7 @@
}
- (id <MGLStyleAttributeValue>)iconImage {
- return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getIconImage()];
+ return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getIconImage() ?: self.layer->getDefaultIconImage()];
}
- (void)setIconRotate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconRotate {
@@ -136,7 +136,7 @@
}
- (id <MGLStyleAttributeValue>)iconRotate {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconRotate()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconRotate() ?: self.layer->getDefaultIconRotate()];
}
- (void)setIconPadding:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconPadding {
@@ -145,7 +145,7 @@
}
- (id <MGLStyleAttributeValue>)iconPadding {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconPadding()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconPadding() ?: self.layer->getDefaultIconPadding()];
}
- (void)setIconKeepUpright:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconKeepUpright {
@@ -154,7 +154,7 @@
}
- (id <MGLStyleAttributeValue>)iconKeepUpright {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconKeepUpright()];
+ return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconKeepUpright() ?: self.layer->getDefaultIconKeepUpright()];
}
- (void)setIconOffset:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconOffset {
@@ -163,7 +163,7 @@
}
- (id <MGLStyleAttributeValue>)iconOffset {
- return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getIconOffset()];
+ return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getIconOffset() ?: self.layer->getDefaultIconOffset()];
}
- (void)setTextPitchAlignment:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textPitchAlignment {
@@ -190,7 +190,7 @@
}
- (id <MGLStyleAttributeValue>)textField {
- return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getTextField()];
+ return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getTextField() ?: self.layer->getDefaultTextField()];
}
- (void)setTextFont:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textFont {
@@ -199,7 +199,7 @@
}
- (id <MGLStyleAttributeValue>)textFont {
- return [MGLStyleAttribute mbgl_stringArrayWithPropertyValueStringArray:self.layer->getTextFont()];
+ return [MGLStyleAttribute mbgl_stringArrayWithPropertyValueStringArray:self.layer->getTextFont() ?: self.layer->getDefaultTextFont()];
}
- (void)setTextSize:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textSize {
@@ -208,7 +208,7 @@
}
- (id <MGLStyleAttributeValue>)textSize {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextSize()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextSize() ?: self.layer->getDefaultTextSize()];
}
- (void)setTextMaxWidth:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textMaxWidth {
@@ -217,7 +217,7 @@
}
- (id <MGLStyleAttributeValue>)textMaxWidth {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextMaxWidth()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextMaxWidth() ?: self.layer->getDefaultTextMaxWidth()];
}
- (void)setTextLineHeight:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textLineHeight {
@@ -226,7 +226,7 @@
}
- (id <MGLStyleAttributeValue>)textLineHeight {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextLineHeight()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextLineHeight() ?: self.layer->getDefaultTextLineHeight()];
}
- (void)setTextLetterSpacing:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textLetterSpacing {
@@ -235,7 +235,7 @@
}
- (id <MGLStyleAttributeValue>)textLetterSpacing {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextLetterSpacing()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextLetterSpacing() ?: self.layer->getDefaultTextLetterSpacing()];
}
- (void)setTextJustify:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textJustify {
@@ -262,7 +262,7 @@
}
- (id <MGLStyleAttributeValue>)textMaxAngle {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextMaxAngle()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextMaxAngle() ?: self.layer->getDefaultTextMaxAngle()];
}
- (void)setTextRotate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textRotate {
@@ -271,7 +271,7 @@
}
- (id <MGLStyleAttributeValue>)textRotate {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextRotate()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextRotate() ?: self.layer->getDefaultTextRotate()];
}
- (void)setTextPadding:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textPadding {
@@ -280,7 +280,7 @@
}
- (id <MGLStyleAttributeValue>)textPadding {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextPadding()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextPadding() ?: self.layer->getDefaultTextPadding()];
}
- (void)setTextKeepUpright:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textKeepUpright {
@@ -289,7 +289,7 @@
}
- (id <MGLStyleAttributeValue>)textKeepUpright {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextKeepUpright()];
+ return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextKeepUpright() ?: self.layer->getDefaultTextKeepUpright()];
}
- (void)setTextTransform:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textTransform {
@@ -307,7 +307,7 @@
}
- (id <MGLStyleAttributeValue>)textOffset {
- return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getTextOffset()];
+ return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getTextOffset() ?: self.layer->getDefaultTextOffset()];
}
- (void)setTextAllowOverlap:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textAllowOverlap {
@@ -316,7 +316,7 @@
}
- (id <MGLStyleAttributeValue>)textAllowOverlap {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextAllowOverlap()];
+ return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextAllowOverlap() ?: self.layer->getDefaultTextAllowOverlap()];
}
- (void)setTextIgnorePlacement:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textIgnorePlacement {
@@ -325,7 +325,7 @@
}
- (id <MGLStyleAttributeValue>)textIgnorePlacement {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextIgnorePlacement()];
+ return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextIgnorePlacement() ?: self.layer->getDefaultTextIgnorePlacement()];
}
- (void)setTextOptional:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textOptional {
@@ -334,7 +334,7 @@
}
- (id <MGLStyleAttributeValue>)textOptional {
- return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextOptional()];
+ return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextOptional() ?: self.layer->getDefaultTextOptional()];
}
#pragma mark - Accessing the Paint Attributes
@@ -345,7 +345,7 @@
}
- (id <MGLStyleAttributeValue>)iconOpacity {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconOpacity()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconOpacity() ?: self.layer->getDefaultIconOpacity()];
}
- (void)setIconColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconColor {
@@ -354,7 +354,7 @@
}
- (id <MGLStyleAttributeValue>)iconColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getIconColor()];
+ return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getIconColor() ?: self.layer->getDefaultIconColor()];
}
- (void)setIconHaloColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconHaloColor {
@@ -363,7 +363,7 @@
}
- (id <MGLStyleAttributeValue>)iconHaloColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getIconHaloColor()];
+ return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getIconHaloColor() ?: self.layer->getDefaultIconHaloColor()];
}
- (void)setIconHaloWidth:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconHaloWidth {
@@ -372,7 +372,7 @@
}
- (id <MGLStyleAttributeValue>)iconHaloWidth {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconHaloWidth()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconHaloWidth() ?: self.layer->getDefaultIconHaloWidth()];
}
- (void)setIconHaloBlur:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconHaloBlur {
@@ -381,7 +381,7 @@
}
- (id <MGLStyleAttributeValue>)iconHaloBlur {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconHaloBlur()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconHaloBlur() ?: self.layer->getDefaultIconHaloBlur()];
}
- (void)setIconTranslate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconTranslate {
@@ -390,7 +390,7 @@
}
- (id <MGLStyleAttributeValue>)iconTranslate {
- return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getIconTranslate()];
+ return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getIconTranslate() ?: self.layer->getDefaultIconTranslate()];
}
- (void)setIconTranslateAnchor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconTranslateAnchor {
@@ -408,7 +408,7 @@
}
- (id <MGLStyleAttributeValue>)textOpacity {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextOpacity()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextOpacity() ?: self.layer->getDefaultTextOpacity()];
}
- (void)setTextColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textColor {
@@ -417,7 +417,7 @@
}
- (id <MGLStyleAttributeValue>)textColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getTextColor()];
+ return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getTextColor() ?: self.layer->getDefaultTextColor()];
}
- (void)setTextHaloColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textHaloColor {
@@ -426,7 +426,7 @@
}
- (id <MGLStyleAttributeValue>)textHaloColor {
- return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getTextHaloColor()];
+ return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getTextHaloColor() ?: self.layer->getDefaultTextHaloColor()];
}
- (void)setTextHaloWidth:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textHaloWidth {
@@ -435,7 +435,7 @@
}
- (id <MGLStyleAttributeValue>)textHaloWidth {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextHaloWidth()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextHaloWidth() ?: self.layer->getDefaultTextHaloWidth()];
}
- (void)setTextHaloBlur:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textHaloBlur {
@@ -444,7 +444,7 @@
}
- (id <MGLStyleAttributeValue>)textHaloBlur {
- return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextHaloBlur()];
+ return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextHaloBlur() ?: self.layer->getDefaultTextHaloBlur()];
}
- (void)setTextTranslate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textTranslate {
@@ -453,7 +453,7 @@
}
- (id <MGLStyleAttributeValue>)textTranslate {
- return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getTextTranslate()];
+ return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getTextTranslate() ?: self.layer->getDefaultTextTranslate()];
}
- (void)setTextTranslateAnchor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textTranslateAnchor {