summaryrefslogtreecommitdiff
path: root/platform/darwin
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin')
-rw-r--r--platform/darwin/scripts/generate-style-code.js46
-rw-r--r--platform/darwin/src/MGLBaseStyleLayer.h2
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.h22
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.h17
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.h35
-rw-r--r--platform/darwin/src/MGLStyleLayer.h.ejs20
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.h156
-rw-r--r--platform/darwin/test/MGLSymbolStyleLayerTests.m8
8 files changed, 266 insertions, 40 deletions
diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js
index 33ac014295..7fca6021df 100644
--- a/platform/darwin/scripts/generate-style-code.js
+++ b/platform/darwin/scripts/generate-style-code.js
@@ -20,7 +20,13 @@ global.camelizeWithLeadingLowercase = function (str) {
});
};
-global.objCName = function (property) { return camelizeWithLeadingLowercase(property.name); }
+global.objCName = function (property) {
+ return camelizeWithLeadingLowercase(property.name);
+}
+
+global.objCType = function (layerType, propertyName) {
+ return `${prefix}${camelize(layerType)}${suffix}${camelize(propertyName)}`;
+}
global.arrayType = function (property) {
return property.type === 'array' ? property.name.split('-').pop() : false;
@@ -53,8 +59,8 @@ global.testHelperMessage = function (property, layerType, isFunction) {
case 'string':
return 'testString' + fnSuffix;
case 'enum':
- let objCType = `${prefix}${camelize(layerType)}${suffix}${camelize(property.name)}`;
- let objCEnum = `${objCType}${camelize(property.values[property.values.length-1])}`;
+ let objCType = global.objCType(layerType, property.name);
+ let objCEnum = `${objCType}${camelize(Object.keys(property.values)[Object.keys(property.values).length-1])}`;
return `testEnum${fnSuffix}:${objCEnum} type:@encode(${objCType})`;
case 'color':
return 'testColor' + fnSuffix;
@@ -77,10 +83,25 @@ global.testHelperMessage = function (property, layerType, isFunction) {
}
};
-global.propertyDoc = function (property, layerType) {
- let doc = property.doc.replace(/`(.+?)`/g, function (m, symbol, offset, str) {
- if ('values' in property && property.values.indexOf(symbol) !== -1) {
- let objCType = `${prefix}${camelize(layerType)}${suffix}${camelize(property.name)}`;
+global.propertyDoc = function (propertyName, property, layerType) {
+ // Match references to other property names & values.
+ // Requires the format 'When `foo` is set to `bar`,'.
+ let doc = property.doc.replace(/When `(.+?)` is set to `(.+?)`,/g, function (m, peerPropertyName, propertyValue, offset, str) {
+ let otherProperty = camelizeWithLeadingLowercase(peerPropertyName);
+ let otherValue = objCType(layerType, peerPropertyName) + camelize(propertyValue);
+ return 'When `' + `${otherProperty}` + '` is set to `' + `${otherValue}` + '`,';
+ });
+ // Match references to our own property values.
+ // Requires the format 'is equivalent to `bar`'.
+ doc = doc.replace(/is equivalent to `(.+?)`/g, function(m, propertyValue, offset, str) {
+ propertyValue = objCType(layerType, propertyName) + camelize(propertyValue);
+ return 'is equivalent to `' + propertyValue + '`';
+ });
+ // Format everything else: our property name & its possible values.
+ // Requires symbols to be surrounded by backticks.
+ doc = doc.replace(/`(.+?)`/g, function (m, symbol, offset, str) {
+ if ('values' in property && Object.keys(property.values).indexOf(symbol) !== -1) {
+ let objCType = objCType(layerType, property.name);
return '`' + `${objCType}${camelize(symbol)}` + '`';
}
if (str.substr(offset - 4, 3) !== 'CSS') {
@@ -88,6 +109,7 @@ global.propertyDoc = function (property, layerType) {
}
return '`' + symbol + '`';
});
+ // Format references to units.
if ('units' in property) {
if (!property.units.match(/s$/)) {
property.units += 's';
@@ -138,11 +160,11 @@ global.describeValue = function (value, property, layerType) {
let conjunction = '';
if (value.length === 2 && i === 0) conjunction = 'either ';
if (i === value.length - 1) conjunction = 'or ';
- let objCType = `${prefix}${camelize(layerType)}${suffix}${camelize(property.name)}`;
+ let objCType = global.objCType(layerType, property.name);
return `${conjunction}\`${objCType}${camelize(possibleValue)}\``;
}).join(separator);
} else {
- let objCType = `${prefix}${camelize(layerType)}${suffix}${camelize(property.name)}`;
+ let objCType = global.objCType(layerType, property.name);
displayValue = `\`${objCType}${camelize(value)}\``;
}
return `an \`NSValue\` object containing ${displayValue}`;
@@ -222,7 +244,7 @@ global.setterImplementation = function(property, layerType) {
implementation = `self.layer->set${camelize(property.name)}(${objCName(property)}.mbgl_stringPropertyValue);`;
break;
case 'enum':
- let objCType = `${prefix}${camelize(layerType)}${suffix}${camelize(property.name)}`;
+ let objCType = global.objCType(layerType, property.name);
implementation = `MGLSetEnumProperty(${objCName(property)}, ${camelize(property.name)}, ${mbglType(property)}, ${objCType});`;
break;
case 'color':
@@ -272,7 +294,7 @@ global.styleAttributeFactory = function (property, layerType) {
global.getterImplementation = function(property, layerType) {
if (property.type === 'enum') {
- let objCType = `${prefix}${camelize(layerType)}${suffix}${camelize(property.name)}`;
+ let objCType = global.objCType(layerType, property.name);
return `MGLGetEnumProperty(${camelize(property.name)}, ${mbglType(property)}, ${objCType});`;
}
let rawValue = `self.layer->get${camelize(property.name)}() ?: self.layer->getDefault${camelize(property.name)}()`;
@@ -299,7 +321,7 @@ const layerH = ejs.compile(fs.readFileSync('platform/darwin/src/MGLStyleLayer.h.
const layerM = ejs.compile(fs.readFileSync('platform/darwin/src/MGLStyleLayer.mm.ejs', 'utf8'), { strict: true});
const testLayers = ejs.compile(fs.readFileSync('platform/darwin/src/MGLRuntimeStylingTests.m.ejs', 'utf8'), { strict: true});
-const layers = spec.layer.type.values.map((type) => {
+const layers = Object.keys(spec.layer.type.values).map((type) => {
const layoutProperties = Object.keys(spec[`layout_${type}`]).reduce((memo, name) => {
if (name !== 'visibility') {
spec[`layout_${type}`][name].name = name;
diff --git a/platform/darwin/src/MGLBaseStyleLayer.h b/platform/darwin/src/MGLBaseStyleLayer.h
index 6cd525a0fd..fee7707c64 100644
--- a/platform/darwin/src/MGLBaseStyleLayer.h
+++ b/platform/darwin/src/MGLBaseStyleLayer.h
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface MGLBaseStyleLayer : NSObject
/**
- The display of the layer. A value of `NO` hides the layer.
+ Whether this layer is displayed. A value of `NO` hides the layer.
*/
@property (nonatomic, assign, getter=isVisible) BOOL visible;
diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h
index 2cda065b52..9e620eeeec 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.h
+++ b/platform/darwin/src/MGLCircleStyleLayer.h
@@ -6,13 +6,31 @@
NS_ASSUME_NONNULL_BEGIN
+/**
+ Controls the translation reference point.
+ */
typedef NS_ENUM(NSUInteger, MGLCircleStyleLayerCircleTranslateAnchor) {
+ /**
+ The circle is translated relative to the map.
+ */
MGLCircleStyleLayerCircleTranslateAnchorMap,
+ /**
+ The circle is translated relative to the viewport.
+ */
MGLCircleStyleLayerCircleTranslateAnchorViewport,
};
+/**
+ Controls the scaling behavior of the circle when the map is pitched.
+ */
typedef NS_ENUM(NSUInteger, MGLCircleStyleLayerCirclePitchScale) {
+ /**
+ Circles are scaled according to their apparent distance to the camera.
+ */
MGLCircleStyleLayerCirclePitchScaleMap,
+ /**
+ Circles are not scaled.
+ */
MGLCircleStyleLayerCirclePitchScaleViewport,
};
@@ -87,7 +105,7 @@ typedef NS_ENUM(NSUInteger, MGLCircleStyleLayerCirclePitchScale) {
@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> circleTranslate;
/**
- Control whether the translation is relative to the map (north) or viewport (screen)
+ Controls the translation reference point.
The default value of this property is an `NSValue` object containing `MGLCircleStyleLayerCircleTranslateAnchorMap`. Set this property to `nil` to reset it to the default value.
@@ -96,7 +114,7 @@ typedef NS_ENUM(NSUInteger, MGLCircleStyleLayerCirclePitchScale) {
@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.
+ Controls the scaling behavior of the circle when the map is pitched.
The default value of this property is an `NSValue` object containing `MGLCircleStyleLayerCirclePitchScaleMap`. Set this property to `nil` to reset it to the default value.
*/
diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h
index ab30efff5c..9adfd7c432 100644
--- a/platform/darwin/src/MGLFillStyleLayer.h
+++ b/platform/darwin/src/MGLFillStyleLayer.h
@@ -6,8 +6,17 @@
NS_ASSUME_NONNULL_BEGIN
+/**
+ Controls the translation reference point.
+ */
typedef NS_ENUM(NSUInteger, MGLFillStyleLayerFillTranslateAnchor) {
+ /**
+ The fill is translated relative to the map.
+ */
MGLFillStyleLayerFillTranslateAnchorMap,
+ /**
+ The fill is translated relative to the viewport.
+ */
MGLFillStyleLayerFillTranslateAnchorViewport,
};
@@ -41,7 +50,7 @@ typedef NS_ENUM(NSUInteger, MGLFillStyleLayerFillTranslateAnchor) {
@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.
+ 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.
*/
@@ -49,7 +58,7 @@ typedef NS_ENUM(NSUInteger, MGLFillStyleLayerFillTranslateAnchor) {
#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 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.
@@ -58,7 +67,7 @@ typedef NS_ENUM(NSUInteger, MGLFillStyleLayerFillTranslateAnchor) {
@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> 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 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.
@@ -84,7 +93,7 @@ typedef NS_ENUM(NSUInteger, MGLFillStyleLayerFillTranslateAnchor) {
@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> fillTranslate;
/**
- Control whether the translation is relative to the map (north) or viewport (screen)
+ Controls the translation reference point.
The default value of this property is an `NSValue` object containing `MGLFillStyleLayerFillTranslateAnchorMap`. Set this property to `nil` to reset it to the default value.
diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h
index 58c601d53c..d0a341d024 100644
--- a/platform/darwin/src/MGLLineStyleLayer.h
+++ b/platform/darwin/src/MGLLineStyleLayer.h
@@ -6,20 +6,53 @@
NS_ASSUME_NONNULL_BEGIN
+/**
+ The display of line endings.
+ */
typedef NS_ENUM(NSUInteger, MGLLineStyleLayerLineCap) {
+ /**
+ A cap with a squared-off end which is drawn to the exact endpoint of the line.
+ */
MGLLineStyleLayerLineCapButt,
+ /**
+ A cap with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line.
+ */
MGLLineStyleLayerLineCapRound,
+ /**
+ A cap with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width.
+ */
MGLLineStyleLayerLineCapSquare,
};
+/**
+ The display of lines when joining.
+ */
typedef NS_ENUM(NSUInteger, MGLLineStyleLayerLineJoin) {
+ /**
+ A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width.
+ */
MGLLineStyleLayerLineJoinBevel,
+ /**
+ A join with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line.
+ */
MGLLineStyleLayerLineJoinRound,
+ /**
+ A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet.
+ */
MGLLineStyleLayerLineJoinMiter,
};
+/**
+ Controls the translation reference point.
+ */
typedef NS_ENUM(NSUInteger, MGLLineStyleLayerLineTranslateAnchor) {
+ /**
+ The line is translated relative to the map.
+ */
MGLLineStyleLayerLineTranslateAnchorMap,
+ /**
+ The line is translated relative to the viewport.
+ */
MGLLineStyleLayerLineTranslateAnchorViewport,
};
@@ -116,7 +149,7 @@ typedef NS_ENUM(NSUInteger, MGLLineStyleLayerLineTranslateAnchor) {
@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> lineTranslate;
/**
- Control whether the translation is relative to the map (north) or viewport (screen)
+ Controls the translation reference point.
The default value of this property is an `NSValue` object containing `MGLLineStyleLayerLineTranslateAnchorMap`. Set this property to `nil` to reset it to the default value.
diff --git a/platform/darwin/src/MGLStyleLayer.h.ejs b/platform/darwin/src/MGLStyleLayer.h.ejs
index 054adcb32e..40b750e73c 100644
--- a/platform/darwin/src/MGLStyleLayer.h.ejs
+++ b/platform/darwin/src/MGLStyleLayer.h.ejs
@@ -15,8 +15,14 @@ NS_ASSUME_NONNULL_BEGIN
<% for (const property of layoutProperties) { -%>
<% if (property.type == "enum") { -%>
+/**
+ <%- propertyDoc(property.name, property, type) %>
+ */
typedef NS_ENUM(NSUInteger, MGL<%- camelize(type) %>StyleLayer<%- camelize(property.name) %>) {
-<% for (const value of property.values) { -%>
+<% for (const value in property.values) { -%>
+ /**
+ <%- propertyDoc(property.name, property.values[value], type) %>
+ */
MGL<%- camelize(type) %>StyleLayer<%- camelize(property.name) %><%- camelize(value) %>,
<% } -%>
};
@@ -25,8 +31,14 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(type) %>StyleLayer<%- camelize(prope
<% } -%>
<% for (const property of paintProperties) { -%>
<% if (property.type == "enum") { -%>
+/**
+ <%- propertyDoc(property.name, property, type) %>
+ */
typedef NS_ENUM(NSUInteger, MGL<%- camelize(type) %>StyleLayer<%- camelize(property.name) %>) {
-<% for (const value of property.values) { -%>
+<% for (const value in property.values) { -%>
+ /**
+ <%- propertyDoc(property.name, property.values[value], type) %>
+ */
MGL<%- camelize(type) %>StyleLayer<%- camelize(property.name) %><%- camelize(value) %>,
<% } -%>
};
@@ -75,7 +87,7 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(type) %>StyleLayer<%- camelize(prope
<% for (const property of layoutProperties) { -%>
/**
- <%- propertyDoc(property, type) %>
+ <%- propertyDoc(property.name, property, type) %>
<% if ('default' in property) { -%>
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.<% } %>
@@ -93,7 +105,7 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(type) %>StyleLayer<%- camelize(prope
<% for (const property of paintProperties) { -%>
/**
- <%- propertyDoc(property, type) %>
+ <%- propertyDoc(property.name, property, type) %>
<% if ('default' in property) { -%>
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.<% } %>
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h
index c501f512e8..b805ee18da 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.h
+++ b/platform/darwin/src/MGLSymbolStyleLayer.h
@@ -6,67 +6,199 @@
NS_ASSUME_NONNULL_BEGIN
+/**
+ Label placement relative to its geometry.
+ */
typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerSymbolPlacement) {
+ /**
+ The label is placed at the point where the geometry is located.
+ */
MGLSymbolStyleLayerSymbolPlacementPoint,
+ /**
+ The label is placed along the line of the geometry. Can only be used on `LineString` and `Polygon` geometries.
+ */
MGLSymbolStyleLayerSymbolPlacementLine,
};
+/**
+ In combination with `symbolPlacement`, determines the rotation behavior of icons.
+ */
typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerIconRotationAlignment) {
+ /**
+ When `symbolPlacement` is set to `MGLSymbolStyleLayerSymbolPlacementPoint`, aligns icons east-west. When `symbolPlacement` is set to `MGLSymbolStyleLayerSymbolPlacementLine`, aligns icon x-axes with the line.
+ */
MGLSymbolStyleLayerIconRotationAlignmentMap,
+ /**
+ Produces icons whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbolPlacement`.
+ */
MGLSymbolStyleLayerIconRotationAlignmentViewport,
+ /**
+ When `symbolPlacement` is set to `MGLSymbolStyleLayerSymbolPlacementPoint`, this is equivalent to `MGLSymbolStyleLayerIconRotationAlignmentViewport`. When `symbolPlacement` is set to `MGLSymbolStyleLayerSymbolPlacementLine`, this is equivalent to `MGLSymbolStyleLayerIconRotationAlignmentMap`.
+ */
MGLSymbolStyleLayerIconRotationAlignmentAuto,
};
+/**
+ Scales the icon to fit around the associated text.
+ */
typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerIconTextFit) {
+ /**
+ The icon is displayed at its intrinsic aspect ratio.
+ */
MGLSymbolStyleLayerIconTextFitNone,
- MGLSymbolStyleLayerIconTextFitBoth,
+ /**
+ The icon is scaled in the x-dimension to fit the width of the text.
+ */
MGLSymbolStyleLayerIconTextFitWidth,
+ /**
+ The icon is scaled in the y-dimension to fit the height of the text.
+ */
MGLSymbolStyleLayerIconTextFitHeight,
+ /**
+ The icon is scaled in both x- and y-dimensions.
+ */
+ MGLSymbolStyleLayerIconTextFitBoth,
};
+/**
+ Orientation of text when map is pitched.
+ */
typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextPitchAlignment) {
+ /**
+ The text is aligned to the plane of the map.
+ */
MGLSymbolStyleLayerTextPitchAlignmentMap,
+ /**
+ The text is aligned to the plane of the viewport.
+ */
MGLSymbolStyleLayerTextPitchAlignmentViewport,
+ /**
+ Automatically matches the value of `textRotationAlignment`.
+ */
MGLSymbolStyleLayerTextPitchAlignmentAuto,
};
+/**
+ In combination with `symbolPlacement`, determines the rotation behavior of the individual glyphs forming the text.
+ */
typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextRotationAlignment) {
+ /**
+ When `symbolPlacement` is set to `MGLSymbolStyleLayerSymbolPlacementPoint`, aligns text east-west. When `symbolPlacement` is set to `MGLSymbolStyleLayerSymbolPlacementLine`, aligns text x-axes with the line.
+ */
MGLSymbolStyleLayerTextRotationAlignmentMap,
+ /**
+ Produces glyphs whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbolPlacement`.
+ */
MGLSymbolStyleLayerTextRotationAlignmentViewport,
+ /**
+ When `symbolPlacement` is set to `MGLSymbolStyleLayerSymbolPlacementPoint`, this is equivalent to `MGLSymbolStyleLayerTextRotationAlignmentViewport`. When `symbolPlacement` is set to `MGLSymbolStyleLayerSymbolPlacementLine`, this is equivalent to `MGLSymbolStyleLayerTextRotationAlignmentMap`.
+ */
MGLSymbolStyleLayerTextRotationAlignmentAuto,
};
+/**
+ Text justification options.
+ */
typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextJustify) {
+ /**
+ The text is aligned to the left.
+ */
MGLSymbolStyleLayerTextJustifyLeft,
+ /**
+ The text is centered.
+ */
MGLSymbolStyleLayerTextJustifyCenter,
+ /**
+ The text is aligned to the right.
+ */
MGLSymbolStyleLayerTextJustifyRight,
};
+/**
+ Part of the text placed closest to the anchor.
+ */
typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextAnchor) {
+ /**
+ The center of the text is placed closest to the anchor.
+ */
MGLSymbolStyleLayerTextAnchorCenter,
+ /**
+ The left side of the text is placed closest to the anchor.
+ */
MGLSymbolStyleLayerTextAnchorLeft,
+ /**
+ The right side of the text is placed closest to the anchor.
+ */
MGLSymbolStyleLayerTextAnchorRight,
+ /**
+ The top of the text is placed closest to the anchor.
+ */
MGLSymbolStyleLayerTextAnchorTop,
+ /**
+ The bottom of the text is placed closest to the anchor.
+ */
MGLSymbolStyleLayerTextAnchorBottom,
+ /**
+ The top left corner of the text is placed closest to the anchor.
+ */
MGLSymbolStyleLayerTextAnchorTopLeft,
+ /**
+ The top right corner of the text is placed closest to the anchor.
+ */
MGLSymbolStyleLayerTextAnchorTopRight,
+ /**
+ The bottom left corner of the text is placed closest to the anchor.
+ */
MGLSymbolStyleLayerTextAnchorBottomLeft,
+ /**
+ The bottom right corner of the text is placed closest to the anchor.
+ */
MGLSymbolStyleLayerTextAnchorBottomRight,
};
+/**
+ Specifies how to capitalize text, similar to the CSS `text-transform` property.
+ */
typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextTransform) {
+ /**
+ The text is not altered.
+ */
MGLSymbolStyleLayerTextTransformNone,
+ /**
+ Forces all letters to be displayed in uppercase.
+ */
MGLSymbolStyleLayerTextTransformUppercase,
+ /**
+ Forces all letters to be displayed in lowercase.
+ */
MGLSymbolStyleLayerTextTransformLowercase,
};
+/**
+ Controls the translation reference point.
+ */
typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerIconTranslateAnchor) {
+ /**
+ Icons are translated relative to the map.
+ */
MGLSymbolStyleLayerIconTranslateAnchorMap,
+ /**
+ Icons are translated relative to the viewport.
+ */
MGLSymbolStyleLayerIconTranslateAnchorViewport,
};
+/**
+ Controls the translation reference point.
+ */
typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextTranslateAnchor) {
+ /**
+ The text is translated relative to the map.
+ */
MGLSymbolStyleLayerTextTranslateAnchorMap,
+ /**
+ The text is translated relative to the viewport.
+ */
MGLSymbolStyleLayerTextTranslateAnchorViewport,
};
@@ -93,7 +225,7 @@ typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextTranslateAnchor) {
#pragma mark - Accessing the Layout Attributes
/**
- Label placement relative to its geometry. `MGLSymbolStyleLayerSymbolPlacementLine` can only be used on LineStrings and Polygons.
+ Label placement relative to its geometry.
The default value of this property is an `NSValue` object containing `MGLSymbolStyleLayerSymbolPlacementPoint`. Set this property to `nil` to reset it to the default value.
*/
@@ -145,7 +277,7 @@ typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextTranslateAnchor) {
@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconOptional;
/**
- In combination with `symbolPlacement`, determines the rotation behavior of icons. The value `MGLSymbolStyleLayerIconRotationAlignmentViewport` produces icons whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbolPlacement`. When `symbolPlacement` is set to `point`, the value `MGLSymbolStyleLayerIconRotationAlignmentMap` produces icons whose x-axes are aligned east-west, and the value `MGLSymbolStyleLayerIconRotationAlignmentAuto` is equivalent to `MGLSymbolStyleLayerIconRotationAlignmentViewport`. When `symbolPlacement` is set to `line`, the value `MGLSymbolStyleLayerIconRotationAlignmentMap` produces icons whose x-axes are aligned with the line, and the value `MGLSymbolStyleLayerIconRotationAlignmentAuto` is equivalent to `MGLSymbolStyleLayerIconRotationAlignmentMap`.
+ In combination with `symbolPlacement`, determines the rotation behavior of icons.
The default value of this property is an `NSValue` object containing `MGLSymbolStyleLayerIconRotationAlignmentAuto`. Set this property to `nil` to reset it to the default value.
@@ -163,7 +295,7 @@ typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextTranslateAnchor) {
@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconSize;
/**
- Scales the icon to fit around the associated text. The value `MGLSymbolStyleLayerIconTextFitNone` performs no scaling. The values `MGLSymbolStyleLayerIconTextFitWidth` and `MGLSymbolStyleLayerIconTextFitHeight` scale the x- or y-dimension, respectively, to fit the text's dimensions. The value `MGLSymbolStyleLayerIconTextFitBoth` scales in both dimensions.
+ Scales the icon to fit around the associated text.
The default value of this property is an `NSValue` object containing `MGLSymbolStyleLayerIconTextFitNone`. Set this property to `nil` to reset it to the default value.
@@ -172,13 +304,13 @@ typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextTranslateAnchor) {
@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconTextFit;
/**
- Size of the additional area added to dimensions determined by `iconTextFix`, in clockwise order: top, right, bottom, left.
+ 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.
- 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.
+ 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 `MGLSymbolStyleLayerIconTextFitBoth`, `MGLSymbolStyleLayerIconTextFitWidth`, or `MGLSymbolStyleLayerIconTextFitHeight`. Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconTextFitPadding;
@@ -228,7 +360,7 @@ typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextTranslateAnchor) {
@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconOffset;
/**
- Orientation of text when map is pitched. Aligns text to the plane of the viewport when set to `MGLSymbolStyleLayerTextPitchAlignmentViewport` or the plane of the map when set to `MGLSymbolStyleLayerTextPitchAlignmentMap`. Matches `textRotationAlignment` if `MGLSymbolStyleLayerTextPitchAlignmentAuto`.
+ Orientation of text when map is pitched.
The default value of this property is an `NSValue` object containing `MGLSymbolStyleLayerTextPitchAlignmentAuto`. Set this property to `nil` to reset it to the default value.
@@ -237,7 +369,7 @@ typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextTranslateAnchor) {
@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textPitchAlignment;
/**
- In combination with `symbolPlacement`, determines the rotation behavior of the individual glyphs forming the text. The value `MGLSymbolStyleLayerTextRotationAlignmentViewport` produces glyphs whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbolPlacement`. When `symbolPlacement` is set to `point`, the value `MGLSymbolStyleLayerTextRotationAlignmentMap` produces glyphs whose x-axes are aligned east-west, and the value `MGLSymbolStyleLayerTextRotationAlignmentAuto` is equivalent to `MGLSymbolStyleLayerTextRotationAlignmentViewport`. When `symbolPlacement` is set to `line`, the value `MGLSymbolStyleLayerTextRotationAlignmentMap` produces glyphs whose x-axes are aligned with the line at the point where each glyph is placed, and the value `MGLSymbolStyleLayerTextRotationAlignmentAuto` is equivalent to `MGLSymbolStyleLayerTextRotationAlignmentMap`.
+ 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 `MGLSymbolStyleLayerTextRotationAlignmentAuto`. Set this property to `nil` to reset it to the default value.
@@ -445,7 +577,7 @@ typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextTranslateAnchor) {
#if TARGET_OS_IPHONE
/**
- The color of the icon's halo. Icon halos can only be used with sdf icons.
+ 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.
@@ -454,7 +586,7 @@ typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextTranslateAnchor) {
@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconHaloColor;
#else
/**
- The color of the icon's halo. Icon halos can only be used with sdf icons.
+ 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.
@@ -497,7 +629,7 @@ typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextTranslateAnchor) {
@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> iconTranslate;
/**
- Control whether the translation is relative to the map (north) or viewport (screen).
+ Controls the translation reference point.
The default value of this property is an `NSValue` object containing `MGLSymbolStyleLayerIconTranslateAnchorMap`. Set this property to `nil` to reset it to the default value.
@@ -588,7 +720,7 @@ typedef NS_ENUM(NSUInteger, MGLSymbolStyleLayerTextTranslateAnchor) {
@property (nonatomic, null_resettable) id <MGLStyleAttributeValue> textTranslate;
/**
- Control whether the translation is relative to the map (north) or viewport (screen).
+ Controls the translation reference point.
The default value of this property is an `NSValue` object containing `MGLSymbolStyleLayerTextTranslateAnchorMap`. Set this property to `nil` to reset it to the default value.
diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.m b/platform/darwin/test/MGLSymbolStyleLayerTests.m
index deee9f47ed..096a49b571 100644
--- a/platform/darwin/test/MGLSymbolStyleLayerTests.m
+++ b/platform/darwin/test/MGLSymbolStyleLayerTests.m
@@ -24,7 +24,7 @@ MGLSymbolStyleLayer *layer = [[MGLSymbolStyleLayer alloc] initWithLayerIdentifie
layer.iconOptional = [MGLRuntimeStylingHelper testBool];
layer.iconRotationAlignment = [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerIconRotationAlignmentAuto type:@encode(MGLSymbolStyleLayerIconRotationAlignment)];
layer.iconSize = [MGLRuntimeStylingHelper testNumber];
- layer.iconTextFit = [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerIconTextFitHeight type:@encode(MGLSymbolStyleLayerIconTextFit)];
+ layer.iconTextFit = [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerIconTextFitBoth type:@encode(MGLSymbolStyleLayerIconTextFit)];
layer.iconTextFitPadding = [MGLRuntimeStylingHelper testPadding];
layer.iconImage = [MGLRuntimeStylingHelper testString];
layer.iconRotate = [MGLRuntimeStylingHelper testNumber];
@@ -74,7 +74,7 @@ MGLSymbolStyleLayer *layer = [[MGLSymbolStyleLayer alloc] initWithLayerIdentifie
XCTAssertEqualObjects(gLayer.iconOptional, [MGLRuntimeStylingHelper testBool]);
XCTAssert([(NSValue *)gLayer.iconRotationAlignment isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerIconRotationAlignmentAuto type:@encode(MGLSymbolStyleLayerIconRotationAlignment)]], @"%@ is not equal to %@", gLayer.iconRotationAlignment, [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerIconRotationAlignmentAuto type:@encode(MGLSymbolStyleLayerIconRotationAlignment)]);
XCTAssertEqualObjects(gLayer.iconSize, [MGLRuntimeStylingHelper testNumber]);
- XCTAssert([(NSValue *)gLayer.iconTextFit isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerIconTextFitHeight type:@encode(MGLSymbolStyleLayerIconTextFit)]], @"%@ is not equal to %@", gLayer.iconTextFit, [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerIconTextFitHeight type:@encode(MGLSymbolStyleLayerIconTextFit)]);
+ XCTAssert([(NSValue *)gLayer.iconTextFit isEqualToValue:[MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerIconTextFitBoth type:@encode(MGLSymbolStyleLayerIconTextFit)]], @"%@ is not equal to %@", gLayer.iconTextFit, [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerIconTextFitBoth type:@encode(MGLSymbolStyleLayerIconTextFit)]);
XCTAssertEqualObjects(gLayer.iconTextFitPadding, [MGLRuntimeStylingHelper testPadding]);
XCTAssertEqualObjects(gLayer.iconImage, [MGLRuntimeStylingHelper testString]);
XCTAssertEqualObjects(gLayer.iconRotate, [MGLRuntimeStylingHelper testNumber]);
@@ -123,7 +123,7 @@ MGLSymbolStyleLayer *layer = [[MGLSymbolStyleLayer alloc] initWithLayerIdentifie
layer.iconOptional = [MGLRuntimeStylingHelper testBoolFunction];
layer.iconRotationAlignment = [MGLRuntimeStylingHelper testEnumFunction:MGLSymbolStyleLayerIconRotationAlignmentAuto type:@encode(MGLSymbolStyleLayerIconRotationAlignment)];
layer.iconSize = [MGLRuntimeStylingHelper testNumberFunction];
- layer.iconTextFit = [MGLRuntimeStylingHelper testEnumFunction:MGLSymbolStyleLayerIconTextFitHeight type:@encode(MGLSymbolStyleLayerIconTextFit)];
+ layer.iconTextFit = [MGLRuntimeStylingHelper testEnumFunction:MGLSymbolStyleLayerIconTextFitBoth type:@encode(MGLSymbolStyleLayerIconTextFit)];
layer.iconTextFitPadding = [MGLRuntimeStylingHelper testPaddingFunction];
layer.iconImage = [MGLRuntimeStylingHelper testStringFunction];
layer.iconRotate = [MGLRuntimeStylingHelper testNumberFunction];
@@ -172,7 +172,7 @@ MGLSymbolStyleLayer *layer = [[MGLSymbolStyleLayer alloc] initWithLayerIdentifie
XCTAssertEqualObjects(gLayer.iconOptional, [MGLRuntimeStylingHelper testBoolFunction]);
XCTAssertEqualObjects(gLayer.iconRotationAlignment, [MGLRuntimeStylingHelper testEnumFunction:MGLSymbolStyleLayerIconRotationAlignmentAuto type:@encode(MGLSymbolStyleLayerIconRotationAlignment)]);
XCTAssertEqualObjects(gLayer.iconSize, [MGLRuntimeStylingHelper testNumberFunction]);
- XCTAssertEqualObjects(gLayer.iconTextFit, [MGLRuntimeStylingHelper testEnumFunction:MGLSymbolStyleLayerIconTextFitHeight type:@encode(MGLSymbolStyleLayerIconTextFit)]);
+ XCTAssertEqualObjects(gLayer.iconTextFit, [MGLRuntimeStylingHelper testEnumFunction:MGLSymbolStyleLayerIconTextFitBoth type:@encode(MGLSymbolStyleLayerIconTextFit)]);
XCTAssertEqualObjects(gLayer.iconTextFitPadding, [MGLRuntimeStylingHelper testPaddingFunction]);
XCTAssertEqualObjects(gLayer.iconImage, [MGLRuntimeStylingHelper testStringFunction]);
XCTAssertEqualObjects(gLayer.iconRotate, [MGLRuntimeStylingHelper testNumberFunction]);