@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.
- package/ios/MLRN/CameraStop.h +1 -1
- package/ios/MLRN/CameraStop.m +58 -60
- package/ios/MLRN/CameraUpdateItem.h +2 -1
- package/ios/MLRN/CameraUpdateItem.m +132 -132
- package/ios/MLRN/CameraUpdateQueue.m +43 -47
- package/ios/MLRN/FilterParser.h +1 -1
- package/ios/MLRN/FilterParser.m +5 -6
- package/ios/MLRN/MLRNBackgroundLayer.m +10 -9
- package/ios/MLRN/MLRNBackgroundLayerManager.m +4 -5
- package/ios/MLRN/MLRNCallout.h +1 -1
- package/ios/MLRN/MLRNCallout.m +37 -36
- package/ios/MLRN/MLRNCalloutManager.m +2 -3
- package/ios/MLRN/MLRNCamera.h +1 -1
- package/ios/MLRN/MLRNCamera.m +169 -182
- package/ios/MLRN/MLRNCameraManager.m +4 -6
- package/ios/MLRN/MLRNCircleLayer.m +17 -14
- package/ios/MLRN/MLRNCircleLayerManager.m +4 -5
- package/ios/MLRN/MLRNCustomHeaders.h +2 -2
- package/ios/MLRN/MLRNCustomHeaders.m +63 -63
- package/ios/MLRN/MLRNEvent.h +3 -3
- package/ios/MLRN/MLRNEvent.m +19 -24
- package/ios/MLRN/MLRNEventProtocol.h +1 -1
- package/ios/MLRN/MLRNFillExtrusionLayer.m +18 -14
- package/ios/MLRN/MLRNFillExtrusionLayerManager.m +4 -5
- package/ios/MLRN/MLRNFillLayer.m +16 -14
- package/ios/MLRN/MLRNFillLayerManager.m +4 -5
- package/ios/MLRN/MLRNHeatmapLayer.m +17 -14
- package/ios/MLRN/MLRNHeatmapLayerManager.m +4 -5
- package/ios/MLRN/MLRNImageQueue.h +4 -1
- package/ios/MLRN/MLRNImageQueue.m +29 -32
- package/ios/MLRN/MLRNImageQueueOperation.h +1 -1
- package/ios/MLRN/MLRNImageQueueOperation.m +92 -91
- package/ios/MLRN/MLRNImageSource.m +36 -38
- package/ios/MLRN/MLRNImageSourceManager.m +2 -3
- package/ios/MLRN/MLRNImageUtils.h +3 -3
- package/ios/MLRN/MLRNImageUtils.m +15 -14
- package/ios/MLRN/MLRNImages.h +0 -1
- package/ios/MLRN/MLRNImages.m +89 -91
- package/ios/MLRN/MLRNImagesManager.m +4 -5
- package/ios/MLRN/MLRNLayer.h +9 -11
- package/ios/MLRN/MLRNLayer.m +170 -182
- package/ios/MLRN/MLRNLight.m +21 -23
- package/ios/MLRN/MLRNLightManager.m +2 -3
- package/ios/MLRN/MLRNLineLayer.m +17 -15
- package/ios/MLRN/MLRNLineLayerManager.m +4 -6
- package/ios/MLRN/MLRNLocation.h +1 -1
- package/ios/MLRN/MLRNLocation.m +16 -17
- package/ios/MLRN/MLRNLocationManager.m +109 -124
- package/ios/MLRN/MLRNLocationManagerDelegate.h +3 -3
- package/ios/MLRN/MLRNLocationModule.h +1 -1
- package/ios/MLRN/MLRNLocationModule.m +40 -55
- package/ios/MLRN/MLRNLogging.h +1 -4
- package/ios/MLRN/MLRNLogging.m +84 -89
- package/ios/MLRN/MLRNMapTouchEvent.h +2 -2
- package/ios/MLRN/MLRNMapTouchEvent.m +50 -49
- package/ios/MLRN/MLRNMapView.h +43 -36
- package/ios/MLRN/MLRNMapView.m +409 -440
- package/ios/MLRN/MLRNMapViewManager.m +489 -502
- package/ios/MLRN/MLRNModule.h +1 -1
- package/ios/MLRN/MLRNModule.m +111 -105
- package/ios/MLRN/MLRNNativeUserLocation.m +24 -27
- package/ios/MLRN/MLRNNativeUserLocationManager.m +4 -8
- package/ios/MLRN/MLRNOfflineModule.h +1 -1
- package/ios/MLRN/MLRNOfflineModule.m +416 -421
- package/ios/MLRN/MLRNPointAnnotation.h +2 -2
- package/ios/MLRN/MLRNPointAnnotation.m +154 -175
- package/ios/MLRN/MLRNPointAnnotationManager.m +2 -3
- package/ios/MLRN/MLRNRasterLayer.m +16 -12
- package/ios/MLRN/MLRNRasterLayerManager.m +4 -5
- package/ios/MLRN/MLRNRasterSource.m +21 -17
- package/ios/MLRN/MLRNRasterSourceManager.m +2 -3
- package/ios/MLRN/MLRNShapeSource.h +17 -16
- package/ios/MLRN/MLRNShapeSource.m +94 -102
- package/ios/MLRN/MLRNShapeSourceManager.h +2 -2
- package/ios/MLRN/MLRNShapeSourceManager.m +86 -90
- package/ios/MLRN/MLRNSnapshotModule.h +1 -1
- package/ios/MLRN/MLRNSnapshotModule.m +51 -53
- package/ios/MLRN/MLRNSource.h +12 -12
- package/ios/MLRN/MLRNSource.m +82 -88
- package/ios/MLRN/MLRNStyleValue.h +1 -1
- package/ios/MLRN/MLRNStyleValue.m +128 -128
- package/ios/MLRN/MLRNSymbolLayer.m +17 -13
- package/ios/MLRN/MLRNSymbolLayerManager.m +4 -5
- package/ios/MLRN/MLRNTileSource.h +1 -1
- package/ios/MLRN/MLRNTileSource.m +21 -20
- package/ios/MLRN/MLRNUserLocation.h +1 -1
- package/ios/MLRN/MLRNUserLocation.m +10 -12
- package/ios/MLRN/MLRNUtils.h +18 -11
- package/ios/MLRN/MLRNUtils.m +168 -160
- package/ios/MLRN/MLRNVectorLayer.m +28 -34
- package/ios/MLRN/MLRNVectorSource.h +3 -1
- package/ios/MLRN/MLRNVectorSource.m +14 -11
- package/ios/MLRN/MLRNVectorSourceManager.h +2 -2
- package/ios/MLRN/MLRNVectorSourceManager.m +36 -39
- package/ios/MLRN/ViewManager.h +1 -1
- package/ios/MLRN/ViewManager.m +29 -35
- package/lib/commonjs/components/MarkerView.js +1 -1
- package/lib/commonjs/components/ShapeSource.js +2 -1
- package/lib/commonjs/components/ShapeSource.js.map +1 -1
- package/lib/commonjs/components/UserLocation.js +8 -38
- package/lib/commonjs/components/UserLocation.js.map +1 -1
- package/lib/commonjs/components/UserLocationPuck.js +52 -0
- package/lib/commonjs/components/UserLocationPuck.js.map +1 -0
- package/lib/commonjs/components/{HeadingIndicator.js → UserLocationPuckHeading.js} +12 -9
- package/lib/commonjs/components/UserLocationPuckHeading.js.map +1 -0
- package/lib/commonjs/utils/animated/AbstractAnimatedCoordinates.js +8 -7
- package/lib/commonjs/utils/animated/AbstractAnimatedCoordinates.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedExtractCoordinateFromArray.js +1 -2
- package/lib/commonjs/utils/animated/AnimatedExtractCoordinateFromArray.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedRouteCoordinatesArray.js +28 -38
- package/lib/commonjs/utils/animated/AnimatedRouteCoordinatesArray.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedShape.js +11 -7
- package/lib/commonjs/utils/animated/AnimatedShape.js.map +1 -1
- package/lib/module/components/MarkerView.js +1 -1
- package/lib/module/components/ShapeSource.js +2 -1
- package/lib/module/components/ShapeSource.js.map +1 -1
- package/lib/module/components/UserLocation.js +7 -36
- package/lib/module/components/UserLocation.js.map +1 -1
- package/lib/module/components/UserLocationPuck.js +48 -0
- package/lib/module/components/UserLocationPuck.js.map +1 -0
- package/lib/module/components/{HeadingIndicator.js → UserLocationPuckHeading.js} +11 -7
- package/lib/module/components/UserLocationPuckHeading.js.map +1 -0
- package/lib/module/utils/animated/AbstractAnimatedCoordinates.js +8 -7
- package/lib/module/utils/animated/AbstractAnimatedCoordinates.js.map +1 -1
- package/lib/module/utils/animated/AnimatedExtractCoordinateFromArray.js +1 -3
- package/lib/module/utils/animated/AnimatedExtractCoordinateFromArray.js.map +1 -1
- package/lib/module/utils/animated/AnimatedRouteCoordinatesArray.js +29 -39
- package/lib/module/utils/animated/AnimatedRouteCoordinatesArray.js.map +1 -1
- package/lib/module/utils/animated/AnimatedShape.js +11 -7
- package/lib/module/utils/animated/AnimatedShape.js.map +1 -1
- package/lib/typescript/commonjs/src/components/MarkerView.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/UserLocation.d.ts +0 -1
- package/lib/typescript/commonjs/src/components/UserLocation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/UserLocationPuck.d.ts +9 -0
- package/lib/typescript/commonjs/src/components/UserLocationPuck.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/UserLocationPuckHeading.d.ts +9 -0
- package/lib/typescript/commonjs/src/components/UserLocationPuckHeading.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts +12 -13
- package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +5 -4
- package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts +0 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts +33 -21
- package/lib/typescript/commonjs/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts +8 -5
- package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts.map +1 -1
- package/lib/typescript/module/src/components/MarkerView.d.ts +1 -1
- package/lib/typescript/module/src/components/ShapeSource.d.ts +1 -1
- package/lib/typescript/module/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/UserLocation.d.ts +0 -1
- package/lib/typescript/module/src/components/UserLocation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/UserLocationPuck.d.ts +9 -0
- package/lib/typescript/module/src/components/UserLocationPuck.d.ts.map +1 -0
- package/lib/typescript/module/src/components/UserLocationPuckHeading.d.ts +9 -0
- package/lib/typescript/module/src/components/UserLocationPuckHeading.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts +12 -13
- package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +5 -4
- package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts +0 -1
- package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts +33 -21
- package/lib/typescript/module/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts +8 -5
- package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/components/MarkerView.tsx +1 -1
- package/src/components/ShapeSource.tsx +58 -53
- package/src/components/UserLocation.tsx +13 -51
- package/src/components/UserLocationPuck.tsx +62 -0
- package/src/components/UserLocationPuckHeading.tsx +33 -0
- package/src/utils/animated/AbstractAnimatedCoordinates.ts +26 -15
- package/src/utils/animated/AnimatedExtractCoordinateFromArray.ts +10 -6
- package/src/utils/animated/AnimatedRouteCoordinatesArray.ts +63 -51
- package/src/utils/animated/AnimatedShape.ts +22 -13
- package/lib/commonjs/components/HeadingIndicator.js.map +0 -1
- package/lib/module/components/HeadingIndicator.js.map +0 -1
- package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts +0 -7
- package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts.map +0 -1
- package/lib/typescript/module/src/components/HeadingIndicator.d.ts +0 -7
- package/lib/typescript/module/src/components/HeadingIndicator.d.ts.map +0 -1
- package/src/components/HeadingIndicator.tsx +0 -26
package/ios/MLRN/MLRNLayer.h
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
#import <UIKit/UIKit.h>
|
|
2
1
|
#import <React/RCTBridge.h>
|
|
3
|
-
|
|
2
|
+
#import <UIKit/UIKit.h>
|
|
4
3
|
|
|
5
4
|
@class MLRNMapView;
|
|
6
5
|
|
|
@@ -8,11 +7,11 @@
|
|
|
8
7
|
|
|
9
8
|
@interface MLRNLayer<T> : UIView
|
|
10
9
|
|
|
11
|
-
@property (nonatomic, weak, nullable) RCTBridge*
|
|
10
|
+
@property (nonatomic, weak, nullable) RCTBridge *bridge;
|
|
12
11
|
|
|
13
12
|
@property (nonatomic, strong, nullable) MLNStyleLayer *styleLayer;
|
|
14
13
|
@property (nonatomic, strong, nullable) MLNStyle *style;
|
|
15
|
-
@property (nonatomic, weak, nullable) MLRNMapView*
|
|
14
|
+
@property (nonatomic, weak, nullable) MLRNMapView *map;
|
|
16
15
|
@property (nonatomic, strong, nullable) NSDictionary *reactStyle;
|
|
17
16
|
@property (nonatomic, strong, nullable) NSArray *filter;
|
|
18
17
|
|
|
@@ -26,19 +25,18 @@
|
|
|
26
25
|
@property (nonatomic, copy, nullable) NSNumber *maxZoomLevel;
|
|
27
26
|
@property (nonatomic, copy, nullable) NSNumber *minZoomLevel;
|
|
28
27
|
|
|
29
|
-
- (void)addToMap:(nonnull MLRNMapView*)map style:(nonnull MLNStyle*)style;
|
|
28
|
+
- (void)addToMap:(nonnull MLRNMapView *)map style:(nonnull MLNStyle *)style;
|
|
30
29
|
- (void)addedToMap;
|
|
31
|
-
- (void)removeFromMap:(nonnull MLNStyle*)style;
|
|
32
|
-
- (nullable T)makeLayer:(nonnull MLNStyle*)style;
|
|
30
|
+
- (void)removeFromMap:(nonnull MLNStyle *)style;
|
|
31
|
+
- (nullable T)makeLayer:(nonnull MLNStyle *)style;
|
|
33
32
|
- (void)addStyles;
|
|
34
|
-
- (void)insertAbove:(nonnull NSString*)layer;
|
|
35
|
-
- (void)insertBelow:(nonnull NSString*)layer;
|
|
33
|
+
- (void)insertAbove:(nonnull NSString *)layer;
|
|
34
|
+
- (void)insertBelow:(nonnull NSString *)layer;
|
|
36
35
|
- (void)insertAtIndex:(NSUInteger)index;
|
|
37
|
-
- (void)insertLayer;
|
|
38
36
|
- (void)setZoomBounds;
|
|
39
37
|
|
|
40
38
|
- (BOOL)isAddedToMap;
|
|
41
39
|
|
|
42
|
-
- (nullable MLNSource*)layerWithSourceIDInStyle:(nonnull MLNStyle*)
|
|
40
|
+
- (nullable MLNSource *)layerWithSourceIDInStyle:(nonnull MLNStyle *)style;
|
|
43
41
|
|
|
44
42
|
@end
|
package/ios/MLRN/MLRNLayer.m
CHANGED
|
@@ -1,228 +1,216 @@
|
|
|
1
1
|
#import "MLRNLayer.h"
|
|
2
|
+
#import "MLRNMapView.h"
|
|
2
3
|
#import "MLRNSource.h"
|
|
3
4
|
#import "MLRNStyleValue.h"
|
|
4
5
|
#import "MLRNUtils.h"
|
|
5
|
-
#import "MLRNMapView.h"
|
|
6
6
|
|
|
7
7
|
@implementation MLRNLayer
|
|
8
8
|
|
|
9
|
-
- (void)setMinZoomLevel:(NSNumber*)minZoomLevel
|
|
10
|
-
|
|
11
|
-
_minZoomLevel = minZoomLevel;
|
|
12
|
-
|
|
13
|
-
if (_styleLayer != nil) {
|
|
14
|
-
_styleLayer.minimumZoomLevel = [_minZoomLevel doubleValue];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
- (void)setMinZoomLevel:(NSNumber *)minZoomLevel {
|
|
10
|
+
_minZoomLevel = minZoomLevel;
|
|
17
11
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (_styleLayer != nil) {
|
|
23
|
-
_styleLayer.maximumZoomLevel = [_maxZoomLevel doubleValue];
|
|
24
|
-
}
|
|
12
|
+
if (_styleLayer != nil) {
|
|
13
|
+
_styleLayer.minimumZoomLevel = [_minZoomLevel doubleValue];
|
|
14
|
+
}
|
|
25
15
|
}
|
|
26
16
|
|
|
27
|
-
- (void)
|
|
28
|
-
|
|
29
|
-
if (_aboveLayerID != nil && _aboveLayerID == aboveLayerID) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
_aboveLayerID = aboveLayerID;
|
|
34
|
-
if (_styleLayer != nil) {
|
|
35
|
-
[self removeFromMap:_style];
|
|
36
|
-
[self insertAbove:aboveLayerID];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
17
|
+
- (void)setMaxZoomLevel:(NSNumber *)maxZoomLevel {
|
|
18
|
+
_maxZoomLevel = maxZoomLevel;
|
|
39
19
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
_belowLayerID = belowLayerID;
|
|
47
|
-
if (_styleLayer != nil) {
|
|
48
|
-
[self removeFromMap:_style];
|
|
49
|
-
[self insertBelow:_belowLayerID];
|
|
50
|
-
}
|
|
20
|
+
if (_styleLayer != nil) {
|
|
21
|
+
_styleLayer.maximumZoomLevel = [_maxZoomLevel doubleValue];
|
|
22
|
+
}
|
|
51
23
|
}
|
|
52
24
|
|
|
53
|
-
- (void)
|
|
54
|
-
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
25
|
+
- (void)setAboveLayerID:(NSString *)aboveLayerID {
|
|
26
|
+
if (_aboveLayerID != nil && _aboveLayerID == aboveLayerID) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
_aboveLayerID = aboveLayerID;
|
|
31
|
+
if (_styleLayer != nil) {
|
|
32
|
+
[self removeFromMap:_style];
|
|
33
|
+
[self insertAbove:aboveLayerID];
|
|
34
|
+
}
|
|
64
35
|
}
|
|
65
36
|
|
|
66
|
-
- (void)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
37
|
+
- (void)setBelowLayerID:(NSString *)belowLayerID {
|
|
38
|
+
if (_belowLayerID != nil && _belowLayerID == belowLayerID) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
_belowLayerID = belowLayerID;
|
|
43
|
+
if (_styleLayer != nil) {
|
|
44
|
+
[self removeFromMap:_style];
|
|
45
|
+
[self insertBelow:_belowLayerID];
|
|
46
|
+
}
|
|
74
47
|
}
|
|
75
48
|
|
|
76
|
-
-(void)
|
|
77
|
-
{
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
49
|
+
- (void)setLayerIndex:(NSNumber *)layerIndex {
|
|
50
|
+
if (_layerIndex != nil && _layerIndex == layerIndex) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
_layerIndex = layerIndex;
|
|
55
|
+
if (_styleLayer != nil) {
|
|
56
|
+
[self removeFromMap:_style];
|
|
57
|
+
[self insertAtIndex:_layerIndex.unsignedIntegerValue];
|
|
58
|
+
}
|
|
85
59
|
}
|
|
86
60
|
|
|
87
|
-
- (void)
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
61
|
+
- (void)setMap:(MLRNMapView *)map {
|
|
62
|
+
if (map == nil) {
|
|
63
|
+
[self removeFromMap:_map.style];
|
|
64
|
+
_map = nil;
|
|
65
|
+
} else {
|
|
92
66
|
_map = map;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
67
|
+
[self addToMap:map style:map.style];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
- (void)setReactStyle:(NSDictionary *)reactStyle {
|
|
72
|
+
_reactStyle = reactStyle;
|
|
73
|
+
|
|
74
|
+
if (_styleLayer != nil) {
|
|
75
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
76
|
+
[self addStyles];
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
- (void)addToMap:(MLRNMapView *)map style:(MLNStyle *)style {
|
|
82
|
+
if (style == nil) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
_map = map;
|
|
86
|
+
_style = style;
|
|
87
|
+
if (_id == nil) {
|
|
88
|
+
RCTLogError(@"Cannot add a layer without id to the map: %@", self);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
MLNStyleLayer *existingLayer = [style layerWithIdentifier:_id];
|
|
92
|
+
if (existingLayer != nil) {
|
|
93
|
+
_styleLayer = existingLayer;
|
|
94
|
+
} else {
|
|
95
|
+
_styleLayer = [self makeLayer:style];
|
|
96
|
+
if (_styleLayer == nil) {
|
|
97
|
+
RCTLogError(@"Failed to make layer: %@", _id);
|
|
96
98
|
return;
|
|
97
99
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (_styleLayer == nil) {
|
|
104
|
-
RCTLogError(@"Failed to make layer: %@", _id);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
[self insertLayer: map];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
[self addStyles];
|
|
111
|
-
[self addedToMap];
|
|
100
|
+
[self insertLayer:map];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
[self addStyles];
|
|
104
|
+
[self addedToMap];
|
|
112
105
|
}
|
|
113
106
|
|
|
114
|
-
- (nullable MLNSource*)layerWithSourceIDInStyle:(nonnull MLNStyle*)
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return result;
|
|
107
|
+
- (nullable MLNSource *)layerWithSourceIDInStyle:(nonnull MLNStyle *)style {
|
|
108
|
+
MLNSource *result = [style sourceWithIdentifier:self.sourceID];
|
|
109
|
+
if (result == NULL) {
|
|
110
|
+
RCTLogError(@"Cannot find layer with id: %@ referenced by layer:%@", self.sourceID, _id);
|
|
111
|
+
}
|
|
112
|
+
return result;
|
|
121
113
|
}
|
|
122
114
|
|
|
123
|
-
- (void)removeFromMap:(MLNStyle *)style
|
|
124
|
-
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
_style = nil;
|
|
115
|
+
- (void)removeFromMap:(MLNStyle *)style {
|
|
116
|
+
if (_styleLayer != nil) {
|
|
117
|
+
[style removeLayer:_styleLayer];
|
|
118
|
+
}
|
|
119
|
+
_style = nil;
|
|
129
120
|
}
|
|
130
121
|
|
|
131
|
-
- (BOOL)isAddedToMap
|
|
132
|
-
|
|
133
|
-
return (_style != nil);
|
|
122
|
+
- (BOOL)isAddedToMap {
|
|
123
|
+
return (_style != nil);
|
|
134
124
|
}
|
|
135
125
|
|
|
136
|
-
- (nullable MLNStyleLayer*)makeLayer:(MLNStyle*)style
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
126
|
+
- (nullable MLNStyleLayer *)makeLayer:(MLNStyle *)style {
|
|
127
|
+
@throw [NSException
|
|
128
|
+
exceptionWithName:NSInternalInconsistencyException
|
|
129
|
+
reason:[NSString stringWithFormat:@"You must override %@ in a subclass",
|
|
130
|
+
NSStringFromSelector(_cmd)]
|
|
131
|
+
userInfo:nil];
|
|
141
132
|
}
|
|
142
133
|
|
|
143
|
-
- (void)addStyles
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
134
|
+
- (void)addStyles {
|
|
135
|
+
@throw [NSException
|
|
136
|
+
exceptionWithName:NSInternalInconsistencyException
|
|
137
|
+
reason:[NSString stringWithFormat:@"You must override %@ in a subclass",
|
|
138
|
+
NSStringFromSelector(_cmd)]
|
|
139
|
+
userInfo:nil];
|
|
148
140
|
}
|
|
149
141
|
|
|
150
|
-
- (void)addedToMap
|
|
151
|
-
|
|
152
|
-
// override if you want
|
|
142
|
+
- (void)addedToMap {
|
|
143
|
+
// override if you want
|
|
153
144
|
}
|
|
154
145
|
|
|
155
|
-
- (void)insertLayer:
|
|
156
|
-
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
146
|
+
- (void)insertLayer:(MLRNMapView *)map {
|
|
147
|
+
if ([_style layerWithIdentifier:_id] != nil) {
|
|
148
|
+
return; // prevent layer from being added twice
|
|
149
|
+
}
|
|
160
150
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
151
|
+
if (_aboveLayerID != nil) {
|
|
152
|
+
[self insertAbove:_aboveLayerID];
|
|
153
|
+
} else if (_belowLayerID != nil) {
|
|
154
|
+
[self insertBelow:_belowLayerID];
|
|
155
|
+
} else if (_layerIndex != nil) {
|
|
156
|
+
[self insertAtIndex:_layerIndex.unsignedIntegerValue];
|
|
157
|
+
} else {
|
|
158
|
+
[_style addLayer:_styleLayer];
|
|
159
|
+
[_map layerAdded:_styleLayer];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
[self setZoomBounds];
|
|
173
163
|
}
|
|
174
164
|
|
|
175
|
-
- (void)setZoomBounds
|
|
176
|
-
{
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
165
|
+
- (void)setZoomBounds {
|
|
166
|
+
if (_maxZoomLevel != nil) {
|
|
167
|
+
_styleLayer.maximumZoomLevel = [_maxZoomLevel doubleValue];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (_minZoomLevel != nil) {
|
|
171
|
+
_styleLayer.minimumZoomLevel = [_minZoomLevel doubleValue];
|
|
172
|
+
}
|
|
184
173
|
}
|
|
185
174
|
|
|
186
|
-
-(void)insertAbove:(NSString*)aboveLayerIDs
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
-(void)insertBelow:(NSString*)belowLayerID
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
-(void)insertAtIndex:(NSUInteger)index
|
|
210
|
-
{
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
175
|
+
- (void)insertAbove:(NSString *)aboveLayerIDs {
|
|
176
|
+
[_map waitForLayerWithID:aboveLayerIDs
|
|
177
|
+
then:^void(MLNStyleLayer *layer) {
|
|
178
|
+
if (![self _hasInitialized]) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
[self->_style insertLayer:self->_styleLayer aboveLayer:layer];
|
|
182
|
+
[self->_map layerAdded:self->_styleLayer];
|
|
183
|
+
}];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
- (void)insertBelow:(NSString *)belowLayerID {
|
|
187
|
+
[_map waitForLayerWithID:belowLayerID
|
|
188
|
+
then:^void(MLNStyleLayer *layer) {
|
|
189
|
+
if (![self _hasInitialized]) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
[self->_style insertLayer:self->_styleLayer belowLayer:layer];
|
|
194
|
+
[self->_map layerAdded:self->_styleLayer];
|
|
195
|
+
}];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
- (void)insertAtIndex:(NSUInteger)index {
|
|
199
|
+
if (![self _hasInitialized]) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
NSArray *layers = _style.layers;
|
|
203
|
+
if (index >= layers.count) {
|
|
204
|
+
RCTLogWarn(@"Layer index is greater than number of layers on map. Layer inserted at end of "
|
|
205
|
+
@"layer stack.");
|
|
206
|
+
index = layers.count - 1;
|
|
207
|
+
}
|
|
208
|
+
[_style insertLayer:self->_styleLayer atIndex:index];
|
|
209
|
+
[_map layerAdded:self->_styleLayer];
|
|
221
210
|
}
|
|
222
211
|
|
|
223
|
-
- (BOOL)_hasInitialized
|
|
224
|
-
|
|
225
|
-
return _style != nil && _styleLayer != nil;
|
|
212
|
+
- (BOOL)_hasInitialized {
|
|
213
|
+
return _style != nil && _styleLayer != nil;
|
|
226
214
|
}
|
|
227
215
|
|
|
228
216
|
@end
|
package/ios/MLRN/MLRNLight.m
CHANGED
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
#import "MLRNLight.h"
|
|
2
2
|
#import "MLRNStyle.h"
|
|
3
3
|
|
|
4
|
-
@implementation MLRNLight
|
|
5
|
-
|
|
6
|
-
MLNLight *internalLight;
|
|
4
|
+
@implementation MLRNLight {
|
|
5
|
+
MLNLight *internalLight;
|
|
7
6
|
}
|
|
8
7
|
|
|
9
|
-
- (void)setReactStyle:(NSDictionary *)reactStyle
|
|
10
|
-
|
|
11
|
-
_reactStyle = reactStyle;
|
|
12
|
-
|
|
13
|
-
if (_map != nil) {
|
|
14
|
-
[self addStyles];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
8
|
+
- (void)setReactStyle:(NSDictionary *)reactStyle {
|
|
9
|
+
_reactStyle = reactStyle;
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
{
|
|
20
|
-
_map = map;
|
|
11
|
+
if (_map != nil) {
|
|
21
12
|
[self addStyles];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
- (void)setMap:(MLNMapView *)map {
|
|
17
|
+
_map = map;
|
|
18
|
+
[self addStyles];
|
|
22
19
|
}
|
|
23
20
|
|
|
24
21
|
- (BOOL)isAddedToMap {
|
|
25
|
-
|
|
22
|
+
return _map != NULL;
|
|
26
23
|
}
|
|
27
24
|
|
|
28
|
-
- (void)addStyles
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
- (void)addStyles {
|
|
26
|
+
MLNLight *light = [[MLNLight alloc] init];
|
|
27
|
+
MLRNStyle *style = [[MLRNStyle alloc] init];
|
|
28
|
+
[style lightLayer:light
|
|
29
|
+
withReactStyle:_reactStyle
|
|
30
|
+
isValid:^{
|
|
31
|
+
return [self isAddedToMap];
|
|
32
|
+
}];
|
|
33
|
+
_map.style.light = light;
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
@end
|
package/ios/MLRN/MLRNLineLayer.m
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
#import "MLRNLineLayer.h"
|
|
2
|
-
#import "MLRNStyle.h"
|
|
3
2
|
#import <React/RCTLog.h>
|
|
3
|
+
#import "MLRNStyle.h"
|
|
4
4
|
|
|
5
5
|
@implementation MLRNLineLayer
|
|
6
6
|
|
|
7
|
-
- (MLNLineStyleLayer*)makeLayer:(MLNStyle*)style
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
- (MLNLineStyleLayer *)makeLayer:(MLNStyle *)style {
|
|
8
|
+
MLNSource *source = [self layerWithSourceIDInStyle:style];
|
|
9
|
+
if (source == nil) {
|
|
10
|
+
return nil;
|
|
11
|
+
}
|
|
12
|
+
MLNLineStyleLayer *layer = [[MLNLineStyleLayer alloc] initWithIdentifier:self.id source:source];
|
|
13
|
+
layer.sourceLayerIdentifier = self.sourceLayerID;
|
|
14
|
+
return layer;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
- (void)addStyles
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
- (void)addStyles {
|
|
18
|
+
MLRNStyle *style = [[MLRNStyle alloc] initWithMLNStyle:self.style];
|
|
19
|
+
style.bridge = self.bridge;
|
|
20
|
+
[style lineLayer:(MLNLineStyleLayer *)self.styleLayer
|
|
21
|
+
withReactStyle:self.reactStyle
|
|
22
|
+
isValid:^{
|
|
23
|
+
return [self isAddedToMap];
|
|
24
|
+
}];
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
@end
|
|
@@ -21,12 +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
|
-
|
|
27
|
-
|
|
28
|
-
return layer;
|
|
24
|
+
- (UIView *)view {
|
|
25
|
+
MLRNLineLayer *layer = [MLRNLineLayer new];
|
|
26
|
+
layer.bridge = self.bridge;
|
|
27
|
+
return layer;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
|
|
32
30
|
@end
|
package/ios/MLRN/MLRNLocation.h
CHANGED
package/ios/MLRN/MLRNLocation.m
CHANGED
|
@@ -2,23 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
@implementation MLRNLocation
|
|
4
4
|
|
|
5
|
-
- (NSDictionary<NSString *, id> *)toJSON
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return json;
|
|
5
|
+
- (NSDictionary<NSString *, id> *)toJSON {
|
|
6
|
+
NSMutableDictionary<NSString *, id> *json = [[NSMutableDictionary alloc] init];
|
|
7
|
+
|
|
8
|
+
NSMutableDictionary<NSString *, NSNumber *> *coords = [[NSMutableDictionary alloc] init];
|
|
9
|
+
coords[@"longitude"] = @(_location.coordinate.longitude);
|
|
10
|
+
coords[@"latitude"] = @(_location.coordinate.latitude);
|
|
11
|
+
coords[@"altitude"] = @(_location.altitude);
|
|
12
|
+
coords[@"accuracy"] = @(_location.horizontalAccuracy);
|
|
13
|
+
coords[@"heading"] = @(_heading.trueHeading);
|
|
14
|
+
coords[@"course"] = @(_location.course);
|
|
15
|
+
coords[@"speed"] = @(_location.speed);
|
|
16
|
+
|
|
17
|
+
json[@"coords"] = coords;
|
|
18
|
+
json[@"timestamp"] = @([_location.timestamp timeIntervalSince1970]);
|
|
19
|
+
|
|
20
|
+
return json;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
@end
|