summaryrefslogtreecommitdiff
path: root/platform/darwin/src
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src')
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.h42
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.mm47
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.h181
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.mm77
4 files changed, 208 insertions, 139 deletions
diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h
index f0fc95db06..76f8cbd4c6 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.h
+++ b/platform/darwin/src/MGLCircleStyleLayer.h
@@ -9,18 +9,18 @@ NS_ASSUME_NONNULL_BEGIN
/**
Controls the scaling behavior of the circle when the map is pitched.
- Values of this type are used in the `MGLCircleStyleLayer.circlePitchScale`
+ Values of this type are used in the `MGLCircleStyleLayer.circleScaleAlignment`
property.
*/
-typedef NS_ENUM(NSUInteger, MGLCirclePitchScale) {
+typedef NS_ENUM(NSUInteger, MGLCircleScaleAlignment) {
/**
Circles are scaled according to their apparent distance to the camera.
*/
- MGLCirclePitchScaleMap,
+ MGLCircleScaleAlignmentMap,
/**
Circles are not scaled.
*/
- MGLCirclePitchScaleViewport,
+ MGLCircleScaleAlignmentViewport,
};
/**
@@ -119,15 +119,6 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslateAnchor) {
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleOpacity;
/**
- Controls the scaling behavior of the circle when the map is pitched.
-
- The default value of this property is an `MGLStyleValue` object containing an
- `NSValue` object containing `MGLCirclePitchScaleMap`. Set this property to
- `nil` to reset it to the default value.
- */
-@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *circlePitchScale;
-
-/**
Circle radius.
This property is measured in points.
@@ -139,6 +130,21 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslateAnchor) {
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleRadius;
/**
+ Controls the scaling behavior of the circle when the map is pitched.
+
+ The default value of this property is an `MGLStyleValue` object containing an
+ `NSValue` object containing `MGLCircleScaleAlignmentMap`. Set this property to
+ `nil` to reset it to the default value.
+
+ This attribute corresponds to the <a
+ href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-circle-circle-pitch-scale"><code>circle-pitch-scale</code></a>
+ layout property in the Mapbox Style Specification.
+ */
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *circleScaleAlignment;
+
+@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *circlePitchScale __attribute__((unavailable("Use circleScaleAlignment instead.")));
+
+/**
The geometry's offset.
This property is measured in points.
@@ -173,17 +179,17 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslateAnchor) {
#pragma mark Working with Circle Style Layer Attribute Values
/**
- Creates a new value object containing the given `MGLCirclePitchScale` enumeration.
+ Creates a new value object containing the given `MGLCircleScaleAlignment` enumeration.
- @param circlePitchScale The value for the new object.
+ @param circleScaleAlignment The value for the new object.
@return A new value object that contains the enumeration value.
*/
-+ (instancetype)valueWithMGLCirclePitchScale:(MGLCirclePitchScale)circlePitchScale;
++ (instancetype)valueWithMGLCircleScaleAlignment:(MGLCircleScaleAlignment)circleScaleAlignment;
/**
- The `MGLCirclePitchScale` enumeration representation of the value.
+ The `MGLCircleScaleAlignment` enumeration representation of the value.
*/
-@property (readonly) MGLCirclePitchScale MGLCirclePitchScaleValue;
+@property (readonly) MGLCircleScaleAlignment MGLCircleScaleAlignmentValue;
/**
Creates a new value object containing the given `MGLCircleTranslateAnchor` enumeration.
diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm
index ecba9b01d3..c23658b518 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.mm
+++ b/platform/darwin/src/MGLCircleStyleLayer.mm
@@ -11,9 +11,9 @@
#include <mbgl/style/layers/circle_layer.hpp>
namespace mbgl {
- MBGL_DEFINE_ENUM(MGLCirclePitchScale, {
- { MGLCirclePitchScaleMap, "map" },
- { MGLCirclePitchScaleViewport, "viewport" },
+ MBGL_DEFINE_ENUM(MGLCircleScaleAlignment, {
+ { MGLCircleScaleAlignmentMap, "map" },
+ { MGLCircleScaleAlignmentViewport, "viewport" },
});
MBGL_DEFINE_ENUM(MGLCircleTranslateAnchor, {
@@ -173,32 +173,37 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setCirclePitchScale:(MGLStyleValue<NSValue *> *)circlePitchScale {
+- (void)setCircleRadius:(MGLStyleValue<NSNumber *> *)circleRadius {
MGLAssertStyleLayerIsValid();
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::CirclePitchScaleType, NSValue *, mbgl::style::CirclePitchScaleType, MGLCirclePitchScale>().toEnumPropertyValue(circlePitchScale);
- self.rawLayer->setCirclePitchScale(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(circleRadius);
+ self.rawLayer->setCircleRadius(mbglValue);
}
-- (MGLStyleValue<NSValue *> *)circlePitchScale {
+- (MGLStyleValue<NSNumber *> *)circleRadius {
MGLAssertStyleLayerIsValid();
- auto propertyValue = self.rawLayer->getCirclePitchScale() ?: self.rawLayer->getDefaultCirclePitchScale();
- return MGLStyleValueTransformer<mbgl::style::CirclePitchScaleType, NSValue *, mbgl::style::CirclePitchScaleType, MGLCirclePitchScale>().toEnumStyleValue(propertyValue);
+ auto propertyValue = self.rawLayer->getCircleRadius() ?: self.rawLayer->getDefaultCircleRadius();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-- (void)setCircleRadius:(MGLStyleValue<NSNumber *> *)circleRadius {
+- (void)setCircleScaleAlignment:(MGLStyleValue<NSValue *> *)circleScaleAlignment {
MGLAssertStyleLayerIsValid();
- auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(circleRadius);
- self.rawLayer->setCircleRadius(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::CirclePitchScaleType, NSValue *, mbgl::style::CirclePitchScaleType, MGLCircleScaleAlignment>().toEnumPropertyValue(circleScaleAlignment);
+ self.rawLayer->setCirclePitchScale(mbglValue);
}
-- (MGLStyleValue<NSNumber *> *)circleRadius {
+- (MGLStyleValue<NSValue *> *)circleScaleAlignment {
MGLAssertStyleLayerIsValid();
- auto propertyValue = self.rawLayer->getCircleRadius() ?: self.rawLayer->getDefaultCircleRadius();
- return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
+ auto propertyValue = self.rawLayer->getCirclePitchScale() ?: self.rawLayer->getDefaultCirclePitchScale();
+ return MGLStyleValueTransformer<mbgl::style::CirclePitchScaleType, NSValue *, mbgl::style::CirclePitchScaleType, MGLCircleScaleAlignment>().toEnumStyleValue(propertyValue);
+}
+
+
+- (void)setCirclePitchScale:(MGLStyleValue<NSValue *> *)circlePitchScale {
+ NSAssert(NO, @"Use -setCircleScaleAlignment: instead.");
}
- (void)setCircleTranslate:(MGLStyleValue<NSValue *> *)circleTranslate {
@@ -234,14 +239,14 @@ namespace mbgl {
@implementation NSValue (MGLCircleStyleLayerAdditions)
-+ (NSValue *)valueWithMGLCirclePitchScale:(MGLCirclePitchScale)circlePitchScale {
- return [NSValue value:&circlePitchScale withObjCType:@encode(MGLCirclePitchScale)];
++ (NSValue *)valueWithMGLCircleScaleAlignment:(MGLCircleScaleAlignment)circleScaleAlignment {
+ return [NSValue value:&circleScaleAlignment withObjCType:@encode(MGLCircleScaleAlignment)];
}
-- (MGLCirclePitchScale)MGLCirclePitchScaleValue {
- MGLCirclePitchScale circlePitchScale;
- [self getValue:&circlePitchScale];
- return circlePitchScale;
+- (MGLCircleScaleAlignment)MGLCircleScaleAlignmentValue {
+ MGLCircleScaleAlignment circleScaleAlignment;
+ [self getValue:&circleScaleAlignment];
+ return circleScaleAlignment;
}
+ (NSValue *)valueWithMGLCircleTranslateAnchor:(MGLCircleTranslateAnchor)circleTranslateAnchor {
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h
index e12faa46ea..8edc88dfa1 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.h
+++ b/platform/darwin/src/MGLSymbolStyleLayer.h
@@ -268,7 +268,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
layer.sourceLayerIdentifier = "pois"
layer.iconImageName = MGLStyleValue(rawValue: "coffee")
layer.iconScale = MGLStyleValue(rawValue: 0.5)
- layer.textField = MGLStyleValue(rawValue: "{name}")
+ layer.text = MGLStyleValue(rawValue: "{name}")
layer.textTranslate = MGLStyleValue(rawValue: NSValue(cgVector: CGVector(dx: 10, dy: 0)))
layer.textJustification = MGLStyleValue(rawValue: NSValue(mglTextJustification: .left))
layer.textAnchor = MGLStyleValue(rawValue: NSValue(mglTextAnchor: .left))
@@ -352,7 +352,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
the default value.
This property is only applied to the style if `iconImageName` is non-`nil`, and
- `textField` is non-`nil`. Otherwise, it is ignored.
+ `text` is non-`nil`. Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable, getter=isIconOptional) MGLStyleValue<NSNumber *> *iconOptional;
@@ -432,7 +432,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
reset it to the default value.
This property is only applied to the style if `iconImageName` is non-`nil`, and
- `textField` is non-`nil`. Otherwise, it is ignored.
+ `text` is non-`nil`. Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *iconTextFit;
@@ -446,7 +446,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
property to `nil` to reset it to the default value.
This property is only applied to the style if `iconImageName` is non-`nil`, and
- `textField` is non-`nil`, and `iconTextFit` is set to an `MGLStyleValue` object
+ `text` is non-`nil`, and `iconTextFit` is set to an `MGLStyleValue` object
containing an `NSValue` object containing `MGLIconTextFitBoth`,
`MGLIconTextFitWidth`, or `MGLIconTextFitHeight`. Otherwise, it is ignored.
*/
@@ -482,7 +482,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSNumber` object containing `YES`. Set this property to `nil` to reset it to
the default value.
- This property is only applied to the style if `textField` is non-`nil`, and
+ This property is only applied to the style if `text` is non-`nil`, and
`textRotationAlignment` is set to an `MGLStyleValue` object containing an
`NSValue` object containing `MGLTextRotationAlignmentMap`, and
`symbolPlacement` is set to an `MGLStyleValue` object containing an `NSValue`
@@ -506,7 +506,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSNumber` object containing the float `45`. Set this property to `nil` to
reset it to the default value.
- This property is only applied to the style if `textField` is non-`nil`, and
+ This property is only applied to the style if `text` is non-`nil`, and
`symbolPlacement` is set to an `MGLStyleValue` object containing an `NSValue`
object containing `MGLSymbolPlacementLine`. Otherwise, it is ignored.
@@ -528,8 +528,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSNumber` object containing the float `10`. Set this property to `nil` to
reset it to the default value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
This attribute corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-max-width"><code>text-max-width</code></a>
@@ -584,6 +584,22 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *symbolSpacing;
/**
+ Value to use for a text label. Feature properties are specified using tokens
+ like {field_name}.
+
+ The default value of this property is an `MGLStyleValue` object containing the
+ empty string. Set this property to `nil` to reset it to the default value.
+
+ This attribute corresponds to the <a
+ href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-field"><code>text-field</code></a>
+ layout property in the Mapbox Style Specification.
+ */
+@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *text;
+
+
+@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *textField __attribute__((unavailable("Use text instead.")));
+
+/**
If true, the text will be visible even if it collides with other previously
drawn symbols.
@@ -591,8 +607,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSNumber` object containing `NO`. Set this property to `nil` to reset it to
the default value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
This attribute corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-allow-overlap"><code>text-allow-overlap</code></a>
@@ -610,31 +626,60 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSValue` object containing `MGLTextAnchorCenter`. Set this property to `nil`
to reset it to the default value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textAnchor;
/**
- Value to use for a text label. Feature properties are specified using tokens
- like {field_name}.
+ An array of font face names used to display the text.
+
+ Each font name must be included in the `{fontstack}` portion of the JSON
+ stylesheet’s <a
+ href="https://www.mapbox.com/mapbox-gl-style-spec/#glyphs"><code>glyphs</code></a>
+ property. You can register a custom font when designing the style in Mapbox
+ Studio. Fonts installed on the system are not used.
+
+ The first font named in the array is applied to the text. For each character in
+ the text, if the first font lacks a glyph for the character, the next font is
+ applied as a fallback, and so on.
The default value of this property is an `MGLStyleValue` object containing the
- empty string. Set this property to `nil` to reset it to the default value.
+ array `Open Sans Regular`, `Arial Unicode MS Regular`. Set this property to
+ `nil` to reset it to the default value.
+
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
+
+ This attribute corresponds to the <a
+ href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-font"><code>text-font</code></a>
+ layout property in the Mapbox Style Specification.
*/
-@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *textField;
+@property (nonatomic, null_resettable) MGLStyleValue<NSArray<NSString *> *> *textFontNames;
+
+
+@property (nonatomic, null_resettable) MGLStyleValue<NSArray<NSString *> *> *textFont __attribute__((unavailable("Use textFontNames instead.")));
/**
- Font stack to use for displaying text.
+ Font size.
- The default value of this property is an `MGLStyleValue` object containing the
- array `Open Sans Regular`, `Arial Unicode MS Regular`. Set this property to
- `nil` to reset it to the default value.
+ This property is measured in points.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ The default value of this property is an `MGLStyleValue` object containing an
+ `NSNumber` object containing the float `16`. Set this property to `nil` to
+ reset it to the default value.
+
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
+
+ This attribute corresponds to the <a
+ href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-size"><code>text-size</code></a>
+ layout property in the Mapbox Style Specification.
*/
-@property (nonatomic, null_resettable) MGLStyleValue<NSArray<NSString *> *> *textFont;
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textFontSize;
+
+
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textSize __attribute__((unavailable("Use textFontSize instead.")));
/**
If true, other symbols can be visible even if they collide with the text.
@@ -643,8 +688,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSNumber` object containing `NO`. Set this property to `nil` to reset it to
the default value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
This attribute corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-ignore-placement"><code>text-ignore-placement</code></a>
@@ -662,8 +707,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSValue` object containing `MGLTextJustificationCenter`. 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.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
This attribute corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-justify"><code>text-justify</code></a>
@@ -683,8 +728,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSNumber` object containing the float `0`. Set this property to `nil` to reset
it to the default value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textLetterSpacing;
@@ -697,8 +742,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSNumber` object containing the float `1.2`. Set this property to `nil` to
reset it to the default value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textLineHeight;
@@ -712,8 +757,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
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.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textOffset;
@@ -725,7 +770,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSNumber` object containing `NO`. Set this property to `nil` to reset it to
the default value.
- This property is only applied to the style if `textField` is non-`nil`, and
+ This property is only applied to the style if `text` is non-`nil`, and
`iconImageName` is non-`nil`. Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable, getter=isTextOptional) MGLStyleValue<NSNumber *> *textOptional;
@@ -740,8 +785,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSNumber` object containing the float `2`. Set this property to `nil` to reset
it to the default value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textPadding;
@@ -752,8 +797,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSValue` object containing `MGLTextPitchAlignmentAuto`. Set this property to
`nil` to reset it to the default value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textPitchAlignment;
@@ -766,8 +811,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSNumber` object containing the float `0`. Set this property to `nil` to reset
it to the default value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
This attribute corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-rotate"><code>text-rotate</code></a>
@@ -786,34 +831,20 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSValue` object containing `MGLTextRotationAlignmentAuto`. Set this property
to `nil` to reset it to the default value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textRotationAlignment;
/**
- Font size.
-
- This property is measured in points.
-
- The default value of this property is an `MGLStyleValue` object containing an
- `NSNumber` object containing the float `16`. Set this property to `nil` to
- reset it to the default value.
-
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
- */
-@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textSize;
-
-/**
Specifies how to capitalize text.
The default value of this property is an `MGLStyleValue` object containing an
`NSValue` object containing `MGLTextTransformNone`. Set this property to `nil`
to reset it to the default value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textTransform;
@@ -950,8 +981,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`UIColor.blackColor`. Set this property to `nil` to reset it to the default
value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *textColor;
#else
@@ -962,8 +993,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSColor.blackColor`. Set this property to `nil` to reset it to the default
value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *textColor;
#endif
@@ -977,8 +1008,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSNumber` object containing the float `0`. Set this property to `nil` to reset
it to the default value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textHaloBlur;
@@ -990,8 +1021,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`UIColor.clearColor`. Set this property to `nil` to reset it to the default
value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *textHaloColor;
#else
@@ -1002,8 +1033,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSColor.clearColor`. Set this property to `nil` to reset it to the default
value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *textHaloColor;
#endif
@@ -1018,8 +1049,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSNumber` object containing the float `0`. Set this property to `nil` to reset
it to the default value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textHaloWidth;
@@ -1030,8 +1061,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSNumber` object containing the float `1`. Set this property to `nil` to reset
it to the default value.
- This property is only applied to the style if `textField` is non-`nil`.
- Otherwise, it is ignored.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textOpacity;
@@ -1045,8 +1076,8 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
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.
+ This property is only applied to the style if `text` is non-`nil`. Otherwise,
+ it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textTranslate;
@@ -1057,7 +1088,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) {
`NSValue` object containing `MGLTextTranslateAnchorMap`. Set this property to
`nil` to reset it to the default value.
- This property is only applied to the style if `textField` is non-`nil`, and
+ This property is only applied to the style if `text` is non-`nil`, and
`textTranslate` is non-`nil`. Otherwise, it is ignored.
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textTranslateAnchor;
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm
index 3cfaee986b..cf79d67967 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.mm
+++ b/platform/darwin/src/MGLSymbolStyleLayer.mm
@@ -527,6 +527,29 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setText:(MGLStyleValue<NSString *> *)text {
+ MGLAssertStyleLayerIsValid();
+
+ auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(text);
+ self.rawLayer->setTextField(mbglValue);
+}
+
+- (MGLStyleValue<NSString *> *)text {
+ MGLAssertStyleLayerIsValid();
+
+ auto propertyValue = self.rawLayer->getTextField() ?: self.rawLayer->getDefaultTextField();
+ return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
+}
+
+
+- (void)setTextField:(MGLStyleValue<NSString *> *)textField {
+ self.text = textField;
+}
+
+- (MGLStyleValue<NSString *> *)textField {
+ return self.text;
+}
+
- (void)setTextAllowsOverlap:(MGLStyleValue<NSNumber *> *)textAllowsOverlap {
MGLAssertStyleLayerIsValid();
@@ -564,32 +587,50 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::style::TextAnchorType, NSValue *, mbgl::style::TextAnchorType, MGLTextAnchor>().toEnumStyleValue(propertyValue);
}
-- (void)setTextField:(MGLStyleValue<NSString *> *)textField {
+- (void)setTextFontNames:(MGLStyleValue<NSArray<NSString *> *> *)textFontNames {
MGLAssertStyleLayerIsValid();
- auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(textField);
- self.rawLayer->setTextField(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<std::vector<std::string>, NSArray<NSString *> *, std::string>().toPropertyValue(textFontNames);
+ self.rawLayer->setTextFont(mbglValue);
}
-- (MGLStyleValue<NSString *> *)textField {
+- (MGLStyleValue<NSArray<NSString *> *> *)textFontNames {
MGLAssertStyleLayerIsValid();
- auto propertyValue = self.rawLayer->getTextField() ?: self.rawLayer->getDefaultTextField();
- return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
+ auto propertyValue = self.rawLayer->getTextFont() ?: self.rawLayer->getDefaultTextFont();
+ return MGLStyleValueTransformer<std::vector<std::string>, NSArray<NSString *> *, std::string>().toStyleValue(propertyValue);
}
+
- (void)setTextFont:(MGLStyleValue<NSArray<NSString *> *> *)textFont {
+ self.textFontNames = textFont;
+}
+
+- (MGLStyleValue<NSArray<NSString *> *> *)textFont {
+ return self.textFontNames;
+}
+
+- (void)setTextFontSize:(MGLStyleValue<NSNumber *> *)textFontSize {
MGLAssertStyleLayerIsValid();
- auto mbglValue = MGLStyleValueTransformer<std::vector<std::string>, NSArray<NSString *> *, std::string>().toPropertyValue(textFont);
- self.rawLayer->setTextFont(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textFontSize);
+ self.rawLayer->setTextSize(mbglValue);
}
-- (MGLStyleValue<NSArray<NSString *> *> *)textFont {
+- (MGLStyleValue<NSNumber *> *)textFontSize {
MGLAssertStyleLayerIsValid();
- auto propertyValue = self.rawLayer->getTextFont() ?: self.rawLayer->getDefaultTextFont();
- return MGLStyleValueTransformer<std::vector<std::string>, NSArray<NSString *> *, std::string>().toStyleValue(propertyValue);
+ auto propertyValue = self.rawLayer->getTextSize() ?: self.rawLayer->getDefaultTextSize();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
+}
+
+
+- (void)setTextSize:(MGLStyleValue<NSNumber *> *)textSize {
+ self.textFontSize = textSize;
+}
+
+- (MGLStyleValue<NSNumber *> *)textSize {
+ return self.textFontSize;
}
- (void)setTextIgnoresPlacement:(MGLStyleValue<NSNumber *> *)textIgnoresPlacement {
@@ -759,20 +800,6 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *, mbgl::style::AlignmentType, MGLTextRotationAlignment>().toEnumStyleValue(propertyValue);
}
-- (void)setTextSize:(MGLStyleValue<NSNumber *> *)textSize {
- MGLAssertStyleLayerIsValid();
-
- auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textSize);
- self.rawLayer->setTextSize(mbglValue);
-}
-
-- (MGLStyleValue<NSNumber *> *)textSize {
- MGLAssertStyleLayerIsValid();
-
- auto propertyValue = self.rawLayer->getTextSize() ?: self.rawLayer->getDefaultTextSize();
- return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
-}
-
- (void)setTextTransform:(MGLStyleValue<NSValue *> *)textTransform {
MGLAssertStyleLayerIsValid();