@maplibre/maplibre-react-native 10.1.0 → 10.1.1
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/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/module/components/MarkerView.js +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/typescript/commonjs/src/components/MarkerView.d.ts +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 +0 -1
- package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +0 -1
- 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/AnimatedShape.d.ts +0 -1
- 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/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 +0 -1
- package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +0 -1
- 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/AnimatedShape.d.ts +0 -1
- 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/UserLocation.tsx +13 -51
- package/src/components/UserLocationPuck.tsx +62 -0
- package/src/components/UserLocationPuckHeading.tsx +33 -0
- 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/MLRNSource.m
CHANGED
|
@@ -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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
51
|
+
return _reactSubviews;
|
|
54
52
|
}
|
|
55
53
|
#pragma clang diagnostic pop
|
|
56
54
|
|
|
57
|
-
- (void)setMap:(MLRNMapView *)map
|
|
58
|
-
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
102
|
-
|
|
84
|
+
MLRNLayer *layer = [_layers objectAtIndex:i];
|
|
85
|
+
[layer addToMap:_map style:_map.style];
|
|
103
86
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
|
@@ -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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
83
|
-
{
|
|
84
|
-
NSString *imageURI = [self getImageURI];
|
|
85
|
-
|
|
86
|
-
return [imageURI containsString:@"://"];
|
|
85
|
+
return object;
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
- (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
- (
|
|
101
|
-
{
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
110
|
+
return 1.0;
|
|
111
111
|
}
|
|
112
|
+
} else {
|
|
113
|
+
return 1.0;
|
|
114
|
+
}
|
|
112
115
|
}
|
|
113
116
|
|
|
114
|
-
- (MLNTransition)getTransition
|
|
115
|
-
{
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
27
|
-
|
|
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
|
|
@@ -7,25 +7,26 @@
|
|
|
7
7
|
|
|
8
8
|
@implementation MLRNTileSource
|
|
9
9
|
|
|
10
|
-
- (NSDictionary<MLNTileSourceOption, id
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|