Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit babeec1

Browse files
committed
[ios, macos] #5626 - cleanup and use appropiate data types
1 parent 2ab2ab2 commit babeec1

8 files changed

+174
-75
lines changed

platform/darwin/src/MGLBackgroundStyleLayer.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#import "MGLTypes.h"
66

7+
78
@interface MGLBackgroundStyleLayer : MGLStyleLayer
89

910
// Paint properties
@@ -12,7 +13,7 @@
1213

1314
@property (nonatomic) NSString *backgroundPattern;
1415

15-
@property (nonatomic) float backgroundOpacity;
16+
@property (nonatomic) CGFloat backgroundOpacity;
1617

1718
@end
1819

platform/darwin/src/MGLCircleStyleLayer.h

+15-6
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,32 @@
44

55
#import "MGLTypes.h"
66

7+
typedef NS_ENUM(NSUInteger, MGLCircleStyleLayerCircleTranslateAnchor) {
8+
MGLCircleStyleLayerCircleTranslateAnchorMap,
9+
MGLCircleStyleLayerCircleTranslateAnchorViewport,
10+
};
11+
typedef NS_ENUM(NSUInteger, MGLCircleStyleLayerCirclePitchScale) {
12+
MGLCircleStyleLayerCirclePitchScaleMap,
13+
MGLCircleStyleLayerCirclePitchScaleViewport,
14+
};
15+
716
@interface MGLCircleStyleLayer : MGLStyleLayer
817

918
// Paint properties
1019

11-
@property (nonatomic) float circleRadius;
20+
@property (nonatomic) CGFloat circleRadius;
1221

1322
@property (nonatomic) MGLColor *circleColor;
1423

15-
@property (nonatomic) float circleBlur;
24+
@property (nonatomic) CGFloat circleBlur;
1625

17-
@property (nonatomic) float circleOpacity;
26+
@property (nonatomic) CGFloat circleOpacity;
1827

19-
@property (nonatomic) NSMutableArray *circleTranslate;
28+
@property (nonatomic) NSArray *circleTranslate;
2029

21-
@property (nonatomic) NSString *circleTranslateAnchor;
30+
@property (nonatomic) MGLCircleStyleLayerCircleTranslateAnchor circleTranslateAnchor;
2231

23-
@property (nonatomic) NSString *circlePitchScale;
32+
@property (nonatomic) MGLCircleStyleLayerCirclePitchScale circlePitchScale;
2433

2534
@end
2635

platform/darwin/src/MGLFillStyleLayer.h

+8-3
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,26 @@
44

55
#import "MGLTypes.h"
66

7+
typedef NS_ENUM(NSUInteger, MGLFillStyleLayerFillTranslateAnchor) {
8+
MGLFillStyleLayerFillTranslateAnchorMap,
9+
MGLFillStyleLayerFillTranslateAnchorViewport,
10+
};
11+
712
@interface MGLFillStyleLayer : MGLStyleLayer
813

914
// Paint properties
1015

1116
@property (nonatomic) BOOL fillAntialias;
1217

13-
@property (nonatomic) float fillOpacity;
18+
@property (nonatomic) CGFloat fillOpacity;
1419

1520
@property (nonatomic) MGLColor *fillColor;
1621

1722
@property (nonatomic) MGLColor *fillOutlineColor;
1823

19-
@property (nonatomic) NSMutableArray *fillTranslate;
24+
@property (nonatomic) NSArray *fillTranslate;
2025

21-
@property (nonatomic) NSString *fillTranslateAnchor;
26+
@property (nonatomic) MGLFillStyleLayerFillTranslateAnchor fillTranslateAnchor;
2227

2328
@property (nonatomic) NSString *fillPattern;
2429

platform/darwin/src/MGLLineStyleLayer.h

+27-12
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,52 @@
44

55
#import "MGLTypes.h"
66

7+
typedef NS_ENUM(NSUInteger, MGLLineStyleLayerLineCap) {
8+
MGLLineStyleLayerLineCapButt,
9+
MGLLineStyleLayerLineCapRound,
10+
MGLLineStyleLayerLineCapSquare,
11+
};
12+
typedef NS_ENUM(NSUInteger, MGLLineStyleLayerLineJoin) {
13+
MGLLineStyleLayerLineJoinBevel,
14+
MGLLineStyleLayerLineJoinRound,
15+
MGLLineStyleLayerLineJoinMiter,
16+
};
17+
typedef NS_ENUM(NSUInteger, MGLLineStyleLayerLineTranslateAnchor) {
18+
MGLLineStyleLayerLineTranslateAnchorMap,
19+
MGLLineStyleLayerLineTranslateAnchorViewport,
20+
};
21+
722
@interface MGLLineStyleLayer : MGLStyleLayer
823

924
// Layout properties
1025

11-
@property (nonatomic) NSString *lineCap;
26+
@property (nonatomic) MGLLineStyleLayerLineCap lineCap;
1227

13-
@property (nonatomic) NSString *lineJoin;
28+
@property (nonatomic) MGLLineStyleLayerLineJoin lineJoin;
1429

