@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,148 +1,140 @@
1
1
  #import "MLRNShapeSource.h"
2
- #import "MLRNUtils.h"
3
2
  #import "MLRNMapView.h"
3
+ #import "MLRNUtils.h"
4
4
 
5
5
  @implementation MLRNShapeSource
6
6
 
7
- static UIImage * _placeHolderImage;
7
+ static UIImage *_placeHolderImage;
8
8
 
9
- - (void)setUrl: (NSString*) url
10
- {
11
- _url = url;
12
- if (self.source != nil) {
13
- MLNShapeSource *source = (MLNShapeSource *)self.source;
14
- [source setURL: url == nil ? nil : [NSURL URLWithString:url]];
15
- }
9
+ - (void)setUrl:(NSString *)url {
10
+ _url = url;
11
+ if (self.source != nil) {
12
+ MLNShapeSource *source = (MLNShapeSource *)self.source;
13
+ [source setURL:url == nil ? nil : [NSURL URLWithString:url]];
14
+ }
16
15
  }
17
16
 
18
- - (void)setShape:(NSString *)shape
19
- {
20
- _shape = shape;
17
+ - (void)setShape:(NSString *)shape {
18
+ _shape = shape;
21
19
 
22
- if (self.source != nil) {
23
- MLNShapeSource *source = (MLNShapeSource *)self.source;
24
- [source setShape: shape == nil ? nil : [MLRNUtils shapeFromGeoJSON:_shape]];
25
- }
20
+ if (self.source != nil) {
21
+ MLNShapeSource *source = (MLNShapeSource *)self.source;
22
+ [source setShape:shape == nil ? nil : [MLRNUtils shapeFromGeoJSON:_shape]];
23
+ }
26
24
  }
27
25
 
28
- - (void)addToMap
29
- {
30
- if (self.map.style == nil) {
31
- return;
32
- }
33
- [super addToMap];
26
+ - (void)addToMap {
27
+ if (self.map.style == nil) {
28
+ return;
29
+ }
30
+ [super addToMap];
34
31
  }
35
32
 
36
- - (void)removeFromMap
37
- {
38
- if (self.map.style == nil) {
39
- return;
40
- }
33
+ - (void)removeFromMap {
34
+ if (self.map.style == nil) {
35
+ return;
36
+ }
41
37
 
42
- [super removeFromMap];
38
+ [super removeFromMap];
43
39
  }
44
40
 
45
- - (nullable MLNSource*)makeSource
46
- {
47
- NSDictionary<MLNShapeSourceOption, id> *options = [self _getOptions];
41
+ - (nullable MLNSource *)makeSource {
42
+ NSDictionary<MLNShapeSourceOption, id> *options = [self _getOptions];
48
43
 
49
- if (_shape != nil) {
50
- MLNShape *shape = [MLRNUtils shapeFromGeoJSON:_shape];
51
- return [[MLNShapeSource alloc] initWithIdentifier:self.id shape:shape options:options];
52
- }
44
+ if (_shape != nil) {
45
+ MLNShape *shape = [MLRNUtils shapeFromGeoJSON:_shape];
46
+ return [[MLNShapeSource alloc] initWithIdentifier:self.id shape:shape options:options];
47
+ }
53
48
 
54
- if (_url != nil) {
55
- NSURL *url = [[NSURL alloc] initWithString:_url];
56
- return [[MLNShapeSource alloc] initWithIdentifier:self.id URL:url options:options];
57
- }
58
- return nil;
49
+ if (_url != nil) {
50
+ NSURL *url = [[NSURL alloc] initWithString:_url];
51
+ return [[MLNShapeSource alloc] initWithIdentifier:self.id URL:url options:options];
52
+ }
53
+ return nil;
59
54
  }
60
55
 
61
- - (NSDictionary<MLNShapeSourceOption, id>*)_getOptions
62
- {
63
- NSMutableDictionary<MLNShapeSourceOption, id> *options = [[NSMutableDictionary alloc] init];
56
+ - (NSDictionary<MLNShapeSourceOption, id> *)_getOptions {
57
+ NSMutableDictionary<MLNShapeSourceOption, id> *options = [[NSMutableDictionary alloc] init];
64
58
 
65
- if (_cluster != nil) {
66
- options[MLNShapeSourceOptionClustered] = [NSNumber numberWithBool:[_cluster intValue] == 1];
67
- }
59
+ if (_cluster != nil) {
60
+ options[MLNShapeSourceOptionClustered] = [NSNumber numberWithBool:[_cluster intValue] == 1];
61
+ }
68
62
 
69
- if (_clusterRadius != nil) {
70
- options[MLNShapeSourceOptionClusterRadius] = _clusterRadius;
71
- }
63
+ if (_clusterRadius != nil) {
64
+ options[MLNShapeSourceOptionClusterRadius] = _clusterRadius;
65
+ }
72
66
 
73
- if (_clusterMaxZoomLevel != nil) {
74
- options[MLNShapeSourceOptionMaximumZoomLevelForClustering] = _clusterMaxZoomLevel;
75
- }
67
+ if (_clusterMaxZoomLevel != nil) {
68
+ options[MLNShapeSourceOptionMaximumZoomLevelForClustering] = _clusterMaxZoomLevel;
69
+ }
76
70
 
77
- if (_clusterProperties != nil) {
78
- NSMutableDictionary<NSString *, NSArray *> *properties = [NSMutableDictionary new];
71
+ if (_clusterProperties != nil) {
72
+ NSMutableDictionary<NSString *, NSArray *> *properties = [NSMutableDictionary new];
79
73
 
80
- for (NSString *propertyName in _clusterProperties.allKeys) {
81
- NSArray<NSExpression *> *expressions = [_clusterProperties objectForKey: propertyName];
82
- NSExpression *firstExpression = [NSExpression expressionWithMLNJSONObject:[expressions objectAtIndex: 0]];
83
- NSExpression *secondExpression = [NSExpression expressionWithMLNJSONObject:[expressions objectAtIndex: 1]];
74
+ for (NSString *propertyName in _clusterProperties.allKeys) {
75
+ NSArray<NSExpression *> *expressions = [_clusterProperties objectForKey:propertyName];
76
+ NSExpression *firstExpression =
77
+ [NSExpression expressionWithMLNJSONObject:[expressions objectAtIndex:0]];
78
+ NSExpression *secondExpression =
79
+ [NSExpression expressionWithMLNJSONObject:[expressions objectAtIndex:1]];
84
80
 
85
- [properties setObject:@[firstExpression, secondExpression] forKey:propertyName];
86
- }
87
-
88
- options[MLNShapeSourceOptionClusterProperties] = properties;
89
- }
90
-
91
- if (_maxZoomLevel != nil) {
92
- options[MLNShapeSourceOptionMaximumZoomLevel] = _maxZoomLevel;
81
+ [properties setObject:@[ firstExpression, secondExpression ] forKey:propertyName];
93
82
  }
94
83
 
95
- if (_buffer != nil) {
96
- options[MLNShapeSourceOptionBuffer] = _buffer;
97
- }
84
+ options[MLNShapeSourceOptionClusterProperties] = properties;
85
+ }
98
86
 
99
- if (_tolerance != nil) {
100
- options[MLNShapeSourceOptionSimplificationTolerance] = _tolerance;
101
- }
87
+ if (_maxZoomLevel != nil) {
88
+ options[MLNShapeSourceOptionMaximumZoomLevel] = _maxZoomLevel;
89
+ }
102
90
 
103
- if (_lineMetrics != nil) {
104
- options[MLNShapeSourceOptionLineDistanceMetrics] = _lineMetrics;
105
- }
91
+ if (_buffer != nil) {
92
+ options[MLNShapeSourceOptionBuffer] = _buffer;
93
+ }
106
94
 
107
- return options;
95
+ if (_tolerance != nil) {
96
+ options[MLNShapeSourceOptionSimplificationTolerance] = _tolerance;
97
+ }
98
+
99
+ if (_lineMetrics != nil) {
100
+ options[MLNShapeSourceOptionLineDistanceMetrics] = _lineMetrics;
101
+ }
102
+
103
+ return options;
108
104
  }
109
105
 
110
- - (nonnull NSArray<id <MLNFeature>> *)featuresMatchingPredicate:(nullable NSPredicate *)predicate
111
- {
112
- MLNShapeSource *shapeSource = (MLNShapeSource *)self.source;
106
+ - (nonnull NSArray<id<MLNFeature>> *)featuresMatchingPredicate:(nullable NSPredicate *)predicate {
107
+ MLNShapeSource *shapeSource = (MLNShapeSource *)self.source;
113
108
 
114
- return [shapeSource featuresMatchingPredicate:predicate];
109
+ return [shapeSource featuresMatchingPredicate:predicate];
115
110
  }
116
111
 
117
- - (double)getClusterExpansionZoom:(nonnull NSString *)featureJSON
118
- {
119
- MLNShapeSource *shapeSource = (MLNShapeSource *)self.source;
112
+ - (double)getClusterExpansionZoom:(nonnull NSString *)featureJSON {
113
+ MLNShapeSource *shapeSource = (MLNShapeSource *)self.source;
114
+
115
+ MLNPointFeature *feature = (MLNPointFeature *)[MLRNUtils shapeFromGeoJSON:featureJSON];
120
116
 
121
- MLNPointFeature *feature = (MLNPointFeature*)[MLRNUtils shapeFromGeoJSON:featureJSON];
122
-
123
- return [shapeSource zoomLevelForExpandingCluster:(MLNPointFeatureCluster *)feature];
117
+ return [shapeSource zoomLevelForExpandingCluster:(MLNPointFeatureCluster *)feature];
124
118
  }
125
119
 
126
- - (nonnull NSArray<id <MLNFeature>> *)getClusterLeaves:(nonnull NSString *)featureJSON
127
- number:(NSUInteger)number
128
- offset:(NSUInteger)offset
129
- {
130
- MLNShapeSource *shapeSource = (MLNShapeSource *)self.source;
120
+ - (nonnull NSArray<id<MLNFeature>> *)getClusterLeaves:(nonnull NSString *)featureJSON
121
+ number:(NSUInteger)number
122
+ offset:(NSUInteger)offset {
123
+ MLNShapeSource *shapeSource = (MLNShapeSource *)self.source;
131
124
 
132
- MLNPointFeature *feature = (MLNPointFeature*)[MLRNUtils shapeFromGeoJSON:featureJSON];
125
+ MLNPointFeature *feature = (MLNPointFeature *)[MLRNUtils shapeFromGeoJSON:featureJSON];
133
126
 
134
- MLNPointFeatureCluster * cluster = (MLNPointFeatureCluster *)feature;
135
- return [shapeSource leavesOfCluster:cluster offset:offset limit:number];
127
+ MLNPointFeatureCluster *cluster = (MLNPointFeatureCluster *)feature;
128
+ return [shapeSource leavesOfCluster:cluster offset:offset limit:number];
136
129
  }
137
130
 
138
- - (nonnull NSArray<id <MLNFeature>> *)getClusterChildren:(nonnull NSString *)featureJSON
139
- {
140
- MLNShapeSource *shapeSource = (MLNShapeSource *)self.source;
141
-
142
- MLNPointFeature *feature = (MLNPointFeature*)[MLRNUtils shapeFromGeoJSON:featureJSON];
143
-
144
- MLNPointFeatureCluster * cluster = (MLNPointFeatureCluster *)feature;
145
- return [shapeSource childrenOfCluster:cluster];
131
+ - (nonnull NSArray<id<MLNFeature>> *)getClusterChildren:(nonnull NSString *)featureJSON {
132
+ MLNShapeSource *shapeSource = (MLNShapeSource *)self.source;
133
+
134
+ MLNPointFeature *feature = (MLNPointFeature *)[MLRNUtils shapeFromGeoJSON:featureJSON];
135
+
136
+ MLNPointFeatureCluster *cluster = (MLNPointFeatureCluster *)feature;
137
+ return [shapeSource childrenOfCluster:cluster];
146
138
  }
147
139
 
148
140
  @end
@@ -1,6 +1,6 @@
1
- #import "ViewManager.h"
2
1
  #import <React/RCTBridgeModule.h>
2
+ #import "ViewManager.h"
3
3
 
4
- @interface MLRNShapeSourceManager : ViewManager<RCTBridgeModule>
4
+ @interface MLRNShapeSourceManager : ViewManager <RCTBridgeModule>
5
5
 
6
6
  @end
@@ -1,7 +1,7 @@
1
1
  #import <React/RCTUIManager.h>
2
2
 
3
- #import "MLRNShapeSourceManager.h"
4
3
  #import "MLRNShapeSource.h"
4
+ #import "MLRNShapeSourceManager.h"
5
5
 
6
6
  #import "FilterParser.h"
7
7
 
@@ -27,105 +27,101 @@ RCT_EXPORT_VIEW_PROPERTY(hasPressListener, BOOL)
27
27
  RCT_EXPORT_VIEW_PROPERTY(hitbox, NSDictionary)
28
28
  RCT_REMAP_VIEW_PROPERTY(onMapboxShapeSourcePress, onPress, RCTBubblingEventBlock)
29
29
 
30
- - (UIView*)view
31
- {
32
- MLRNShapeSource *source = [MLRNShapeSource new];
33
- source.bridge = self.bridge;
34
- return source;
30
+ - (UIView *)view {
31
+ MLRNShapeSource *source = [MLRNShapeSource new];
32
+ source.bridge = self.bridge;
33
+ return source;
35
34
  }
36
35
 
37
- RCT_EXPORT_METHOD(features:(nonnull NSNumber*)reactTag
38
- withFilter:(NSArray *)filter
39
- resolver:(RCTPromiseResolveBlock)resolve
40
- rejecter:(RCTPromiseRejectBlock)reject)
41
- {
42
- [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *manager, NSDictionary<NSNumber*, UIView*> *viewRegistry) {
43
- MLRNShapeSource* shapeSource = viewRegistry[reactTag];
44
-
45
- if (![shapeSource isKindOfClass:[MLRNShapeSource class]]) {
46
- RCTLogError(@"Invalid react tag, could not find MLRNMapView");
47
- return;
48
- }
49
-
50
- NSPredicate* predicate = [FilterParser parse:filter];
51
- NSArray<id<MLNFeature>> *shapes = [shapeSource featuresMatchingPredicate: predicate];
52
-
53
- NSMutableArray<NSDictionary*> *features = [[NSMutableArray alloc] initWithCapacity:shapes.count];
54
- for (int i = 0; i < shapes.count; i++) {
55
- [features addObject:shapes[i].geoJSONDictionary];
56
- }
57
-
58
- resolve(@{
59
- @"data": @{ @"type": @"FeatureCollection", @"features": features }
60
- });
61
- }];
36
+ RCT_EXPORT_METHOD(features : (nonnull NSNumber *)reactTag withFilter : (NSArray *)
37
+ filter resolver : (RCTPromiseResolveBlock)
38
+ resolve rejecter : (RCTPromiseRejectBlock)reject) {
39
+ [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *manager,
40
+ NSDictionary<NSNumber *, UIView *> *viewRegistry) {
41
+ UIView *view = viewRegistry[reactTag];
42
+ MLRNShapeSource *shapeSource = nil;
43
+
44
+ if ([shapeSource isKindOfClass:[MLRNShapeSource class]]) {
45
+ shapeSource = (MLRNShapeSource *)view;
46
+ } else {
47
+ RCTLogError(@"Invalid react tag, could not find MLRNMapView");
48
+ return;
49
+ }
50
+
51
+ NSPredicate *predicate = [FilterParser parse:filter];
52
+ NSArray<id<MLNFeature>> *shapes = [shapeSource featuresMatchingPredicate:predicate];
53
+
54
+ NSMutableArray<NSDictionary *> *features =
55
+ [[NSMutableArray alloc] initWithCapacity:shapes.count];
56
+ for (int i = 0; i < shapes.count; i++) {
57
+ [features addObject:shapes[i].geoJSONDictionary];
58
+ }
59
+
60
+ resolve(@{@"data" : @{@"type" : @"FeatureCollection", @"features" : features}});
61
+ }];
62
62
  }
63
63
 
64
- RCT_EXPORT_METHOD(getClusterExpansionZoom:(nonnull NSNumber*)reactTag
65
- featureJSON:(nonnull NSString*)featureJSON
66
- resolver:(RCTPromiseResolveBlock)resolve
67
- rejecter:(RCTPromiseRejectBlock)reject)
68
- {
69
- [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *manager, NSDictionary<NSNumber*, UIView*> *viewRegistry) {
70
- MLRNShapeSource* shapeSource = (MLRNShapeSource *)viewRegistry[reactTag];
71
-
72
- if (![shapeSource isKindOfClass:[MLRNShapeSource class]]) {
73
- RCTLogError(@"Invalid react tag, could not find MLRNMapView");
74
- return;
75
- }
76
-
77
- double zoom = [shapeSource getClusterExpansionZoom: featureJSON];
78
- if (zoom == -1) {
79
- reject(@"zoom_error", [NSString stringWithFormat:@"Could not get zoom for cluster %@", featureJSON], nil);
80
- return;
81
- }
82
- resolve(@{@"data":@(zoom)});
83
- }];
64
+ RCT_EXPORT_METHOD(getClusterExpansionZoom : (nonnull NSNumber *)reactTag featureJSON : (
65
+ nonnull NSString *)featureJSON resolver : (RCTPromiseResolveBlock)
66
+ resolve rejecter : (RCTPromiseRejectBlock)reject) {
67
+ [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *manager,
68
+ NSDictionary<NSNumber *, UIView *> *viewRegistry) {
69
+ MLRNShapeSource *shapeSource = (MLRNShapeSource *)viewRegistry[reactTag];
70
+
71
+ if (![shapeSource isKindOfClass:[MLRNShapeSource class]]) {
72
+ RCTLogError(@"Invalid react tag, could not find MLRNMapView");
73
+ return;
74
+ }
75
+
76
+ double zoom = [shapeSource getClusterExpansionZoom:featureJSON];
77
+ if (zoom == -1) {
78
+ reject(@"zoom_error",
79
+ [NSString stringWithFormat:@"Could not get zoom for cluster %@", featureJSON], nil);
80
+ return;
81
+ }
82
+ resolve(@{@"data" : @(zoom)});
83
+ }];
84
84
  }
85
85
 
86
+ RCT_EXPORT_METHOD(getClusterLeaves : (nonnull NSNumber *)reactTag featureJSON : (nonnull NSString *)
87
+ featureJSON number : (NSUInteger)number offset : (NSUInteger)
88
+ offset resolver : (RCTPromiseResolveBlock)
89
+ resolve rejecter : (RCTPromiseRejectBlock)reject) {
90
+ [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *manager,
91
+ NSDictionary<NSNumber *, UIView *> *viewRegistry) {
92
+ MLRNShapeSource *shapeSource = (MLRNShapeSource *)viewRegistry[reactTag];
93
+
94
+ NSArray<id<MLNFeature>> *shapes = [shapeSource getClusterLeaves:featureJSON
95
+ number:number
96
+ offset:offset];
97
+
98
+ NSMutableArray<NSDictionary *> *features =
99
+ [[NSMutableArray alloc] initWithCapacity:shapes.count];
100
+ for (int i = 0; i < shapes.count; i++) {
101
+ [features addObject:shapes[i].geoJSONDictionary];
102
+ }
103
+
104
+ resolve(@{@"data" : @{@"type" : @"FeatureCollection", @"features" : features}});
105
+ }];
106
+ }
86
107
 
87
- RCT_EXPORT_METHOD(getClusterLeaves:(nonnull NSNumber*)reactTag
88
- featureJSON:(nonnull NSString*)featureJSON
89
- number:(NSUInteger) number
90
- offset:(NSUInteger) offset
91
- resolver:(RCTPromiseResolveBlock)resolve
92
- rejecter:(RCTPromiseRejectBlock)reject)
93
- {
94
- [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *manager, NSDictionary<NSNumber*, UIView*> *viewRegistry) {
95
- MLRNShapeSource* shapeSource = (MLRNShapeSource *)viewRegistry[reactTag];
96
-
97
- NSArray<id<MLNFeature>> *shapes = [shapeSource getClusterLeaves:featureJSON number:number offset:offset];
108
+ RCT_EXPORT_METHOD(getClusterChildren : (nonnull NSNumber *)reactTag featureJSON : (
109
+ nonnull NSString *)featureJSON resolver : (RCTPromiseResolveBlock)
110
+ resolve rejecter : (RCTPromiseRejectBlock)reject) {
111
+ [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *manager,
112
+ NSDictionary<NSNumber *, UIView *> *viewRegistry) {
113
+ MLRNShapeSource *shapeSource = (MLRNShapeSource *)viewRegistry[reactTag];
98
114
 
99
- NSMutableArray<NSDictionary*> *features = [[NSMutableArray alloc] initWithCapacity:shapes.count];
100
- for (int i = 0; i < shapes.count; i++) {
101
- [features addObject:shapes[i].geoJSONDictionary];
102
- }
115
+ NSArray<id<MLNFeature>> *shapes = [shapeSource getClusterChildren:featureJSON];
103
116
 
104
- resolve(@{
105
- @"data": @{ @"type": @"FeatureCollection", @"features": features }
106
- });
107
- }];
108
- }
117
+ NSMutableArray<NSDictionary *> *features =
118
+ [[NSMutableArray alloc] initWithCapacity:shapes.count];
119
+ for (int i = 0; i < shapes.count; i++) {
120
+ [features addObject:shapes[i].geoJSONDictionary];
121
+ }
109
122
 
110
- RCT_EXPORT_METHOD(getClusterChildren:(nonnull NSNumber*)reactTag
111
- featureJSON:(nonnull NSString*)featureJSON
112
- resolver:(RCTPromiseResolveBlock)resolve
113
- rejecter:(RCTPromiseRejectBlock)reject)
114
- {
115
- [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *manager, NSDictionary<NSNumber*, UIView*> *viewRegistry) {
116
- MLRNShapeSource* shapeSource = (MLRNShapeSource *)viewRegistry[reactTag];
117
-
118
- NSArray<id<MLNFeature>> *shapes = [shapeSource getClusterChildren: featureJSON];
119
-
120
- NSMutableArray<NSDictionary*> *features = [[NSMutableArray alloc] initWithCapacity:shapes.count];
121
- for (int i = 0; i < shapes.count; i++) {
122
- [features addObject:shapes[i].geoJSONDictionary];
123
- }
124
-
125
- resolve(@{
126
- @"data": @{ @"type": @"FeatureCollection", @"features": features }
127
- });
128
- }];
123
+ resolve(@{@"data" : @{@"type" : @"FeatureCollection", @"features" : features}});
124
+ }];
129
125
  }
130
126
 
131
127
  @end
@@ -1,5 +1,5 @@
1
1
  #import <React/RCTBridgeModule.h>
2
2
 
3
- @interface MLRNSnapshotModule : NSObject<RCTBridgeModule>
3
+ @interface MLRNSnapshotModule : NSObject <RCTBridgeModule>
4
4
 
5
5
  @end
@@ -1,72 +1,70 @@
1
1
  #import "MLRNSnapshotModule.h"
2
- #import "MLRNUtils.h"
3
2
  #import "MLRNImageUtils.h"
3
+ #import "MLRNUtils.h"
4
4
  @import MapLibre;
5
5
 
6
6
  @implementation MLRNSnapshotModule
7
7
 
8
8
  RCT_EXPORT_MODULE()
9
9
 
10
- + (BOOL)requiresMainQueueSetup
11
- {
12
- return YES;
10
+ + (BOOL)requiresMainQueueSetup {
11
+ return YES;
13
12
  }
14
13
 
15
- RCT_EXPORT_METHOD(takeSnap:(NSDictionary *)jsOptions
16
- resolver:(RCTPromiseResolveBlock)resolve
17
- rejecter:(RCTPromiseRejectBlock)reject)
18
- {
19
- dispatch_async(dispatch_get_main_queue(), ^{
20
- MLNMapSnapshotOptions *options = [self _getOptions:jsOptions];
21
- __block MLNMapSnapshotter *snapshotter = [[MLNMapSnapshotter alloc] initWithOptions:options];
14
+ RCT_EXPORT_METHOD(takeSnap : (NSDictionary *)jsOptions resolver : (RCTPromiseResolveBlock)
15
+ resolve rejecter : (RCTPromiseRejectBlock)reject) {
16
+ dispatch_async(dispatch_get_main_queue(), ^{
17
+ MLNMapSnapshotOptions *options = [self _getOptions:jsOptions];
18
+ __block MLNMapSnapshotter *snapshotter = [[MLNMapSnapshotter alloc] initWithOptions:options];
22
19
 
23
- [snapshotter startWithCompletionHandler:^(MLNMapSnapshot * _Nullable snapshot, NSError * _Nullable err) {
24
- if (err != nil) {
25
- reject(@"takeSnap", @"Could not create snapshot", err);
26
- snapshotter = nil;
27
- return;
28
- }
29
-
30
- NSString *result = nil;
31
- if ([jsOptions[@"writeToDisk"] boolValue]) {
32
- result = [MLRNImageUtils createTempFile:snapshot.image];
33
- } else {
34
- result = [MLRNImageUtils createBase64:snapshot.image];
35
- }
36
-
37
- resolve(result);
20
+ [snapshotter
21
+ startWithCompletionHandler:^(MLNMapSnapshot *_Nullable snapshot, NSError *_Nullable err) {
22
+ if (err != nil) {
23
+ reject(@"takeSnap", @"Could not create snapshot", err);
38
24
  snapshotter = nil;
25
+ return;
26
+ }
27
+
28
+ NSString *result = nil;
29
+ if ([jsOptions[@"writeToDisk"] boolValue]) {
30
+ result = [MLRNImageUtils createTempFile:snapshot.image];
31
+ } else {
32
+ result = [MLRNImageUtils createBase64:snapshot.image];
33
+ }
34
+
35
+ resolve(result);
36
+ snapshotter = nil;
39
37
  }];
40
- });
38
+ });
41
39
  }
42
40
 
43
- - (MLNMapSnapshotOptions *)_getOptions:(NSDictionary *)jsOptions
44
- {
45
- MLNMapCamera *camera = [[MLNMapCamera alloc] init];
46
-
47
- camera.pitch = [jsOptions[@"pitch"] doubleValue];
48
- camera.heading = [jsOptions[@"heading"] doubleValue];
49
-
50
- if (jsOptions[@"centerCoordinate"] != nil) {
51
- camera.centerCoordinate = [MLRNUtils fromFeature:jsOptions[@"centerCoordinate"]];
52
- }
53
-
54
- NSNumber *width = jsOptions[@"width"];
55
- NSNumber *height = jsOptions[@"height"];
56
- CGSize size = CGSizeMake([width doubleValue], [height doubleValue]);
57
-
58
- MLNMapSnapshotOptions *options = [[MLNMapSnapshotOptions alloc] initWithStyleURL:[NSURL URLWithString:jsOptions[@"styleURL"]]
59
- camera:camera
60
- size:size];
61
- if (jsOptions[@"zoomLevel"] != nil) {
62
- options.zoomLevel = [jsOptions[@"zoomLevel"] doubleValue];
63
- }
64
-
65
- if (jsOptions[@"bounds"] != nil) {
66
- options.coordinateBounds = [MLRNUtils fromFeatureCollection:jsOptions[@"bounds"]];
67
- }
41
+ - (MLNMapSnapshotOptions *)_getOptions:(NSDictionary *)jsOptions {
42
+ MLNMapCamera *camera = [[MLNMapCamera alloc] init];
43
+
44
+ camera.pitch = [jsOptions[@"pitch"] doubleValue];
45
+ camera.heading = [jsOptions[@"heading"] doubleValue];
46
+
47
+ if (jsOptions[@"centerCoordinate"] != nil) {
48
+ camera.centerCoordinate = [MLRNUtils fromFeature:jsOptions[@"centerCoordinate"]];
49
+ }
50
+
51
+ NSNumber *width = jsOptions[@"width"];
52
+ NSNumber *height = jsOptions[@"height"];
53
+ CGSize size = CGSizeMake([width doubleValue], [height doubleValue]);
54
+
55
+ MLNMapSnapshotOptions *options =
56
+ [[MLNMapSnapshotOptions alloc] initWithStyleURL:[NSURL URLWithString:jsOptions[@"styleURL"]]
57
+ camera:camera
58
+ size:size];
59
+ if (jsOptions[@"zoomLevel"] != nil) {
60
+ options.zoomLevel = [jsOptions[@"zoomLevel"] doubleValue];
61
+ }
62
+
63
+ if (jsOptions[@"bounds"] != nil) {
64
+ options.coordinateBounds = [MLRNUtils fromFeatureCollection:jsOptions[@"bounds"]];
65
+ }
68
66
 
69
- return options;
67
+ return options;
70
68
  }
71
69
 
72
70
  @end
@@ -1,27 +1,27 @@
1
1
  #import <React/RCTComponent.h>
2
- #import "MLRNLayer.h"
3
2
  #import <UIKit/UIKit.h>
3
+ #import "MLRNLayer.h"
4
4
  @import MapLibre;
5
5
 
6
6
  @interface MLRNSource : UIView
7
7
 
8
- extern NSString * _Nonnull const DEFAULT_SOURCE_ID;
8
+ extern NSString *_Nonnull const DEFAULT_SOURCE_ID;
9
9
 
10
- @property (nonatomic, strong) NSMutableArray<id<RCTComponent>> *reactSubviews;
11
- @property (nonatomic, strong) NSMutableArray<MLRNLayer*> *layers;
12
- @property (nonatomic, strong) MLNSource *source;
13
- @property (nonatomic, strong) MLRNMapView *map;
14
- @property (nonatomic, strong) NSDictionary<NSString *, NSNumber *> *hitbox;
10
+ @property (nonatomic, strong, nonnull) NSMutableArray<id<RCTComponent>> *reactSubviews;
11
+ @property (nonatomic, strong, nonnull) NSMutableArray<MLRNLayer *> *layers;
12
+ @property (nonatomic, strong, nullable) MLNSource *source;
13
+ @property (nonatomic, strong, nullable) MLRNMapView *map;
14
+ @property (nonatomic, strong, nonnull) NSDictionary<NSString *, NSNumber *> *hitbox;
15
15
 
16
- @property (nonatomic, copy) NSString *id;
16
+ @property (nonatomic, copy, nonnull) NSString *id;
17
17
  @property (nonatomic, assign) BOOL hasPressListener;
18
- @property (nonatomic, copy) RCTBubblingEventBlock onPress;
18
+ @property (nonatomic, copy, nullable) RCTBubblingEventBlock onPress;
19
19
 
20
20
  - (void)addToMap;
21
21
  - (void)removeFromMap;
22
- - (nullable MLNSource*)makeSource;
23
- - (NSArray<NSString *> *)getLayerIDs;
22
+ - (nullable MLNSource *)makeSource;
23
+ - (nonnull NSArray<NSString *> *)getLayerIDs;
24
24
 
25
- + (BOOL)isDefaultSource:(NSString*)sourceID;
25
+ + (BOOL)isDefaultSource:(nonnull NSString *)sourceID;
26
26
 
27
27
  @end