From bf8d037fca3a5e76818f2cd546e783814f046019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Fri, 6 Jan 2017 12:29:03 -0800 Subject: =?UTF-8?q?[ios,=20macos]=20-translate=20=E2=86=92=20-translation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform/darwin/scripts/generate-style-code.js | 20 +++--- .../scripts/style-spec-cocoa-conventions-v8.json | 20 ++++-- platform/darwin/src/MGLCircleStyleLayer.h | 40 +++++++---- platform/darwin/src/MGLCircleStyleLayer.mm | 42 ++++++----- platform/darwin/src/MGLFillStyleLayer.h | 38 ++++++---- platform/darwin/src/MGLFillStyleLayer.mm | 42 ++++++----- platform/darwin/src/MGLLineStyleLayer.h | 38 ++++++---- platform/darwin/src/MGLLineStyleLayer.mm | 42 ++++++----- platform/darwin/src/MGLSymbolStyleLayer.h | 78 +++++++++++++------- platform/darwin/src/MGLSymbolStyleLayer.mm | 84 +++++++++++++--------- platform/darwin/test/MGLCircleStyleLayerTests.m | 22 +++--- .../darwin/test/MGLDocumentationExampleTests.swift | 4 +- platform/darwin/test/MGLFillStyleLayerTests.m | 22 +++--- platform/darwin/test/MGLLineStyleLayerTests.m | 22 +++--- platform/darwin/test/MGLSymbolStyleLayerTests.m | 44 ++++++------ platform/ios/docs/guides/For Style Authors.md | 10 +++ platform/macos/docs/guides/For Style Authors.md | 10 +++ 17 files changed, 361 insertions(+), 217 deletions(-) diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js index a7421da103..dfc0d64ec2 100644 --- a/platform/darwin/scripts/generate-style-code.js +++ b/platform/darwin/scripts/generate-style-code.js @@ -256,16 +256,18 @@ global.describeValue = function (value, property, layerType) { if (units) { units = ` ${units}`.replace(/pixel/, 'point'); } - if (property.name.indexOf('padding') !== -1) { - if (value[0] === 0 && value[1] === 0 && value[2] === 0 && value[3] === 0) { - return 'an `NSValue` object containing `NSEdgeInsetsZero` or `UIEdgeInsetsZero`'; - } - return 'an `NSValue` object containing an `NSEdgeInsets` or `UIEdgeInsets` struct set to' + ` ${value[0]}${units} on the top, ${value[3]}${units} on the left, ${value[2]}${units} on the bottom, and ${value[1]}${units} on the right`; - } - if (property.name.indexOf('offset') !== -1 || property.name.indexOf('translate') !== -1) { - return 'an `NSValue` object containing a `CGVector` struct set to' + ` ${value[0]}${units} from the left and ${value[1]}${units} from the top`; + switch (arrayType(property)) { + case 'padding': + if (value[0] === 0 && value[1] === 0 && value[2] === 0 && value[3] === 0) { + return 'an `NSValue` object containing `NSEdgeInsetsZero` or `UIEdgeInsetsZero`'; + } + return 'an `NSValue` object containing an `NSEdgeInsets` or `UIEdgeInsets` struct set to' + ` ${value[0]}${units} on the top, ${value[3]}${units} on the left, ${value[2]}${units} on the bottom, and ${value[1]}${units} on the right`; + case 'offset': + case 'translate': + return 'an `NSValue` object containing a `CGVector` struct set to' + ` ${value[0]}${units} from the left and ${value[1]}${units} from the top`; + default: + return 'the array `' + value.join('`, `') + '`'; } - return 'the array `' + value.join('`, `') + '`'; default: throw new Error(`unknown type for ${property.name}`); } diff --git a/platform/darwin/scripts/style-spec-cocoa-conventions-v8.json b/platform/darwin/scripts/style-spec-cocoa-conventions-v8.json index 4c47d178b5..9d80ff3896 100644 --- a/platform/darwin/scripts/style-spec-cocoa-conventions-v8.json +++ b/platform/darwin/scripts/style-spec-cocoa-conventions-v8.json @@ -21,7 +21,14 @@ "text-size": "text-font-size" }, "paint_circle": { - "circle-pitch-scale": "circle-scale-alignment" + "circle-pitch-scale": "circle-scale-alignment", + "circle-translate": "circle-translation", + "circle-translate-anchor": "circle-translation-anchor" + }, + "paint_fill": { + "fill-antialias": "is-fill-antialiased", + "fill-translate": "fill-translation", + "fill-translate-anchor": "fill-translation-anchor" }, "paint_raster": { "raster-brightness-min": "minimum-raster-brightness", @@ -29,9 +36,14 @@ "raster-hue-rotate": "raster-hue-rotation" }, "paint_line": { - "line-dasharray": "line-dash-pattern" + "line-dasharray": "line-dash-pattern", + "line-translate": "line-translation", + "line-translate-anchor": "line-translation-anchor" }, - "paint_fill": { - "fill-antialias": "is-fill-antialiased" + "paint_symbol": { + "icon-translate": "icon-translation", + "icon-translate-anchor": "icon-translation-anchor", + "text-translate": "text-translation", + "text-translate-anchor": "text-translation-anchor" } } \ No newline at end of file diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h index 76f8cbd4c6..cdb51f0819 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.h +++ b/platform/darwin/src/MGLCircleStyleLayer.h @@ -26,18 +26,18 @@ typedef NS_ENUM(NSUInteger, MGLCircleScaleAlignment) { /** Controls the translation reference point. - Values of this type are used in the `MGLCircleStyleLayer.circleTranslateAnchor` + Values of this type are used in the `MGLCircleStyleLayer.circleTranslationAnchor` property. */ -typedef NS_ENUM(NSUInteger, MGLCircleTranslateAnchor) { +typedef NS_ENUM(NSUInteger, MGLCircleTranslationAnchor) { /** The circle is translated relative to the map. */ - MGLCircleTranslateAnchorMap, + MGLCircleTranslationAnchorMap, /** The circle is translated relative to the viewport. */ - MGLCircleTranslateAnchorViewport, + MGLCircleTranslationAnchorViewport, }; /** @@ -153,20 +153,32 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslateAnchor) { `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value. + + This attribute corresponds to the circle-translate + layout property in the Mapbox Style Specification. */ -@property (nonatomic, null_resettable) MGLStyleValue *circleTranslate; +@property (nonatomic, null_resettable) MGLStyleValue *circleTranslation; + +@property (nonatomic, null_resettable) MGLStyleValue *circleTranslate __attribute__((unavailable("Use circleTranslation instead."))); /** Controls the translation reference point. The default value of this property is an `MGLStyleValue` object containing an - `NSValue` object containing `MGLCircleTranslateAnchorMap`. Set this property to - `nil` to reset it to the default value. + `NSValue` object containing `MGLCircleTranslationAnchorMap`. 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`. + This property is only applied to the style if `circleTranslation` is non-`nil`. Otherwise, it is ignored. + + This attribute corresponds to the circle-translate-anchor + layout property in the Mapbox Style Specification. */ -@property (nonatomic, null_resettable) MGLStyleValue *circleTranslateAnchor; +@property (nonatomic, null_resettable) MGLStyleValue *circleTranslationAnchor; + +@property (nonatomic, null_resettable) MGLStyleValue *circleTranslateAnchor __attribute__((unavailable("Use circleTranslationAnchor instead."))); @end @@ -192,17 +204,17 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslateAnchor) { @property (readonly) MGLCircleScaleAlignment MGLCircleScaleAlignmentValue; /** - Creates a new value object containing the given `MGLCircleTranslateAnchor` enumeration. + Creates a new value object containing the given `MGLCircleTranslationAnchor` enumeration. - @param circleTranslateAnchor The value for the new object. + @param circleTranslationAnchor The value for the new object. @return A new value object that contains the enumeration value. */ -+ (instancetype)valueWithMGLCircleTranslateAnchor:(MGLCircleTranslateAnchor)circleTranslateAnchor; ++ (instancetype)valueWithMGLCircleTranslationAnchor:(MGLCircleTranslationAnchor)circleTranslationAnchor; /** - The `MGLCircleTranslateAnchor` enumeration representation of the value. + The `MGLCircleTranslationAnchor` enumeration representation of the value. */ -@property (readonly) MGLCircleTranslateAnchor MGLCircleTranslateAnchorValue; +@property (readonly) MGLCircleTranslationAnchor MGLCircleTranslationAnchorValue; @end diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm index c23658b518..d454f21dd6 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.mm +++ b/platform/darwin/src/MGLCircleStyleLayer.mm @@ -16,9 +16,9 @@ namespace mbgl { { MGLCircleScaleAlignmentViewport, "viewport" }, }); - MBGL_DEFINE_ENUM(MGLCircleTranslateAnchor, { - { MGLCircleTranslateAnchorMap, "map" }, - { MGLCircleTranslateAnchorViewport, "viewport" }, + MBGL_DEFINE_ENUM(MGLCircleTranslationAnchor, { + { MGLCircleTranslationAnchorMap, "map" }, + { MGLCircleTranslationAnchorViewport, "viewport" }, }); } @@ -206,32 +206,42 @@ namespace mbgl { NSAssert(NO, @"Use -setCircleScaleAlignment: instead."); } -- (void)setCircleTranslate:(MGLStyleValue *)circleTranslate { +- (void)setCircleTranslation:(MGLStyleValue *)circleTranslation { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(circleTranslate); + auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(circleTranslation); self.rawLayer->setCircleTranslate(mbglValue); } -- (MGLStyleValue *)circleTranslate { +- (MGLStyleValue *)circleTranslation { MGLAssertStyleLayerIsValid(); auto propertyValue = self.rawLayer->getCircleTranslate() ?: self.rawLayer->getDefaultCircleTranslate(); return MGLStyleValueTransformer, NSValue *>().toStyleValue(propertyValue); } -- (void)setCircleTranslateAnchor:(MGLStyleValue *)circleTranslateAnchor { + +- (void)setCircleTranslate:(MGLStyleValue *)circleTranslate { + NSAssert(NO, @"Use -setCircleTranslation: instead."); +} + +- (void)setCircleTranslationAnchor:(MGLStyleValue *)circleTranslationAnchor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer().toEnumPropertyValue(circleTranslateAnchor); + auto mbglValue = MGLStyleValueTransformer().toEnumPropertyValue(circleTranslationAnchor); self.rawLayer->setCircleTranslateAnchor(mbglValue); } -- (MGLStyleValue *)circleTranslateAnchor { +- (MGLStyleValue *)circleTranslationAnchor { MGLAssertStyleLayerIsValid(); auto propertyValue = self.rawLayer->getCircleTranslateAnchor() ?: self.rawLayer->getDefaultCircleTranslateAnchor(); - return MGLStyleValueTransformer().toEnumStyleValue(propertyValue); + return MGLStyleValueTransformer().toEnumStyleValue(propertyValue); +} + + +- (void)setCircleTranslateAnchor:(MGLStyleValue *)circleTranslateAnchor { + NSAssert(NO, @"Use -setCircleTranslationAnchor: instead."); } @@ -249,14 +259,14 @@ namespace mbgl { return circleScaleAlignment; } -+ (NSValue *)valueWithMGLCircleTranslateAnchor:(MGLCircleTranslateAnchor)circleTranslateAnchor { - return [NSValue value:&circleTranslateAnchor withObjCType:@encode(MGLCircleTranslateAnchor)]; ++ (NSValue *)valueWithMGLCircleTranslationAnchor:(MGLCircleTranslationAnchor)circleTranslationAnchor { + return [NSValue value:&circleTranslationAnchor withObjCType:@encode(MGLCircleTranslationAnchor)]; } -- (MGLCircleTranslateAnchor)MGLCircleTranslateAnchorValue { - MGLCircleTranslateAnchor circleTranslateAnchor; - [self getValue:&circleTranslateAnchor]; - return circleTranslateAnchor; +- (MGLCircleTranslationAnchor)MGLCircleTranslationAnchorValue { + MGLCircleTranslationAnchor circleTranslationAnchor; + [self getValue:&circleTranslationAnchor]; + return circleTranslationAnchor; } @end diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h index a154b2e297..f46998be5b 100644 --- a/platform/darwin/src/MGLFillStyleLayer.h +++ b/platform/darwin/src/MGLFillStyleLayer.h @@ -9,18 +9,18 @@ NS_ASSUME_NONNULL_BEGIN /** Controls the translation reference point. - Values of this type are used in the `MGLFillStyleLayer.fillTranslateAnchor` + Values of this type are used in the `MGLFillStyleLayer.fillTranslationAnchor` property. */ -typedef NS_ENUM(NSUInteger, MGLFillTranslateAnchor) { +typedef NS_ENUM(NSUInteger, MGLFillTranslationAnchor) { /** The fill is translated relative to the map. */ - MGLFillTranslateAnchorMap, + MGLFillTranslationAnchorMap, /** The fill is translated relative to the viewport. */ - MGLFillTranslateAnchorViewport, + MGLFillTranslationAnchorViewport, }; /** @@ -127,20 +127,32 @@ typedef NS_ENUM(NSUInteger, MGLFillTranslateAnchor) { `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value. + + This attribute corresponds to the fill-translate + layout property in the Mapbox Style Specification. */ -@property (nonatomic, null_resettable) MGLStyleValue *fillTranslate; +@property (nonatomic, null_resettable) MGLStyleValue *fillTranslation; + +@property (nonatomic, null_resettable) MGLStyleValue *fillTranslate __attribute__((unavailable("Use fillTranslation instead."))); /** Controls the translation reference point. The default value of this property is an `MGLStyleValue` object containing an - `NSValue` object containing `MGLFillTranslateAnchorMap`. Set this property to + `NSValue` object containing `MGLFillTranslationAnchorMap`. 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`. + This property is only applied to the style if `fillTranslation` is non-`nil`. Otherwise, it is ignored. + + This attribute corresponds to the fill-translate-anchor + layout property in the Mapbox Style Specification. */ -@property (nonatomic, null_resettable) MGLStyleValue *fillTranslateAnchor; +@property (nonatomic, null_resettable) MGLStyleValue *fillTranslationAnchor; + +@property (nonatomic, null_resettable) MGLStyleValue *fillTranslateAnchor __attribute__((unavailable("Use fillTranslationAnchor instead."))); @end @@ -153,17 +165,17 @@ typedef NS_ENUM(NSUInteger, MGLFillTranslateAnchor) { #pragma mark Working with Fill Style Layer Attribute Values /** - Creates a new value object containing the given `MGLFillTranslateAnchor` enumeration. + Creates a new value object containing the given `MGLFillTranslationAnchor` enumeration. - @param fillTranslateAnchor The value for the new object. + @param fillTranslationAnchor The value for the new object. @return A new value object that contains the enumeration value. */ -+ (instancetype)valueWithMGLFillTranslateAnchor:(MGLFillTranslateAnchor)fillTranslateAnchor; ++ (instancetype)valueWithMGLFillTranslationAnchor:(MGLFillTranslationAnchor)fillTranslationAnchor; /** - The `MGLFillTranslateAnchor` enumeration representation of the value. + The `MGLFillTranslationAnchor` enumeration representation of the value. */ -@property (readonly) MGLFillTranslateAnchor MGLFillTranslateAnchorValue; +@property (readonly) MGLFillTranslationAnchor MGLFillTranslationAnchorValue; @end diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm index 967014929f..136d4a11c9 100644 --- a/platform/darwin/src/MGLFillStyleLayer.mm +++ b/platform/darwin/src/MGLFillStyleLayer.mm @@ -11,9 +11,9 @@ #include namespace mbgl { - MBGL_DEFINE_ENUM(MGLFillTranslateAnchor, { - { MGLFillTranslateAnchorMap, "map" }, - { MGLFillTranslateAnchorViewport, "viewport" }, + MBGL_DEFINE_ENUM(MGLFillTranslationAnchor, { + { MGLFillTranslationAnchorMap, "map" }, + { MGLFillTranslationAnchorViewport, "viewport" }, }); } @@ -201,32 +201,42 @@ namespace mbgl { return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setFillTranslate:(MGLStyleValue *)fillTranslate { +- (void)setFillTranslation:(MGLStyleValue *)fillTranslation { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(fillTranslate); + auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(fillTranslation); self.rawLayer->setFillTranslate(mbglValue); } -- (MGLStyleValue *)fillTranslate { +- (MGLStyleValue *)fillTranslation { MGLAssertStyleLayerIsValid(); auto propertyValue = self.rawLayer->getFillTranslate() ?: self.rawLayer->getDefaultFillTranslate(); return MGLStyleValueTransformer, NSValue *>().toStyleValue(propertyValue); } -- (void)setFillTranslateAnchor:(MGLStyleValue *)fillTranslateAnchor { + +- (void)setFillTranslate:(MGLStyleValue *)fillTranslate { + NSAssert(NO, @"Use -setFillTranslation: instead."); +} + +- (void)setFillTranslationAnchor:(MGLStyleValue *)fillTranslationAnchor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer().toEnumPropertyValue(fillTranslateAnchor); + auto mbglValue = MGLStyleValueTransformer().toEnumPropertyValue(fillTranslationAnchor); self.rawLayer->setFillTranslateAnchor(mbglValue); } -- (MGLStyleValue *)fillTranslateAnchor { +- (MGLStyleValue *)fillTranslationAnchor { MGLAssertStyleLayerIsValid(); auto propertyValue = self.rawLayer->getFillTranslateAnchor() ?: self.rawLayer->getDefaultFillTranslateAnchor(); - return MGLStyleValueTransformer().toEnumStyleValue(propertyValue); + return MGLStyleValueTransformer().toEnumStyleValue(propertyValue); +} + + +- (void)setFillTranslateAnchor:(MGLStyleValue *)fillTranslateAnchor { + NSAssert(NO, @"Use -setFillTranslationAnchor: instead."); } @@ -234,14 +244,14 @@ namespace mbgl { @implementation NSValue (MGLFillStyleLayerAdditions) -+ (NSValue *)valueWithMGLFillTranslateAnchor:(MGLFillTranslateAnchor)fillTranslateAnchor { - return [NSValue value:&fillTranslateAnchor withObjCType:@encode(MGLFillTranslateAnchor)]; ++ (NSValue *)valueWithMGLFillTranslationAnchor:(MGLFillTranslationAnchor)fillTranslationAnchor { + return [NSValue value:&fillTranslationAnchor withObjCType:@encode(MGLFillTranslationAnchor)]; } -- (MGLFillTranslateAnchor)MGLFillTranslateAnchorValue { - MGLFillTranslateAnchor fillTranslateAnchor; - [self getValue:&fillTranslateAnchor]; - return fillTranslateAnchor; +- (MGLFillTranslationAnchor)MGLFillTranslationAnchorValue { + MGLFillTranslationAnchor fillTranslationAnchor; + [self getValue:&fillTranslationAnchor]; + return fillTranslationAnchor; } @end diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index 72629c4d0e..75a71a3923 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -59,18 +59,18 @@ typedef NS_ENUM(NSUInteger, MGLLineJoin) { /** Controls the translation reference point. - Values of this type are used in the `MGLLineStyleLayer.lineTranslateAnchor` + Values of this type are used in the `MGLLineStyleLayer.lineTranslationAnchor` property. */ -typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { +typedef NS_ENUM(NSUInteger, MGLLineTranslationAnchor) { /** The line is translated relative to the map. */ - MGLLineTranslateAnchorMap, + MGLLineTranslationAnchorMap, /** The line is translated relative to the viewport. */ - MGLLineTranslateAnchorViewport, + MGLLineTranslationAnchorViewport, }; /** @@ -258,20 +258,32 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { `NSValue` object containing a `CGVector` struct set to 0 points from the left and 0 points from the top. Set this property to `nil` to reset it to the default value. + + This attribute corresponds to the line-translate + layout property in the Mapbox Style Specification. */ -@property (nonatomic, null_resettable) MGLStyleValue *lineTranslate; +@property (nonatomic, null_resettable) MGLStyleValue *lineTranslation; + +@property (nonatomic, null_resettable) MGLStyleValue *lineTranslate __attribute__((unavailable("Use lineTranslation instead."))); /** Controls the translation reference point. The default value of this property is an `MGLStyleValue` object containing an - `NSValue` object containing `MGLLineTranslateAnchorMap`. Set this property to + `NSValue` object containing `MGLLineTranslationAnchorMap`. 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`. + This property is only applied to the style if `lineTranslation` is non-`nil`. Otherwise, it is ignored. + + This attribute corresponds to the line-translate-anchor + layout property in the Mapbox Style Specification. */ -@property (nonatomic, null_resettable) MGLStyleValue *lineTranslateAnchor; +@property (nonatomic, null_resettable) MGLStyleValue *lineTranslationAnchor; + +@property (nonatomic, null_resettable) MGLStyleValue *lineTranslateAnchor __attribute__((unavailable("Use lineTranslationAnchor instead."))); /** Stroke thickness. @@ -321,17 +333,17 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { @property (readonly) MGLLineJoin MGLLineJoinValue; /** - Creates a new value object containing the given `MGLLineTranslateAnchor` enumeration. + Creates a new value object containing the given `MGLLineTranslationAnchor` enumeration. - @param lineTranslateAnchor The value for the new object. + @param lineTranslationAnchor The value for the new object. @return A new value object that contains the enumeration value. */ -+ (instancetype)valueWithMGLLineTranslateAnchor:(MGLLineTranslateAnchor)lineTranslateAnchor; ++ (instancetype)valueWithMGLLineTranslationAnchor:(MGLLineTranslationAnchor)lineTranslationAnchor; /** - The `MGLLineTranslateAnchor` enumeration representation of the value. + The `MGLLineTranslationAnchor` enumeration representation of the value. */ -@property (readonly) MGLLineTranslateAnchor MGLLineTranslateAnchorValue; +@property (readonly) MGLLineTranslationAnchor MGLLineTranslationAnchorValue; @end diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm index ae838af0a8..7d0d5ba6a5 100644 --- a/platform/darwin/src/MGLLineStyleLayer.mm +++ b/platform/darwin/src/MGLLineStyleLayer.mm @@ -23,9 +23,9 @@ namespace mbgl { { MGLLineJoinMiter, "miter" }, }); - MBGL_DEFINE_ENUM(MGLLineTranslateAnchor, { - { MGLLineTranslateAnchorMap, "map" }, - { MGLLineTranslateAnchorViewport, "viewport" }, + MBGL_DEFINE_ENUM(MGLLineTranslationAnchor, { + { MGLLineTranslationAnchorMap, "map" }, + { MGLLineTranslationAnchorViewport, "viewport" }, }); } @@ -299,32 +299,42 @@ namespace mbgl { return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setLineTranslate:(MGLStyleValue *)lineTranslate { +- (void)setLineTranslation:(MGLStyleValue *)lineTranslation { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(lineTranslate); + auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(lineTranslation); self.rawLayer->setLineTranslate(mbglValue); } -- (MGLStyleValue *)lineTranslate { +- (MGLStyleValue *)lineTranslation { MGLAssertStyleLayerIsValid(); auto propertyValue = self.rawLayer->getLineTranslate() ?: self.rawLayer->getDefaultLineTranslate(); return MGLStyleValueTransformer, NSValue *>().toStyleValue(propertyValue); } -- (void)setLineTranslateAnchor:(MGLStyleValue *)lineTranslateAnchor { + +- (void)setLineTranslate:(MGLStyleValue *)lineTranslate { + NSAssert(NO, @"Use -setLineTranslation: instead."); +} + +- (void)setLineTranslationAnchor:(MGLStyleValue *)lineTranslationAnchor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer().toEnumPropertyValue(lineTranslateAnchor); + auto mbglValue = MGLStyleValueTransformer().toEnumPropertyValue(lineTranslationAnchor); self.rawLayer->setLineTranslateAnchor(mbglValue); } -- (MGLStyleValue *)lineTranslateAnchor { +- (MGLStyleValue *)lineTranslationAnchor { MGLAssertStyleLayerIsValid(); auto propertyValue = self.rawLayer->getLineTranslateAnchor() ?: self.rawLayer->getDefaultLineTranslateAnchor(); - return MGLStyleValueTransformer().toEnumStyleValue(propertyValue); + return MGLStyleValueTransformer().toEnumStyleValue(propertyValue); +} + + +- (void)setLineTranslateAnchor:(MGLStyleValue *)lineTranslateAnchor { + NSAssert(NO, @"Use -setLineTranslationAnchor: instead."); } - (void)setLineWidth:(MGLStyleValue *)lineWidth { @@ -366,14 +376,14 @@ namespace mbgl { return lineJoin; } -+ (NSValue *)valueWithMGLLineTranslateAnchor:(MGLLineTranslateAnchor)lineTranslateAnchor { - return [NSValue value:&lineTranslateAnchor withObjCType:@encode(MGLLineTranslateAnchor)]; ++ (NSValue *)valueWithMGLLineTranslationAnchor:(MGLLineTranslationAnchor)lineTranslationAnchor { + return [NSValue value:&lineTranslationAnchor withObjCType:@encode(MGLLineTranslationAnchor)]; } -- (MGLLineTranslateAnchor)MGLLineTranslateAnchorValue { - MGLLineTranslateAnchor lineTranslateAnchor; - [self getValue:&lineTranslateAnchor]; - return lineTranslateAnchor; +- (MGLLineTranslationAnchor)MGLLineTranslationAnchorValue { + MGLLineTranslationAnchor lineTranslationAnchor; + [self getValue:&lineTranslationAnchor]; + return lineTranslationAnchor; } @end diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h index 8edc88dfa1..264d3adb0f 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.h +++ b/platform/darwin/src/MGLSymbolStyleLayer.h @@ -216,35 +216,35 @@ typedef NS_ENUM(NSUInteger, MGLTextTransform) { /** Controls the translation reference point. - Values of this type are used in the `MGLSymbolStyleLayer.iconTranslateAnchor` + Values of this type are used in the `MGLSymbolStyleLayer.iconTranslationAnchor` property. */ -typedef NS_ENUM(NSUInteger, MGLIconTranslateAnchor) { +typedef NS_ENUM(NSUInteger, MGLIconTranslationAnchor) { /** Icons are translated relative to the map. */ - MGLIconTranslateAnchorMap, + MGLIconTranslationAnchorMap, /** Icons are translated relative to the viewport. */ - MGLIconTranslateAnchorViewport, + MGLIconTranslationAnchorViewport, }; /** Controls the translation reference point. - Values of this type are used in the `MGLSymbolStyleLayer.textTranslateAnchor` + Values of this type are used in the `MGLSymbolStyleLayer.textTranslationAnchor` property. */ -typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { +typedef NS_ENUM(NSUInteger, MGLTextTranslationAnchor) { /** The text is translated relative to the map. */ - MGLTextTranslateAnchorMap, + MGLTextTranslationAnchorMap, /** The text is translated relative to the viewport. */ - MGLTextTranslateAnchorViewport, + MGLTextTranslationAnchorViewport, }; /** @@ -269,7 +269,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { layer.iconImageName = MGLStyleValue(rawValue: "coffee") layer.iconScale = MGLStyleValue(rawValue: 0.5) layer.text = MGLStyleValue(rawValue: "{name}") - layer.textTranslate = MGLStyleValue(rawValue: NSValue(cgVector: CGVector(dx: 10, dy: 0))) + layer.textTranslation = MGLStyleValue(rawValue: NSValue(cgVector: CGVector(dx: 10, dy: 0))) layer.textJustification = MGLStyleValue(rawValue: NSValue(mglTextJustification: .left)) layer.textAnchor = MGLStyleValue(rawValue: NSValue(mglTextAnchor: .left)) layer.predicate = NSPredicate(format: "%K == %@", "venue-type", "coffee") @@ -958,20 +958,32 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. + + This attribute corresponds to the icon-translate + layout property in the Mapbox Style Specification. */ -@property (nonatomic, null_resettable) MGLStyleValue *iconTranslate; +@property (nonatomic, null_resettable) MGLStyleValue *iconTranslation; + +@property (nonatomic, null_resettable) MGLStyleValue *iconTranslate __attribute__((unavailable("Use iconTranslation instead."))); /** Controls the translation reference point. The default value of this property is an `MGLStyleValue` object containing an - `NSValue` object containing `MGLIconTranslateAnchorMap`. Set this property to + `NSValue` object containing `MGLIconTranslationAnchorMap`. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImageName` is non-`nil`, and - `iconTranslate` is non-`nil`. Otherwise, it is ignored. + `iconTranslation` is non-`nil`. Otherwise, it is ignored. + + This attribute corresponds to the icon-translate-anchor + layout property in the Mapbox Style Specification. */ -@property (nonatomic, null_resettable) MGLStyleValue *iconTranslateAnchor; +@property (nonatomic, null_resettable) MGLStyleValue *iconTranslationAnchor; + +@property (nonatomic, null_resettable) MGLStyleValue *iconTranslateAnchor __attribute__((unavailable("Use iconTranslationAnchor instead."))); #if TARGET_OS_IPHONE /** @@ -1078,20 +1090,32 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. + + This attribute corresponds to the text-translate + layout property in the Mapbox Style Specification. */ -@property (nonatomic, null_resettable) MGLStyleValue *textTranslate; +@property (nonatomic, null_resettable) MGLStyleValue *textTranslation; + +@property (nonatomic, null_resettable) MGLStyleValue *textTranslate __attribute__((unavailable("Use textTranslation instead."))); /** Controls the translation reference point. The default value of this property is an `MGLStyleValue` object containing an - `NSValue` object containing `MGLTextTranslateAnchorMap`. Set this property to + `NSValue` object containing `MGLTextTranslationAnchorMap`. 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`, and - `textTranslate` is non-`nil`. Otherwise, it is ignored. + `textTranslation` is non-`nil`. Otherwise, it is ignored. + + This attribute corresponds to the text-translate-anchor + layout property in the Mapbox Style Specification. */ -@property (nonatomic, null_resettable) MGLStyleValue *textTranslateAnchor; +@property (nonatomic, null_resettable) MGLStyleValue *textTranslationAnchor; + +@property (nonatomic, null_resettable) MGLStyleValue *textTranslateAnchor __attribute__((unavailable("Use textTranslationAnchor instead."))); @end @@ -1208,30 +1232,30 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { @property (readonly) MGLTextTransform MGLTextTransformValue; /** - Creates a new value object containing the given `MGLIconTranslateAnchor` enumeration. + Creates a new value object containing the given `MGLIconTranslationAnchor` enumeration. - @param iconTranslateAnchor The value for the new object. + @param iconTranslationAnchor The value for the new object. @return A new value object that contains the enumeration value. */ -+ (instancetype)valueWithMGLIconTranslateAnchor:(MGLIconTranslateAnchor)iconTranslateAnchor; ++ (instancetype)valueWithMGLIconTranslationAnchor:(MGLIconTranslationAnchor)iconTranslationAnchor; /** - The `MGLIconTranslateAnchor` enumeration representation of the value. + The `MGLIconTranslationAnchor` enumeration representation of the value. */ -@property (readonly) MGLIconTranslateAnchor MGLIconTranslateAnchorValue; +@property (readonly) MGLIconTranslationAnchor MGLIconTranslationAnchorValue; /** - Creates a new value object containing the given `MGLTextTranslateAnchor` enumeration. + Creates a new value object containing the given `MGLTextTranslationAnchor` enumeration. - @param textTranslateAnchor The value for the new object. + @param textTranslationAnchor The value for the new object. @return A new value object that contains the enumeration value. */ -+ (instancetype)valueWithMGLTextTranslateAnchor:(MGLTextTranslateAnchor)textTranslateAnchor; ++ (instancetype)valueWithMGLTextTranslationAnchor:(MGLTextTranslationAnchor)textTranslationAnchor; /** - The `MGLTextTranslateAnchor` enumeration representation of the value. + The `MGLTextTranslationAnchor` enumeration representation of the value. */ -@property (readonly) MGLTextTranslateAnchor MGLTextTranslateAnchorValue; +@property (readonly) MGLTextTranslationAnchor MGLTextTranslationAnchorValue; @end diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm index cf79d67967..d753442c61 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.mm +++ b/platform/darwin/src/MGLSymbolStyleLayer.mm @@ -65,14 +65,14 @@ namespace mbgl { { MGLTextTransformLowercase, "lowercase" }, }); - MBGL_DEFINE_ENUM(MGLIconTranslateAnchor, { - { MGLIconTranslateAnchorMap, "map" }, - { MGLIconTranslateAnchorViewport, "viewport" }, + MBGL_DEFINE_ENUM(MGLIconTranslationAnchor, { + { MGLIconTranslationAnchorMap, "map" }, + { MGLIconTranslationAnchorViewport, "viewport" }, }); - MBGL_DEFINE_ENUM(MGLTextTranslateAnchor, { - { MGLTextTranslateAnchorMap, "map" }, - { MGLTextTranslateAnchorViewport, "viewport" }, + MBGL_DEFINE_ENUM(MGLTextTranslationAnchor, { + { MGLTextTranslationAnchorMap, "map" }, + { MGLTextTranslationAnchorViewport, "viewport" }, }); } @@ -886,32 +886,42 @@ namespace mbgl { return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setIconTranslate:(MGLStyleValue *)iconTranslate { +- (void)setIconTranslation:(MGLStyleValue *)iconTranslation { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(iconTranslate); + auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(iconTranslation); self.rawLayer->setIconTranslate(mbglValue); } -- (MGLStyleValue *)iconTranslate { +- (MGLStyleValue *)iconTranslation { MGLAssertStyleLayerIsValid(); auto propertyValue = self.rawLayer->getIconTranslate() ?: self.rawLayer->getDefaultIconTranslate(); return MGLStyleValueTransformer, NSValue *>().toStyleValue(propertyValue); } -- (void)setIconTranslateAnchor:(MGLStyleValue *)iconTranslateAnchor { + +- (void)setIconTranslate:(MGLStyleValue *)iconTranslate { + NSAssert(NO, @"Use -setIconTranslation: instead."); +} + +- (void)setIconTranslationAnchor:(MGLStyleValue *)iconTranslationAnchor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer().toEnumPropertyValue(iconTranslateAnchor); + auto mbglValue = MGLStyleValueTransformer().toEnumPropertyValue(iconTranslationAnchor); self.rawLayer->setIconTranslateAnchor(mbglValue); } -- (MGLStyleValue *)iconTranslateAnchor { +- (MGLStyleValue *)iconTranslationAnchor { MGLAssertStyleLayerIsValid(); auto propertyValue = self.rawLayer->getIconTranslateAnchor() ?: self.rawLayer->getDefaultIconTranslateAnchor(); - return MGLStyleValueTransformer().toEnumStyleValue(propertyValue); + return MGLStyleValueTransformer().toEnumStyleValue(propertyValue); +} + + +- (void)setIconTranslateAnchor:(MGLStyleValue *)iconTranslateAnchor { + NSAssert(NO, @"Use -setIconTranslationAnchor: instead."); } - (void)setTextColor:(MGLStyleValue *)textColor { @@ -984,32 +994,42 @@ namespace mbgl { return MGLStyleValueTransformer().toStyleValue(propertyValue); } -- (void)setTextTranslate:(MGLStyleValue *)textTranslate { +- (void)setTextTranslation:(MGLStyleValue *)textTranslation { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(textTranslate); + auto mbglValue = MGLStyleValueTransformer, NSValue *>().toPropertyValue(textTranslation); self.rawLayer->setTextTranslate(mbglValue); } -- (MGLStyleValue *)textTranslate { +- (MGLStyleValue *)textTranslation { MGLAssertStyleLayerIsValid(); auto propertyValue = self.rawLayer->getTextTranslate() ?: self.rawLayer->getDefaultTextTranslate(); return MGLStyleValueTransformer, NSValue *>().toStyleValue(propertyValue); } -- (void)setTextTranslateAnchor:(MGLStyleValue *)textTranslateAnchor { + +- (void)setTextTranslate:(MGLStyleValue *)textTranslate { + NSAssert(NO, @"Use -setTextTranslation: instead."); +} + +- (void)setTextTranslationAnchor:(MGLStyleValue *)textTranslationAnchor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer().toEnumPropertyValue(textTranslateAnchor); + auto mbglValue = MGLStyleValueTransformer().toEnumPropertyValue(textTranslationAnchor); self.rawLayer->setTextTranslateAnchor(mbglValue); } -- (MGLStyleValue *)textTranslateAnchor { +- (MGLStyleValue *)textTranslationAnchor { MGLAssertStyleLayerIsValid(); auto propertyValue = self.rawLayer->getTextTranslateAnchor() ?: self.rawLayer->getDefaultTextTranslateAnchor(); - return MGLStyleValueTransformer().toEnumStyleValue(propertyValue); + return MGLStyleValueTransformer().toEnumStyleValue(propertyValue); +} + + +- (void)setTextTranslateAnchor:(MGLStyleValue *)textTranslateAnchor { + NSAssert(NO, @"Use -setTextTranslationAnchor: instead."); } @@ -1097,24 +1117,24 @@ namespace mbgl { return textTransform; } -+ (NSValue *)valueWithMGLIconTranslateAnchor:(MGLIconTranslateAnchor)iconTranslateAnchor { - return [NSValue value:&iconTranslateAnchor withObjCType:@encode(MGLIconTranslateAnchor)]; ++ (NSValue *)valueWithMGLIconTranslationAnchor:(MGLIconTranslationAnchor)iconTranslationAnchor { + return [NSValue value:&iconTranslationAnchor withObjCType:@encode(MGLIconTranslationAnchor)]; } -- (MGLIconTranslateAnchor)MGLIconTranslateAnchorValue { - MGLIconTranslateAnchor iconTranslateAnchor; - [self getValue:&iconTranslateAnchor]; - return iconTranslateAnchor; +- (MGLIconTranslationAnchor)MGLIconTranslationAnchorValue { + MGLIconTranslationAnchor iconTranslationAnchor; + [self getValue:&iconTranslationAnchor]; + return iconTranslationAnchor; } -+ (NSValue *)valueWithMGLTextTranslateAnchor:(MGLTextTranslateAnchor)textTranslateAnchor { - return [NSValue value:&textTranslateAnchor withObjCType:@encode(MGLTextTranslateAnchor)]; ++ (NSValue *)valueWithMGLTextTranslationAnchor:(MGLTextTranslationAnchor)textTranslationAnchor { + return [NSValue value:&textTranslationAnchor withObjCType:@encode(MGLTextTranslationAnchor)]; } -- (MGLTextTranslateAnchor)MGLTextTranslateAnchorValue { - MGLTextTranslateAnchor textTranslateAnchor; - [self getValue:&textTranslateAnchor]; - return textTranslateAnchor; +- (MGLTextTranslationAnchor)MGLTextTranslationAnchorValue { + MGLTextTranslationAnchor textTranslationAnchor; + [self getValue:&textTranslationAnchor]; + return textTranslationAnchor; } @end diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.m b/platform/darwin/test/MGLCircleStyleLayerTests.m index 0fca470f04..78898a49cb 100644 --- a/platform/darwin/test/MGLCircleStyleLayerTests.m +++ b/platform/darwin/test/MGLCircleStyleLayerTests.m @@ -25,8 +25,8 @@ layer.circleOpacity = [MGLRuntimeStylingHelper testNumber]; layer.circleRadius = [MGLRuntimeStylingHelper testNumber]; layer.circleScaleAlignment = [MGLRuntimeStylingHelper testEnum:MGLCircleScaleAlignmentViewport type:@encode(MGLCircleScaleAlignment)]; - layer.circleTranslate = [MGLRuntimeStylingHelper testOffset]; - layer.circleTranslateAnchor = [MGLRuntimeStylingHelper testEnum:MGLCircleTranslateAnchorViewport type:@encode(MGLCircleTranslateAnchor)]; + layer.circleTranslation = [MGLRuntimeStylingHelper testOffset]; + layer.circleTranslationAnchor = [MGLRuntimeStylingHelper testEnum:MGLCircleTranslationAnchorViewport type:@encode(MGLCircleTranslationAnchor)]; MGLCircleStyleLayer *gLayer = (MGLCircleStyleLayer *)[self.mapView.style layerWithIdentifier:@"layerID"]; XCTAssertTrue([gLayer isKindOfClass:[MGLCircleStyleLayer class]]); @@ -36,25 +36,25 @@ XCTAssertEqualObjects(gLayer.circleRadius, [MGLRuntimeStylingHelper testNumber]); XCTAssert([gLayer.circleScaleAlignment isKindOfClass:[MGLStyleConstantValue class]]); XCTAssertEqualObjects(gLayer.circleScaleAlignment, [MGLRuntimeStylingHelper testEnum:MGLCircleScaleAlignmentViewport type:@encode(MGLCircleScaleAlignment)]); - XCTAssertEqualObjects(gLayer.circleTranslate, [MGLRuntimeStylingHelper testOffset]); - XCTAssert([gLayer.circleTranslateAnchor isKindOfClass:[MGLStyleConstantValue class]]); - XCTAssertEqualObjects(gLayer.circleTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLCircleTranslateAnchorViewport type:@encode(MGLCircleTranslateAnchor)]); + XCTAssertEqualObjects(gLayer.circleTranslation, [MGLRuntimeStylingHelper testOffset]); + XCTAssert([gLayer.circleTranslationAnchor isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.circleTranslationAnchor, [MGLRuntimeStylingHelper testEnum:MGLCircleTranslationAnchorViewport type:@encode(MGLCircleTranslationAnchor)]); layer.circleBlur = [MGLRuntimeStylingHelper testNumberFunction]; layer.circleColor = [MGLRuntimeStylingHelper testColorFunction]; layer.circleOpacity = [MGLRuntimeStylingHelper testNumberFunction]; layer.circleRadius = [MGLRuntimeStylingHelper testNumberFunction]; layer.circleScaleAlignment = [MGLRuntimeStylingHelper testEnumFunction:MGLCircleScaleAlignmentViewport type:@encode(MGLCircleScaleAlignment)]; - layer.circleTranslate = [MGLRuntimeStylingHelper testOffsetFunction]; - layer.circleTranslateAnchor = [MGLRuntimeStylingHelper testEnumFunction:MGLCircleTranslateAnchorViewport type:@encode(MGLCircleTranslateAnchor)]; + layer.circleTranslation = [MGLRuntimeStylingHelper testOffsetFunction]; + layer.circleTranslationAnchor = [MGLRuntimeStylingHelper testEnumFunction:MGLCircleTranslationAnchorViewport type:@encode(MGLCircleTranslationAnchor)]; XCTAssertEqualObjects(gLayer.circleBlur, [MGLRuntimeStylingHelper testNumberFunction]); XCTAssertEqualObjects(gLayer.circleColor, [MGLRuntimeStylingHelper testColorFunction]); XCTAssertEqualObjects(gLayer.circleOpacity, [MGLRuntimeStylingHelper testNumberFunction]); XCTAssertEqualObjects(gLayer.circleRadius, [MGLRuntimeStylingHelper testNumberFunction]); XCTAssertEqualObjects(gLayer.circleScaleAlignment, [MGLRuntimeStylingHelper testEnumFunction:MGLCircleScaleAlignmentViewport type:@encode(MGLCircleScaleAlignment)]); - XCTAssertEqualObjects(gLayer.circleTranslate, [MGLRuntimeStylingHelper testOffsetFunction]); - XCTAssertEqualObjects(gLayer.circleTranslateAnchor, [MGLRuntimeStylingHelper testEnumFunction:MGLCircleTranslateAnchorViewport type:@encode(MGLCircleTranslateAnchor)]); + XCTAssertEqualObjects(gLayer.circleTranslation, [MGLRuntimeStylingHelper testOffsetFunction]); + XCTAssertEqualObjects(gLayer.circleTranslationAnchor, [MGLRuntimeStylingHelper testEnumFunction:MGLCircleTranslationAnchorViewport type:@encode(MGLCircleTranslationAnchor)]); } - (void)testPropertyNames { @@ -63,8 +63,8 @@ [self testPropertyName:@"circle-opacity" isBoolean:NO]; [self testPropertyName:@"circle-radius" isBoolean:NO]; [self testPropertyName:@"circle-scale-alignment" isBoolean:NO]; - [self testPropertyName:@"circle-translate" isBoolean:NO]; - [self testPropertyName:@"circle-translate-anchor" isBoolean:NO]; + [self testPropertyName:@"circle-translation" isBoolean:NO]; + [self testPropertyName:@"circle-translation-anchor" isBoolean:NO]; } @end diff --git a/platform/darwin/test/MGLDocumentationExampleTests.swift b/platform/darwin/test/MGLDocumentationExampleTests.swift index 418aa98d76..12bebf19bc 100644 --- a/platform/darwin/test/MGLDocumentationExampleTests.swift +++ b/platform/darwin/test/MGLDocumentationExampleTests.swift @@ -160,9 +160,9 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { layer.text = MGLStyleValue(rawValue: "{name}") #if os(macOS) var vector = CGVector(dx: 10, dy: 0) - layer.textTranslate = MGLStyleValue(rawValue: NSValue(bytes: &vector, objCType: "{CGVector=dd}")) + layer.textTranslation = MGLStyleValue(rawValue: NSValue(bytes: &vector, objCType: "{CGVector=dd}")) #else - layer.textTranslate = MGLStyleValue(rawValue: NSValue(cgVector: CGVector(dx: 10, dy: 0))) + layer.textTranslation = MGLStyleValue(rawValue: NSValue(cgVector: CGVector(dx: 10, dy: 0))) #endif layer.textJustification = MGLStyleValue(rawValue: NSValue(mglTextJustification: .left)) layer.textAnchor = MGLStyleValue(rawValue: NSValue(mglTextAnchor: .left)) diff --git a/platform/darwin/test/MGLFillStyleLayerTests.m b/platform/darwin/test/MGLFillStyleLayerTests.m index 7d51c15cf4..549a8cf4a8 100644 --- a/platform/darwin/test/MGLFillStyleLayerTests.m +++ b/platform/darwin/test/MGLFillStyleLayerTests.m @@ -25,8 +25,8 @@ layer.fillOpacity = [MGLRuntimeStylingHelper testNumber]; layer.fillOutlineColor = [MGLRuntimeStylingHelper testColor]; layer.fillPattern = [MGLRuntimeStylingHelper testString]; - layer.fillTranslate = [MGLRuntimeStylingHelper testOffset]; - layer.fillTranslateAnchor = [MGLRuntimeStylingHelper testEnum:MGLFillTranslateAnchorViewport type:@encode(MGLFillTranslateAnchor)]; + layer.fillTranslation = [MGLRuntimeStylingHelper testOffset]; + layer.fillTranslationAnchor = [MGLRuntimeStylingHelper testEnum:MGLFillTranslationAnchorViewport type:@encode(MGLFillTranslationAnchor)]; MGLFillStyleLayer *gLayer = (MGLFillStyleLayer *)[self.mapView.style layerWithIdentifier:@"layerID"]; XCTAssertTrue([gLayer isKindOfClass:[MGLFillStyleLayer class]]); @@ -35,25 +35,25 @@ XCTAssertEqualObjects(gLayer.fillOpacity, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.fillOutlineColor, [MGLRuntimeStylingHelper testColor]); XCTAssertEqualObjects(gLayer.fillPattern, [MGLRuntimeStylingHelper testString]); - XCTAssertEqualObjects(gLayer.fillTranslate, [MGLRuntimeStylingHelper testOffset]); - XCTAssert([gLayer.fillTranslateAnchor isKindOfClass:[MGLStyleConstantValue class]]); - XCTAssertEqualObjects(gLayer.fillTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLFillTranslateAnchorViewport type:@encode(MGLFillTranslateAnchor)]); + XCTAssertEqualObjects(gLayer.fillTranslation, [MGLRuntimeStylingHelper testOffset]); + XCTAssert([gLayer.fillTranslationAnchor isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.fillTranslationAnchor, [MGLRuntimeStylingHelper testEnum:MGLFillTranslationAnchorViewport type:@encode(MGLFillTranslationAnchor)]); layer.fillAntialiased = [MGLRuntimeStylingHelper testBoolFunction]; layer.fillColor = [MGLRuntimeStylingHelper testColorFunction]; layer.fillOpacity = [MGLRuntimeStylingHelper testNumberFunction]; layer.fillOutlineColor = [MGLRuntimeStylingHelper testColorFunction]; layer.fillPattern = [MGLRuntimeStylingHelper testStringFunction]; - layer.fillTranslate = [MGLRuntimeStylingHelper testOffsetFunction]; - layer.fillTranslateAnchor = [MGLRuntimeStylingHelper testEnumFunction:MGLFillTranslateAnchorViewport type:@encode(MGLFillTranslateAnchor)]; + layer.fillTranslation = [MGLRuntimeStylingHelper testOffsetFunction]; + layer.fillTranslationAnchor = [MGLRuntimeStylingHelper testEnumFunction:MGLFillTranslationAnchorViewport type:@encode(MGLFillTranslationAnchor)]; XCTAssertEqualObjects(gLayer.fillAntialiased, [MGLRuntimeStylingHelper testBoolFunction]); XCTAssertEqualObjects(gLayer.fillColor, [MGLRuntimeStylingHelper testColorFunction]); XCTAssertEqualObjects(gLayer.fillOpacity, [MGLRuntimeStylingHelper testNumberFunction]); XCTAssertEqualObjects(gLayer.fillOutlineColor, [MGLRuntimeStylingHelper testColorFunction]); XCTAssertEqualObjects(gLayer.fillPattern, [MGLRuntimeStylingHelper testStringFunction]); - XCTAssertEqualObjects(gLayer.fillTranslate, [MGLRuntimeStylingHelper testOffsetFunction]); - XCTAssertEqualObjects(gLayer.fillTranslateAnchor, [MGLRuntimeStylingHelper testEnumFunction:MGLFillTranslateAnchorViewport type:@encode(MGLFillTranslateAnchor)]); + XCTAssertEqualObjects(gLayer.fillTranslation, [MGLRuntimeStylingHelper testOffsetFunction]); + XCTAssertEqualObjects(gLayer.fillTranslationAnchor, [MGLRuntimeStylingHelper testEnumFunction:MGLFillTranslationAnchorViewport type:@encode(MGLFillTranslationAnchor)]); } - (void)testPropertyNames { @@ -62,8 +62,8 @@ [self testPropertyName:@"fill-opacity" isBoolean:NO]; [self testPropertyName:@"fill-outline-color" isBoolean:NO]; [self testPropertyName:@"fill-pattern" isBoolean:NO]; - [self testPropertyName:@"fill-translate" isBoolean:NO]; - [self testPropertyName:@"fill-translate-anchor" isBoolean:NO]; + [self testPropertyName:@"fill-translation" isBoolean:NO]; + [self testPropertyName:@"fill-translation-anchor" isBoolean:NO]; } @end diff --git a/platform/darwin/test/MGLLineStyleLayerTests.m b/platform/darwin/test/MGLLineStyleLayerTests.m index e877c1d57a..a9e9c7e6a3 100644 --- a/platform/darwin/test/MGLLineStyleLayerTests.m +++ b/platform/darwin/test/MGLLineStyleLayerTests.m @@ -31,8 +31,8 @@ layer.lineOffset = [MGLRuntimeStylingHelper testNumber]; layer.lineOpacity = [MGLRuntimeStylingHelper testNumber]; layer.linePattern = [MGLRuntimeStylingHelper testString]; - layer.lineTranslate = [MGLRuntimeStylingHelper testOffset]; - layer.lineTranslateAnchor = [MGLRuntimeStylingHelper testEnum:MGLLineTranslateAnchorViewport type:@encode(MGLLineTranslateAnchor)]; + layer.lineTranslation = [MGLRuntimeStylingHelper testOffset]; + layer.lineTranslationAnchor = [MGLRuntimeStylingHelper testEnum:MGLLineTranslationAnchorViewport type:@encode(MGLLineTranslationAnchor)]; layer.lineWidth = [MGLRuntimeStylingHelper testNumber]; MGLLineStyleLayer *gLayer = (MGLLineStyleLayer *)[self.mapView.style layerWithIdentifier:@"layerID"]; @@ -50,9 +50,9 @@ XCTAssertEqualObjects(gLayer.lineOffset, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.lineOpacity, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.linePattern, [MGLRuntimeStylingHelper testString]); - XCTAssertEqualObjects(gLayer.lineTranslate, [MGLRuntimeStylingHelper testOffset]); - XCTAssert([gLayer.lineTranslateAnchor isKindOfClass:[MGLStyleConstantValue class]]); - XCTAssertEqualObjects(gLayer.lineTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLLineTranslateAnchorViewport type:@encode(MGLLineTranslateAnchor)]); + XCTAssertEqualObjects(gLayer.lineTranslation, [MGLRuntimeStylingHelper testOffset]); + XCTAssert([gLayer.lineTranslationAnchor isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.lineTranslationAnchor, [MGLRuntimeStylingHelper testEnum:MGLLineTranslationAnchorViewport type:@encode(MGLLineTranslationAnchor)]); XCTAssertEqualObjects(gLayer.lineWidth, [MGLRuntimeStylingHelper testNumber]); layer.lineCap = [MGLRuntimeStylingHelper testEnumFunction:MGLLineCapSquare type:@encode(MGLLineCap)]; @@ -66,8 +66,8 @@ layer.lineOffset = [MGLRuntimeStylingHelper testNumberFunction]; layer.lineOpacity = [MGLRuntimeStylingHelper testNumberFunction]; layer.linePattern = [MGLRuntimeStylingHelper testStringFunction]; - layer.lineTranslate = [MGLRuntimeStylingHelper testOffsetFunction]; - layer.lineTranslateAnchor = [MGLRuntimeStylingHelper testEnumFunction:MGLLineTranslateAnchorViewport type:@encode(MGLLineTranslateAnchor)]; + layer.lineTranslation = [MGLRuntimeStylingHelper testOffsetFunction]; + layer.lineTranslationAnchor = [MGLRuntimeStylingHelper testEnumFunction:MGLLineTranslationAnchorViewport type:@encode(MGLLineTranslationAnchor)]; layer.lineWidth = [MGLRuntimeStylingHelper testNumberFunction]; XCTAssertEqualObjects(gLayer.lineCap, [MGLRuntimeStylingHelper testEnumFunction:MGLLineCapSquare type:@encode(MGLLineCap)]); @@ -81,8 +81,8 @@ XCTAssertEqualObjects(gLayer.lineOffset, [MGLRuntimeStylingHelper testNumberFunction]); XCTAssertEqualObjects(gLayer.lineOpacity, [MGLRuntimeStylingHelper testNumberFunction]); XCTAssertEqualObjects(gLayer.linePattern, [MGLRuntimeStylingHelper testStringFunction]); - XCTAssertEqualObjects(gLayer.lineTranslate, [MGLRuntimeStylingHelper testOffsetFunction]); - XCTAssertEqualObjects(gLayer.lineTranslateAnchor, [MGLRuntimeStylingHelper testEnumFunction:MGLLineTranslateAnchorViewport type:@encode(MGLLineTranslateAnchor)]); + XCTAssertEqualObjects(gLayer.lineTranslation, [MGLRuntimeStylingHelper testOffsetFunction]); + XCTAssertEqualObjects(gLayer.lineTranslationAnchor, [MGLRuntimeStylingHelper testEnumFunction:MGLLineTranslationAnchorViewport type:@encode(MGLLineTranslationAnchor)]); XCTAssertEqualObjects(gLayer.lineWidth, [MGLRuntimeStylingHelper testNumberFunction]); } @@ -98,8 +98,8 @@ [self testPropertyName:@"line-offset" isBoolean:NO]; [self testPropertyName:@"line-opacity" isBoolean:NO]; [self testPropertyName:@"line-pattern" isBoolean:NO]; - [self testPropertyName:@"line-translate" isBoolean:NO]; - [self testPropertyName:@"line-translate-anchor" isBoolean:NO]; + [self testPropertyName:@"line-translation" isBoolean:NO]; + [self testPropertyName:@"line-translation-anchor" isBoolean:NO]; [self testPropertyName:@"line-width" isBoolean:NO]; } diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.m b/platform/darwin/test/MGLSymbolStyleLayerTests.m index e8d9c775ba..ba9bc78d26 100644 --- a/platform/darwin/test/MGLSymbolStyleLayerTests.m +++ b/platform/darwin/test/MGLSymbolStyleLayerTests.m @@ -59,15 +59,15 @@ layer.iconHaloColor = [MGLRuntimeStylingHelper testColor]; layer.iconHaloWidth = [MGLRuntimeStylingHelper testNumber]; layer.iconOpacity = [MGLRuntimeStylingHelper testNumber]; - layer.iconTranslate = [MGLRuntimeStylingHelper testOffset]; - layer.iconTranslateAnchor = [MGLRuntimeStylingHelper testEnum:MGLIconTranslateAnchorViewport type:@encode(MGLIconTranslateAnchor)]; + layer.iconTranslation = [MGLRuntimeStylingHelper testOffset]; + layer.iconTranslationAnchor = [MGLRuntimeStylingHelper testEnum:MGLIconTranslationAnchorViewport type:@encode(MGLIconTranslationAnchor)]; layer.textColor = [MGLRuntimeStylingHelper testColor]; layer.textHaloBlur = [MGLRuntimeStylingHelper testNumber]; layer.textHaloColor = [MGLRuntimeStylingHelper testColor]; layer.textHaloWidth = [MGLRuntimeStylingHelper testNumber]; layer.textOpacity = [MGLRuntimeStylingHelper testNumber]; - layer.textTranslate = [MGLRuntimeStylingHelper testOffset]; - layer.textTranslateAnchor = [MGLRuntimeStylingHelper testEnum:MGLTextTranslateAnchorViewport type:@encode(MGLTextTranslateAnchor)]; + layer.textTranslation = [MGLRuntimeStylingHelper testOffset]; + layer.textTranslationAnchor = [MGLRuntimeStylingHelper testEnum:MGLTextTranslationAnchorViewport type:@encode(MGLTextTranslationAnchor)]; MGLSymbolStyleLayer *gLayer = (MGLSymbolStyleLayer *)[self.mapView.style layerWithIdentifier:@"layerID"]; XCTAssertTrue([gLayer isKindOfClass:[MGLSymbolStyleLayer class]]); @@ -118,17 +118,17 @@ XCTAssertEqualObjects(gLayer.iconHaloColor, [MGLRuntimeStylingHelper testColor]); XCTAssertEqualObjects(gLayer.iconHaloWidth, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.iconOpacity, [MGLRuntimeStylingHelper testNumber]); - XCTAssertEqualObjects(gLayer.iconTranslate, [MGLRuntimeStylingHelper testOffset]); - XCTAssert([gLayer.iconTranslateAnchor isKindOfClass:[MGLStyleConstantValue class]]); - XCTAssertEqualObjects(gLayer.iconTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLIconTranslateAnchorViewport type:@encode(MGLIconTranslateAnchor)]); + XCTAssertEqualObjects(gLayer.iconTranslation, [MGLRuntimeStylingHelper testOffset]); + XCTAssert([gLayer.iconTranslationAnchor isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.iconTranslationAnchor, [MGLRuntimeStylingHelper testEnum:MGLIconTranslationAnchorViewport type:@encode(MGLIconTranslationAnchor)]); XCTAssertEqualObjects(gLayer.textColor, [MGLRuntimeStylingHelper testColor]); XCTAssertEqualObjects(gLayer.textHaloBlur, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.textHaloColor, [MGLRuntimeStylingHelper testColor]); XCTAssertEqualObjects(gLayer.textHaloWidth, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.textOpacity, [MGLRuntimeStylingHelper testNumber]); - XCTAssertEqualObjects(gLayer.textTranslate, [MGLRuntimeStylingHelper testOffset]); - XCTAssert([gLayer.textTranslateAnchor isKindOfClass:[MGLStyleConstantValue class]]); - XCTAssertEqualObjects(gLayer.textTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLTextTranslateAnchorViewport type:@encode(MGLTextTranslateAnchor)]); + XCTAssertEqualObjects(gLayer.textTranslation, [MGLRuntimeStylingHelper testOffset]); + XCTAssert([gLayer.textTranslationAnchor isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.textTranslationAnchor, [MGLRuntimeStylingHelper testEnum:MGLTextTranslationAnchorViewport type:@encode(MGLTextTranslationAnchor)]); layer.iconAllowsOverlap = [MGLRuntimeStylingHelper testBoolFunction]; layer.iconIgnoresPlacement = [MGLRuntimeStylingHelper testBoolFunction]; @@ -169,15 +169,15 @@ layer.iconHaloColor = [MGLRuntimeStylingHelper testColorFunction]; layer.iconHaloWidth = [MGLRuntimeStylingHelper testNumberFunction]; layer.iconOpacity = [MGLRuntimeStylingHelper testNumberFunction]; - layer.iconTranslate = [MGLRuntimeStylingHelper testOffsetFunction]; - layer.iconTranslateAnchor = [MGLRuntimeStylingHelper testEnumFunction:MGLIconTranslateAnchorViewport type:@encode(MGLIconTranslateAnchor)]; + layer.iconTranslation = [MGLRuntimeStylingHelper testOffsetFunction]; + layer.iconTranslationAnchor = [MGLRuntimeStylingHelper testEnumFunction:MGLIconTranslationAnchorViewport type:@encode(MGLIconTranslationAnchor)]; layer.textColor = [MGLRuntimeStylingHelper testColorFunction]; layer.textHaloBlur = [MGLRuntimeStylingHelper testNumberFunction]; layer.textHaloColor = [MGLRuntimeStylingHelper testColorFunction]; layer.textHaloWidth = [MGLRuntimeStylingHelper testNumberFunction]; layer.textOpacity = [MGLRuntimeStylingHelper testNumberFunction]; - layer.textTranslate = [MGLRuntimeStylingHelper testOffsetFunction]; - layer.textTranslateAnchor = [MGLRuntimeStylingHelper testEnumFunction:MGLTextTranslateAnchorViewport type:@encode(MGLTextTranslateAnchor)]; + layer.textTranslation = [MGLRuntimeStylingHelper testOffsetFunction]; + layer.textTranslationAnchor = [MGLRuntimeStylingHelper testEnumFunction:MGLTextTranslationAnchorViewport type:@encode(MGLTextTranslationAnchor)]; XCTAssertEqualObjects(gLayer.iconAllowsOverlap, [MGLRuntimeStylingHelper testBoolFunction]); XCTAssertEqualObjects(gLayer.iconIgnoresPlacement, [MGLRuntimeStylingHelper testBoolFunction]); @@ -218,15 +218,15 @@ XCTAssertEqualObjects(gLayer.iconHaloColor, [MGLRuntimeStylingHelper testColorFunction]); XCTAssertEqualObjects(gLayer.iconHaloWidth, [MGLRuntimeStylingHelper testNumberFunction]); XCTAssertEqualObjects(gLayer.iconOpacity, [MGLRuntimeStylingHelper testNumberFunction]); - XCTAssertEqualObjects(gLayer.iconTranslate, [MGLRuntimeStylingHelper testOffsetFunction]); - XCTAssertEqualObjects(gLayer.iconTranslateAnchor, [MGLRuntimeStylingHelper testEnumFunction:MGLIconTranslateAnchorViewport type:@encode(MGLIconTranslateAnchor)]); + XCTAssertEqualObjects(gLayer.iconTranslation, [MGLRuntimeStylingHelper testOffsetFunction]); + XCTAssertEqualObjects(gLayer.iconTranslationAnchor, [MGLRuntimeStylingHelper testEnumFunction:MGLIconTranslationAnchorViewport type:@encode(MGLIconTranslationAnchor)]); XCTAssertEqualObjects(gLayer.textColor, [MGLRuntimeStylingHelper testColorFunction]); XCTAssertEqualObjects(gLayer.textHaloBlur, [MGLRuntimeStylingHelper testNumberFunction]); XCTAssertEqualObjects(gLayer.textHaloColor, [MGLRuntimeStylingHelper testColorFunction]); XCTAssertEqualObjects(gLayer.textHaloWidth, [MGLRuntimeStylingHelper testNumberFunction]); XCTAssertEqualObjects(gLayer.textOpacity, [MGLRuntimeStylingHelper testNumberFunction]); - XCTAssertEqualObjects(gLayer.textTranslate, [MGLRuntimeStylingHelper testOffsetFunction]); - XCTAssertEqualObjects(gLayer.textTranslateAnchor, [MGLRuntimeStylingHelper testEnumFunction:MGLTextTranslateAnchorViewport type:@encode(MGLTextTranslateAnchor)]); + XCTAssertEqualObjects(gLayer.textTranslation, [MGLRuntimeStylingHelper testOffsetFunction]); + XCTAssertEqualObjects(gLayer.textTranslationAnchor, [MGLRuntimeStylingHelper testEnumFunction:MGLTextTranslationAnchorViewport type:@encode(MGLTextTranslationAnchor)]); } - (void)testPropertyNames { @@ -269,15 +269,15 @@ [self testPropertyName:@"icon-halo-color" isBoolean:NO]; [self testPropertyName:@"icon-halo-width" isBoolean:NO]; [self testPropertyName:@"icon-opacity" isBoolean:NO]; - [self testPropertyName:@"icon-translate" isBoolean:NO]; - [self testPropertyName:@"icon-translate-anchor" isBoolean:NO]; + [self testPropertyName:@"icon-translation" isBoolean:NO]; + [self testPropertyName:@"icon-translation-anchor" isBoolean:NO]; [self testPropertyName:@"text-color" isBoolean:NO]; [self testPropertyName:@"text-halo-blur" isBoolean:NO]; [self testPropertyName:@"text-halo-color" isBoolean:NO]; [self testPropertyName:@"text-halo-width" isBoolean:NO]; [self testPropertyName:@"text-opacity" isBoolean:NO]; - [self testPropertyName:@"text-translate" isBoolean:NO]; - [self testPropertyName:@"text-translate-anchor" isBoolean:NO]; + [self testPropertyName:@"text-translation" isBoolean:NO]; + [self testPropertyName:@"text-translation-anchor" isBoolean:NO]; } @end diff --git a/platform/ios/docs/guides/For Style Authors.md b/platform/ios/docs/guides/For Style Authors.md index c5ce50f3b2..8b6d153b56 100644 --- a/platform/ios/docs/guides/For Style Authors.md +++ b/platform/ios/docs/guides/For Style Authors.md @@ -193,18 +193,24 @@ whose names differ from the style specification are listed below: In style JSON | In Objective-C | In Swift --------------|----------------|--------- `circle-pitch-scale` | `MGLCircleStyleLayer.circleScaleAlignment` | `MGLCircleStyleLayer.circleScaleAlignment` +`circle-translate` | `MGLCircleStyleLayer.circleTranslation` | `MGLCircleStyleLayer.circleTranslation` +`circle-translate-anchor` | `MGLCircleStyleLayer.circleTranslationAnchor` | `MGLCircleStyleLayer.circleTranslationAnchor` ### Fill style layers In style JSON | In Objective-C | In Swift --------------|----------------|--------- `fill-antialias` | `MGLFillStyleLayer.fillAntialiased` | `MGLFillStyleLayer.isFillAntialiased` +`fill-translate` | `MGLFillStyleLayer.fillTranslation` | `MGLFillStyleLayer.fillTranslation` +`fill-translate-anchor` | `MGLFillStyleLayer.fillTranslationAnchor` | `MGLFillStyleLayer.fillTranslationAnchor` ### Line style layers In style JSON | In Objective-C | In Swift --------------|----------------|--------- `line-dasharray` | `MGLLineStyleLayer.lineDashPattern` | `MGLLineStyleLayer.lineDashPattern` +`line-translate` | `MGLLineStyleLayer.lineTranslation` | `MGLLineStyleLayer.lineTranslation` +`line-translate-anchor` | `MGLLineStyleLayer.lineTranslationAnchor` | `MGLLineStyleLayer.lineTranslationAnchor` ### Raster style layers @@ -237,6 +243,10 @@ In style JSON | In Objective-C | In Swift `text-justify` | `MGLSymbolStyleLayer.textJustification` | `MGLSymbolStyleLayer.textJustification` `text-optional` | `MGLSymbolStyleLayer.textOptional` | `MGLSymbolStyleLayer.isTextOptional` `text-rotate` | `MGLSymbolStyleLayer.textRotation` | `MGLSymbolStyleLayer.textRotation` +`icon-translate` | `MGLSymbolStyleLayer.iconTranslation` | `MGLSymbolStyleLayer.iconTranslation` +`icon-translate-anchor` | `MGLSymbolStyleLayer.iconTranslationAnchor` | `MGLSymbolStyleLayer.iconTranslationAnchor` +`text-translate` | `MGLSymbolStyleLayer.textTranslation` | `MGLSymbolStyleLayer.textTranslation` +`text-translate-anchor` | `MGLSymbolStyleLayer.textTranslationAnchor` | `MGLSymbolStyleLayer.textTranslationAnchor` ## Setting attribute values diff --git a/platform/macos/docs/guides/For Style Authors.md b/platform/macos/docs/guides/For Style Authors.md index 42c62fc006..5f11c17597 100644 --- a/platform/macos/docs/guides/For Style Authors.md +++ b/platform/macos/docs/guides/For Style Authors.md @@ -181,18 +181,24 @@ whose names differ from the style specification are listed below: In style JSON | In Objective-C | In Swift --------------|----------------|--------- `circle-pitch-scale` | `MGLCircleStyleLayer.circleScaleAlignment` | `MGLCircleStyleLayer.circleScaleAlignment` +`circle-translate` | `MGLCircleStyleLayer.circleTranslation` | `MGLCircleStyleLayer.circleTranslation` +`circle-translate-anchor` | `MGLCircleStyleLayer.circleTranslationAnchor` | `MGLCircleStyleLayer.circleTranslationAnchor` ### Fill style layers In style JSON | In Objective-C | In Swift --------------|----------------|--------- `fill-antialias` | `MGLFillStyleLayer.fillAntialiased` | `MGLFillStyleLayer.isFillAntialiased` +`fill-translate` | `MGLFillStyleLayer.fillTranslation` | `MGLFillStyleLayer.fillTranslation` +`fill-translate-anchor` | `MGLFillStyleLayer.fillTranslationAnchor` | `MGLFillStyleLayer.fillTranslationAnchor` ### Line style layers In style JSON | In Objective-C | In Swift --------------|----------------|--------- `line-dasharray` | `MGLLineStyleLayer.lineDashPattern` | `MGLLineStyleLayer.lineDashPattern` +`line-translate` | `MGLLineStyleLayer.lineTranslation` | `MGLLineStyleLayer.lineTranslation` +`line-translate-anchor` | `MGLLineStyleLayer.lineTranslationAnchor` | `MGLLineStyleLayer.lineTranslationAnchor` ### Raster style layers @@ -225,6 +231,10 @@ In style JSON | In Objective-C | In Swift `text-justify` | `MGLSymbolStyleLayer.textJustification` | `MGLSymbolStyleLayer.textJustification` `text-optional` | `MGLSymbolStyleLayer.textOptional` | `MGLSymbolStyleLayer.isTextOptional` `text-rotate` | `MGLSymbolStyleLayer.textRotation` | `MGLSymbolStyleLayer.textRotation` +`icon-translate` | `MGLSymbolStyleLayer.iconTranslation` | `MGLSymbolStyleLayer.iconTranslation` +`icon-translate-anchor` | `MGLSymbolStyleLayer.iconTranslationAnchor` | `MGLSymbolStyleLayer.iconTranslationAnchor` +`text-translate` | `MGLSymbolStyleLayer.textTranslation` | `MGLSymbolStyleLayer.textTranslation` +`text-translate-anchor` | `MGLSymbolStyleLayer.textTranslationAnchor` | `MGLSymbolStyleLayer.textTranslationAnchor` ## Setting attribute values -- cgit v1.2.1