diff options
Diffstat (limited to 'platform/darwin')
-rw-r--r-- | platform/darwin/scripts/generate-style-code.js | 13 | ||||
-rw-r--r-- | platform/darwin/src/MGLCircleStyleLayer.h | 36 | ||||
-rw-r--r-- | platform/darwin/src/MGLCircleStyleLayer.mm | 24 | ||||
-rw-r--r-- | platform/darwin/src/MGLFillStyleLayer.h | 23 | ||||
-rw-r--r-- | platform/darwin/src/MGLFillStyleLayer.mm | 14 | ||||
-rw-r--r-- | platform/darwin/src/MGLLineStyleLayer.h | 49 | ||||
-rw-r--r-- | platform/darwin/src/MGLLineStyleLayer.mm | 34 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyleLayer.h.ejs | 28 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyleLayer.mm.ejs | 22 | ||||
-rw-r--r-- | platform/darwin/src/MGLSymbolStyleLayer.h | 140 | ||||
-rw-r--r-- | platform/darwin/src/MGLSymbolStyleLayer.mm | 104 | ||||
-rw-r--r-- | platform/darwin/src/NSValue+MGLStyleLayerAdditions.h | 261 | ||||
-rw-r--r-- | platform/darwin/src/NSValue+MGLStyleLayerAdditions.h.ejs | 44 | ||||
-rw-r--r-- | platform/darwin/src/NSValue+MGLStyleLayerAdditions.mm | 181 | ||||
-rw-r--r-- | platform/darwin/src/NSValue+MGLStyleLayerAdditions.mm.ejs | 28 |
15 files changed, 473 insertions, 528 deletions
diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js index 98ee1a83f7..a7421da103 100644 --- a/platform/darwin/scripts/generate-style-code.js +++ b/platform/darwin/scripts/generate-style-code.js @@ -368,8 +368,6 @@ global.mbglType = function(property) { const layerH = ejs.compile(fs.readFileSync('platform/darwin/src/MGLStyleLayer.h.ejs', 'utf8'), { strict: true }); const layerM = ejs.compile(fs.readFileSync('platform/darwin/src/MGLStyleLayer.mm.ejs', 'utf8'), { strict: true}); const testLayers = ejs.compile(fs.readFileSync('platform/darwin/test/MGLStyleLayerTests.m.ejs', 'utf8'), { strict: true}); -const categoryH = ejs.compile(fs.readFileSync('platform/darwin/src/NSValue+MGLStyleLayerAdditions.h.ejs', 'utf8'), { strict: true}); -const categoryM = ejs.compile(fs.readFileSync('platform/darwin/src/NSValue+MGLStyleLayerAdditions.mm.ejs', 'utf8'), { strict: true}); const guideMD = ejs.compile(fs.readFileSync('platform/darwin/docs/guides/For Style Authors.md.ejs', 'utf8'), { strict: true }); const layers = _(spec.layer.type.values).map((value, layerType) => { @@ -414,15 +412,13 @@ ${macosComment}${decl} }); } -let enumPropertiesByLayerType = {}; var renamedPropertiesByLayerType = {}; for (var layer of layers) { let properties = _.concat(layer.layoutProperties, layer.paintProperties); let enumProperties = _.filter(properties, prop => prop.type === 'enum'); if (enumProperties.length) { - enumPropertiesByLayerType[layer.type] = enumProperties; - layer.containsEnumerationProperties = true; + layer.enumProperties = enumProperties; } let renamedProperties = {}; @@ -436,13 +432,6 @@ for (var layer of layers) { fs.writeFileSync(`platform/darwin/test/${prefix}${camelize(layer.type)}${suffix}Tests.m`, testLayers(layer)); } -fs.writeFileSync(`platform/darwin/src/NSValue+MGLStyleLayerAdditions.h`, categoryH({ - enumPropertiesByLayerType: enumPropertiesByLayerType, -})); -fs.writeFileSync(`platform/darwin/src/NSValue+MGLStyleLayerAdditions.mm`, categoryM({ - enumPropertiesByLayerType: enumPropertiesByLayerType, -})); - fs.writeFileSync(`platform/ios/docs/guides/For Style Authors.md`, guideMD({ os: 'iOS', renamedProperties: renamedPropertiesByLayerType, diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h index d2e043e22a..f0fc95db06 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.h +++ b/platform/darwin/src/MGLCircleStyleLayer.h @@ -164,4 +164,40 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslateAnchor) { @end +/** + Methods for wrapping an enumeration value for a style layer attribute in an + `MGLCircleStyleLayer` object and unwrapping its raw value. + */ +@interface NSValue (MGLCircleStyleLayerAdditions) + +#pragma mark Working with Circle Style Layer Attribute Values + +/** + Creates a new value object containing the given `MGLCirclePitchScale` enumeration. + + @param circlePitchScale The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLCirclePitchScale:(MGLCirclePitchScale)circlePitchScale; + +/** + The `MGLCirclePitchScale` enumeration representation of the value. + */ +@property (readonly) MGLCirclePitchScale MGLCirclePitchScaleValue; + +/** + Creates a new value object containing the given `MGLCircleTranslateAnchor` enumeration. + + @param circleTranslateAnchor The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLCircleTranslateAnchor:(MGLCircleTranslateAnchor)circleTranslateAnchor; + +/** + The `MGLCircleTranslateAnchor` enumeration representation of the value. + */ +@property (readonly) MGLCircleTranslateAnchor MGLCircleTranslateAnchorValue; + +@end + NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm index 25dd859606..ecba9b01d3 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.mm +++ b/platform/darwin/src/MGLCircleStyleLayer.mm @@ -231,3 +231,27 @@ namespace mbgl { @end + +@implementation NSValue (MGLCircleStyleLayerAdditions) + ++ (NSValue *)valueWithMGLCirclePitchScale:(MGLCirclePitchScale)circlePitchScale { + return [NSValue value:&circlePitchScale withObjCType:@encode(MGLCirclePitchScale)]; +} + +- (MGLCirclePitchScale)MGLCirclePitchScaleValue { + MGLCirclePitchScale circlePitchScale; + [self getValue:&circlePitchScale]; + return circlePitchScale; +} + ++ (NSValue *)valueWithMGLCircleTranslateAnchor:(MGLCircleTranslateAnchor)circleTranslateAnchor { + return [NSValue value:&circleTranslateAnchor withObjCType:@encode(MGLCircleTranslateAnchor)]; +} + +- (MGLCircleTranslateAnchor)MGLCircleTranslateAnchorValue { + MGLCircleTranslateAnchor circleTranslateAnchor; + [self getValue:&circleTranslateAnchor]; + return circleTranslateAnchor; +} + +@end diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h index 184f44ef65..a154b2e297 100644 --- a/platform/darwin/src/MGLFillStyleLayer.h +++ b/platform/darwin/src/MGLFillStyleLayer.h @@ -144,4 +144,27 @@ typedef NS_ENUM(NSUInteger, MGLFillTranslateAnchor) { @end +/** + Methods for wrapping an enumeration value for a style layer attribute in an + `MGLFillStyleLayer` object and unwrapping its raw value. + */ +@interface NSValue (MGLFillStyleLayerAdditions) + +#pragma mark Working with Fill Style Layer Attribute Values + +/** + Creates a new value object containing the given `MGLFillTranslateAnchor` enumeration. + + @param fillTranslateAnchor The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLFillTranslateAnchor:(MGLFillTranslateAnchor)fillTranslateAnchor; + +/** + The `MGLFillTranslateAnchor` enumeration representation of the value. + */ +@property (readonly) MGLFillTranslateAnchor MGLFillTranslateAnchorValue; + +@end + NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm index 204a4e92cb..967014929f 100644 --- a/platform/darwin/src/MGLFillStyleLayer.mm +++ b/platform/darwin/src/MGLFillStyleLayer.mm @@ -231,3 +231,17 @@ namespace mbgl { @end + +@implementation NSValue (MGLFillStyleLayerAdditions) + ++ (NSValue *)valueWithMGLFillTranslateAnchor:(MGLFillTranslateAnchor)fillTranslateAnchor { + return [NSValue value:&fillTranslateAnchor withObjCType:@encode(MGLFillTranslateAnchor)]; +} + +- (MGLFillTranslateAnchor)MGLFillTranslateAnchorValue { + MGLFillTranslateAnchor fillTranslateAnchor; + [self getValue:&fillTranslateAnchor]; + return fillTranslateAnchor; +} + +@end diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index f049ae1db1..72629c4d0e 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -286,4 +286,53 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslateAnchor) { @end +/** + Methods for wrapping an enumeration value for a style layer attribute in an + `MGLLineStyleLayer` object and unwrapping its raw value. + */ +@interface NSValue (MGLLineStyleLayerAdditions) + +#pragma mark Working with Line Style Layer Attribute Values + +/** + Creates a new value object containing the given `MGLLineCap` enumeration. + + @param lineCap The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLLineCap:(MGLLineCap)lineCap; + +/** + The `MGLLineCap` enumeration representation of the value. + */ +@property (readonly) MGLLineCap MGLLineCapValue; + +/** + Creates a new value object containing the given `MGLLineJoin` enumeration. + + @param lineJoin The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLLineJoin:(MGLLineJoin)lineJoin; + +/** + The `MGLLineJoin` enumeration representation of the value. + */ +@property (readonly) MGLLineJoin MGLLineJoinValue; + +/** + Creates a new value object containing the given `MGLLineTranslateAnchor` enumeration. + + @param lineTranslateAnchor The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLLineTranslateAnchor:(MGLLineTranslateAnchor)lineTranslateAnchor; + +/** + The `MGLLineTranslateAnchor` enumeration representation of the value. + */ +@property (readonly) MGLLineTranslateAnchor MGLLineTranslateAnchorValue; + +@end + NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm index ab58a35f7f..ae838af0a8 100644 --- a/platform/darwin/src/MGLLineStyleLayer.mm +++ b/platform/darwin/src/MGLLineStyleLayer.mm @@ -343,3 +343,37 @@ namespace mbgl { @end + +@implementation NSValue (MGLLineStyleLayerAdditions) + ++ (NSValue *)valueWithMGLLineCap:(MGLLineCap)lineCap { + return [NSValue value:&lineCap withObjCType:@encode(MGLLineCap)]; +} + +- (MGLLineCap)MGLLineCapValue { + MGLLineCap lineCap; + [self getValue:&lineCap]; + return lineCap; +} + ++ (NSValue *)valueWithMGLLineJoin:(MGLLineJoin)lineJoin { + return [NSValue value:&lineJoin withObjCType:@encode(MGLLineJoin)]; +} + +- (MGLLineJoin)MGLLineJoinValue { + MGLLineJoin lineJoin; + [self getValue:&lineJoin]; + return lineJoin; +} + ++ (NSValue *)valueWithMGLLineTranslateAnchor:(MGLLineTranslateAnchor)lineTranslateAnchor { + return [NSValue value:&lineTranslateAnchor withObjCType:@encode(MGLLineTranslateAnchor)]; +} + +- (MGLLineTranslateAnchor)MGLLineTranslateAnchorValue { + MGLLineTranslateAnchor lineTranslateAnchor; + [self getValue:&lineTranslateAnchor]; + return lineTranslateAnchor; +} + +@end diff --git a/platform/darwin/src/MGLStyleLayer.h.ejs b/platform/darwin/src/MGLStyleLayer.h.ejs index 17529b8f9d..a10512dbcb 100644 --- a/platform/darwin/src/MGLStyleLayer.h.ejs +++ b/platform/darwin/src/MGLStyleLayer.h.ejs @@ -3,6 +3,7 @@ const type = locals.type; const layoutProperties = locals.layoutProperties; const paintProperties = locals.paintProperties; + const enumProperties = locals.enumProperties; -%> // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. @@ -116,4 +117,31 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) { <% } -%> @end +<% if (enumProperties) { -%> +/** + Methods for wrapping an enumeration value for a style layer attribute in an + `MGL<%- camelize(type) %>StyleLayer` object and unwrapping its raw value. + */ +@interface NSValue (MGL<%- camelize(type) %>StyleLayerAdditions) + +#pragma mark Working with <%- camelize(type) %> Style Layer Attribute Values + +<% for (let property of enumProperties) { -%> +/** + Creates a new value object containing the given `MGL<%- camelize(property.name) %>` enumeration. + + @param <%- objCName(property) %> The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGL<%- camelize(property.name) %>:(MGL<%- camelize(property.name) %>)<%- objCName(property) %>; + +/** + The `MGL<%- camelize(property.name) %>` enumeration representation of the value. + */ +@property (readonly) MGL<%- camelize(property.name) %> MGL<%- camelize(property.name) %>Value; + +<% } -%> +@end + +<% } -%> NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs index 30bec0c79e..c7e379eaa7 100644 --- a/platform/darwin/src/MGLStyleLayer.mm.ejs +++ b/platform/darwin/src/MGLStyleLayer.mm.ejs @@ -2,7 +2,7 @@ const type = locals.type; const layoutProperties = locals.layoutProperties; const paintProperties = locals.paintProperties; - const containsEnumerationProperties = locals.containsEnumerationProperties; + const enumProperties = locals.enumProperties; -%> // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. @@ -15,7 +15,7 @@ #import "MGL<%- camelize(type) %>StyleLayer.h" #include <mbgl/style/layers/<%- type %>_layer.hpp> -<% if (containsEnumerationProperties) { -%> +<% if (enumProperties) { -%> namespace mbgl { <% if (layoutProperties.length) { -%> @@ -243,3 +243,21 @@ namespace mbgl { <% } -%> @end +<% if (enumProperties) { -%> + +@implementation NSValue (MGL<%- camelize(type) %>StyleLayerAdditions) + +<% for (let property of enumProperties) { -%> ++ (NSValue *)valueWithMGL<%- camelize(property.name) %>:(MGL<%- camelize(property.name) %>)<%- objCName(property) %> { + return [NSValue value:&<%- objCName(property) %> withObjCType:@encode(MGL<%- camelize(property.name) %>)]; +} + +- (MGL<%- camelize(property.name) %>)MGL<%- camelize(property.name) %>Value { + MGL<%- camelize(property.name) %> <%- objCName(property) %>; + [self getValue:&<%- objCName(property) %>]; + return <%- objCName(property) %>; +} + +<% } -%> +@end +<% } -%>
\ No newline at end of file diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h index ca34698159..e12faa46ea 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.h +++ b/platform/darwin/src/MGLSymbolStyleLayer.h @@ -1064,4 +1064,144 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslateAnchor) { @end +/** + Methods for wrapping an enumeration value for a style layer attribute in an + `MGLSymbolStyleLayer` object and unwrapping its raw value. + */ +@interface NSValue (MGLSymbolStyleLayerAdditions) + +#pragma mark Working with Symbol Style Layer Attribute Values + +/** + Creates a new value object containing the given `MGLIconRotationAlignment` enumeration. + + @param iconRotationAlignment The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLIconRotationAlignment:(MGLIconRotationAlignment)iconRotationAlignment; + +/** + The `MGLIconRotationAlignment` enumeration representation of the value. + */ +@property (readonly) MGLIconRotationAlignment MGLIconRotationAlignmentValue; + +/** + Creates a new value object containing the given `MGLIconTextFit` enumeration. + + @param iconTextFit The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLIconTextFit:(MGLIconTextFit)iconTextFit; + +/** + The `MGLIconTextFit` enumeration representation of the value. + */ +@property (readonly) MGLIconTextFit MGLIconTextFitValue; + +/** + Creates a new value object containing the given `MGLSymbolPlacement` enumeration. + + @param symbolPlacement The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLSymbolPlacement:(MGLSymbolPlacement)symbolPlacement; + +/** + The `MGLSymbolPlacement` enumeration representation of the value. + */ +@property (readonly) MGLSymbolPlacement MGLSymbolPlacementValue; + +/** + Creates a new value object containing the given `MGLTextAnchor` enumeration. + + @param textAnchor The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLTextAnchor:(MGLTextAnchor)textAnchor; + +/** + The `MGLTextAnchor` enumeration representation of the value. + */ +@property (readonly) MGLTextAnchor MGLTextAnchorValue; + +/** + Creates a new value object containing the given `MGLTextJustification` enumeration. + + @param textJustification The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLTextJustification:(MGLTextJustification)textJustification; + +/** + The `MGLTextJustification` enumeration representation of the value. + */ +@property (readonly) MGLTextJustification MGLTextJustificationValue; + +/** + Creates a new value object containing the given `MGLTextPitchAlignment` enumeration. + + @param textPitchAlignment The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLTextPitchAlignment:(MGLTextPitchAlignment)textPitchAlignment; + +/** + The `MGLTextPitchAlignment` enumeration representation of the value. + */ +@property (readonly) MGLTextPitchAlignment MGLTextPitchAlignmentValue; + +/** + Creates a new value object containing the given `MGLTextRotationAlignment` enumeration. + + @param textRotationAlignment The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLTextRotationAlignment:(MGLTextRotationAlignment)textRotationAlignment; + +/** + The `MGLTextRotationAlignment` enumeration representation of the value. + */ +@property (readonly) MGLTextRotationAlignment MGLTextRotationAlignmentValue; + +/** + Creates a new value object containing the given `MGLTextTransform` enumeration. + + @param textTransform The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLTextTransform:(MGLTextTransform)textTransform; + +/** + The `MGLTextTransform` enumeration representation of the value. + */ +@property (readonly) MGLTextTransform MGLTextTransformValue; + +/** + Creates a new value object containing the given `MGLIconTranslateAnchor` enumeration. + + @param iconTranslateAnchor The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLIconTranslateAnchor:(MGLIconTranslateAnchor)iconTranslateAnchor; + +/** + The `MGLIconTranslateAnchor` enumeration representation of the value. + */ +@property (readonly) MGLIconTranslateAnchor MGLIconTranslateAnchorValue; + +/** + Creates a new value object containing the given `MGLTextTranslateAnchor` enumeration. + + @param textTranslateAnchor The value for the new object. + @return A new value object that contains the enumeration value. + */ ++ (instancetype)valueWithMGLTextTranslateAnchor:(MGLTextTranslateAnchor)textTranslateAnchor; + +/** + The `MGLTextTranslateAnchor` enumeration representation of the value. + */ +@property (readonly) MGLTextTranslateAnchor MGLTextTranslateAnchorValue; + +@end + NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm index 464a3d9505..3cfaee986b 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.mm +++ b/platform/darwin/src/MGLSymbolStyleLayer.mm @@ -987,3 +987,107 @@ namespace mbgl { @end + +@implementation NSValue (MGLSymbolStyleLayerAdditions) + ++ (NSValue *)valueWithMGLIconRotationAlignment:(MGLIconRotationAlignment)iconRotationAlignment { + return [NSValue value:&iconRotationAlignment withObjCType:@encode(MGLIconRotationAlignment)]; +} + +- (MGLIconRotationAlignment)MGLIconRotationAlignmentValue { + MGLIconRotationAlignment iconRotationAlignment; + [self getValue:&iconRotationAlignment]; + return iconRotationAlignment; +} + ++ (NSValue *)valueWithMGLIconTextFit:(MGLIconTextFit)iconTextFit { + return [NSValue value:&iconTextFit withObjCType:@encode(MGLIconTextFit)]; +} + +- (MGLIconTextFit)MGLIconTextFitValue { + MGLIconTextFit iconTextFit; + [self getValue:&iconTextFit]; + return iconTextFit; +} + ++ (NSValue *)valueWithMGLSymbolPlacement:(MGLSymbolPlacement)symbolPlacement { + return [NSValue value:&symbolPlacement withObjCType:@encode(MGLSymbolPlacement)]; +} + +- (MGLSymbolPlacement)MGLSymbolPlacementValue { + MGLSymbolPlacement symbolPlacement; + [self getValue:&symbolPlacement]; + return symbolPlacement; +} + ++ (NSValue *)valueWithMGLTextAnchor:(MGLTextAnchor)textAnchor { + return [NSValue value:&textAnchor withObjCType:@encode(MGLTextAnchor)]; +} + +- (MGLTextAnchor)MGLTextAnchorValue { + MGLTextAnchor textAnchor; + [self getValue:&textAnchor]; + return textAnchor; +} + ++ (NSValue *)valueWithMGLTextJustification:(MGLTextJustification)textJustification { + return [NSValue value:&textJustification withObjCType:@encode(MGLTextJustification)]; +} + +- (MGLTextJustification)MGLTextJustificationValue { + MGLTextJustification textJustification; + [self getValue:&textJustification]; + return textJustification; +} + ++ (NSValue *)valueWithMGLTextPitchAlignment:(MGLTextPitchAlignment)textPitchAlignment { + return [NSValue value:&textPitchAlignment withObjCType:@encode(MGLTextPitchAlignment)]; +} + +- (MGLTextPitchAlignment)MGLTextPitchAlignmentValue { + MGLTextPitchAlignment textPitchAlignment; + [self getValue:&textPitchAlignment]; + return textPitchAlignment; +} + ++ (NSValue *)valueWithMGLTextRotationAlignment:(MGLTextRotationAlignment)textRotationAlignment { + return [NSValue value:&textRotationAlignment withObjCType:@encode(MGLTextRotationAlignment)]; +} + +- (MGLTextRotationAlignment)MGLTextRotationAlignmentValue { + MGLTextRotationAlignment textRotationAlignment; + [self getValue:&textRotationAlignment]; + return textRotationAlignment; +} + ++ (NSValue *)valueWithMGLTextTransform:(MGLTextTransform)textTransform { + return [NSValue value:&textTransform withObjCType:@encode(MGLTextTransform)]; +} + +- (MGLTextTransform)MGLTextTransformValue { + MGLTextTransform textTransform; + [self getValue:&textTransform]; + return textTransform; +} + ++ (NSValue *)valueWithMGLIconTranslateAnchor:(MGLIconTranslateAnchor)iconTranslateAnchor { + return [NSValue value:&iconTranslateAnchor withObjCType:@encode(MGLIconTranslateAnchor)]; +} + +- (MGLIconTranslateAnchor)MGLIconTranslateAnchorValue { + MGLIconTranslateAnchor iconTranslateAnchor; + [self getValue:&iconTranslateAnchor]; + return iconTranslateAnchor; +} + ++ (NSValue *)valueWithMGLTextTranslateAnchor:(MGLTextTranslateAnchor)textTranslateAnchor { + return [NSValue value:&textTranslateAnchor withObjCType:@encode(MGLTextTranslateAnchor)]; +} + +- (MGLTextTranslateAnchor)MGLTextTranslateAnchorValue { + MGLTextTranslateAnchor textTranslateAnchor; + [self getValue:&textTranslateAnchor]; + return textTranslateAnchor; +} + +@end diff --git a/platform/darwin/src/NSValue+MGLStyleLayerAdditions.h b/platform/darwin/src/NSValue+MGLStyleLayerAdditions.h deleted file mode 100644 index 92fda42d76..0000000000 --- a/platform/darwin/src/NSValue+MGLStyleLayerAdditions.h +++ /dev/null @@ -1,261 +0,0 @@ -// This file is generated. -// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. - -#import <Foundation/Foundation.h> - -#import "MGLCircleStyleLayer.h" -#import "MGLFillStyleLayer.h" -#import "MGLLineStyleLayer.h" -#import "MGLSymbolStyleLayer.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - Methods for wrapping an enumeration value for a style layer attribute in an - `MGLCircleStyleLayer` object and unwrapping its raw value. - */ -@interface NSValue (MGLCircleStyleLayerAdditions) - -#pragma mark Working with Circle Style Layer Attribute Values - -/** - Creates a new value object containing the given `MGLCirclePitchScale` enumeration. - - @param circlePitchScale The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLCirclePitchScale:(MGLCirclePitchScale)circlePitchScale; - -/** - The `MGLCirclePitchScale` enumeration representation of the value. - */ -@property (readonly) MGLCirclePitchScale MGLCirclePitchScaleValue; - -/** - Creates a new value object containing the given `MGLCircleTranslateAnchor` enumeration. - - @param circleTranslateAnchor The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLCircleTranslateAnchor:(MGLCircleTranslateAnchor)circleTranslateAnchor; - -/** - The `MGLCircleTranslateAnchor` enumeration representation of the value. - */ -@property (readonly) MGLCircleTranslateAnchor MGLCircleTranslateAnchorValue; - -@end - -/** - Methods for wrapping an enumeration value for a style layer attribute in an - `MGLFillStyleLayer` object and unwrapping its raw value. - */ -@interface NSValue (MGLFillStyleLayerAdditions) - -#pragma mark Working with Fill Style Layer Attribute Values - -/** - Creates a new value object containing the given `MGLFillTranslateAnchor` enumeration. - - @param fillTranslateAnchor The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLFillTranslateAnchor:(MGLFillTranslateAnchor)fillTranslateAnchor; - -/** - The `MGLFillTranslateAnchor` enumeration representation of the value. - */ -@property (readonly) MGLFillTranslateAnchor MGLFillTranslateAnchorValue; - -@end - -/** - Methods for wrapping an enumeration value for a style layer attribute in an - `MGLLineStyleLayer` object and unwrapping its raw value. - */ -@interface NSValue (MGLLineStyleLayerAdditions) - -#pragma mark Working with Line Style Layer Attribute Values - -/** - Creates a new value object containing the given `MGLLineCap` enumeration. - - @param lineCap The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLLineCap:(MGLLineCap)lineCap; - -/** - The `MGLLineCap` enumeration representation of the value. - */ -@property (readonly) MGLLineCap MGLLineCapValue; - -/** - Creates a new value object containing the given `MGLLineJoin` enumeration. - - @param lineJoin The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLLineJoin:(MGLLineJoin)lineJoin; - -/** - The `MGLLineJoin` enumeration representation of the value. - */ -@property (readonly) MGLLineJoin MGLLineJoinValue; - -/** - Creates a new value object containing the given `MGLLineTranslateAnchor` enumeration. - - @param lineTranslateAnchor The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLLineTranslateAnchor:(MGLLineTranslateAnchor)lineTranslateAnchor; - -/** - The `MGLLineTranslateAnchor` enumeration representation of the value. - */ -@property (readonly) MGLLineTranslateAnchor MGLLineTranslateAnchorValue; - -@end - -/** - Methods for wrapping an enumeration value for a style layer attribute in an - `MGLSymbolStyleLayer` object and unwrapping its raw value. - */ -@interface NSValue (MGLSymbolStyleLayerAdditions) - -#pragma mark Working with Symbol Style Layer Attribute Values - -/** - Creates a new value object containing the given `MGLIconRotationAlignment` enumeration. - - @param iconRotationAlignment The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLIconRotationAlignment:(MGLIconRotationAlignment)iconRotationAlignment; - -/** - The `MGLIconRotationAlignment` enumeration representation of the value. - */ -@property (readonly) MGLIconRotationAlignment MGLIconRotationAlignmentValue; - -/** - Creates a new value object containing the given `MGLIconTextFit` enumeration. - - @param iconTextFit The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLIconTextFit:(MGLIconTextFit)iconTextFit; - -/** - The `MGLIconTextFit` enumeration representation of the value. - */ -@property (readonly) MGLIconTextFit MGLIconTextFitValue; - -/** - Creates a new value object containing the given `MGLSymbolPlacement` enumeration. - - @param symbolPlacement The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLSymbolPlacement:(MGLSymbolPlacement)symbolPlacement; - -/** - The `MGLSymbolPlacement` enumeration representation of the value. - */ -@property (readonly) MGLSymbolPlacement MGLSymbolPlacementValue; - -/** - Creates a new value object containing the given `MGLTextAnchor` enumeration. - - @param textAnchor The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLTextAnchor:(MGLTextAnchor)textAnchor; - -/** - The `MGLTextAnchor` enumeration representation of the value. - */ -@property (readonly) MGLTextAnchor MGLTextAnchorValue; - -/** - Creates a new value object containing the given `MGLTextJustification` enumeration. - - @param textJustification The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLTextJustification:(MGLTextJustification)textJustification; - -/** - The `MGLTextJustification` enumeration representation of the value. - */ -@property (readonly) MGLTextJustification MGLTextJustificationValue; - -/** - Creates a new value object containing the given `MGLTextPitchAlignment` enumeration. - - @param textPitchAlignment The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLTextPitchAlignment:(MGLTextPitchAlignment)textPitchAlignment; - -/** - The `MGLTextPitchAlignment` enumeration representation of the value. - */ -@property (readonly) MGLTextPitchAlignment MGLTextPitchAlignmentValue; - -/** - Creates a new value object containing the given `MGLTextRotationAlignment` enumeration. - - @param textRotationAlignment The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLTextRotationAlignment:(MGLTextRotationAlignment)textRotationAlignment; - -/** - The `MGLTextRotationAlignment` enumeration representation of the value. - */ -@property (readonly) MGLTextRotationAlignment MGLTextRotationAlignmentValue; - -/** - Creates a new value object containing the given `MGLTextTransform` enumeration. - - @param textTransform The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLTextTransform:(MGLTextTransform)textTransform; - -/** - The `MGLTextTransform` enumeration representation of the value. - */ -@property (readonly) MGLTextTransform MGLTextTransformValue; - -/** - Creates a new value object containing the given `MGLIconTranslateAnchor` enumeration. - - @param iconTranslateAnchor The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLIconTranslateAnchor:(MGLIconTranslateAnchor)iconTranslateAnchor; - -/** - The `MGLIconTranslateAnchor` enumeration representation of the value. - */ -@property (readonly) MGLIconTranslateAnchor MGLIconTranslateAnchorValue; - -/** - Creates a new value object containing the given `MGLTextTranslateAnchor` enumeration. - - @param textTranslateAnchor The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGLTextTranslateAnchor:(MGLTextTranslateAnchor)textTranslateAnchor; - -/** - The `MGLTextTranslateAnchor` enumeration representation of the value. - */ -@property (readonly) MGLTextTranslateAnchor MGLTextTranslateAnchorValue; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/NSValue+MGLStyleLayerAdditions.h.ejs b/platform/darwin/src/NSValue+MGLStyleLayerAdditions.h.ejs deleted file mode 100644 index d998e232ec..0000000000 --- a/platform/darwin/src/NSValue+MGLStyleLayerAdditions.h.ejs +++ /dev/null @@ -1,44 +0,0 @@ -// This file is generated. -// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. -<% -const enumPropertiesByLayerType = locals.enumPropertiesByLayerType; --%> - -#import <Foundation/Foundation.h> - -<% for (let layerType of Object.getOwnPropertyNames(enumPropertiesByLayerType)) { -%> -#import "MGL<%- camelize(layerType) %>StyleLayer.h" -<% } -%> - -NS_ASSUME_NONNULL_BEGIN - -<% for (let layerType in enumPropertiesByLayerType) { -%> -<% if (enumPropertiesByLayerType.hasOwnProperty(layerType)) { -%> -/** - Methods for wrapping an enumeration value for a style layer attribute in an - `MGL<%- camelize(layerType) %>StyleLayer` object and unwrapping its raw value. - */ -@interface NSValue (MGL<%- camelize(layerType) %>StyleLayerAdditions) - -#pragma mark Working with <%- camelize(layerType) %> Style Layer Attribute Values - -<% for (let property of enumPropertiesByLayerType[layerType]) { -%> -/** - Creates a new value object containing the given `MGL<%- camelize(property.name) %>` enumeration. - - @param <%- objCName(property) %> The value for the new object. - @return A new value object that contains the enumeration value. - */ -+ (instancetype)valueWithMGL<%- camelize(property.name) %>:(MGL<%- camelize(property.name) %>)<%- objCName(property) %>; - -/** - The `MGL<%- camelize(property.name) %>` enumeration representation of the value. - */ -@property (readonly) MGL<%- camelize(property.name) %> MGL<%- camelize(property.name) %>Value; - -<% } -%> -@end - -<% } -%> -<% } -%> -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/NSValue+MGLStyleLayerAdditions.mm b/platform/darwin/src/NSValue+MGLStyleLayerAdditions.mm deleted file mode 100644 index efa3a01215..0000000000 --- a/platform/darwin/src/NSValue+MGLStyleLayerAdditions.mm +++ /dev/null @@ -1,181 +0,0 @@ -// This file is generated. -// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. - -#import "NSValue+MGLStyleLayerAdditions.h" - -@implementation NSValue (MGLCircleStyleLayerAdditions) - -+ (NSValue *)valueWithMGLCirclePitchScale:(MGLCirclePitchScale)circlePitchScale { - return [NSValue value:&circlePitchScale withObjCType:@encode(MGLCirclePitchScale)]; -} - -- (MGLCirclePitchScale)MGLCirclePitchScaleValue { - MGLCirclePitchScale circlePitchScale; - [self getValue:&circlePitchScale]; - return circlePitchScale; -} - -+ (NSValue *)valueWithMGLCircleTranslateAnchor:(MGLCircleTranslateAnchor)circleTranslateAnchor { - return [NSValue value:&circleTranslateAnchor withObjCType:@encode(MGLCircleTranslateAnchor)]; -} - -- (MGLCircleTranslateAnchor)MGLCircleTranslateAnchorValue { - MGLCircleTranslateAnchor circleTranslateAnchor; - [self getValue:&circleTranslateAnchor]; - return circleTranslateAnchor; -} - -@end - -@implementation NSValue (MGLFillStyleLayerAdditions) - -+ (NSValue *)valueWithMGLFillTranslateAnchor:(MGLFillTranslateAnchor)fillTranslateAnchor { - return [NSValue value:&fillTranslateAnchor withObjCType:@encode(MGLFillTranslateAnchor)]; -} - -- (MGLFillTranslateAnchor)MGLFillTranslateAnchorValue { - MGLFillTranslateAnchor fillTranslateAnchor; - [self getValue:&fillTranslateAnchor]; - return fillTranslateAnchor; -} - -@end - -@implementation NSValue (MGLLineStyleLayerAdditions) - -+ (NSValue *)valueWithMGLLineCap:(MGLLineCap)lineCap { - return [NSValue value:&lineCap withObjCType:@encode(MGLLineCap)]; -} - -- (MGLLineCap)MGLLineCapValue { - MGLLineCap lineCap; - [self getValue:&lineCap]; - return lineCap; -} - -+ (NSValue *)valueWithMGLLineJoin:(MGLLineJoin)lineJoin { - return [NSValue value:&lineJoin withObjCType:@encode(MGLLineJoin)]; -} - -- (MGLLineJoin)MGLLineJoinValue { - MGLLineJoin lineJoin; - [self getValue:&lineJoin]; - return lineJoin; -} - -+ (NSValue *)valueWithMGLLineTranslateAnchor:(MGLLineTranslateAnchor)lineTranslateAnchor { - return [NSValue value:&lineTranslateAnchor withObjCType:@encode(MGLLineTranslateAnchor)]; -} - -- (MGLLineTranslateAnchor)MGLLineTranslateAnchorValue { - MGLLineTranslateAnchor lineTranslateAnchor; - [self getValue:&lineTranslateAnchor]; - return lineTranslateAnchor; -} - -@end - -@implementation NSValue (MGLSymbolStyleLayerAdditions) - -+ (NSValue *)valueWithMGLIconRotationAlignment:(MGLIconRotationAlignment)iconRotationAlignment { - return [NSValue value:&iconRotationAlignment withObjCType:@encode(MGLIconRotationAlignment)]; -} - -- (MGLIconRotationAlignment)MGLIconRotationAlignmentValue { - MGLIconRotationAlignment iconRotationAlignment; - [self getValue:&iconRotationAlignment]; - return iconRotationAlignment; -} - -+ (NSValue *)valueWithMGLIconTextFit:(MGLIconTextFit)iconTextFit { - return [NSValue value:&iconTextFit withObjCType:@encode(MGLIconTextFit)]; -} - -- (MGLIconTextFit)MGLIconTextFitValue { - MGLIconTextFit iconTextFit; - [self getValue:&iconTextFit]; - return iconTextFit; -} - -+ (NSValue *)valueWithMGLSymbolPlacement:(MGLSymbolPlacement)symbolPlacement { - return [NSValue value:&symbolPlacement withObjCType:@encode(MGLSymbolPlacement)]; -} - -- (MGLSymbolPlacement)MGLSymbolPlacementValue { - MGLSymbolPlacement symbolPlacement; - [self getValue:&symbolPlacement]; - return symbolPlacement; -} - -+ (NSValue *)valueWithMGLTextAnchor:(MGLTextAnchor)textAnchor { - return [NSValue value:&textAnchor withObjCType:@encode(MGLTextAnchor)]; -} - -- (MGLTextAnchor)MGLTextAnchorValue { - MGLTextAnchor textAnchor; - [self getValue:&textAnchor]; - return textAnchor; -} - -+ (NSValue *)valueWithMGLTextJustification:(MGLTextJustification)textJustification { - return [NSValue value:&textJustification withObjCType:@encode(MGLTextJustification)]; -} - -- (MGLTextJustification)MGLTextJustificationValue { - MGLTextJustification textJustification; - [self getValue:&textJustification]; - return textJustification; -} - -+ (NSValue *)valueWithMGLTextPitchAlignment:(MGLTextPitchAlignment)textPitchAlignment { - return [NSValue value:&textPitchAlignment withObjCType:@encode(MGLTextPitchAlignment)]; -} - -- (MGLTextPitchAlignment)MGLTextPitchAlignmentValue { - MGLTextPitchAlignment textPitchAlignment; - [self getValue:&textPitchAlignment]; - return textPitchAlignment; -} - -+ (NSValue *)valueWithMGLTextRotationAlignment:(MGLTextRotationAlignment)textRotationAlignment { - return [NSValue value:&textRotationAlignment withObjCType:@encode(MGLTextRotationAlignment)]; -} - -- (MGLTextRotationAlignment)MGLTextRotationAlignmentValue { - MGLTextRotationAlignment textRotationAlignment; - [self getValue:&textRotationAlignment]; - return textRotationAlignment; -} - -+ (NSValue *)valueWithMGLTextTransform:(MGLTextTransform)textTransform { - return [NSValue value:&textTransform withObjCType:@encode(MGLTextTransform)]; -} - -- (MGLTextTransform)MGLTextTransformValue { - MGLTextTransform textTransform; - [self getValue:&textTransform]; - return textTransform; -} - -+ (NSValue *)valueWithMGLIconTranslateAnchor:(MGLIconTranslateAnchor)iconTranslateAnchor { - return [NSValue value:&iconTranslateAnchor withObjCType:@encode(MGLIconTranslateAnchor)]; -} - -- (MGLIconTranslateAnchor)MGLIconTranslateAnchorValue { - MGLIconTranslateAnchor iconTranslateAnchor; - [self getValue:&iconTranslateAnchor]; - return iconTranslateAnchor; -} - -+ (NSValue *)valueWithMGLTextTranslateAnchor:(MGLTextTranslateAnchor)textTranslateAnchor { - return [NSValue value:&textTranslateAnchor withObjCType:@encode(MGLTextTranslateAnchor)]; -} - -- (MGLTextTranslateAnchor)MGLTextTranslateAnchorValue { - MGLTextTranslateAnchor textTranslateAnchor; - [self getValue:&textTranslateAnchor]; - return textTranslateAnchor; -} - -@end - diff --git a/platform/darwin/src/NSValue+MGLStyleLayerAdditions.mm.ejs b/platform/darwin/src/NSValue+MGLStyleLayerAdditions.mm.ejs deleted file mode 100644 index 758fb66546..0000000000 --- a/platform/darwin/src/NSValue+MGLStyleLayerAdditions.mm.ejs +++ /dev/null @@ -1,28 +0,0 @@ -// This file is generated. -// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. -<% -const enumPropertiesByLayerType = locals.enumPropertiesByLayerType; --%> - -#import "NSValue+MGLStyleLayerAdditions.h" - -<% for (let layerType in enumPropertiesByLayerType) { -%> -<% if (enumPropertiesByLayerType.hasOwnProperty(layerType)) { -%> -@implementation NSValue (MGL<%- camelize(layerType) %>StyleLayerAdditions) - -<% for (let property of enumPropertiesByLayerType[layerType]) { -%> -+ (NSValue *)valueWithMGL<%- camelize(property.name) %>:(MGL<%- camelize(property.name) %>)<%- objCName(property) %> { - return [NSValue value:&<%- objCName(property) %> withObjCType:@encode(MGL<%- camelize(property.name) %>)]; -} - -- (MGL<%- camelize(property.name) %>)MGL<%- camelize(property.name) %>Value { - MGL<%- camelize(property.name) %> <%- objCName(property) %>; - [self getValue:&<%- objCName(property) %>]; - return <%- objCName(property) %>; -} - -<% } -%> -<% } -%> -@end - -<% } -%> |