15-
@property (nonatomic) float lineMiterLimit;
30+
@property (nonatomic) CGFloat lineMiterLimit;
1631

17-
@property (nonatomic) float lineRoundLimit;
32+
@property (nonatomic) CGFloat lineRoundLimit;
1833

1934
// Paint properties
2035

21-
@property (nonatomic) float lineOpacity;
36+
@property (nonatomic) CGFloat lineOpacity;
2237

2338
@property (nonatomic) MGLColor *lineColor;
2439

25-
@property (nonatomic) NSMutableArray *lineTranslate;
40+
@property (nonatomic) NSArray *lineTranslate;
2641

27-
@property (nonatomic) NSString *lineTranslateAnchor;
42+
@property (nonatomic) MGLLineStyleLayerLineTranslateAnchor lineTranslateAnchor;
2843

29-
@property (nonatomic) float lineWidth;
44+
@property (nonatomic) CGFloat lineWidth;
3045

31-
@property (nonatomic) float lineGapWidth;
46+
@property (nonatomic) CGFloat lineGapWidth;
3247

33-
@property (nonatomic) float lineOffset;
48+
@property (nonatomic) CGFloat lineOffset;
3449

35-
@property (nonatomic) float lineBlur;
50+
@property (nonatomic) CGFloat lineBlur;
3651

37-
@property (nonatomic) CGVector *lineDasharray;
52+
@property (nonatomic) NSArray *lineDasharray;
3853

3954
@property (nonatomic) NSString *linePattern;
4055

platform/darwin/src/MGLRasterStyleLayer.h

+8-7
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@
44

55
#import "MGLTypes.h"
66

7+
78
@interface MGLRasterStyleLayer : MGLStyleLayer
89

910
// Paint properties
1011

11-
@property (nonatomic) float rasterOpacity;
12+
@property (nonatomic) CGFloat rasterOpacity;
1213

13-
@property (nonatomic) float rasterHueRotate;
14+
@property (nonatomic) CGFloat rasterHueRotate;
1415

15-
@property (nonatomic) float rasterBrightnessMin;
16+
@property (nonatomic) CGFloat rasterBrightnessMin;
1617

17-
@property (nonatomic) float rasterBrightnessMax;
18+
@property (nonatomic) CGFloat rasterBrightnessMax;
1819

19-
@property (nonatomic) float rasterSaturation;
20+
@property (nonatomic) CGFloat rasterSaturation;
2021

21-
@property (nonatomic) float rasterContrast;
22+
@property (nonatomic) CGFloat rasterContrast;
2223

23-
@property (nonatomic) float rasterFadeDuration;
24+
@property (nonatomic) CGFloat rasterFadeDuration;
2425

2526
@end
2627

platform/darwin/src/MGLStyleLayer.h.ejs

+21-2
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,39 @@
99

1010
#import "MGLTypes.h"
1111

12+
<% for (const property of layoutProperties) { -%>
13+
<% if (property.type == "enum") { -%>
14+
typedef NS_ENUM(NSUInteger, MGL<%- camelize(type) %>StyleLayer<%- camelize(property.name) %>) {
15+
<% for (const value of property.values) { -%>
16+
MGL<%- camelize(type) %>StyleLayer<%- camelize(property.name) %><%- camelize(value) %>,
17+
<% } -%>
18+
};
19+
<% } -%>
20+
<% } -%>
21+
<% for (const property of paintProperties) { -%>
22+
<% if (property.type == "enum") { -%>
23+
typedef NS_ENUM(NSUInteger, MGL<%- camelize(type) %>StyleLayer<%- camelize(property.name) %>) {
24+
<% for (const value of property.values) { -%>
25+
MGL<%- camelize(type) %>StyleLayer<%- camelize(property.name) %><%- camelize(value) %>,
26+
<% } -%>
27+
};
28+
<% } -%>
29+
<% } -%>
30+
1231
@interface MGL<%- camelize(type) %>StyleLayer : MGLStyleLayer
1332

1433
<% if (layoutProperties.length) { -%>
1534
// Layout properties
1635
1736
<% for (const property of layoutProperties) { -%>
18-
@property (nonatomic) <%- propertyType(property) %> <% if (isObject(property)) { -%>*<% } -%><%- camelizeWithLeadingLowercase(property.name) %>;
37+
@property (nonatomic) <%- propertyType(property, type) %> <% if (isObject(property)) { -%>*<% } -%><%- camelizeWithLeadingLowercase(property.name) %>;
1938
2039
<% } -%>
2140
<% } -%>
2241
// Paint properties
2342

2443
<% for (const property of paintProperties) { -%>
25-
@property (nonatomic) <%- propertyType(property) %> <% if (isObject(property)) { -%>*<% } -%><%- camelizeWithLeadingLowercase(property.name) %>;
44+
@property (nonatomic) <%- propertyType(property, type) %> <% if (isObject(property)) { -%>*<% } -%><%- camelizeWithLeadingLowercase(property.name) %>;
2645
2746
<% } -%>
2847
@end

0 commit comments

Comments
 (0)