react-native-map4d-map-dtqg 0.1.0 → 0.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/LICENSE +21 -21
- package/README.md +88 -41
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.9/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.9/gc.properties +0 -0
- package/android/.gradle/9.0-milestone-1/checksums/checksums.lock +0 -0
- package/android/.gradle/9.0-milestone-1/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/9.0-milestone-1/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/9.0-milestone-1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/9.0-milestone-1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/9.0-milestone-1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/config.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/AndroidProjectSystem.xml +6 -0
- package/android/.idea/caches/deviceStreaming.xml +1570 -0
- package/android/.idea/copilot.data.migration.ask2agent.xml +6 -0
- package/android/.idea/gradle.xml +12 -0
- package/android/.idea/migrations.xml +10 -0
- package/android/.idea/misc.xml +10 -0
- package/android/.idea/runConfigurations.xml +17 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/build.gradle +60 -60
- package/android/local.properties +8 -0
- package/android/src/main/AndroidManifest.xml +4 -4
- package/android/src/main/java/com/reactnativemap4dmap/ImageUtils.java +87 -87
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapModule.java +298 -298
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapPackage.java +35 -35
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapViewManager.java +31 -31
- package/android/src/main/java/com/reactnativemap4dmap/RMFBuilding.java +167 -167
- package/android/src/main/java/com/reactnativemap4dmap/RMFBuildingManager.java +121 -121
- package/android/src/main/java/com/reactnativemap4dmap/RMFCircle.java +105 -105
- package/android/src/main/java/com/reactnativemap4dmap/RMFCircleManager.java +121 -121
- package/android/src/main/java/com/reactnativemap4dmap/RMFDirectionsRenderer.java +502 -502
- package/android/src/main/java/com/reactnativemap4dmap/RMFDirectionsRendererManager.java +143 -143
- package/android/src/main/java/com/reactnativemap4dmap/RMFFeature.java +17 -17
- package/android/src/main/java/com/reactnativemap4dmap/RMFMapView.java +1172 -1172
- package/android/src/main/java/com/reactnativemap4dmap/RMFMapViewManager.java +226 -226
- package/android/src/main/java/com/reactnativemap4dmap/RMFMarker.java +412 -412
- package/android/src/main/java/com/reactnativemap4dmap/RMFMarkerManager.java +211 -211
- package/android/src/main/java/com/reactnativemap4dmap/RMFPOI.java +222 -222
- package/android/src/main/java/com/reactnativemap4dmap/RMFPOIManager.java +119 -119
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolygon.java +172 -172
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolygonManager.java +147 -147
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolyline.java +146 -146
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolylineManager.java +137 -137
- package/android/src/main/java/com/reactnativemap4dmap/RMFTileOverlay.java +95 -95
- package/android/src/main/java/com/reactnativemap4dmap/RMFTileOverlayManager.java +64 -64
- package/android/src/main/java/com/reactnativemap4dmap/SizeReportingShadowNode.java +31 -31
- package/android/src/main/java/com/reactnativemap4dmap/ViewAttacherGroup.java +31 -31
- package/android/src/main/java/com/reactnativemap4dmap/ViewChangesTracker.java +70 -70
- package/android/src/main/java/vn/map4d/map/annotations/RMFBitmapDescriptor.java +9 -9
- package/ios/Map4dMap.h +7 -7
- package/ios/Map4dMap.m +14 -14
- package/ios/Map4dMapViewManager.m +34 -34
- package/ios/RCTConvert+Map4dMap.h +33 -33
- package/ios/RCTConvert+Map4dMap.m +112 -112
- package/ios/RMFCircle.h +37 -37
- package/ios/RMFCircle.m +100 -100
- package/ios/RMFCircleManager.h +18 -18
- package/ios/RMFCircleManager.m +155 -155
- package/ios/RMFCircleMap4d.h +23 -23
- package/ios/RMFCircleMap4d.m +13 -13
- package/ios/RMFCoordinate.h +22 -22
- package/ios/RMFCoordinate.m +13 -13
- package/ios/RMFDirectionsMarkerOptions.h +24 -24
- package/ios/RMFDirectionsMarkerOptions.m +23 -23
- package/ios/RMFDirectionsRenderer.h +47 -47
- package/ios/RMFDirectionsRenderer.m +182 -182
- package/ios/RMFDirectionsRendererManager.h +17 -17
- package/ios/RMFDirectionsRendererManager.m +84 -84
- package/ios/RMFDirectionsRendererMap4d.h +21 -21
- package/ios/RMFDirectionsRendererMap4d.m +12 -12
- package/ios/RMFDummyView.h +6 -6
- package/ios/RMFDummyView.m +12 -12
- package/ios/RMFEventResponse.h +39 -39
- package/ios/RMFEventResponse.m +98 -98
- package/ios/RMFIcon.h +24 -24
- package/ios/RMFIcon.m +35 -35
- package/ios/RMFMapView.h +84 -84
- package/ios/RMFMapView.m +376 -376
- package/ios/RMFMapViewManager.h +17 -17
- package/ios/RMFMapViewManager.m +493 -493
- package/ios/RMFMarker.h +57 -57
- package/ios/RMFMarker.m +267 -267
- package/ios/RMFMarkerManager.h +17 -17
- package/ios/RMFMarkerManager.m +156 -156
- package/ios/RMFMarkerMap4d.h +19 -19
- package/ios/RMFMarkerMap4d.m +13 -13
- package/ios/RMFPOI.h +38 -38
- package/ios/RMFPOI.m +123 -123
- package/ios/RMFPOIManager.h +18 -18
- package/ios/RMFPOIManager.m +168 -168
- package/ios/RMFPOIMap4d.h +22 -22
- package/ios/RMFPOIMap4d.m +12 -12
- package/ios/RMFPolygon.h +41 -41
- package/ios/RMFPolygon.m +106 -106
- package/ios/RMFPolygonManager.h +18 -18
- package/ios/RMFPolygonManager.m +141 -141
- package/ios/RMFPolygonMap4d.h +23 -23
- package/ios/RMFPolygonMap4d.m +15 -15
- package/ios/RMFPolyline.h +38 -38
- package/ios/RMFPolyline.m +101 -101
- package/ios/RMFPolylineManager.h +18 -18
- package/ios/RMFPolylineManager.m +139 -139
- package/ios/RMFPolylineMap4d.h +22 -22
- package/ios/RMFPolylineMap4d.m +15 -15
- package/ios/building/RMFBuilding.h +41 -41
- package/ios/building/RMFBuilding.m +104 -104
- package/ios/building/RMFBuildingManager.h +19 -19
- package/ios/building/RMFBuildingManager.m +133 -133
- package/ios/building/RMFBuildingMap4d.h +23 -23
- package/ios/building/RMFBuildingMap4d.m +15 -15
- package/ios/overlays/RMFTileOverlay.h +36 -36
- package/ios/overlays/RMFTileOverlay.m +64 -64
- package/ios/overlays/RMFTileOverlayManager.h +17 -17
- package/ios/overlays/RMFTileOverlayManager.m +27 -27
- package/lib/commonjs/components/MFBuilding.js +26 -26
- package/lib/commonjs/components/MFBuilding.js.map +1 -1
- package/lib/commonjs/components/MFCircle.js +20 -20
- package/lib/commonjs/components/MFCircle.js.map +1 -1
- package/lib/commonjs/components/MFDirectionsRenderer.js +32 -32
- package/lib/commonjs/components/MFDirectionsRenderer.js.map +1 -1
- package/lib/commonjs/components/MFMapView.js +133 -71
- package/lib/commonjs/components/MFMapView.js.map +1 -1
- package/lib/commonjs/components/MFMarker.js +35 -35
- package/lib/commonjs/components/MFMarker.js.map +1 -1
- package/lib/commonjs/components/MFPOI.js +20 -20
- package/lib/commonjs/components/MFPOI.js.map +1 -1
- package/lib/commonjs/components/MFPolygon.js +22 -22
- package/lib/commonjs/components/MFPolygon.js.map +1 -1
- package/lib/commonjs/components/MFPolyline.js +18 -18
- package/lib/commonjs/components/MFPolyline.js.map +1 -1
- package/lib/commonjs/components/MFTileOverlay.js +9 -9
- package/lib/commonjs/components/MFTileOverlay.js.map +1 -1
- package/lib/commonjs/components/Map4dMapView.js.map +1 -1
- package/lib/commonjs/components/extends/AreaFocuser.js +311 -0
- package/lib/commonjs/components/extends/AreaFocuser.js.map +1 -0
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/MFBuilding.js +26 -26
- package/lib/module/components/MFBuilding.js.map +1 -1
- package/lib/module/components/MFCircle.js +20 -20
- package/lib/module/components/MFCircle.js.map +1 -1
- package/lib/module/components/MFDirectionsRenderer.js +32 -32
- package/lib/module/components/MFDirectionsRenderer.js.map +1 -1
- package/lib/module/components/MFMapView.js +131 -71
- package/lib/module/components/MFMapView.js.map +1 -1
- package/lib/module/components/MFMarker.js +35 -35
- package/lib/module/components/MFMarker.js.map +1 -1
- package/lib/module/components/MFPOI.js +20 -20
- package/lib/module/components/MFPOI.js.map +1 -1
- package/lib/module/components/MFPolygon.js +22 -22
- package/lib/module/components/MFPolygon.js.map +1 -1
- package/lib/module/components/MFPolyline.js +18 -18
- package/lib/module/components/MFPolyline.js.map +1 -1
- package/lib/module/components/MFTileOverlay.js +9 -9
- package/lib/module/components/MFTileOverlay.js.map +1 -1
- package/lib/module/components/Map4dMapView.js.map +1 -1
- package/lib/module/components/extends/AreaFocuser.js +302 -0
- package/lib/module/components/extends/AreaFocuser.js.map +1 -0
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/components/Map4dMapView.d.ts +7 -7
- package/package.json +152 -152
- package/react-native-map4d-map.podspec +20 -20
- package/src/components/MFBuilding.js +187 -187
- package/src/components/MFCircle.js +173 -173
- package/src/components/MFDirectionsRenderer.js +237 -237
- package/src/components/MFMapView.js +447 -373
- package/src/components/MFMarker.js +246 -246
- package/src/components/MFPOI.js +184 -184
- package/src/components/MFPolygon.js +186 -186
- package/src/components/MFPolyline.js +172 -172
- package/src/components/MFTileOverlay.js +45 -45
- package/src/components/Map4dMapView.tsx +26 -26
- package/src/components/extends/AreaFocuser.js +339 -0
- package/src/index.js +23 -21
package/ios/RMFMapView.m
CHANGED
|
@@ -1,376 +1,376 @@
|
|
|
1
|
-
//
|
|
2
|
-
// RMFMapView.m
|
|
3
|
-
// Map4dMap
|
|
4
|
-
//
|
|
5
|
-
// Created by Huy Dang on 4/27/20.
|
|
6
|
-
// Copyright © 2020 IOTLink. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#import "RMFMapView.h"
|
|
10
|
-
#import <Foundation/Foundation.h>
|
|
11
|
-
#import <React/RCTConvert+CoreLocation.h>
|
|
12
|
-
#import <React/RCTComponent.h>
|
|
13
|
-
#import <React/RCTBridge.h>
|
|
14
|
-
#import <React/RCTLog.h>
|
|
15
|
-
#import "RMFMarker.h"
|
|
16
|
-
#import "RMFCircle.h"
|
|
17
|
-
#import "RMFPolyline.h"
|
|
18
|
-
#import "RMFPolygon.h"
|
|
19
|
-
#import "RMFPOI.h"
|
|
20
|
-
#import "RMFBuilding.h"
|
|
21
|
-
#import "RMFDirectionsRenderer.h"
|
|
22
|
-
#import "RMFTileOverlay.h"
|
|
23
|
-
#import "RMFEventResponse.h"
|
|
24
|
-
|
|
25
|
-
@class GLKView;
|
|
26
|
-
|
|
27
|
-
@interface MFMapView()
|
|
28
|
-
- (void)glkView:(nonnull GLKView *)view drawInRect:(CGRect)rect;
|
|
29
|
-
- (void)respondToTapGesture:(UITapGestureRecognizer *)tapRecognizer;
|
|
30
|
-
- (void)respondToPanGesture:(UIPanGestureRecognizer *)panRecognizer;
|
|
31
|
-
- (void)respondToLongPressGesture:(UILongPressGestureRecognizer *)panRecognizer;
|
|
32
|
-
@end
|
|
33
|
-
|
|
34
|
-
@interface RMFMapView()
|
|
35
|
-
@property(nonatomic, readwrite) CGPoint lastTapPixel;
|
|
36
|
-
@property(nonatomic, readwrite) CGPoint lastPanPixel;
|
|
37
|
-
@property(nonatomic, readwrite) CGPoint lastLongPressPixel;
|
|
38
|
-
@end
|
|
39
|
-
|
|
40
|
-
@implementation RMFMapView {
|
|
41
|
-
bool _didCallOnMapReady;
|
|
42
|
-
NSMutableArray<UIView *> *_reactSubviews;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
- (instancetype _Nonnull)init {
|
|
46
|
-
if ((self = [super init])) {
|
|
47
|
-
_didCallOnMapReady = false;
|
|
48
|
-
_reactSubviews = [NSMutableArray new];
|
|
49
|
-
}
|
|
50
|
-
return self;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
- (instancetype _Nonnull )initWithFrame: (CGRect)frame {
|
|
54
|
-
if ((self = [super initWithFrame:frame])) {
|
|
55
|
-
_didCallOnMapReady = false;
|
|
56
|
-
_reactSubviews = [NSMutableArray new];
|
|
57
|
-
}
|
|
58
|
-
return self;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
#pragma clang diagnostic push
|
|
62
|
-
#pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
|
|
63
|
-
- (void)insertReactSubview:(id<RCTComponent>)subview atIndex:(NSInteger)atIndex {
|
|
64
|
-
if ([subview isKindOfClass:[RMFMarker class]]) {
|
|
65
|
-
RMFMarker *marker = (RMFMarker*)subview;
|
|
66
|
-
[marker setMapView:self];
|
|
67
|
-
//[super insertReactSubview:marker atIndex:atIndex];
|
|
68
|
-
}
|
|
69
|
-
else if ([subview isKindOfClass:[RMFCircle class]]) {
|
|
70
|
-
RMFCircle *circle = (RMFCircle*)subview;
|
|
71
|
-
[circle setMapView:self];
|
|
72
|
-
//[super insertReactSubview:circle atIndex:atIndex];
|
|
73
|
-
}
|
|
74
|
-
else if ([subview isKindOfClass:[RMFPolyline class]]) {
|
|
75
|
-
RMFPolyline* polyline = (RMFPolyline*)subview;
|
|
76
|
-
[polyline setMapView:self];
|
|
77
|
-
//[super insertReactSubview:polyline atIndex:atIndex];
|
|
78
|
-
}
|
|
79
|
-
else if ([subview isKindOfClass:[RMFPolygon class]]) {
|
|
80
|
-
RMFPolygon* polygon = (RMFPolygon*)subview;
|
|
81
|
-
[polygon setMapView:self];
|
|
82
|
-
}
|
|
83
|
-
else if ([subview isKindOfClass:[RMFPOI class]]) {
|
|
84
|
-
RMFPOI* poi = (RMFPOI*)subview;
|
|
85
|
-
[poi setMapView:self];
|
|
86
|
-
//[super insertReactSubview:poi atIndex:atIndex];
|
|
87
|
-
}
|
|
88
|
-
else if ([subview isKindOfClass:[RMFBuilding class]]) {
|
|
89
|
-
RMFBuilding* building = (RMFBuilding*)subview;
|
|
90
|
-
[building setMapView:self];
|
|
91
|
-
}
|
|
92
|
-
else if ([subview isKindOfClass:[RMFDirectionsRenderer class]]) {
|
|
93
|
-
RMFDirectionsRenderer* renderer = (RMFDirectionsRenderer*)subview;
|
|
94
|
-
[renderer setMapView:self];
|
|
95
|
-
}
|
|
96
|
-
else if ([subview isKindOfClass:[RMFTileOverlay class]]) {
|
|
97
|
-
RMFTileOverlay* overlay = (RMFTileOverlay*)subview;
|
|
98
|
-
[overlay setMapView:self];
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
NSArray<id<RCTComponent>> *childSubviews = [subview reactSubviews];
|
|
102
|
-
for (int i = 0; i < childSubviews.count; i++) {
|
|
103
|
-
[self insertReactSubview:(UIView *)childSubviews[i] atIndex:atIndex];
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
[_reactSubviews insertObject:(UIView *)subview atIndex:(NSUInteger) atIndex];
|
|
108
|
-
}
|
|
109
|
-
#pragma clang diagnostic pop
|
|
110
|
-
|
|
111
|
-
#pragma clang diagnostic push
|
|
112
|
-
#pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
|
|
113
|
-
- (void)removeReactSubview:(UIView *)subview {
|
|
114
|
-
if ([subview isKindOfClass:[RMFMarker class]]) {
|
|
115
|
-
RMFMarker* marker = (RMFMarker*)subview;
|
|
116
|
-
marker.map4dMarker.map = nil;
|
|
117
|
-
}
|
|
118
|
-
else if ([subview isKindOfClass:[RMFCircle class]]) {
|
|
119
|
-
RMFCircle* circle = (RMFCircle*)subview;
|
|
120
|
-
circle.map4dCircle.map = nil;
|
|
121
|
-
}
|
|
122
|
-
else if ([subview isKindOfClass:[RMFPolyline class]]) {
|
|
123
|
-
RMFPolyline* polyline = (RMFPolyline*)subview;
|
|
124
|
-
polyline.map4dPolyline.map = nil;
|
|
125
|
-
}
|
|
126
|
-
else if ([subview isKindOfClass:[RMFPolygon class]]) {
|
|
127
|
-
RMFPolygon* polygon = (RMFPolygon*)subview;
|
|
128
|
-
polygon.map4dPolygon.map = nil;
|
|
129
|
-
}
|
|
130
|
-
else if ([subview isKindOfClass:[RMFPOI class]]) {
|
|
131
|
-
RMFPOI* poi = (RMFPOI*)subview;
|
|
132
|
-
poi.map4dPOI.map = nil;
|
|
133
|
-
}
|
|
134
|
-
else if ([subview isKindOfClass:[RMFBuilding class]]) {
|
|
135
|
-
RMFBuilding* building = (RMFBuilding*)subview;
|
|
136
|
-
[building setMapView:nil];
|
|
137
|
-
}
|
|
138
|
-
else if ([subview isKindOfClass:[RMFDirectionsRenderer class]]) {
|
|
139
|
-
RMFDirectionsRenderer* renderer = (RMFDirectionsRenderer*)subview;
|
|
140
|
-
[renderer setMapView:nil];
|
|
141
|
-
}
|
|
142
|
-
else if ([subview isKindOfClass:[RMFTileOverlay class]]) {
|
|
143
|
-
RMFTileOverlay* overlay = (RMFTileOverlay*)subview;
|
|
144
|
-
[overlay setMapView:nil];
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
NSArray<id<RCTComponent>> *childSubviews = [subview reactSubviews];
|
|
148
|
-
for (int i = 0; i < childSubviews.count; i++) {
|
|
149
|
-
[self removeReactSubview:(UIView *)childSubviews[i]];
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
[_reactSubviews removeObject:(UIView *)subview];
|
|
153
|
-
}
|
|
154
|
-
#pragma clang diagnostic pop
|
|
155
|
-
|
|
156
|
-
- (void)setMapIdProp:(NSString *)mapIdProp {
|
|
157
|
-
if ([mapIdProp length] == 0) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
[self setMapID:[MFMapID mapIDWithIdentifier:mapIdProp]];
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
- (void)setCameraProp:(MFCameraPosition *)cameraProp {
|
|
164
|
-
_cameraProp = cameraProp;
|
|
165
|
-
self.camera = cameraProp;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
- (void)setMapTypeProp:(NSString *)mapTypeProp {
|
|
169
|
-
_mapTypeProp = mapTypeProp;
|
|
170
|
-
if ([@"hybrid" caseInsensitiveCompare:mapTypeProp] == NSOrderedSame) {
|
|
171
|
-
self.mapType = MFMapTypeHybrid;
|
|
172
|
-
}
|
|
173
|
-
else if ([@"satellite" caseInsensitiveCompare:mapTypeProp] == NSOrderedSame) {
|
|
174
|
-
self.mapType = MFMapTypeSatellite;
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
self.mapType = MFMapTypeRoadmap;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
- (void)setShowsBuildings:(BOOL)showsBuildings {
|
|
182
|
-
_showsBuildings = showsBuildings;
|
|
183
|
-
[self setBuildingsEnabled:showsBuildings];
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
- (void)setShowsPOIs:(BOOL)showsPOIs {
|
|
187
|
-
_showsPOIs = showsPOIs;
|
|
188
|
-
[self setPOIsEnabled:showsPOIs];
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
- (void)setZoomGesturesEnabled:(BOOL)enabled {
|
|
192
|
-
_zoomGesturesEnabled = enabled;
|
|
193
|
-
self.settings.zoomGestures = enabled;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
- (void)setScrollGesturesEnabled:(BOOL)enabled {
|
|
197
|
-
_scrollGesturesEnabled = enabled;
|
|
198
|
-
self.settings.scrollGestures = enabled;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
- (void)setRotateGesturesEnabled:(BOOL)enabled {
|
|
202
|
-
_rotateGesturesEnabled = enabled;
|
|
203
|
-
self.settings.rotateGestures = enabled;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
- (void)setTiltGesturesEnabled:(BOOL)enabled {
|
|
207
|
-
_tiltGesturesEnabled = enabled;
|
|
208
|
-
self.settings.tiltGestures = enabled;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
- (void)setShowsMyLocationButton:(BOOL)showsMyLocationButton {
|
|
212
|
-
_showsMyLocationButton = showsMyLocationButton;
|
|
213
|
-
self.settings.myLocationButton = showsMyLocationButton;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
- (void)setShowsMyLocation:(BOOL)showsMyLocation {
|
|
217
|
-
_showsMyLocation = showsMyLocation;
|
|
218
|
-
[self setMyLocationEnabled:showsMyLocation];
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
- (void)didTapAtCoordinate:(CLLocationCoordinate2D)coordinate {
|
|
222
|
-
if (!self.onPress) return;
|
|
223
|
-
|
|
224
|
-
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCoordinate:coordinate
|
|
225
|
-
pixel:_lastTapPixel]];
|
|
226
|
-
response[@"action"] = @"map-press";
|
|
227
|
-
self.onPress(response);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
- (void)didTapPOIWithPlaceID:(NSString *)placeID name:(NSString *)name location:(CLLocationCoordinate2D)location {
|
|
231
|
-
if (!self.onPoiPress) {
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
CLLocationCoordinate2D tapLocation = [self.projection coordinateForPoint:_lastTapPixel];
|
|
236
|
-
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCoordinate:tapLocation
|
|
237
|
-
pixel:_lastTapPixel]];
|
|
238
|
-
response[@"poi"] = @{
|
|
239
|
-
@"id": placeID,
|
|
240
|
-
@"title": name,
|
|
241
|
-
kRMFLatLngCoordinateResponseKey: [RMFEventResponse fromCoordinate:location]
|
|
242
|
-
};
|
|
243
|
-
response[@"action"] = @"map-poi-press";
|
|
244
|
-
|
|
245
|
-
self.onPoiPress(response);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
- (void)didTapBuildingWithBuildingID:(NSString *)buildingID name:(NSString *)name location:(CLLocationCoordinate2D)location {
|
|
249
|
-
if (!self.onBuildingPress) {
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
CLLocationCoordinate2D tapLocation = [self.projection coordinateForPoint:_lastTapPixel];
|
|
254
|
-
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCoordinate:tapLocation
|
|
255
|
-
pixel:_lastTapPixel]];
|
|
256
|
-
response[@"building"] = @{
|
|
257
|
-
@"id": buildingID,
|
|
258
|
-
@"name": name,
|
|
259
|
-
kRMFLatLngCoordinateResponseKey: [RMFEventResponse fromCoordinate:location]
|
|
260
|
-
};
|
|
261
|
-
response[@"action"] = @"map-building-press";
|
|
262
|
-
|
|
263
|
-
self.onBuildingPress(response);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
- (void)didTapPlaceWithName:(NSString*)name location:(CLLocationCoordinate2D)location {
|
|
267
|
-
if (!self.onPlacePress) {
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
CLLocationCoordinate2D tapLocation = [self.projection coordinateForPoint:_lastTapPixel];
|
|
272
|
-
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:
|
|
273
|
-
[RMFEventResponse fromCoordinate:tapLocation pixel:_lastTapPixel]];
|
|
274
|
-
response[@"place"] = @{
|
|
275
|
-
@"name": name,
|
|
276
|
-
kRMFLatLngCoordinateResponseKey: [RMFEventResponse fromCoordinate:location]
|
|
277
|
-
};
|
|
278
|
-
response[@"action"] = @"map-place-press";
|
|
279
|
-
|
|
280
|
-
self.onPlacePress(response);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
- (void)didTapDataSourceFeature:(MFDataSourceFeature *)feature location:(CLLocationCoordinate2D)location {
|
|
284
|
-
if (!self.onDataSourceFeaturePress) {
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
CLLocationCoordinate2D tapLocation = [self.projection coordinateForPoint:_lastTapPixel];
|
|
289
|
-
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:
|
|
290
|
-
[RMFEventResponse fromCoordinate:tapLocation pixel:_lastTapPixel]];
|
|
291
|
-
response[@"feature"] = @{
|
|
292
|
-
@"source": feature.source,
|
|
293
|
-
@"sourceLayer": feature.sourceLayer,
|
|
294
|
-
@"layerType": feature.layerType,
|
|
295
|
-
@"properties": feature.properties,
|
|
296
|
-
@"location": [RMFEventResponse fromCoordinate:location],
|
|
297
|
-
};
|
|
298
|
-
response[@"action"] = @"data-source-feature-press";
|
|
299
|
-
|
|
300
|
-
self.onDataSourceFeaturePress(response);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
- (BOOL)didTapMyLocationButton {
|
|
304
|
-
if (self.onMyLocationButtonPress) {
|
|
305
|
-
self.onMyLocationButtonPress(@{ @"action": @"my-location-button-press" });
|
|
306
|
-
}
|
|
307
|
-
return false;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
- (void)willMove: (BOOL) gesture {
|
|
311
|
-
if (!self.onCameraMoveStart) {
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCameraPosition: self.camera]];
|
|
315
|
-
response[@"gesture"] = [NSNumber numberWithBool:gesture];
|
|
316
|
-
response[@"action"] = @"camera-move-started";
|
|
317
|
-
self.onCameraMoveStart(response);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
- (void)movingCameraPosition:(MFCameraPosition *)position {
|
|
321
|
-
if (!self.onCameraMove) {
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCameraPosition:position]];
|
|
326
|
-
response[@"action"] = @"camera-move";
|
|
327
|
-
self.onCameraMove(response);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
- (void)didChangeCameraPosition:(MFCameraPosition *)position {
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
- (void)idleAtCameraPosition: (MFCameraPosition *) position {
|
|
334
|
-
if (!self.onCameraIdle) {
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCameraPosition:position]];
|
|
338
|
-
response[@"action"] = @"camera-idle";
|
|
339
|
-
self.onCameraIdle(response);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
#pragma mark - MapView Override
|
|
343
|
-
|
|
344
|
-
- (void)glkView:(nonnull GLKView *)view drawInRect:(CGRect)rect {
|
|
345
|
-
[super glkView:view drawInRect:rect];
|
|
346
|
-
|
|
347
|
-
if (_didCallOnMapReady) return;
|
|
348
|
-
_didCallOnMapReady = true;
|
|
349
|
-
if (self.onMapReady) self.onMapReady(@{});
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
- (void)respondToTapGesture:(UITapGestureRecognizer *)tapRecognizer {
|
|
353
|
-
_lastTapPixel = [tapRecognizer locationInView:self];
|
|
354
|
-
[super respondToTapGesture:tapRecognizer];
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
- (void)respondToPanGesture:(UIPanGestureRecognizer *)panRecognizer {
|
|
358
|
-
_lastPanPixel = [panRecognizer locationInView:self];
|
|
359
|
-
[super respondToPanGesture:panRecognizer];
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
- (void)respondToLongPressGesture:(UILongPressGestureRecognizer *)panRecognizer {
|
|
363
|
-
_lastLongPressPixel = [panRecognizer locationInView:self];
|
|
364
|
-
[super respondToLongPressGesture:panRecognizer];
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
#pragma clang diagnostic pop
|
|
368
|
-
|
|
369
|
-
#pragma clang diagnostic push
|
|
370
|
-
#pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
|
|
371
|
-
- (NSArray<id<RCTComponent>> *)reactSubviews {
|
|
372
|
-
return _reactSubviews;
|
|
373
|
-
}
|
|
374
|
-
#pragma clang diagnostic pop
|
|
375
|
-
|
|
376
|
-
@end
|
|
1
|
+
//
|
|
2
|
+
// RMFMapView.m
|
|
3
|
+
// Map4dMap
|
|
4
|
+
//
|
|
5
|
+
// Created by Huy Dang on 4/27/20.
|
|
6
|
+
// Copyright © 2020 IOTLink. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "RMFMapView.h"
|
|
10
|
+
#import <Foundation/Foundation.h>
|
|
11
|
+
#import <React/RCTConvert+CoreLocation.h>
|
|
12
|
+
#import <React/RCTComponent.h>
|
|
13
|
+
#import <React/RCTBridge.h>
|
|
14
|
+
#import <React/RCTLog.h>
|
|
15
|
+
#import "RMFMarker.h"
|
|
16
|
+
#import "RMFCircle.h"
|
|
17
|
+
#import "RMFPolyline.h"
|
|
18
|
+
#import "RMFPolygon.h"
|
|
19
|
+
#import "RMFPOI.h"
|
|
20
|
+
#import "RMFBuilding.h"
|
|
21
|
+
#import "RMFDirectionsRenderer.h"
|
|
22
|
+
#import "RMFTileOverlay.h"
|
|
23
|
+
#import "RMFEventResponse.h"
|
|
24
|
+
|
|
25
|
+
@class GLKView;
|
|
26
|
+
|
|
27
|
+
@interface MFMapView()
|
|
28
|
+
- (void)glkView:(nonnull GLKView *)view drawInRect:(CGRect)rect;
|
|
29
|
+
- (void)respondToTapGesture:(UITapGestureRecognizer *)tapRecognizer;
|
|
30
|
+
- (void)respondToPanGesture:(UIPanGestureRecognizer *)panRecognizer;
|
|
31
|
+
- (void)respondToLongPressGesture:(UILongPressGestureRecognizer *)panRecognizer;
|
|
32
|
+
@end
|
|
33
|
+
|
|
34
|
+
@interface RMFMapView()
|
|
35
|
+
@property(nonatomic, readwrite) CGPoint lastTapPixel;
|
|
36
|
+
@property(nonatomic, readwrite) CGPoint lastPanPixel;
|
|
37
|
+
@property(nonatomic, readwrite) CGPoint lastLongPressPixel;
|
|
38
|
+
@end
|
|
39
|
+
|
|
40
|
+
@implementation RMFMapView {
|
|
41
|
+
bool _didCallOnMapReady;
|
|
42
|
+
NSMutableArray<UIView *> *_reactSubviews;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
- (instancetype _Nonnull)init {
|
|
46
|
+
if ((self = [super init])) {
|
|
47
|
+
_didCallOnMapReady = false;
|
|
48
|
+
_reactSubviews = [NSMutableArray new];
|
|
49
|
+
}
|
|
50
|
+
return self;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
- (instancetype _Nonnull )initWithFrame: (CGRect)frame {
|
|
54
|
+
if ((self = [super initWithFrame:frame])) {
|
|
55
|
+
_didCallOnMapReady = false;
|
|
56
|
+
_reactSubviews = [NSMutableArray new];
|
|
57
|
+
}
|
|
58
|
+
return self;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
#pragma clang diagnostic push
|
|
62
|
+
#pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
|
|
63
|
+
- (void)insertReactSubview:(id<RCTComponent>)subview atIndex:(NSInteger)atIndex {
|
|
64
|
+
if ([subview isKindOfClass:[RMFMarker class]]) {
|
|
65
|
+
RMFMarker *marker = (RMFMarker*)subview;
|
|
66
|
+
[marker setMapView:self];
|
|
67
|
+
//[super insertReactSubview:marker atIndex:atIndex];
|
|
68
|
+
}
|
|
69
|
+
else if ([subview isKindOfClass:[RMFCircle class]]) {
|
|
70
|
+
RMFCircle *circle = (RMFCircle*)subview;
|
|
71
|
+
[circle setMapView:self];
|
|
72
|
+
//[super insertReactSubview:circle atIndex:atIndex];
|
|
73
|
+
}
|
|
74
|
+
else if ([subview isKindOfClass:[RMFPolyline class]]) {
|
|
75
|
+
RMFPolyline* polyline = (RMFPolyline*)subview;
|
|
76
|
+
[polyline setMapView:self];
|
|
77
|
+
//[super insertReactSubview:polyline atIndex:atIndex];
|
|
78
|
+
}
|
|
79
|
+
else if ([subview isKindOfClass:[RMFPolygon class]]) {
|
|
80
|
+
RMFPolygon* polygon = (RMFPolygon*)subview;
|
|
81
|
+
[polygon setMapView:self];
|
|
82
|
+
}
|
|
83
|
+
else if ([subview isKindOfClass:[RMFPOI class]]) {
|
|
84
|
+
RMFPOI* poi = (RMFPOI*)subview;
|
|
85
|
+
[poi setMapView:self];
|
|
86
|
+
//[super insertReactSubview:poi atIndex:atIndex];
|
|
87
|
+
}
|
|
88
|
+
else if ([subview isKindOfClass:[RMFBuilding class]]) {
|
|
89
|
+
RMFBuilding* building = (RMFBuilding*)subview;
|
|
90
|
+
[building setMapView:self];
|
|
91
|
+
}
|
|
92
|
+
else if ([subview isKindOfClass:[RMFDirectionsRenderer class]]) {
|
|
93
|
+
RMFDirectionsRenderer* renderer = (RMFDirectionsRenderer*)subview;
|
|
94
|
+
[renderer setMapView:self];
|
|
95
|
+
}
|
|
96
|
+
else if ([subview isKindOfClass:[RMFTileOverlay class]]) {
|
|
97
|
+
RMFTileOverlay* overlay = (RMFTileOverlay*)subview;
|
|
98
|
+
[overlay setMapView:self];
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
NSArray<id<RCTComponent>> *childSubviews = [subview reactSubviews];
|
|
102
|
+
for (int i = 0; i < childSubviews.count; i++) {
|
|
103
|
+
[self insertReactSubview:(UIView *)childSubviews[i] atIndex:atIndex];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
[_reactSubviews insertObject:(UIView *)subview atIndex:(NSUInteger) atIndex];
|
|
108
|
+
}
|
|
109
|
+
#pragma clang diagnostic pop
|
|
110
|
+
|
|
111
|
+
#pragma clang diagnostic push
|
|
112
|
+
#pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
|
|
113
|
+
- (void)removeReactSubview:(UIView *)subview {
|
|
114
|
+
if ([subview isKindOfClass:[RMFMarker class]]) {
|
|
115
|
+
RMFMarker* marker = (RMFMarker*)subview;
|
|
116
|
+
marker.map4dMarker.map = nil;
|
|
117
|
+
}
|
|
118
|
+
else if ([subview isKindOfClass:[RMFCircle class]]) {
|
|
119
|
+
RMFCircle* circle = (RMFCircle*)subview;
|
|
120
|
+
circle.map4dCircle.map = nil;
|
|
121
|
+
}
|
|
122
|
+
else if ([subview isKindOfClass:[RMFPolyline class]]) {
|
|
123
|
+
RMFPolyline* polyline = (RMFPolyline*)subview;
|
|
124
|
+
polyline.map4dPolyline.map = nil;
|
|
125
|
+
}
|
|
126
|
+
else if ([subview isKindOfClass:[RMFPolygon class]]) {
|
|
127
|
+
RMFPolygon* polygon = (RMFPolygon*)subview;
|
|
128
|
+
polygon.map4dPolygon.map = nil;
|
|
129
|
+
}
|
|
130
|
+
else if ([subview isKindOfClass:[RMFPOI class]]) {
|
|
131
|
+
RMFPOI* poi = (RMFPOI*)subview;
|
|
132
|
+
poi.map4dPOI.map = nil;
|
|
133
|
+
}
|
|
134
|
+
else if ([subview isKindOfClass:[RMFBuilding class]]) {
|
|
135
|
+
RMFBuilding* building = (RMFBuilding*)subview;
|
|
136
|
+
[building setMapView:nil];
|
|
137
|
+
}
|
|
138
|
+
else if ([subview isKindOfClass:[RMFDirectionsRenderer class]]) {
|
|
139
|
+
RMFDirectionsRenderer* renderer = (RMFDirectionsRenderer*)subview;
|
|
140
|
+
[renderer setMapView:nil];
|
|
141
|
+
}
|
|
142
|
+
else if ([subview isKindOfClass:[RMFTileOverlay class]]) {
|
|
143
|
+
RMFTileOverlay* overlay = (RMFTileOverlay*)subview;
|
|
144
|
+
[overlay setMapView:nil];
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
NSArray<id<RCTComponent>> *childSubviews = [subview reactSubviews];
|
|
148
|
+
for (int i = 0; i < childSubviews.count; i++) {
|
|
149
|
+
[self removeReactSubview:(UIView *)childSubviews[i]];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
[_reactSubviews removeObject:(UIView *)subview];
|
|
153
|
+
}
|
|
154
|
+
#pragma clang diagnostic pop
|
|
155
|
+
|
|
156
|
+
- (void)setMapIdProp:(NSString *)mapIdProp {
|
|
157
|
+
if ([mapIdProp length] == 0) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
[self setMapID:[MFMapID mapIDWithIdentifier:mapIdProp]];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
- (void)setCameraProp:(MFCameraPosition *)cameraProp {
|
|
164
|
+
_cameraProp = cameraProp;
|
|
165
|
+
self.camera = cameraProp;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
- (void)setMapTypeProp:(NSString *)mapTypeProp {
|
|
169
|
+
_mapTypeProp = mapTypeProp;
|
|
170
|
+
if ([@"hybrid" caseInsensitiveCompare:mapTypeProp] == NSOrderedSame) {
|
|
171
|
+
self.mapType = MFMapTypeHybrid;
|
|
172
|
+
}
|
|
173
|
+
else if ([@"satellite" caseInsensitiveCompare:mapTypeProp] == NSOrderedSame) {
|
|
174
|
+
self.mapType = MFMapTypeSatellite;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
self.mapType = MFMapTypeRoadmap;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
- (void)setShowsBuildings:(BOOL)showsBuildings {
|
|
182
|
+
_showsBuildings = showsBuildings;
|
|
183
|
+
[self setBuildingsEnabled:showsBuildings];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
- (void)setShowsPOIs:(BOOL)showsPOIs {
|
|
187
|
+
_showsPOIs = showsPOIs;
|
|
188
|
+
[self setPOIsEnabled:showsPOIs];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
- (void)setZoomGesturesEnabled:(BOOL)enabled {
|
|
192
|
+
_zoomGesturesEnabled = enabled;
|
|
193
|
+
self.settings.zoomGestures = enabled;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
- (void)setScrollGesturesEnabled:(BOOL)enabled {
|
|
197
|
+
_scrollGesturesEnabled = enabled;
|
|
198
|
+
self.settings.scrollGestures = enabled;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
- (void)setRotateGesturesEnabled:(BOOL)enabled {
|
|
202
|
+
_rotateGesturesEnabled = enabled;
|
|
203
|
+
self.settings.rotateGestures = enabled;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
- (void)setTiltGesturesEnabled:(BOOL)enabled {
|
|
207
|
+
_tiltGesturesEnabled = enabled;
|
|
208
|
+
self.settings.tiltGestures = enabled;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
- (void)setShowsMyLocationButton:(BOOL)showsMyLocationButton {
|
|
212
|
+
_showsMyLocationButton = showsMyLocationButton;
|
|
213
|
+
self.settings.myLocationButton = showsMyLocationButton;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
- (void)setShowsMyLocation:(BOOL)showsMyLocation {
|
|
217
|
+
_showsMyLocation = showsMyLocation;
|
|
218
|
+
[self setMyLocationEnabled:showsMyLocation];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
- (void)didTapAtCoordinate:(CLLocationCoordinate2D)coordinate {
|
|
222
|
+
if (!self.onPress) return;
|
|
223
|
+
|
|
224
|
+
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCoordinate:coordinate
|
|
225
|
+
pixel:_lastTapPixel]];
|
|
226
|
+
response[@"action"] = @"map-press";
|
|
227
|
+
self.onPress(response);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
- (void)didTapPOIWithPlaceID:(NSString *)placeID name:(NSString *)name location:(CLLocationCoordinate2D)location {
|
|
231
|
+
if (!self.onPoiPress) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
CLLocationCoordinate2D tapLocation = [self.projection coordinateForPoint:_lastTapPixel];
|
|
236
|
+
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCoordinate:tapLocation
|
|
237
|
+
pixel:_lastTapPixel]];
|
|
238
|
+
response[@"poi"] = @{
|
|
239
|
+
@"id": placeID,
|
|
240
|
+
@"title": name,
|
|
241
|
+
kRMFLatLngCoordinateResponseKey: [RMFEventResponse fromCoordinate:location]
|
|
242
|
+
};
|
|
243
|
+
response[@"action"] = @"map-poi-press";
|
|
244
|
+
|
|
245
|
+
self.onPoiPress(response);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
- (void)didTapBuildingWithBuildingID:(NSString *)buildingID name:(NSString *)name location:(CLLocationCoordinate2D)location {
|
|
249
|
+
if (!self.onBuildingPress) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
CLLocationCoordinate2D tapLocation = [self.projection coordinateForPoint:_lastTapPixel];
|
|
254
|
+
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCoordinate:tapLocation
|
|
255
|
+
pixel:_lastTapPixel]];
|
|
256
|
+
response[@"building"] = @{
|
|
257
|
+
@"id": buildingID,
|
|
258
|
+
@"name": name,
|
|
259
|
+
kRMFLatLngCoordinateResponseKey: [RMFEventResponse fromCoordinate:location]
|
|
260
|
+
};
|
|
261
|
+
response[@"action"] = @"map-building-press";
|
|
262
|
+
|
|
263
|
+
self.onBuildingPress(response);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
- (void)didTapPlaceWithName:(NSString*)name location:(CLLocationCoordinate2D)location {
|
|
267
|
+
if (!self.onPlacePress) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
CLLocationCoordinate2D tapLocation = [self.projection coordinateForPoint:_lastTapPixel];
|
|
272
|
+
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:
|
|
273
|
+
[RMFEventResponse fromCoordinate:tapLocation pixel:_lastTapPixel]];
|
|
274
|
+
response[@"place"] = @{
|
|
275
|
+
@"name": name,
|
|
276
|
+
kRMFLatLngCoordinateResponseKey: [RMFEventResponse fromCoordinate:location]
|
|
277
|
+
};
|
|
278
|
+
response[@"action"] = @"map-place-press";
|
|
279
|
+
|
|
280
|
+
self.onPlacePress(response);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
- (void)didTapDataSourceFeature:(MFDataSourceFeature *)feature location:(CLLocationCoordinate2D)location {
|
|
284
|
+
if (!self.onDataSourceFeaturePress) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
CLLocationCoordinate2D tapLocation = [self.projection coordinateForPoint:_lastTapPixel];
|
|
289
|
+
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:
|
|
290
|
+
[RMFEventResponse fromCoordinate:tapLocation pixel:_lastTapPixel]];
|
|
291
|
+
response[@"feature"] = @{
|
|
292
|
+
@"source": feature.source,
|
|
293
|
+
@"sourceLayer": feature.sourceLayer,
|
|
294
|
+
@"layerType": feature.layerType,
|
|
295
|
+
@"properties": feature.properties,
|
|
296
|
+
@"location": [RMFEventResponse fromCoordinate:location],
|
|
297
|
+
};
|
|
298
|
+
response[@"action"] = @"data-source-feature-press";
|
|
299
|
+
|
|
300
|
+
self.onDataSourceFeaturePress(response);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
- (BOOL)didTapMyLocationButton {
|
|
304
|
+
if (self.onMyLocationButtonPress) {
|
|
305
|
+
self.onMyLocationButtonPress(@{ @"action": @"my-location-button-press" });
|
|
306
|
+
}
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
- (void)willMove: (BOOL) gesture {
|
|
311
|
+
if (!self.onCameraMoveStart) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCameraPosition: self.camera]];
|
|
315
|
+
response[@"gesture"] = [NSNumber numberWithBool:gesture];
|
|
316
|
+
response[@"action"] = @"camera-move-started";
|
|
317
|
+
self.onCameraMoveStart(response);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
- (void)movingCameraPosition:(MFCameraPosition *)position {
|
|
321
|
+
if (!self.onCameraMove) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCameraPosition:position]];
|
|
326
|
+
response[@"action"] = @"camera-move";
|
|
327
|
+
self.onCameraMove(response);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
- (void)didChangeCameraPosition:(MFCameraPosition *)position {
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
- (void)idleAtCameraPosition: (MFCameraPosition *) position {
|
|
334
|
+
if (!self.onCameraIdle) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCameraPosition:position]];
|
|
338
|
+
response[@"action"] = @"camera-idle";
|
|
339
|
+
self.onCameraIdle(response);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
#pragma mark - MapView Override
|
|
343
|
+
|
|
344
|
+
- (void)glkView:(nonnull GLKView *)view drawInRect:(CGRect)rect {
|
|
345
|
+
[super glkView:view drawInRect:rect];
|
|
346
|
+
|
|
347
|
+
if (_didCallOnMapReady) return;
|
|
348
|
+
_didCallOnMapReady = true;
|
|
349
|
+
if (self.onMapReady) self.onMapReady(@{});
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
- (void)respondToTapGesture:(UITapGestureRecognizer *)tapRecognizer {
|
|
353
|
+
_lastTapPixel = [tapRecognizer locationInView:self];
|
|
354
|
+
[super respondToTapGesture:tapRecognizer];
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
- (void)respondToPanGesture:(UIPanGestureRecognizer *)panRecognizer {
|
|
358
|
+
_lastPanPixel = [panRecognizer locationInView:self];
|
|
359
|
+
[super respondToPanGesture:panRecognizer];
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
- (void)respondToLongPressGesture:(UILongPressGestureRecognizer *)panRecognizer {
|
|
363
|
+
_lastLongPressPixel = [panRecognizer locationInView:self];
|
|
364
|
+
[super respondToLongPressGesture:panRecognizer];
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
#pragma clang diagnostic pop
|
|
368
|
+
|
|
369
|
+
#pragma clang diagnostic push
|
|
370
|
+
#pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
|
|
371
|
+
- (NSArray<id<RCTComponent>> *)reactSubviews {
|
|
372
|
+
return _reactSubviews;
|
|
373
|
+
}
|
|
374
|
+
#pragma clang diagnostic pop
|
|
375
|
+
|
|
376
|
+
@end
|