@maplibre/maplibre-react-native 10.1.0 → 10.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/ios/MLRN/CameraStop.h +1 -1
  2. package/ios/MLRN/CameraStop.m +58 -60
  3. package/ios/MLRN/CameraUpdateItem.h +2 -1
  4. package/ios/MLRN/CameraUpdateItem.m +132 -132
  5. package/ios/MLRN/CameraUpdateQueue.m +43 -47
  6. package/ios/MLRN/FilterParser.h +1 -1
  7. package/ios/MLRN/FilterParser.m +5 -6
  8. package/ios/MLRN/MLRNBackgroundLayer.m +10 -9
  9. package/ios/MLRN/MLRNBackgroundLayerManager.m +4 -5
  10. package/ios/MLRN/MLRNCallout.h +1 -1
  11. package/ios/MLRN/MLRNCallout.m +37 -36
  12. package/ios/MLRN/MLRNCalloutManager.m +2 -3
  13. package/ios/MLRN/MLRNCamera.h +1 -1
  14. package/ios/MLRN/MLRNCamera.m +169 -182
  15. package/ios/MLRN/MLRNCameraManager.m +4 -6
  16. package/ios/MLRN/MLRNCircleLayer.m +17 -14
  17. package/ios/MLRN/MLRNCircleLayerManager.m +4 -5
  18. package/ios/MLRN/MLRNCustomHeaders.h +2 -2
  19. package/ios/MLRN/MLRNCustomHeaders.m +63 -63
  20. package/ios/MLRN/MLRNEvent.h +3 -3
  21. package/ios/MLRN/MLRNEvent.m +19 -24
  22. package/ios/MLRN/MLRNEventProtocol.h +1 -1
  23. package/ios/MLRN/MLRNFillExtrusionLayer.m +18 -14
  24. package/ios/MLRN/MLRNFillExtrusionLayerManager.m +4 -5
  25. package/ios/MLRN/MLRNFillLayer.m +16 -14
  26. package/ios/MLRN/MLRNFillLayerManager.m +4 -5
  27. package/ios/MLRN/MLRNHeatmapLayer.m +17 -14
  28. package/ios/MLRN/MLRNHeatmapLayerManager.m +4 -5
  29. package/ios/MLRN/MLRNImageQueue.h +4 -1
  30. package/ios/MLRN/MLRNImageQueue.m +29 -32
  31. package/ios/MLRN/MLRNImageQueueOperation.h +1 -1
  32. package/ios/MLRN/MLRNImageQueueOperation.m +92 -91
  33. package/ios/MLRN/MLRNImageSource.m +36 -38
  34. package/ios/MLRN/MLRNImageSourceManager.m +2 -3
  35. package/ios/MLRN/MLRNImageUtils.h +3 -3
  36. package/ios/MLRN/MLRNImageUtils.m +15 -14
  37. package/ios/MLRN/MLRNImages.h +0 -1
  38. package/ios/MLRN/MLRNImages.m +89 -91
  39. package/ios/MLRN/MLRNImagesManager.m +4 -5
  40. package/ios/MLRN/MLRNLayer.h +9 -11
  41. package/ios/MLRN/MLRNLayer.m +170 -182
  42. package/ios/MLRN/MLRNLight.m +21 -23
  43. package/ios/MLRN/MLRNLightManager.m +2 -3
  44. package/ios/MLRN/MLRNLineLayer.m +17 -15
  45. package/ios/MLRN/MLRNLineLayerManager.m +4 -6
  46. package/ios/MLRN/MLRNLocation.h +1 -1
  47. package/ios/MLRN/MLRNLocation.m +16 -17
  48. package/ios/MLRN/MLRNLocationManager.m +109 -124
  49. package/ios/MLRN/MLRNLocationManagerDelegate.h +3 -3
  50. package/ios/MLRN/MLRNLocationModule.h +1 -1
  51. package/ios/MLRN/MLRNLocationModule.m +40 -55
  52. package/ios/MLRN/MLRNLogging.h +1 -4
  53. package/ios/MLRN/MLRNLogging.m +84 -89
  54. package/ios/MLRN/MLRNMapTouchEvent.h +2 -2
  55. package/ios/MLRN/MLRNMapTouchEvent.m +50 -49
  56. package/ios/MLRN/MLRNMapView.h +43 -36
  57. package/ios/MLRN/MLRNMapView.m +409 -440
  58. package/ios/MLRN/MLRNMapViewManager.m +489 -502
  59. package/ios/MLRN/MLRNModule.h +1 -1
  60. package/ios/MLRN/MLRNModule.m +111 -105
  61. package/ios/MLRN/MLRNNativeUserLocation.m +24 -27
  62. package/ios/MLRN/MLRNNativeUserLocationManager.m +4 -8
  63. package/ios/MLRN/MLRNOfflineModule.h +1 -1
  64. package/ios/MLRN/MLRNOfflineModule.m +416 -421
  65. package/ios/MLRN/MLRNPointAnnotation.h +2 -2
  66. package/ios/MLRN/MLRNPointAnnotation.m +154 -175
  67. package/ios/MLRN/MLRNPointAnnotationManager.m +2 -3
  68. package/ios/MLRN/MLRNRasterLayer.m +16 -12
  69. package/ios/MLRN/MLRNRasterLayerManager.m +4 -5
  70. package/ios/MLRN/MLRNRasterSource.m +21 -17
  71. package/ios/MLRN/MLRNRasterSourceManager.m +2 -3
  72. package/ios/MLRN/MLRNShapeSource.h +17 -16
  73. package/ios/MLRN/MLRNShapeSource.m +94 -102
  74. package/ios/MLRN/MLRNShapeSourceManager.h +2 -2
  75. package/ios/MLRN/MLRNShapeSourceManager.m +86 -90
  76. package/ios/MLRN/MLRNSnapshotModule.h +1 -1
  77. package/ios/MLRN/MLRNSnapshotModule.m +51 -53
  78. package/ios/MLRN/MLRNSource.h +12 -12
  79. package/ios/MLRN/MLRNSource.m +82 -88
  80. package/ios/MLRN/MLRNStyleValue.h +1 -1
  81. package/ios/MLRN/MLRNStyleValue.m +128 -128
  82. package/ios/MLRN/MLRNSymbolLayer.m +17 -13
  83. package/ios/MLRN/MLRNSymbolLayerManager.m +4 -5
  84. package/ios/MLRN/MLRNTileSource.h +1 -1
  85. package/ios/MLRN/MLRNTileSource.m +21 -20
  86. package/ios/MLRN/MLRNUserLocation.h +1 -1
  87. package/ios/MLRN/MLRNUserLocation.m +10 -12
  88. package/ios/MLRN/MLRNUtils.h +18 -11
  89. package/ios/MLRN/MLRNUtils.m +168 -160
  90. package/ios/MLRN/MLRNVectorLayer.m +28 -34
  91. package/ios/MLRN/MLRNVectorSource.h +3 -1
  92. package/ios/MLRN/MLRNVectorSource.m +14 -11
  93. package/ios/MLRN/MLRNVectorSourceManager.h +2 -2
  94. package/ios/MLRN/MLRNVectorSourceManager.m +36 -39
  95. package/ios/MLRN/ViewManager.h +1 -1
  96. package/ios/MLRN/ViewManager.m +29 -35
  97. package/lib/commonjs/components/MarkerView.js +1 -1
  98. package/lib/commonjs/components/ShapeSource.js +2 -1
  99. package/lib/commonjs/components/ShapeSource.js.map +1 -1
  100. package/lib/commonjs/components/UserLocation.js +8 -38
  101. package/lib/commonjs/components/UserLocation.js.map +1 -1
  102. package/lib/commonjs/components/UserLocationPuck.js +52 -0
  103. package/lib/commonjs/components/UserLocationPuck.js.map +1 -0
  104. package/lib/commonjs/components/{HeadingIndicator.js → UserLocationPuckHeading.js} +12 -9
  105. package/lib/commonjs/components/UserLocationPuckHeading.js.map +1 -0
  106. package/lib/commonjs/utils/animated/AbstractAnimatedCoordinates.js +8 -7
  107. package/lib/commonjs/utils/animated/AbstractAnimatedCoordinates.js.map +1 -1
  108. package/lib/commonjs/utils/animated/AnimatedExtractCoordinateFromArray.js +1 -2
  109. package/lib/commonjs/utils/animated/AnimatedExtractCoordinateFromArray.js.map +1 -1
  110. package/lib/commonjs/utils/animated/AnimatedRouteCoordinatesArray.js +28 -38
  111. package/lib/commonjs/utils/animated/AnimatedRouteCoordinatesArray.js.map +1 -1
  112. package/lib/commonjs/utils/animated/AnimatedShape.js +11 -7
  113. package/lib/commonjs/utils/animated/AnimatedShape.js.map +1 -1
  114. package/lib/module/components/MarkerView.js +1 -1
  115. package/lib/module/components/ShapeSource.js +2 -1
  116. package/lib/module/components/ShapeSource.js.map +1 -1
  117. package/lib/module/components/UserLocation.js +7 -36
  118. package/lib/module/components/UserLocation.js.map +1 -1
  119. package/lib/module/components/UserLocationPuck.js +48 -0
  120. package/lib/module/components/UserLocationPuck.js.map +1 -0
  121. package/lib/module/components/{HeadingIndicator.js → UserLocationPuckHeading.js} +11 -7
  122. package/lib/module/components/UserLocationPuckHeading.js.map +1 -0
  123. package/lib/module/utils/animated/AbstractAnimatedCoordinates.js +8 -7
  124. package/lib/module/utils/animated/AbstractAnimatedCoordinates.js.map +1 -1
  125. package/lib/module/utils/animated/AnimatedExtractCoordinateFromArray.js +1 -3
  126. package/lib/module/utils/animated/AnimatedExtractCoordinateFromArray.js.map +1 -1
  127. package/lib/module/utils/animated/AnimatedRouteCoordinatesArray.js +29 -39
  128. package/lib/module/utils/animated/AnimatedRouteCoordinatesArray.js.map +1 -1
  129. package/lib/module/utils/animated/AnimatedShape.js +11 -7
  130. package/lib/module/utils/animated/AnimatedShape.js.map +1 -1
  131. package/lib/typescript/commonjs/src/components/MarkerView.d.ts +1 -1
  132. package/lib/typescript/commonjs/src/components/ShapeSource.d.ts +1 -1
  133. package/lib/typescript/commonjs/src/components/ShapeSource.d.ts.map +1 -1
  134. package/lib/typescript/commonjs/src/components/UserLocation.d.ts +0 -1
  135. package/lib/typescript/commonjs/src/components/UserLocation.d.ts.map +1 -1
  136. package/lib/typescript/commonjs/src/components/UserLocationPuck.d.ts +9 -0
  137. package/lib/typescript/commonjs/src/components/UserLocationPuck.d.ts.map +1 -0
  138. package/lib/typescript/commonjs/src/components/UserLocationPuckHeading.d.ts +9 -0
  139. package/lib/typescript/commonjs/src/components/UserLocationPuckHeading.d.ts.map +1 -0
  140. package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts +12 -13
  141. package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
  142. package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +5 -4
  143. package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
  144. package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts +0 -1
  145. package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
  146. package/lib/typescript/commonjs/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts +33 -21
  147. package/lib/typescript/commonjs/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts.map +1 -1
  148. package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts +8 -5
  149. package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts.map +1 -1
  150. package/lib/typescript/module/src/components/MarkerView.d.ts +1 -1
  151. package/lib/typescript/module/src/components/ShapeSource.d.ts +1 -1
  152. package/lib/typescript/module/src/components/ShapeSource.d.ts.map +1 -1
  153. package/lib/typescript/module/src/components/UserLocation.d.ts +0 -1
  154. package/lib/typescript/module/src/components/UserLocation.d.ts.map +1 -1
  155. package/lib/typescript/module/src/components/UserLocationPuck.d.ts +9 -0
  156. package/lib/typescript/module/src/components/UserLocationPuck.d.ts.map +1 -0
  157. package/lib/typescript/module/src/components/UserLocationPuckHeading.d.ts +9 -0
  158. package/lib/typescript/module/src/components/UserLocationPuckHeading.d.ts.map +1 -0
  159. package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts +12 -13
  160. package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
  161. package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +5 -4
  162. package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
  163. package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts +0 -1
  164. package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
  165. package/lib/typescript/module/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts +33 -21
  166. package/lib/typescript/module/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts.map +1 -1
  167. package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts +8 -5
  168. package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts.map +1 -1
  169. package/package.json +8 -8
  170. package/src/components/MarkerView.tsx +1 -1
  171. package/src/components/ShapeSource.tsx +58 -53
  172. package/src/components/UserLocation.tsx +13 -51
  173. package/src/components/UserLocationPuck.tsx +62 -0
  174. package/src/components/UserLocationPuckHeading.tsx +33 -0
  175. package/src/utils/animated/AbstractAnimatedCoordinates.ts +26 -15
  176. package/src/utils/animated/AnimatedExtractCoordinateFromArray.ts +10 -6
  177. package/src/utils/animated/AnimatedRouteCoordinatesArray.ts +63 -51
  178. package/src/utils/animated/AnimatedShape.ts +22 -13
  179. package/lib/commonjs/components/HeadingIndicator.js.map +0 -1
  180. package/lib/module/components/HeadingIndicator.js.map +0 -1
  181. package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts +0 -7
  182. package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts.map +0 -1
  183. package/lib/typescript/module/src/components/HeadingIndicator.d.ts +0 -7
  184. package/lib/typescript/module/src/components/HeadingIndicator.d.ts.map +0 -1
  185. package/src/components/HeadingIndicator.tsx +0 -26
@@ -1,135 +1,129 @@
1
1
  #import "MLRNSource.h"
2
+ #import <React/RCTLog.h>
2
3
  #import <React/UIView+React.h>
3
4
  #import "MLRNMapView.h"
4
- #import <React/RCTLog.h>
5
5
 
6
6
  @implementation MLRNSource
7
7
 
8
8
  double const DEFAULT_HITBOX_AREA = 44.0;
9
9
  NSString *const DEFAULT_SOURCE_ID = @"composite";
10
10
 
11
-
12
- - (instancetype)initWithFrame:(CGRect)frame
13
- {
14
- if (self = [super initWithFrame:frame]) {
15
- _layers = [[NSMutableArray alloc] init];
16
- _reactSubviews = [[NSMutableArray alloc] init];
17
- _hitbox = @{ @"width": @(DEFAULT_HITBOX_AREA), @"height": @(DEFAULT_HITBOX_AREA) };
18
- }
19
- return self;
11
+ - (instancetype)initWithFrame:(CGRect)frame {
12
+ if (self = [super initWithFrame:frame]) {
13
+ _layers = [[NSMutableArray alloc] init];
14
+ _reactSubviews = [[NSMutableArray alloc] init];
15
+ _hitbox = @{@"width" : @(DEFAULT_HITBOX_AREA), @"height" : @(DEFAULT_HITBOX_AREA)};
16
+ }
17
+ return self;
20
18
  }
21
19
 
22
20
  #pragma clang diagnostic push
23
21
  #pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
24
22
  - (void)insertReactSubview:(id<RCTComponent>)subview atIndex:(NSInteger)atIndex {
25
- if ([subview isKindOfClass:[MLRNLayer class]]) {
26
- MLRNLayer *layer = (MLRNLayer*)subview;
27
-
28
- if (_map.style != nil) {
29
- [layer addToMap:_map style:_map.style];
30
- }
31
-
32
- [_layers addObject:layer];
33
- [_reactSubviews insertObject:layer atIndex:atIndex];
23
+ if ([subview isKindOfClass:[MLRNLayer class]]) {
24
+ MLRNLayer *layer = (MLRNLayer *)subview;
25
+
26
+ if (_map.style != nil) {
27
+ [layer addToMap:_map style:_map.style];
34
28
  }
29
+
30
+ [_layers addObject:layer];
31
+ [_reactSubviews insertObject:layer atIndex:atIndex];
32
+ }
35
33
  }
36
34
  #pragma clang diagnostic pop
37
35
 
38
36
  #pragma clang diagnostic push
39
37
  #pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
40
38
  - (void)removeReactSubview:(id<RCTComponent>)subview {
41
- if ([subview isKindOfClass:[MLRNLayer class]]) {
42
- MLRNLayer *layer = (MLRNLayer*)subview;
43
- [layer removeFromMap:_map.style];
44
- [_layers removeObject:layer];
45
- [_reactSubviews removeObject:layer];
46
- }
39
+ if ([subview isKindOfClass:[MLRNLayer class]]) {
40
+ MLRNLayer *layer = (MLRNLayer *)subview;
41
+ [layer removeFromMap:_map.style];
42
+ [_layers removeObject:layer];
43
+ [_reactSubviews removeObject:layer];
44
+ }
47
45
  }
48
46
  #pragma clang diagnostic pop
49
47
 
50
48
  #pragma clang diagnostic push
51
49
  #pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
52
50
  - (NSArray<id<RCTComponent>> *)reactSubviews {
53
- return _reactSubviews;
51
+ return _reactSubviews;
54
52
  }
55
53
  #pragma clang diagnostic pop
56
54
 
57
- - (void)setMap:(MLRNMapView *)map
58
- {
59
- if (map == nil) {
60
- [self removeFromMap];
61
- _map = nil;
62
- } else {
63
- _map = map;
64
- [self addToMap];
65
- }
55
+ - (void)setMap:(MLRNMapView *)map {
56
+ if (map == nil) {
57
+ [self removeFromMap];
58
+ _map = nil;
59
+ } else {
60
+ _map = map;
61
+ [self addToMap];
62
+ }
66
63
  }
67
64
 
68
- - (void)addToMap
69
- {
70
- if (_map.style == nil) {
71
- return;
72
- }
73
-
74
- MLNSource *existingSource = [_map.style sourceWithIdentifier:_id];
75
- if (existingSource != nil) {
76
- _source = existingSource;
65
+ - (void)addToMap {
66
+ if (_map.style == nil) {
67
+ return;
68
+ }
69
+
70
+ MLNSource *existingSource = [_map.style sourceWithIdentifier:_id];
71
+ if (existingSource != nil) {
72
+ _source = existingSource;
73
+ } else {
74
+ _source = [self makeSource];
75
+ if (_source != nil) {
76
+ [_map.style addSource:_source];
77
77
  } else {
78
- _source = [self makeSource];
79
- if (_source != nil) {
80
- [_map.style addSource:_source];
81
- } else {
82
- RCTLogError(@"Could not create source with id:%@. Make sure url/shape is provided", _id);
83
- }
78
+ RCTLogError(@"Could not create source with id:%@. Make sure url/shape is provided", _id);
84
79
  }
85
-
86
- if (_layers.count > 0) {
87
- for (int i = 0; i < _layers.count; i++) {
88
- MLRNLayer *layer = [_layers objectAtIndex:i];
89
- [layer addToMap:_map style:_map.style];
90
- }
91
- }
92
- }
80
+ }
93
81
 
94
- - (void)removeFromMap
95
- {
96
- if (_map.style == nil) {
97
- return;
98
- }
99
-
82
+ if (_layers.count > 0) {
100
83
  for (int i = 0; i < _layers.count; i++) {
101
- MLRNLayer *layer = [_layers objectAtIndex:i];
102
- [layer removeFromMap:_map.style];
84
+ MLRNLayer *layer = [_layers objectAtIndex:i];
85
+ [layer addToMap:_map style:_map.style];
103
86
  }
104
-
105
- if (![MLRNSource isDefaultSource:_id]) {
106
- if (_source != nil) {
107
- [_map.style removeSource:_source];
108
- }
87
+ }
88
+ }
89
+
90
+ - (void)removeFromMap {
91
+ if (_map.style == nil) {
92
+ return;
93
+ }
94
+
95
+ for (int i = 0; i < _layers.count; i++) {
96
+ MLRNLayer *layer = [_layers objectAtIndex:i];
97
+ [layer removeFromMap:_map.style];
98
+ }
99
+
100
+ if (![MLRNSource isDefaultSource:_id]) {
101
+ if (_source != nil) {
102
+ [_map.style removeSource:_source];
109
103
  }
104
+ }
110
105
  }
111
106
 
112
- - (nullable MLNSource*)makeSource
113
- {
114
- @throw [NSException exceptionWithName:NSInternalInconsistencyException
115
- reason:[NSString stringWithFormat:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)]
116
- userInfo:nil];
107
+ - (nullable MLNSource *)makeSource {
108
+ @throw [NSException
109
+ exceptionWithName:NSInternalInconsistencyException
110
+ reason:[NSString stringWithFormat:@"You must override %@ in a subclass",
111
+ NSStringFromSelector(_cmd)]
112
+ userInfo:nil];
117
113
  }
118
114
 
119
- - (NSArray<NSString *> *)getLayerIDs
120
- {
121
- NSMutableArray *layerIDs = [[NSMutableArray alloc] init];
122
-
123
- for (MLRNLayer *layer in _layers) {
124
- [layerIDs addObject:layer.id];
125
- }
126
-
127
- return layerIDs;
115
+ - (NSArray<NSString *> *)getLayerIDs {
116
+ NSMutableArray *layerIDs = [[NSMutableArray alloc] init];
117
+
118
+ for (MLRNLayer *layer in _layers) {
119
+ [layerIDs addObject:layer.id];
120
+ }
121
+
122
+ return layerIDs;
128
123
  }
129
124
 
130
- + (BOOL)isDefaultSource:(NSString *)sourceID
131
- {
132
- return [sourceID isEqualToString:DEFAULT_SOURCE_ID];
125
+ + (BOOL)isDefaultSource:(NSString *)sourceID {
126
+ return [sourceID isEqualToString:DEFAULT_SOURCE_ID];
133
127
  }
134
128
 
135
129
  @end
@@ -14,6 +14,6 @@
14
14
  - (NSExpression *)getSphericalPosition;
15
15
  - (BOOL)isVisible;
16
16
 
17
- + (MLRNStyleValue*)make:(NSString*)expressionJSONStr;
17
+ + (MLRNStyleValue *)make:(NSString *)expressionJSONStr;
18
18
 
19
19
  @end
@@ -1,159 +1,159 @@
1
1
  #import "MLRNStyleValue.h"
2
- #import "MLRNUtils.h"
3
2
  #import <React/RCTImageLoader.h>
3
+ #import "MLRNUtils.h"
4
4
 
5
- @implementation MLRNStyleValue
6
- {
7
- NSObject *expressionJSON;
5
+ @implementation MLRNStyleValue {
6
+ NSObject *expressionJSON;
8
7
  }
9
8
 
10
- - (NSExpression *)mlnStyleValue
11
- {
12
- if ([_styleType isEqualToString:@"color"] && [expressionJSON respondsToSelector:@selector(objectEnumerator)] && [[[(NSArray*)expressionJSON objectEnumerator] nextObject] isKindOfClass:[NSNumber class]]) {
13
- UIColor *color = [MLRNUtils toColor:expressionJSON];
14
- return [NSExpression expressionWithMLNJSONObject:color];
15
- } else if ([_styleType isEqualToString:@"color"] && [expressionJSON isKindOfClass:[NSNumber class]]) {
16
-
17
- UIColor *color = [MLRNUtils toColor:expressionJSON];
18
- return [NSExpression expressionWithMLNJSONObject:color];
19
- } else if ([_styleType isEqualToString:@"vector"] && [expressionJSON respondsToSelector:@selector(objectEnumerator)] && [[[(NSArray*)expressionJSON objectEnumerator] nextObject] isKindOfClass:[NSNumber class]]) {
20
- CGVector vector = [MLRNUtils toCGVector:(NSArray<NSNumber *> *)expressionJSON];
21
- return [NSExpression expressionWithMLNJSONObject:[NSValue valueWithCGVector:vector]];
22
- } else if ([_styleType isEqualToString:@"image"] && [expressionJSON isKindOfClass:[NSDictionary class]]) {
23
- return [NSExpression expressionForConstantValue:[self getImageURI]];
24
- } else if ([_styleType isEqual:@"edgeinsets"] && [expressionJSON respondsToSelector:@selector(objectEnumerator)] && [[[(NSArray*)expressionJSON objectEnumerator] nextObject] isKindOfClass:[NSNumber class]]){
25
- UIEdgeInsets edgeInsets = [MLRNUtils toUIEdgeInsets:(NSArray<NSNumber *> *)expressionJSON];
26
- return [NSExpression expressionWithMLNJSONObject:[NSValue valueWithUIEdgeInsets:edgeInsets]];
27
- } else if ([_styleType isEqualToString:@"enum"] && [expressionJSON isKindOfClass:[NSNumber class]]) {
28
- // ensure we pass through values as NSUInteger when mapping to an MLN enum
29
- NSUInteger uintValue = [(NSNumber*)expressionJSON unsignedIntegerValue];
30
- id rawValue = [NSValue value:&uintValue withObjCType:@encode(NSUInteger)];
31
- return [NSExpression expressionWithMLNJSONObject:rawValue];
32
- } else if ([expressionJSON respondsToSelector:@selector(objectEnumerator)] && [[[(NSArray*)expressionJSON objectEnumerator] nextObject] isKindOfClass:[NSNumber class]]) {
33
- return [NSExpression expressionForConstantValue:expressionJSON];
34
- } else {
35
- return [NSExpression expressionWithMLNJSONObject:expressionJSON];
36
- }
9
+ - (NSExpression *)mlnStyleValue {
10
+ if ([_styleType isEqualToString:@"color"] &&
11
+ [expressionJSON respondsToSelector:@selector(objectEnumerator)] &&
12
+ [[[(NSArray *)expressionJSON objectEnumerator] nextObject] isKindOfClass:[NSNumber class]]) {
13
+ UIColor *color = [MLRNUtils toColor:expressionJSON];
14
+ return [NSExpression expressionWithMLNJSONObject:color];
15
+ } else if ([_styleType isEqualToString:@"color"] &&
16
+ [expressionJSON isKindOfClass:[NSNumber class]]) {
17
+ UIColor *color = [MLRNUtils toColor:expressionJSON];
18
+ return [NSExpression expressionWithMLNJSONObject:color];
19
+ } else if ([_styleType isEqualToString:@"vector"] &&
20
+ [expressionJSON respondsToSelector:@selector(objectEnumerator)] &&
21
+ [[[(NSArray *)expressionJSON objectEnumerator] nextObject]
22
+ isKindOfClass:[NSNumber class]]) {
23
+ CGVector vector = [MLRNUtils toCGVector:(NSArray<NSNumber *> *)expressionJSON];
24
+ return [NSExpression expressionWithMLNJSONObject:[NSValue valueWithCGVector:vector]];
25
+ } else if ([_styleType isEqualToString:@"image"] &&
26
+ [expressionJSON isKindOfClass:[NSDictionary class]]) {
27
+ return [NSExpression expressionForConstantValue:[self getImageURI]];
28
+ } else if ([_styleType isEqual:@"edgeinsets"] &&
29
+ [expressionJSON respondsToSelector:@selector(objectEnumerator)] &&
30
+ [[[(NSArray *)expressionJSON objectEnumerator] nextObject]
31
+ isKindOfClass:[NSNumber class]]) {
32
+ UIEdgeInsets edgeInsets = [MLRNUtils toUIEdgeInsets:(NSArray<NSNumber *> *)expressionJSON];
33
+ return [NSExpression expressionWithMLNJSONObject:[NSValue valueWithUIEdgeInsets:edgeInsets]];
34
+ } else if ([_styleType isEqualToString:@"enum"] &&
35
+ [expressionJSON isKindOfClass:[NSNumber class]]) {
36
+ // ensure we pass through values as NSUInteger when mapping to an MLN enum
37
+ NSUInteger uintValue = [(NSNumber *)expressionJSON unsignedIntegerValue];
38
+ id rawValue = [NSValue value:&uintValue withObjCType:@encode(NSUInteger)];
39
+ return [NSExpression expressionWithMLNJSONObject:rawValue];
40
+ } else if ([expressionJSON respondsToSelector:@selector(objectEnumerator)] &&
41
+ [[[(NSArray *)expressionJSON objectEnumerator] nextObject]
42
+ isKindOfClass:[NSNumber class]]) {
43
+ return [NSExpression expressionForConstantValue:expressionJSON];
44
+ } else {
45
+ return [NSExpression expressionWithMLNJSONObject:expressionJSON];
46
+ }
37
47
  }
38
48
 
39
- - (void)setStyleObject:(NSObject *)object
40
- {
41
- expressionJSON = object;
49
+ - (void)setStyleObject:(NSObject *)object {
50
+ expressionJSON = object;
42
51
  }
43
52
 
44
- - (NSObject *)parse:(NSDictionary *)rawStyleValue
45
- {
46
- NSObject *object = nil;
47
- NSString *type = (NSString *)rawStyleValue[@"type"];
48
-
49
- if ([type isEqualToString:@"string"]) {
50
- object = (NSString *)rawStyleValue[@"value"];
51
- } else if ([type isEqualToString:@"number"]) {
52
- object = (NSNumber *)rawStyleValue[@"value"];
53
- } else if ([type isEqualToString:@"boolean"]) {
54
- object = rawStyleValue[@"value"];
55
- } else if ([type isEqualToString:@"hashmap"]) {
56
- NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
57
- NSArray *values = (NSArray *)rawStyleValue[@"value"];
58
-
59
- for (int i = 0; i < values.count; i++) {
60
- NSObject *key = [self parse:values[i][0]];
61
- NSObject *value = [self parse:values[i][1]];
62
- dict[[key mutableCopy]] = value;
63
- }
64
-
65
- object = dict;
66
- } else if ([type isEqualToString:@"array"]) {
67
- NSMutableArray *arr = [[NSMutableArray alloc] init];
68
- NSArray *values = (NSArray *)rawStyleValue[@"value"];
69
-
70
- for (int i = 0; i < values.count; i++) {
71
- [arr addObject:[self parse:values[i]]];
72
- }
73
-
74
- object = arr;
53
+ - (NSObject *)parse:(NSDictionary *)rawStyleValue {
54
+ NSObject *object = nil;
55
+ NSString *type = (NSString *)rawStyleValue[@"type"];
56
+
57
+ if ([type isEqualToString:@"string"]) {
58
+ object = (NSString *)rawStyleValue[@"value"];
59
+ } else if ([type isEqualToString:@"number"]) {
60
+ object = (NSNumber *)rawStyleValue[@"value"];
61
+ } else if ([type isEqualToString:@"boolean"]) {
62
+ object = rawStyleValue[@"value"];
63
+ } else if ([type isEqualToString:@"hashmap"]) {
64
+ NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
65
+ NSArray *values = (NSArray *)rawStyleValue[@"value"];
66
+
67
+ for (int i = 0; i < values.count; i++) {
68
+ NSObject *key = [self parse:values[i][0]];
69
+ NSObject *value = [self parse:values[i][1]];
70
+ dict[[key mutableCopy]] = value;
75
71
  }
76
-
77
- return object;
78
- }
79
72
 
73
+ object = dict;
74
+ } else if ([type isEqualToString:@"array"]) {
75
+ NSMutableArray *arr = [[NSMutableArray alloc] init];
76
+ NSArray *values = (NSArray *)rawStyleValue[@"value"];
77
+
78
+ for (int i = 0; i < values.count; i++) {
79
+ [arr addObject:[self parse:values[i]]];
80
+ }
80
81
 
82
+ object = arr;
83
+ }
81
84
 
82
- - (BOOL)shouldAddImage
83
- {
84
- NSString *imageURI = [self getImageURI];
85
-
86
- return [imageURI containsString:@"://"];
85
+ return object;
87
86
  }
88
87
 
89
- - (NSString *)getImageURI
90
- {
91
- if ([expressionJSON isKindOfClass:[NSDictionary class]]) {
92
- return [expressionJSON valueForKey:@"uri"];
93
- } else if ([expressionJSON isKindOfClass:[NSArray class]]) {
94
- return nil;
95
- } else {
96
- return (NSString *)expressionJSON;
97
- }
88
+ - (BOOL)shouldAddImage {
89
+ NSString *imageURI = [self getImageURI];
90
+
91
+ return [imageURI containsString:@"://"];
98
92
  }
99
93
 
100
- - (double)getImageScale
101
- {
102
- if ([expressionJSON isKindOfClass:[NSDictionary class]]) {
103
- id scale = [expressionJSON valueForKey:@"scale"];
104
- if ([scale isKindOfClass:[NSNumber class]]) {
105
- return [scale doubleValue];
106
- } else {
107
- return 1.0;
108
- }
94
+ - (NSString *)getImageURI {
95
+ if ([expressionJSON isKindOfClass:[NSDictionary class]]) {
96
+ return [expressionJSON valueForKey:@"uri"];
97
+ } else if ([expressionJSON isKindOfClass:[NSArray class]]) {
98
+ return nil;
99
+ } else {
100
+ return (NSString *)expressionJSON;
101
+ }
102
+ }
103
+
104
+ - (double)getImageScale {
105
+ if ([expressionJSON isKindOfClass:[NSDictionary class]]) {
106
+ id scale = [expressionJSON valueForKey:@"scale"];
107
+ if ([scale isKindOfClass:[NSNumber class]]) {
108
+ return [scale doubleValue];
109
109
  } else {
110
- return 1.0;
110
+ return 1.0;
111
111
  }
112
+ } else {
113
+ return 1.0;
114
+ }
112
115
  }
113
116
 
114
- - (MLNTransition)getTransition
115
- {
116
- if (![expressionJSON isKindOfClass:[NSDictionary class]]) {
117
- return MLNTransitionMake(0.f, 0.f);
118
- }
119
-
120
- NSDictionary *config = (NSDictionary *)expressionJSON;
121
- double duration = config[@"duration"] != nil ? [config[@"duration"] doubleValue] : 300.0;
122
- double delay = config[@"delay"] != nil ? [config[@"delay"] doubleValue] : 0.0;
123
-
124
- const double millisecondsToSeconds = 1.0/1000.0;
125
-
126
- return MLNTransitionMake(duration * millisecondsToSeconds, delay * millisecondsToSeconds);
117
+ - (MLNTransition)getTransition {
118
+ if (![expressionJSON isKindOfClass:[NSDictionary class]]) {
119
+ return MLNTransitionMake(0.f, 0.f);
120
+ }
121
+
122
+ NSDictionary *config = (NSDictionary *)expressionJSON;
123
+ double duration = config[@"duration"] != nil ? [config[@"duration"] doubleValue] : 300.0;
124
+ double delay = config[@"delay"] != nil ? [config[@"delay"] doubleValue] : 0.0;
125
+
126
+ const double millisecondsToSeconds = 1.0 / 1000.0;
127
+
128
+ return MLNTransitionMake(duration * millisecondsToSeconds, delay * millisecondsToSeconds);
127
129
  }
128
130
 
129
- - (NSExpression *)getSphericalPosition
130
- {
131
- NSArray *values = (NSArray<NSNumber *> *)expressionJSON;
132
-
133
- CGFloat radial = [values[0] floatValue];
134
- CLLocationDistance azimuthal = [values[1] doubleValue];
135
- CLLocationDistance polar = [values[2] doubleValue];
136
-
137
- MLNSphericalPosition pos = MLNSphericalPositionMake(radial, azimuthal, polar);
138
- return [NSExpression expressionWithMLNJSONObject:@(pos)];
131
+ - (NSExpression *)getSphericalPosition {
132
+ NSArray *values = (NSArray<NSNumber *> *)expressionJSON;
133
+
134
+ CGFloat radial = [values[0] floatValue];
135
+ CLLocationDistance azimuthal = [values[1] doubleValue];
136
+ CLLocationDistance polar = [values[2] doubleValue];
137
+
138
+ MLNSphericalPosition pos = MLNSphericalPositionMake(radial, azimuthal, polar);
139
+ return [NSExpression expressionWithMLNJSONObject:@(pos)];
139
140
  }
140
141
 
141
- - (BOOL)isVisible
142
- {
143
- if ([expressionJSON isKindOfClass:[NSString class]]) {
144
- NSString *visible = (NSString *)expressionJSON;
145
- return [visible isEqualToString:@"visible"];
146
- }
147
- return YES;
142
+ - (BOOL)isVisible {
143
+ if ([expressionJSON isKindOfClass:[NSString class]]) {
144
+ NSString *visible = (NSString *)expressionJSON;
145
+ return [visible isEqualToString:@"visible"];
146
+ }
147
+ return YES;
148
148
  }
149
149
 
150
- + (MLRNStyleValue*)make:(NSDictionary*)rawStyleValue;
150
+ + (MLRNStyleValue *)make:(NSDictionary *)rawStyleValue;
151
151
  {
152
- MLRNStyleValue *styleValue = [[MLRNStyleValue alloc] init];
153
- styleValue.styleType = (NSString *)rawStyleValue[@"styletype"];
154
- NSObject *object = [styleValue parse:(NSDictionary *)rawStyleValue[@"stylevalue"]];
155
- [styleValue setStyleObject:object];
156
- return styleValue;
152
+ MLRNStyleValue *styleValue = [[MLRNStyleValue alloc] init];
153
+ styleValue.styleType = (NSString *)rawStyleValue[@"styletype"];
154
+ NSObject *object = [styleValue parse:(NSDictionary *)rawStyleValue[@"stylevalue"]];
155
+ [styleValue setStyleObject:object];
156
+ return styleValue;
157
157
  }
158
158
 
159
159
  @end
@@ -5,21 +5,25 @@
5
5
 
6
6
  @implementation MLRNSymbolLayer
7
7
 
8
- - (MLNSymbolStyleLayer*)makeLayer:(MLNStyle*)style
9
- {
10
- MLNSource *source = [self layerWithSourceIDInStyle: style];
11
- if (source == nil) { return nil; }
12
- MLNSymbolStyleLayer *layer = [[MLNSymbolStyleLayer alloc] initWithIdentifier:self.id source:source];
13
- layer.sourceLayerIdentifier = self.sourceLayerID;
14
- return layer;
8
+ - (MLNSymbolStyleLayer *)makeLayer:(MLNStyle *)style {
9
+ MLNSource *source = [self layerWithSourceIDInStyle:style];
10
+ if (source == nil) {
11
+ return nil;
12
+ }
13
+ MLNSymbolStyleLayer *layer = [[MLNSymbolStyleLayer alloc] initWithIdentifier:self.id
14
+ source:source];
15
+ layer.sourceLayerIdentifier = self.sourceLayerID;
16
+ return layer;
15
17
  }
16
18
 
17
- - (void)addStyles
18
- {
19
- MLRNStyle *style = [[MLRNStyle alloc] initWithMLNStyle:self.style];
20
- style.bridge = self.bridge;
21
- [style symbolLayer:(MLNSymbolStyleLayer*)self.styleLayer withReactStyle:self.reactStyle isValid:^{ return [self isAddedToMap];
22
- }];
19
+ - (void)addStyles {
20
+ MLRNStyle *style = [[MLRNStyle alloc] initWithMLNStyle:self.style];
21
+ style.bridge = self.bridge;
22
+ [style symbolLayer:(MLNSymbolStyleLayer *)self.styleLayer
23
+ withReactStyle:self.reactStyle
24
+ isValid:^{
25
+ return [self isAddedToMap];
26
+ }];
23
27
  }
24
28
 
25
29
  @end
@@ -21,11 +21,10 @@ RCT_EXPORT_VIEW_PROPERTY(reactStyle, NSDictionary);
21
21
  RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, NSNumber);
22
22
  RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, NSNumber);
23
23
 
24
- - (UIView*)view
25
- {
26
- MLRNSymbolLayer *layer = [MLRNSymbolLayer new];
27
- layer.bridge = self.bridge;
28
- return layer;
24
+ - (UIView *)view {
25
+ MLRNSymbolLayer *layer = [MLRNSymbolLayer new];
26
+ layer.bridge = self.bridge;
27
+ return layer;
29
28
  }
30
29
 
31
30
  @end
@@ -17,6 +17,6 @@
17
17
 
18
18
  @property (nonatomic, assign) BOOL tms;
19
19
 
20
- - (NSDictionary<MLNTileSourceOption, id>*)getOptions;
20
+ - (NSDictionary<MLNTileSourceOption, id> *)getOptions;
21
21
 
22
22
  @end
@@ -7,25 +7,26 @@
7
7
 
8
8
  @implementation MLRNTileSource
9
9
 
10
- - (NSDictionary<MLNTileSourceOption, id>*)getOptions {
11
- NSMutableDictionary<MLNTileSourceOption, id> *options = [[NSMutableDictionary alloc] init];
12
-
13
- if (self.maxZoomLevel != nil) {
14
- options[MLNTileSourceOptionMaximumZoomLevel] = self.maxZoomLevel;
15
- }
16
-
17
- if (self.minZoomLevel != nil) {
18
- options[MLNTileSourceOptionMinimumZoomLevel] = self.minZoomLevel;
19
- }
20
-
21
- if (self.tms) {
22
- options[MLNTileSourceOptionTileCoordinateSystem] = [NSNumber numberWithUnsignedInteger:MLNTileCoordinateSystemTMS];
23
- }
24
-
25
- if (self.attribution != nil) {
26
- options[MLNTileSourceOptionAttributionHTMLString] = self.attribution;
27
- }
28
-
29
- return options;
10
+ - (NSDictionary<MLNTileSourceOption, id> *)getOptions {
11
+ NSMutableDictionary<MLNTileSourceOption, id> *options = [[NSMutableDictionary alloc] init];
12
+
13
+ if (self.maxZoomLevel != nil) {
14
+ options[MLNTileSourceOptionMaximumZoomLevel] = self.maxZoomLevel;
15
+ }
16
+
17
+ if (self.minZoomLevel != nil) {
18
+ options[MLNTileSourceOptionMinimumZoomLevel] = self.minZoomLevel;
19
+ }
20
+
21
+ if (self.tms) {
22
+ options[MLNTileSourceOptionTileCoordinateSystem] =
23
+ [NSNumber numberWithUnsignedInteger:MLNTileCoordinateSystemTMS];
24
+ }
25
+
26
+ if (self.attribution != nil) {
27
+ options[MLNTileSourceOptionAttributionHTMLString] = self.attribution;
28
+ }
29
+
30
+ return options;
30
31
  }
31
32
  @end
@@ -2,8 +2,8 @@
2
2
  // MLRNUserLocation.h
3
3
  // MLRN
4
4
 
5
- #import <Foundation/Foundation.h>
6
5
  #import <CoreLocation/CoreLocation.h>
6
+ #import <Foundation/Foundation.h>
7
7
  #import <MapLibre/MLNUserLocationAnnotationView.h>
8
8
 
9
9
  @interface MLRNUserLocation : NSObject