react-native-map4d-map-dtqg 0.1.3 → 0.1.4
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 +133 -133
- package/android/.gradle/8.9/checksums/checksums.lock +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.2.0/checksums/checksums.lock +0 -0
- package/android/.gradle/9.2.0/fileChanges/last-build.bin +0 -0
- package/android/.gradle/9.2.0/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/9.2.0/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/9.2.0/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +60 -60
- 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 +231 -231
- 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 +509 -509
- 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/MFBanDoSo.js.map +1 -1
- package/lib/commonjs/components/MFBuilding.js +50 -32
- package/lib/commonjs/components/MFBuilding.js.map +1 -1
- package/lib/commonjs/components/MFCircle.js +44 -26
- package/lib/commonjs/components/MFCircle.js.map +1 -1
- package/lib/commonjs/components/MFDirectionsRenderer.js +56 -38
- package/lib/commonjs/components/MFDirectionsRenderer.js.map +1 -1
- package/lib/commonjs/components/MFMapView.js +91 -74
- package/lib/commonjs/components/MFMapView.js.map +1 -1
- package/lib/commonjs/components/MFMarker.js +59 -41
- package/lib/commonjs/components/MFMarker.js.map +1 -1
- package/lib/commonjs/components/MFPOI.js +44 -26
- package/lib/commonjs/components/MFPOI.js.map +1 -1
- package/lib/commonjs/components/MFPolygon.js +46 -28
- package/lib/commonjs/components/MFPolygon.js.map +1 -1
- package/lib/commonjs/components/MFPolyline.js +42 -24
- 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/AreaFocusManager.js +16 -16
- package/lib/commonjs/components/extends/AreaFocusManager.js.map +1 -1
- package/lib/commonjs/components/extends/AreaFocuser.js +2 -2
- package/lib/commonjs/components/extends/AreaFocuser.js.map +1 -1
- package/lib/commonjs/components/extends/BoundHelper.js.map +1 -1
- package/lib/commonjs/components/extends/area/AreaFocusAreas.js.map +1 -1
- package/lib/commonjs/components/extends/area/AreaFocusGeometryUtils.js.map +1 -1
- package/lib/commonjs/components/extends/area/AreaFocusSession.js.map +1 -1
- package/lib/commonjs/components/extends/area/AreaFocusTypes.js +18 -18
- package/lib/commonjs/components/extends/area/AreaFocusTypes.js.map +1 -1
- package/lib/commonjs/components/internal/DefaultRoadmapStyle.js.map +1 -1
- package/lib/commonjs/components/internal/GeojsonStyleUtils.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/MFBanDoSo.js.map +1 -1
- package/lib/module/components/MFBuilding.js +51 -33
- package/lib/module/components/MFBuilding.js.map +1 -1
- package/lib/module/components/MFCircle.js +45 -27
- package/lib/module/components/MFCircle.js.map +1 -1
- package/lib/module/components/MFDirectionsRenderer.js +57 -39
- package/lib/module/components/MFDirectionsRenderer.js.map +1 -1
- package/lib/module/components/MFMapView.js +92 -75
- package/lib/module/components/MFMapView.js.map +1 -1
- package/lib/module/components/MFMarker.js +60 -42
- package/lib/module/components/MFMarker.js.map +1 -1
- package/lib/module/components/MFPOI.js +45 -27
- package/lib/module/components/MFPOI.js.map +1 -1
- package/lib/module/components/MFPolygon.js +47 -29
- package/lib/module/components/MFPolygon.js.map +1 -1
- package/lib/module/components/MFPolyline.js +43 -25
- 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/AreaFocusManager.js +16 -16
- package/lib/module/components/extends/AreaFocusManager.js.map +1 -1
- package/lib/module/components/extends/AreaFocuser.js +2 -2
- package/lib/module/components/extends/AreaFocuser.js.map +1 -1
- package/lib/module/components/extends/BoundHelper.js.map +1 -1
- package/lib/module/components/extends/area/AreaFocusAreas.js.map +1 -1
- package/lib/module/components/extends/area/AreaFocusGeometryUtils.js.map +1 -1
- package/lib/module/components/extends/area/AreaFocusSession.js.map +1 -1
- package/lib/module/components/extends/area/AreaFocusTypes.js +18 -18
- package/lib/module/components/extends/area/AreaFocusTypes.js.map +1 -1
- package/lib/module/components/internal/DefaultRoadmapStyle.js.map +1 -1
- package/lib/module/components/internal/GeojsonStyleUtils.js.map +1 -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/MFBanDoSo.js +124 -124
- package/src/components/MFBuilding.js +200 -187
- package/src/components/MFCircle.js +186 -173
- package/src/components/MFDirectionsRenderer.js +250 -237
- package/src/components/MFMapView.js +480 -464
- package/src/components/MFMarker.js +259 -246
- package/src/components/MFPOI.js +197 -184
- package/src/components/MFPolygon.js +199 -186
- package/src/components/MFPolyline.js +185 -172
- package/src/components/MFTileOverlay.js +45 -45
- package/src/components/Map4dMapView.tsx +26 -26
- package/src/components/extends/AreaFocusManager.js +196 -196
- package/src/components/extends/AreaFocuser.js +61 -61
- package/src/components/extends/BoundHelper.js +31 -31
- package/src/components/extends/area/AreaFocusAreas.js +164 -164
- package/src/components/extends/area/AreaFocusGeometryUtils.js +164 -164
- package/src/components/extends/area/AreaFocusSession.js +100 -100
- package/src/components/extends/area/AreaFocusTypes.js +36 -36
- package/src/components/internal/DefaultRoadmapStyle.js +3365 -3365
- package/src/components/internal/GeojsonStyleUtils.js +143 -143
- package/src/index.js +25 -25
package/ios/RMFMapViewManager.m
CHANGED
|
@@ -1,509 +1,509 @@
|
|
|
1
|
-
//
|
|
2
|
-
// RMFMapViewManager.m
|
|
3
|
-
// Map4dMap
|
|
4
|
-
//
|
|
5
|
-
// Created by Huy Dang on 4/27/20.
|
|
6
|
-
// Copyright © 2020 IOTLink. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#import "RMFMapViewManager.h"
|
|
10
|
-
#import "RMFMapView.h"
|
|
11
|
-
#import "RMFMarker.h"
|
|
12
|
-
#import "RMFCircle.h"
|
|
13
|
-
#import "RMFPolyline.h"
|
|
14
|
-
#import "RMFPolygon.h"
|
|
15
|
-
#import "RMFPOI.h"
|
|
16
|
-
#import "RMFBuilding.h"
|
|
17
|
-
#import "RMFDirectionsRenderer.h"
|
|
18
|
-
#import <Foundation/Foundation.h>
|
|
19
|
-
#import <React/RCTLog.h>
|
|
20
|
-
#import <React/RCTBridge.h>
|
|
21
|
-
#import <React/RCTUIManager.h>
|
|
22
|
-
#import <React/RCTConvert+CoreLocation.h>
|
|
23
|
-
#import "RCTConvert+Map4dMap.h"
|
|
24
|
-
#import "RMFEventResponse.h"
|
|
25
|
-
|
|
26
|
-
@interface RMFMapViewManager () <MFMapViewDelegate>
|
|
27
|
-
|
|
28
|
-
@end
|
|
29
|
-
|
|
30
|
-
@implementation RMFMapViewManager
|
|
31
|
-
|
|
32
|
-
RCT_EXPORT_MODULE(RMFMapView)
|
|
33
|
-
|
|
34
|
-
- (UIView *)view {
|
|
35
|
-
RMFMapView * rMap = [[RMFMapView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
|
|
36
|
-
// RMFMapView * rMap = [[RMFMapView alloc] init];
|
|
37
|
-
// [rMap setMyLocationEnabled:true];
|
|
38
|
-
rMap.delegate = self;
|
|
39
|
-
return rMap;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
RCT_EXPORT_VIEW_PROPERTY(onMapReady, RCTBubblingEventBlock)
|
|
43
|
-
//RCT_EXPORT_VIEW_PROPERTY(onMapLoaded, RCTBubblingEventBlock)
|
|
44
|
-
//RCT_EXPORT_VIEW_PROPERTY(onKmlReady, RCTBubblingEventBlock)
|
|
45
|
-
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
|
|
46
|
-
//RCT_EXPORT_VIEW_PROPERTY(onLongPress, RCTBubblingEventBlock)
|
|
47
|
-
//RCT_EXPORT_VIEW_PROPERTY(onPanDrag, RCTBubblingEventBlock)
|
|
48
|
-
//RCT_EXPORT_VIEW_PROPERTY(onUserLocationChange, RCTBubblingEventBlock)
|
|
49
|
-
//RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock)
|
|
50
|
-
//RCT_EXPORT_VIEW_PROPERTY(onMarkerPress, RCTDirectEventBlock)
|
|
51
|
-
//RCT_EXPORT_VIEW_PROPERTY(onRegionChange, RCTDirectEventBlock)
|
|
52
|
-
//RCT_EXPORT_VIEW_PROPERTY(onRegionChangeComplete, RCTDirectEventBlock)
|
|
53
|
-
RCT_EXPORT_VIEW_PROPERTY(onPoiPress, RCTDirectEventBlock)
|
|
54
|
-
RCT_EXPORT_VIEW_PROPERTY(onBuildingPress, RCTDirectEventBlock)
|
|
55
|
-
RCT_EXPORT_VIEW_PROPERTY(onPlacePress, RCTDirectEventBlock)
|
|
56
|
-
RCT_EXPORT_VIEW_PROPERTY(onDataSourceFeaturePress, RCTDirectEventBlock)
|
|
57
|
-
//RCT_EXPORT_VIEW_PROPERTY(onIndoorLevelActivated, RCTDirectEventBlock)
|
|
58
|
-
//RCT_EXPORT_VIEW_PROPERTY(onIndoorBuildingFocused, RCTDirectEventBlock)
|
|
59
|
-
RCT_EXPORT_VIEW_PROPERTY(onCameraIdle, RCTDirectEventBlock)
|
|
60
|
-
RCT_EXPORT_VIEW_PROPERTY(onCameraMove, RCTDirectEventBlock)
|
|
61
|
-
RCT_EXPORT_VIEW_PROPERTY(onCameraMoveStart, RCTDirectEventBlock)
|
|
62
|
-
RCT_EXPORT_VIEW_PROPERTY(onMyLocationButtonPress, RCTDirectEventBlock)
|
|
63
|
-
|
|
64
|
-
RCT_REMAP_VIEW_PROPERTY(mapID, mapIdProp, NSString)
|
|
65
|
-
RCT_REMAP_VIEW_PROPERTY(camera, cameraProp, MFCameraPosition)
|
|
66
|
-
RCT_REMAP_VIEW_PROPERTY(mapType, mapTypeProp, NSString)
|
|
67
|
-
RCT_EXPORT_VIEW_PROPERTY(showsBuildings, BOOL)
|
|
68
|
-
RCT_EXPORT_VIEW_PROPERTY(showsPOIs, BOOL)
|
|
69
|
-
RCT_EXPORT_VIEW_PROPERTY(showsMyLocation, BOOL)
|
|
70
|
-
RCT_EXPORT_VIEW_PROPERTY(showsMyLocationButton, BOOL)
|
|
71
|
-
|
|
72
|
-
RCT_EXPORT_VIEW_PROPERTY(zoomGesturesEnabled, BOOL)
|
|
73
|
-
RCT_EXPORT_VIEW_PROPERTY(scrollGesturesEnabled, BOOL)
|
|
74
|
-
RCT_EXPORT_VIEW_PROPERTY(rotateGesturesEnabled, BOOL)
|
|
75
|
-
RCT_EXPORT_VIEW_PROPERTY(tiltGesturesEnabled, BOOL)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
RCT_EXPORT_METHOD(getCamera:(nonnull NSNumber *)reactTag
|
|
79
|
-
resolver: (RCTPromiseResolveBlock)resolve
|
|
80
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
81
|
-
{
|
|
82
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
83
|
-
id view = viewRegistry[reactTag];
|
|
84
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
85
|
-
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
86
|
-
} else {
|
|
87
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
88
|
-
MFCameraPosition *camera = [mapView camera];
|
|
89
|
-
resolve([RMFEventResponse fromCameraPosition:camera]);
|
|
90
|
-
}
|
|
91
|
-
}];
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
RCT_EXPORT_METHOD(getBounds:(nonnull NSNumber *)reactTag
|
|
95
|
-
resolver: (RCTPromiseResolveBlock)resolve
|
|
96
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
97
|
-
{
|
|
98
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
99
|
-
id view = viewRegistry[reactTag];
|
|
100
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
101
|
-
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
102
|
-
} else {
|
|
103
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
104
|
-
MFCoordinateBounds* bounds = [mapView getBounds];
|
|
105
|
-
resolve([RMFEventResponse fromCoordinateBounds:bounds]);
|
|
106
|
-
}
|
|
107
|
-
}];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
RCT_EXPORT_METHOD(cameraForBounds:(nonnull NSNumber *)reactTag
|
|
111
|
-
withData:(id)json
|
|
112
|
-
resolver: (RCTPromiseResolveBlock)resolve
|
|
113
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
114
|
-
{
|
|
115
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
116
|
-
id view = viewRegistry[reactTag];
|
|
117
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
118
|
-
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
119
|
-
} else {
|
|
120
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
121
|
-
MFCameraPosition *camera = nil;
|
|
122
|
-
id data = [RCTConvert NSDictionary:json];
|
|
123
|
-
if (data[@"bounds"]) {
|
|
124
|
-
MFCoordinateBounds* bounds = [RCTConvert MFCoordinateBounds:data[@"bounds"]];
|
|
125
|
-
if (data[@"padding"]) {
|
|
126
|
-
UIEdgeInsets insets = [RCTConvert UIEdgeInsets:data[@"padding"]];
|
|
127
|
-
camera = [mapView cameraForBounds:bounds insets:insets];
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
camera = [mapView cameraForBounds:bounds];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
resolve([RMFEventResponse fromCameraPosition:camera]);
|
|
134
|
-
}
|
|
135
|
-
}];
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
RCT_EXPORT_METHOD(fitBounds:(nonnull NSNumber *)reactTag
|
|
139
|
-
withData:(id)json)
|
|
140
|
-
{
|
|
141
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
142
|
-
id view = viewRegistry[reactTag];
|
|
143
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
144
|
-
RCTLogError(@"Invalid view returned from registry, expecting RMFMapView, got: %@", view);
|
|
145
|
-
} else {
|
|
146
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
147
|
-
MFCameraPosition* camera = nil;
|
|
148
|
-
id data = [RCTConvert NSDictionary:json];
|
|
149
|
-
if (data[@"bounds"]) {
|
|
150
|
-
MFCoordinateBounds* bounds = [RCTConvert MFCoordinateBounds:data[@"bounds"]];
|
|
151
|
-
if (data[@"padding"]) {
|
|
152
|
-
UIEdgeInsets insets = [RCTConvert UIEdgeInsets:data[@"padding"]];
|
|
153
|
-
camera = [mapView cameraForBounds:bounds insets:insets];
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
camera = [mapView cameraForBounds:bounds];
|
|
157
|
-
}
|
|
158
|
-
[mapView moveCamera:[MFCameraUpdate setCamera:camera]];
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}];
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
RCT_EXPORT_METHOD(pointForCoordinate:(nonnull NSNumber *)reactTag
|
|
165
|
-
withCoordinate:(id)json
|
|
166
|
-
resolver: (RCTPromiseResolveBlock)resolve
|
|
167
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
168
|
-
{
|
|
169
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
170
|
-
id view = viewRegistry[reactTag];
|
|
171
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
172
|
-
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
173
|
-
} else {
|
|
174
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
175
|
-
CGPoint point = [mapView.projection pointForCoordinate:[RCTConvert CLLocationCoordinate2D:json]];
|
|
176
|
-
resolve([RMFEventResponse fromCGPoint:point]);
|
|
177
|
-
}
|
|
178
|
-
}];
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
RCT_EXPORT_METHOD(coordinateForPoint:(nonnull NSNumber *)reactTag
|
|
182
|
-
withPoint:(id)json
|
|
183
|
-
resolver: (RCTPromiseResolveBlock)resolve
|
|
184
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
185
|
-
{
|
|
186
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
187
|
-
id view = viewRegistry[reactTag];
|
|
188
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
189
|
-
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
190
|
-
} else {
|
|
191
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
192
|
-
CLLocationCoordinate2D coordinate = [mapView.projection coordinateForPoint:[RCTConvert CGPoint:json]];
|
|
193
|
-
resolve([RMFEventResponse fromCoordinate:coordinate]);
|
|
194
|
-
}
|
|
195
|
-
}];
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
RCT_EXPORT_METHOD(animateCamera:(nonnull NSNumber *)reactTag
|
|
199
|
-
withCamera:(id)json) {
|
|
200
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
201
|
-
id view = viewRegistry[reactTag];
|
|
202
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
203
|
-
RCTLogError(@"Invalid view returned from registry, expecting RMFMapView, got: %@", view);
|
|
204
|
-
} else {
|
|
205
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
206
|
-
[mapView animateCamera:[MFCameraUpdate setCamera:[RCTConvert MFCameraPosition:json withDefaultCamera:mapView.camera]]];
|
|
207
|
-
}
|
|
208
|
-
}];
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
RCT_EXPORT_METHOD(moveCamera:(nonnull NSNumber *)reactTag
|
|
212
|
-
withCamera:(id)json) {
|
|
213
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
214
|
-
id view = viewRegistry[reactTag];
|
|
215
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
216
|
-
RCTLogError(@"Invalid view returned from registry, expecting RMFMapView, got: %@", view);
|
|
217
|
-
} else {
|
|
218
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
219
|
-
[mapView moveCamera:[MFCameraUpdate setCamera:[RCTConvert MFCameraPosition:json withDefaultCamera:mapView.camera]]];
|
|
220
|
-
}
|
|
221
|
-
}];
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
RCT_EXPORT_METHOD(showsMyLocationButton:(nonnull NSNumber *)reactTag
|
|
225
|
-
enable:(BOOL)enable) {
|
|
226
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
227
|
-
id view = viewRegistry[reactTag];
|
|
228
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
229
|
-
|
|
230
|
-
} else {
|
|
231
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
232
|
-
mapView.settings.myLocationButton = enable;
|
|
233
|
-
}
|
|
234
|
-
}];
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
RCT_EXPORT_METHOD(setMyLocationEnabled:(nonnull NSNumber *)reactTag
|
|
238
|
-
enable:(BOOL)enable) {
|
|
239
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
240
|
-
id view = viewRegistry[reactTag];
|
|
241
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
242
|
-
|
|
243
|
-
} else {
|
|
244
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
245
|
-
[mapView setMyLocationEnabled:enable];
|
|
246
|
-
}
|
|
247
|
-
}];
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
RCT_EXPORT_METHOD(getMyLocation:(nonnull NSNumber *)reactTag
|
|
251
|
-
resolver: (RCTPromiseResolveBlock)resolve
|
|
252
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
253
|
-
{
|
|
254
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
255
|
-
id view = viewRegistry[reactTag];
|
|
256
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
257
|
-
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
258
|
-
} else {
|
|
259
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
260
|
-
CLLocation *location = [mapView getMyLocation];
|
|
261
|
-
resolve([RMFEventResponse fromCLLocation:location]);
|
|
262
|
-
}
|
|
263
|
-
}];
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
RCT_EXPORT_METHOD(setPOIsEnabled:(nonnull NSNumber *)reactTag
|
|
267
|
-
enable:(BOOL)enable) {
|
|
268
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
269
|
-
id view = viewRegistry[reactTag];
|
|
270
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
271
|
-
|
|
272
|
-
} else {
|
|
273
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
274
|
-
[mapView setPOIsEnabled:enable];
|
|
275
|
-
}
|
|
276
|
-
}];
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
RCT_EXPORT_METHOD(setTime:(nonnull NSNumber *)reactTag
|
|
280
|
-
withTime:(id)json) {
|
|
281
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
282
|
-
id view = viewRegistry[reactTag];
|
|
283
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
284
|
-
|
|
285
|
-
} else {
|
|
286
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
287
|
-
NSDate * date = [RCTConvert NSDate:json];
|
|
288
|
-
if (date) {
|
|
289
|
-
[mapView setTime:date];
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}];
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
RCT_EXPORT_METHOD(setMapStyle:(nonnull NSNumber *)reactTag
|
|
296
|
-
withStyle:(NSString *)style) {
|
|
297
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
298
|
-
id view = viewRegistry[reactTag];
|
|
299
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
300
|
-
|
|
301
|
-
} else {
|
|
302
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
303
|
-
if (style.length > 0) {
|
|
304
|
-
MFMapStyle *mapStyle = [[MFMapStyle alloc] initWithJSONString:style];
|
|
305
|
-
[mapView setMapStyle:mapStyle];
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}];
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
RCT_EXPORT_METHOD(setZoomGesturesEnabled:(nonnull NSNumber *)reactTag
|
|
313
|
-
enable:(BOOL)enable) {
|
|
314
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
315
|
-
id view = viewRegistry[reactTag];
|
|
316
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
317
|
-
|
|
318
|
-
} else {
|
|
319
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
320
|
-
mapView.settings.zoomGestures = enable;
|
|
321
|
-
}
|
|
322
|
-
}];
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
RCT_EXPORT_METHOD(setScrollGesturesEnabled:(nonnull NSNumber *)reactTag
|
|
326
|
-
enable:(BOOL)enable) {
|
|
327
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
328
|
-
id view = viewRegistry[reactTag];
|
|
329
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
330
|
-
|
|
331
|
-
} else {
|
|
332
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
333
|
-
mapView.settings.scrollGestures = enable;
|
|
334
|
-
}
|
|
335
|
-
}];
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
RCT_EXPORT_METHOD(setRotateGesturesEnabled:(nonnull NSNumber *)reactTag
|
|
339
|
-
enable:(BOOL)enable) {
|
|
340
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
341
|
-
id view = viewRegistry[reactTag];
|
|
342
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
343
|
-
|
|
344
|
-
} else {
|
|
345
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
346
|
-
mapView.settings.rotateGestures = enable;
|
|
347
|
-
}
|
|
348
|
-
}];
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
RCT_EXPORT_METHOD(setTiltGesturesEnabled:(nonnull NSNumber *)reactTag
|
|
352
|
-
enable:(BOOL)enable) {
|
|
353
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
354
|
-
id view = viewRegistry[reactTag];
|
|
355
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
356
|
-
|
|
357
|
-
} else {
|
|
358
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
359
|
-
mapView.settings.tiltGestures = enable;
|
|
360
|
-
}
|
|
361
|
-
}];
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
RCT_EXPORT_METHOD(setAllGesturesEnabled:(nonnull NSNumber *)reactTag
|
|
365
|
-
enable:(BOOL)enable) {
|
|
366
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
367
|
-
id view = viewRegistry[reactTag];
|
|
368
|
-
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
369
|
-
|
|
370
|
-
} else {
|
|
371
|
-
RMFMapView *mapView = (RMFMapView *)view;
|
|
372
|
-
[mapView.settings setAllGesturesEnabled:enable];
|
|
373
|
-
}
|
|
374
|
-
}];
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
// Delegate
|
|
379
|
-
- (BOOL)mapview:(MFMapView *)mapView didTapMarker:(MFMarker *)marker {
|
|
380
|
-
RMFMapView* map = (RMFMapView*)mapView;
|
|
381
|
-
|
|
382
|
-
RMFMarkerMap4d * rMarker = (RMFMarkerMap4d *) marker;
|
|
383
|
-
[rMarker.reactMarker didTapAtPixel:map.lastTapPixel];
|
|
384
|
-
return NO;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
- (void)mapview:(MFMapView *)mapView didBeginDraggingMarker:(MFMarker *)marker {
|
|
388
|
-
if ([marker isKindOfClass:[RMFMarkerMap4d class]]) {
|
|
389
|
-
RMFMapView* map = (RMFMapView*)mapView;
|
|
390
|
-
RMFMarkerMap4d * rMarker = (RMFMarkerMap4d *) marker;
|
|
391
|
-
[rMarker.reactMarker didBeginDraggingMarkerAtPixel:map.lastLongPressPixel];
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
- (void)mapview:(MFMapView *)mapView didEndDraggingMarker:(MFMarker *)marker {
|
|
396
|
-
if ([marker isKindOfClass:[RMFMarkerMap4d class]]) {
|
|
397
|
-
RMFMapView* map = (RMFMapView*)mapView;
|
|
398
|
-
RMFMarkerMap4d * rMarker = (RMFMarkerMap4d *) marker;
|
|
399
|
-
[rMarker.reactMarker didEndDraggingMarkerAtPixel:map.lastLongPressPixel];
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
- (void)mapview:(MFMapView *)mapView didDragMarker:(MFMarker *)marker {
|
|
404
|
-
if ([marker isKindOfClass:[RMFMarkerMap4d class]]) {
|
|
405
|
-
RMFMapView* map = (RMFMapView*)mapView;
|
|
406
|
-
RMFMarkerMap4d * rMarker = (RMFMarkerMap4d *) marker;
|
|
407
|
-
[rMarker.reactMarker didDragMarkerAtPixel:map.lastPanPixel];
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
- (void)mapview:(MFMapView *)mapView didTapInfoWindowOfMarker:(MFMarker *)marker {
|
|
412
|
-
RMFMapView* map = (RMFMapView*)mapView;
|
|
413
|
-
|
|
414
|
-
RMFMarkerMap4d * rMarker = (RMFMarkerMap4d *) marker;
|
|
415
|
-
[rMarker.reactMarker didTapInfoWindowAtPixel:map.lastTapPixel];
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
- (void)mapview:(MFMapView *)mapView didTapPolyline:(MFPolyline *)polyline {
|
|
419
|
-
RMFMapView* map = (RMFMapView*)mapView;
|
|
420
|
-
RMFPolylineMap4d * rPolyline = (RMFPolylineMap4d *) polyline;
|
|
421
|
-
[rPolyline.reactPolyline didTapAtPixel:map.lastTapPixel];
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
- (void)mapview:(MFMapView *)mapView didTapPolygon:(MFPolygon *)polygon {
|
|
425
|
-
RMFMapView* map = (RMFMapView*)mapView;
|
|
426
|
-
RMFPolygonMap4d * rPolygon = (RMFPolygonMap4d*) polygon;
|
|
427
|
-
[rPolygon.reactPolygon didTapAtPixel:map.lastTapPixel];
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
- (void)mapview:(MFMapView *)mapView didTapCircle:(MFCircle *)circle {
|
|
431
|
-
RMFMapView* map = (RMFMapView*)mapView;
|
|
432
|
-
RMFCircleMap4d * rCircle = (RMFCircleMap4d*)circle;
|
|
433
|
-
[rCircle.reactCircle didTapAtPixel:map.lastTapPixel];
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
- (void)mapView: (MFMapView*) mapView willMove: (BOOL) gesture {
|
|
437
|
-
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
438
|
-
[reactMapView willMove:gesture];
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
- (void)mapView:(MFMapView *)mapView movingCameraPosition:(MFCameraPosition *)position {
|
|
442
|
-
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
443
|
-
[reactMapView movingCameraPosition:position];
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
//- (void)mapView:(MFMapView *)mapView didChangeCameraPosition:(MFCameraPosition *)position {
|
|
447
|
-
//}
|
|
448
|
-
|
|
449
|
-
- (void)mapView:(MFMapView *)mapView idleAtCameraPosition:(MFCameraPosition *)position {
|
|
450
|
-
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
451
|
-
[reactMapView idleAtCameraPosition:position];
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
- (void)mapView:(MFMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate {
|
|
455
|
-
RMFMapView* map = (RMFMapView*)mapView;
|
|
456
|
-
[map didTapAtCoordinate:coordinate];
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
- (void)mapView:(MFMapView *)mapView didTapPOI:(MFPOI *)poi {
|
|
460
|
-
RMFMapView* map = (RMFMapView*)mapView;
|
|
461
|
-
RMFPOIMap4d* rPOI = (RMFPOIMap4d*) poi;
|
|
462
|
-
[rPOI.reactPOI didTapAtPixel:map.lastTapPixel];
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
- (void)mapView:(MFMapView *)mapView didTapPOIWithPlaceID:(NSString *)placeID name:(NSString *)name location:(CLLocationCoordinate2D)location {
|
|
466
|
-
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
467
|
-
[reactMapView didTapPOIWithPlaceID:placeID name:name location:location];
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
- (void)mapView:(MFMapView *)mapView didTapBuilding:(MFBuilding *)building {
|
|
471
|
-
RMFMapView* map = (RMFMapView*)mapView;
|
|
472
|
-
RMFBuildingMap4d *rBuilding = (RMFBuildingMap4d *) building;
|
|
473
|
-
[rBuilding.reactBuilding didTapAtPixel:map.lastTapPixel];
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
- (void)mapView:(MFMapView *)mapView didTapBuildingWithBuildingID:(NSString *)buildingID name:(NSString *)name location:(CLLocationCoordinate2D)location {
|
|
477
|
-
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
478
|
-
[reactMapView didTapBuildingWithBuildingID:buildingID name:name location:location];
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
- (void)mapView:(MFMapView *)mapView didTapPlaceWithName:(NSString *)name location:(CLLocationCoordinate2D)location {
|
|
482
|
-
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
483
|
-
[reactMapView didTapPlaceWithName:name location:location];
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
- (void)mapView:(MFMapView *)mapView didTapDataSourceFeature:(MFDataSourceFeature *)feature location:(CLLocationCoordinate2D)location {
|
|
487
|
-
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
488
|
-
[reactMapView didTapDataSourceFeature:feature location:location];
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
- (void)mapView:(MFMapView *)mapView didTapDirectionsRenderer:(MFDirectionsRenderer *)renderer routeIndex:(NSUInteger)routeIndex {
|
|
492
|
-
RMFMapView* map = (RMFMapView*)mapView;
|
|
493
|
-
RMFDirectionsRendererMap4d* rRenderer = (RMFDirectionsRendererMap4d*)renderer;
|
|
494
|
-
[rRenderer.reactRenderer didTapAtPixel:map.lastTapPixel withRouteIndex:routeIndex];
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
//- (void)mapView:(MFMapView *)mapView didTapMyLocation:(CLLocationCoordinate2D)location {
|
|
498
|
-
//}
|
|
499
|
-
|
|
500
|
-
- (BOOL)didTapMyLocationButtonForMapView:(MFMapView *)mapView {
|
|
501
|
-
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
502
|
-
return [reactMapView didTapMyLocationButton];
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
- (UIView *)mapView:(MFMapView *)mapView markerInfoWindow:(MFMarker *)marker {
|
|
506
|
-
return nil;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
@end
|
|
1
|
+
//
|
|
2
|
+
// RMFMapViewManager.m
|
|
3
|
+
// Map4dMap
|
|
4
|
+
//
|
|
5
|
+
// Created by Huy Dang on 4/27/20.
|
|
6
|
+
// Copyright © 2020 IOTLink. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "RMFMapViewManager.h"
|
|
10
|
+
#import "RMFMapView.h"
|
|
11
|
+
#import "RMFMarker.h"
|
|
12
|
+
#import "RMFCircle.h"
|
|
13
|
+
#import "RMFPolyline.h"
|
|
14
|
+
#import "RMFPolygon.h"
|
|
15
|
+
#import "RMFPOI.h"
|
|
16
|
+
#import "RMFBuilding.h"
|
|
17
|
+
#import "RMFDirectionsRenderer.h"
|
|
18
|
+
#import <Foundation/Foundation.h>
|
|
19
|
+
#import <React/RCTLog.h>
|
|
20
|
+
#import <React/RCTBridge.h>
|
|
21
|
+
#import <React/RCTUIManager.h>
|
|
22
|
+
#import <React/RCTConvert+CoreLocation.h>
|
|
23
|
+
#import "RCTConvert+Map4dMap.h"
|
|
24
|
+
#import "RMFEventResponse.h"
|
|
25
|
+
|
|
26
|
+
@interface RMFMapViewManager () <MFMapViewDelegate>
|
|
27
|
+
|
|
28
|
+
@end
|
|
29
|
+
|
|
30
|
+
@implementation RMFMapViewManager
|
|
31
|
+
|
|
32
|
+
RCT_EXPORT_MODULE(RMFMapView)
|
|
33
|
+
|
|
34
|
+
- (UIView *)view {
|
|
35
|
+
RMFMapView * rMap = [[RMFMapView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
|
|
36
|
+
// RMFMapView * rMap = [[RMFMapView alloc] init];
|
|
37
|
+
// [rMap setMyLocationEnabled:true];
|
|
38
|
+
rMap.delegate = self;
|
|
39
|
+
return rMap;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
RCT_EXPORT_VIEW_PROPERTY(onMapReady, RCTBubblingEventBlock)
|
|
43
|
+
//RCT_EXPORT_VIEW_PROPERTY(onMapLoaded, RCTBubblingEventBlock)
|
|
44
|
+
//RCT_EXPORT_VIEW_PROPERTY(onKmlReady, RCTBubblingEventBlock)
|
|
45
|
+
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
|
|
46
|
+
//RCT_EXPORT_VIEW_PROPERTY(onLongPress, RCTBubblingEventBlock)
|
|
47
|
+
//RCT_EXPORT_VIEW_PROPERTY(onPanDrag, RCTBubblingEventBlock)
|
|
48
|
+
//RCT_EXPORT_VIEW_PROPERTY(onUserLocationChange, RCTBubblingEventBlock)
|
|
49
|
+
//RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock)
|
|
50
|
+
//RCT_EXPORT_VIEW_PROPERTY(onMarkerPress, RCTDirectEventBlock)
|
|
51
|
+
//RCT_EXPORT_VIEW_PROPERTY(onRegionChange, RCTDirectEventBlock)
|
|
52
|
+
//RCT_EXPORT_VIEW_PROPERTY(onRegionChangeComplete, RCTDirectEventBlock)
|
|
53
|
+
RCT_EXPORT_VIEW_PROPERTY(onPoiPress, RCTDirectEventBlock)
|
|
54
|
+
RCT_EXPORT_VIEW_PROPERTY(onBuildingPress, RCTDirectEventBlock)
|
|
55
|
+
RCT_EXPORT_VIEW_PROPERTY(onPlacePress, RCTDirectEventBlock)
|
|
56
|
+
RCT_EXPORT_VIEW_PROPERTY(onDataSourceFeaturePress, RCTDirectEventBlock)
|
|
57
|
+
//RCT_EXPORT_VIEW_PROPERTY(onIndoorLevelActivated, RCTDirectEventBlock)
|
|
58
|
+
//RCT_EXPORT_VIEW_PROPERTY(onIndoorBuildingFocused, RCTDirectEventBlock)
|
|
59
|
+
RCT_EXPORT_VIEW_PROPERTY(onCameraIdle, RCTDirectEventBlock)
|
|
60
|
+
RCT_EXPORT_VIEW_PROPERTY(onCameraMove, RCTDirectEventBlock)
|
|
61
|
+
RCT_EXPORT_VIEW_PROPERTY(onCameraMoveStart, RCTDirectEventBlock)
|
|
62
|
+
RCT_EXPORT_VIEW_PROPERTY(onMyLocationButtonPress, RCTDirectEventBlock)
|
|
63
|
+
|
|
64
|
+
RCT_REMAP_VIEW_PROPERTY(mapID, mapIdProp, NSString)
|
|
65
|
+
RCT_REMAP_VIEW_PROPERTY(camera, cameraProp, MFCameraPosition)
|
|
66
|
+
RCT_REMAP_VIEW_PROPERTY(mapType, mapTypeProp, NSString)
|
|
67
|
+
RCT_EXPORT_VIEW_PROPERTY(showsBuildings, BOOL)
|
|
68
|
+
RCT_EXPORT_VIEW_PROPERTY(showsPOIs, BOOL)
|
|
69
|
+
RCT_EXPORT_VIEW_PROPERTY(showsMyLocation, BOOL)
|
|
70
|
+
RCT_EXPORT_VIEW_PROPERTY(showsMyLocationButton, BOOL)
|
|
71
|
+
|
|
72
|
+
RCT_EXPORT_VIEW_PROPERTY(zoomGesturesEnabled, BOOL)
|
|
73
|
+
RCT_EXPORT_VIEW_PROPERTY(scrollGesturesEnabled, BOOL)
|
|
74
|
+
RCT_EXPORT_VIEW_PROPERTY(rotateGesturesEnabled, BOOL)
|
|
75
|
+
RCT_EXPORT_VIEW_PROPERTY(tiltGesturesEnabled, BOOL)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
RCT_EXPORT_METHOD(getCamera:(nonnull NSNumber *)reactTag
|
|
79
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
80
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
81
|
+
{
|
|
82
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
83
|
+
id view = viewRegistry[reactTag];
|
|
84
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
85
|
+
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
86
|
+
} else {
|
|
87
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
88
|
+
MFCameraPosition *camera = [mapView camera];
|
|
89
|
+
resolve([RMFEventResponse fromCameraPosition:camera]);
|
|
90
|
+
}
|
|
91
|
+
}];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
RCT_EXPORT_METHOD(getBounds:(nonnull NSNumber *)reactTag
|
|
95
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
96
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
97
|
+
{
|
|
98
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
99
|
+
id view = viewRegistry[reactTag];
|
|
100
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
101
|
+
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
102
|
+
} else {
|
|
103
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
104
|
+
MFCoordinateBounds* bounds = [mapView getBounds];
|
|
105
|
+
resolve([RMFEventResponse fromCoordinateBounds:bounds]);
|
|
106
|
+
}
|
|
107
|
+
}];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
RCT_EXPORT_METHOD(cameraForBounds:(nonnull NSNumber *)reactTag
|
|
111
|
+
withData:(id)json
|
|
112
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
113
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
114
|
+
{
|
|
115
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
116
|
+
id view = viewRegistry[reactTag];
|
|
117
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
118
|
+
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
119
|
+
} else {
|
|
120
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
121
|
+
MFCameraPosition *camera = nil;
|
|
122
|
+
id data = [RCTConvert NSDictionary:json];
|
|
123
|
+
if (data[@"bounds"]) {
|
|
124
|
+
MFCoordinateBounds* bounds = [RCTConvert MFCoordinateBounds:data[@"bounds"]];
|
|
125
|
+
if (data[@"padding"]) {
|
|
126
|
+
UIEdgeInsets insets = [RCTConvert UIEdgeInsets:data[@"padding"]];
|
|
127
|
+
camera = [mapView cameraForBounds:bounds insets:insets];
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
camera = [mapView cameraForBounds:bounds];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
resolve([RMFEventResponse fromCameraPosition:camera]);
|
|
134
|
+
}
|
|
135
|
+
}];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
RCT_EXPORT_METHOD(fitBounds:(nonnull NSNumber *)reactTag
|
|
139
|
+
withData:(id)json)
|
|
140
|
+
{
|
|
141
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
142
|
+
id view = viewRegistry[reactTag];
|
|
143
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
144
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFMapView, got: %@", view);
|
|
145
|
+
} else {
|
|
146
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
147
|
+
MFCameraPosition* camera = nil;
|
|
148
|
+
id data = [RCTConvert NSDictionary:json];
|
|
149
|
+
if (data[@"bounds"]) {
|
|
150
|
+
MFCoordinateBounds* bounds = [RCTConvert MFCoordinateBounds:data[@"bounds"]];
|
|
151
|
+
if (data[@"padding"]) {
|
|
152
|
+
UIEdgeInsets insets = [RCTConvert UIEdgeInsets:data[@"padding"]];
|
|
153
|
+
camera = [mapView cameraForBounds:bounds insets:insets];
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
camera = [mapView cameraForBounds:bounds];
|
|
157
|
+
}
|
|
158
|
+
[mapView moveCamera:[MFCameraUpdate setCamera:camera]];
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
RCT_EXPORT_METHOD(pointForCoordinate:(nonnull NSNumber *)reactTag
|
|
165
|
+
withCoordinate:(id)json
|
|
166
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
167
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
168
|
+
{
|
|
169
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
170
|
+
id view = viewRegistry[reactTag];
|
|
171
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
172
|
+
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
173
|
+
} else {
|
|
174
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
175
|
+
CGPoint point = [mapView.projection pointForCoordinate:[RCTConvert CLLocationCoordinate2D:json]];
|
|
176
|
+
resolve([RMFEventResponse fromCGPoint:point]);
|
|
177
|
+
}
|
|
178
|
+
}];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
RCT_EXPORT_METHOD(coordinateForPoint:(nonnull NSNumber *)reactTag
|
|
182
|
+
withPoint:(id)json
|
|
183
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
184
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
185
|
+
{
|
|
186
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
187
|
+
id view = viewRegistry[reactTag];
|
|
188
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
189
|
+
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
190
|
+
} else {
|
|
191
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
192
|
+
CLLocationCoordinate2D coordinate = [mapView.projection coordinateForPoint:[RCTConvert CGPoint:json]];
|
|
193
|
+
resolve([RMFEventResponse fromCoordinate:coordinate]);
|
|
194
|
+
}
|
|
195
|
+
}];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
RCT_EXPORT_METHOD(animateCamera:(nonnull NSNumber *)reactTag
|
|
199
|
+
withCamera:(id)json) {
|
|
200
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
201
|
+
id view = viewRegistry[reactTag];
|
|
202
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
203
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFMapView, got: %@", view);
|
|
204
|
+
} else {
|
|
205
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
206
|
+
[mapView animateCamera:[MFCameraUpdate setCamera:[RCTConvert MFCameraPosition:json withDefaultCamera:mapView.camera]]];
|
|
207
|
+
}
|
|
208
|
+
}];
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
RCT_EXPORT_METHOD(moveCamera:(nonnull NSNumber *)reactTag
|
|
212
|
+
withCamera:(id)json) {
|
|
213
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
214
|
+
id view = viewRegistry[reactTag];
|
|
215
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
216
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFMapView, got: %@", view);
|
|
217
|
+
} else {
|
|
218
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
219
|
+
[mapView moveCamera:[MFCameraUpdate setCamera:[RCTConvert MFCameraPosition:json withDefaultCamera:mapView.camera]]];
|
|
220
|
+
}
|
|
221
|
+
}];
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
RCT_EXPORT_METHOD(showsMyLocationButton:(nonnull NSNumber *)reactTag
|
|
225
|
+
enable:(BOOL)enable) {
|
|
226
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
227
|
+
id view = viewRegistry[reactTag];
|
|
228
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
229
|
+
|
|
230
|
+
} else {
|
|
231
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
232
|
+
mapView.settings.myLocationButton = enable;
|
|
233
|
+
}
|
|
234
|
+
}];
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
RCT_EXPORT_METHOD(setMyLocationEnabled:(nonnull NSNumber *)reactTag
|
|
238
|
+
enable:(BOOL)enable) {
|
|
239
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
240
|
+
id view = viewRegistry[reactTag];
|
|
241
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
242
|
+
|
|
243
|
+
} else {
|
|
244
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
245
|
+
[mapView setMyLocationEnabled:enable];
|
|
246
|
+
}
|
|
247
|
+
}];
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
RCT_EXPORT_METHOD(getMyLocation:(nonnull NSNumber *)reactTag
|
|
251
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
252
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
253
|
+
{
|
|
254
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
255
|
+
id view = viewRegistry[reactTag];
|
|
256
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
257
|
+
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RMFMapView, got: %@", view], NULL);
|
|
258
|
+
} else {
|
|
259
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
260
|
+
CLLocation *location = [mapView getMyLocation];
|
|
261
|
+
resolve([RMFEventResponse fromCLLocation:location]);
|
|
262
|
+
}
|
|
263
|
+
}];
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
RCT_EXPORT_METHOD(setPOIsEnabled:(nonnull NSNumber *)reactTag
|
|
267
|
+
enable:(BOOL)enable) {
|
|
268
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
269
|
+
id view = viewRegistry[reactTag];
|
|
270
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
271
|
+
|
|
272
|
+
} else {
|
|
273
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
274
|
+
[mapView setPOIsEnabled:enable];
|
|
275
|
+
}
|
|
276
|
+
}];
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
RCT_EXPORT_METHOD(setTime:(nonnull NSNumber *)reactTag
|
|
280
|
+
withTime:(id)json) {
|
|
281
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
282
|
+
id view = viewRegistry[reactTag];
|
|
283
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
284
|
+
|
|
285
|
+
} else {
|
|
286
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
287
|
+
NSDate * date = [RCTConvert NSDate:json];
|
|
288
|
+
if (date) {
|
|
289
|
+
[mapView setTime:date];
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}];
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
RCT_EXPORT_METHOD(setMapStyle:(nonnull NSNumber *)reactTag
|
|
296
|
+
withStyle:(NSString *)style) {
|
|
297
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
298
|
+
id view = viewRegistry[reactTag];
|
|
299
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
300
|
+
|
|
301
|
+
} else {
|
|
302
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
303
|
+
if (style.length > 0) {
|
|
304
|
+
MFMapStyle *mapStyle = [[MFMapStyle alloc] initWithJSONString:style];
|
|
305
|
+
[mapView setMapStyle:mapStyle];
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}];
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
RCT_EXPORT_METHOD(setZoomGesturesEnabled:(nonnull NSNumber *)reactTag
|
|
313
|
+
enable:(BOOL)enable) {
|
|
314
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
315
|
+
id view = viewRegistry[reactTag];
|
|
316
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
317
|
+
|
|
318
|
+
} else {
|
|
319
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
320
|
+
mapView.settings.zoomGestures = enable;
|
|
321
|
+
}
|
|
322
|
+
}];
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
RCT_EXPORT_METHOD(setScrollGesturesEnabled:(nonnull NSNumber *)reactTag
|
|
326
|
+
enable:(BOOL)enable) {
|
|
327
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
328
|
+
id view = viewRegistry[reactTag];
|
|
329
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
330
|
+
|
|
331
|
+
} else {
|
|
332
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
333
|
+
mapView.settings.scrollGestures = enable;
|
|
334
|
+
}
|
|
335
|
+
}];
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
RCT_EXPORT_METHOD(setRotateGesturesEnabled:(nonnull NSNumber *)reactTag
|
|
339
|
+
enable:(BOOL)enable) {
|
|
340
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
341
|
+
id view = viewRegistry[reactTag];
|
|
342
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
343
|
+
|
|
344
|
+
} else {
|
|
345
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
346
|
+
mapView.settings.rotateGestures = enable;
|
|
347
|
+
}
|
|
348
|
+
}];
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
RCT_EXPORT_METHOD(setTiltGesturesEnabled:(nonnull NSNumber *)reactTag
|
|
352
|
+
enable:(BOOL)enable) {
|
|
353
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
354
|
+
id view = viewRegistry[reactTag];
|
|
355
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
356
|
+
|
|
357
|
+
} else {
|
|
358
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
359
|
+
mapView.settings.tiltGestures = enable;
|
|
360
|
+
}
|
|
361
|
+
}];
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
RCT_EXPORT_METHOD(setAllGesturesEnabled:(nonnull NSNumber *)reactTag
|
|
365
|
+
enable:(BOOL)enable) {
|
|
366
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
367
|
+
id view = viewRegistry[reactTag];
|
|
368
|
+
if (![view isKindOfClass:[RMFMapView class]]) {
|
|
369
|
+
|
|
370
|
+
} else {
|
|
371
|
+
RMFMapView *mapView = (RMFMapView *)view;
|
|
372
|
+
[mapView.settings setAllGesturesEnabled:enable];
|
|
373
|
+
}
|
|
374
|
+
}];
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
// Delegate
|
|
379
|
+
- (BOOL)mapview:(MFMapView *)mapView didTapMarker:(MFMarker *)marker {
|
|
380
|
+
RMFMapView* map = (RMFMapView*)mapView;
|
|
381
|
+
|
|
382
|
+
RMFMarkerMap4d * rMarker = (RMFMarkerMap4d *) marker;
|
|
383
|
+
[rMarker.reactMarker didTapAtPixel:map.lastTapPixel];
|
|
384
|
+
return NO;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
- (void)mapview:(MFMapView *)mapView didBeginDraggingMarker:(MFMarker *)marker {
|
|
388
|
+
if ([marker isKindOfClass:[RMFMarkerMap4d class]]) {
|
|
389
|
+
RMFMapView* map = (RMFMapView*)mapView;
|
|
390
|
+
RMFMarkerMap4d * rMarker = (RMFMarkerMap4d *) marker;
|
|
391
|
+
[rMarker.reactMarker didBeginDraggingMarkerAtPixel:map.lastLongPressPixel];
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
- (void)mapview:(MFMapView *)mapView didEndDraggingMarker:(MFMarker *)marker {
|
|
396
|
+
if ([marker isKindOfClass:[RMFMarkerMap4d class]]) {
|
|
397
|
+
RMFMapView* map = (RMFMapView*)mapView;
|
|
398
|
+
RMFMarkerMap4d * rMarker = (RMFMarkerMap4d *) marker;
|
|
399
|
+
[rMarker.reactMarker didEndDraggingMarkerAtPixel:map.lastLongPressPixel];
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
- (void)mapview:(MFMapView *)mapView didDragMarker:(MFMarker *)marker {
|
|
404
|
+
if ([marker isKindOfClass:[RMFMarkerMap4d class]]) {
|
|
405
|
+
RMFMapView* map = (RMFMapView*)mapView;
|
|
406
|
+
RMFMarkerMap4d * rMarker = (RMFMarkerMap4d *) marker;
|
|
407
|
+
[rMarker.reactMarker didDragMarkerAtPixel:map.lastPanPixel];
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
- (void)mapview:(MFMapView *)mapView didTapInfoWindowOfMarker:(MFMarker *)marker {
|
|
412
|
+
RMFMapView* map = (RMFMapView*)mapView;
|
|
413
|
+
|
|
414
|
+
RMFMarkerMap4d * rMarker = (RMFMarkerMap4d *) marker;
|
|
415
|
+
[rMarker.reactMarker didTapInfoWindowAtPixel:map.lastTapPixel];
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
- (void)mapview:(MFMapView *)mapView didTapPolyline:(MFPolyline *)polyline {
|
|
419
|
+
RMFMapView* map = (RMFMapView*)mapView;
|
|
420
|
+
RMFPolylineMap4d * rPolyline = (RMFPolylineMap4d *) polyline;
|
|
421
|
+
[rPolyline.reactPolyline didTapAtPixel:map.lastTapPixel];
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
- (void)mapview:(MFMapView *)mapView didTapPolygon:(MFPolygon *)polygon {
|
|
425
|
+
RMFMapView* map = (RMFMapView*)mapView;
|
|
426
|
+
RMFPolygonMap4d * rPolygon = (RMFPolygonMap4d*) polygon;
|
|
427
|
+
[rPolygon.reactPolygon didTapAtPixel:map.lastTapPixel];
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
- (void)mapview:(MFMapView *)mapView didTapCircle:(MFCircle *)circle {
|
|
431
|
+
RMFMapView* map = (RMFMapView*)mapView;
|
|
432
|
+
RMFCircleMap4d * rCircle = (RMFCircleMap4d*)circle;
|
|
433
|
+
[rCircle.reactCircle didTapAtPixel:map.lastTapPixel];
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
- (void)mapView: (MFMapView*) mapView willMove: (BOOL) gesture {
|
|
437
|
+
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
438
|
+
[reactMapView willMove:gesture];
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
- (void)mapView:(MFMapView *)mapView movingCameraPosition:(MFCameraPosition *)position {
|
|
442
|
+
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
443
|
+
[reactMapView movingCameraPosition:position];
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
//- (void)mapView:(MFMapView *)mapView didChangeCameraPosition:(MFCameraPosition *)position {
|
|
447
|
+
//}
|
|
448
|
+
|
|
449
|
+
- (void)mapView:(MFMapView *)mapView idleAtCameraPosition:(MFCameraPosition *)position {
|
|
450
|
+
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
451
|
+
[reactMapView idleAtCameraPosition:position];
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
- (void)mapView:(MFMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate {
|
|
455
|
+
RMFMapView* map = (RMFMapView*)mapView;
|
|
456
|
+
[map didTapAtCoordinate:coordinate];
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
- (void)mapView:(MFMapView *)mapView didTapPOI:(MFPOI *)poi {
|
|
460
|
+
RMFMapView* map = (RMFMapView*)mapView;
|
|
461
|
+
RMFPOIMap4d* rPOI = (RMFPOIMap4d*) poi;
|
|
462
|
+
[rPOI.reactPOI didTapAtPixel:map.lastTapPixel];
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
- (void)mapView:(MFMapView *)mapView didTapPOIWithPlaceID:(NSString *)placeID name:(NSString *)name location:(CLLocationCoordinate2D)location {
|
|
466
|
+
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
467
|
+
[reactMapView didTapPOIWithPlaceID:placeID name:name location:location];
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
- (void)mapView:(MFMapView *)mapView didTapBuilding:(MFBuilding *)building {
|
|
471
|
+
RMFMapView* map = (RMFMapView*)mapView;
|
|
472
|
+
RMFBuildingMap4d *rBuilding = (RMFBuildingMap4d *) building;
|
|
473
|
+
[rBuilding.reactBuilding didTapAtPixel:map.lastTapPixel];
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
- (void)mapView:(MFMapView *)mapView didTapBuildingWithBuildingID:(NSString *)buildingID name:(NSString *)name location:(CLLocationCoordinate2D)location {
|
|
477
|
+
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
478
|
+
[reactMapView didTapBuildingWithBuildingID:buildingID name:name location:location];
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
- (void)mapView:(MFMapView *)mapView didTapPlaceWithName:(NSString *)name location:(CLLocationCoordinate2D)location {
|
|
482
|
+
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
483
|
+
[reactMapView didTapPlaceWithName:name location:location];
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
- (void)mapView:(MFMapView *)mapView didTapDataSourceFeature:(MFDataSourceFeature *)feature location:(CLLocationCoordinate2D)location {
|
|
487
|
+
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
488
|
+
[reactMapView didTapDataSourceFeature:feature location:location];
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
- (void)mapView:(MFMapView *)mapView didTapDirectionsRenderer:(MFDirectionsRenderer *)renderer routeIndex:(NSUInteger)routeIndex {
|
|
492
|
+
RMFMapView* map = (RMFMapView*)mapView;
|
|
493
|
+
RMFDirectionsRendererMap4d* rRenderer = (RMFDirectionsRendererMap4d*)renderer;
|
|
494
|
+
[rRenderer.reactRenderer didTapAtPixel:map.lastTapPixel withRouteIndex:routeIndex];
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
//- (void)mapView:(MFMapView *)mapView didTapMyLocation:(CLLocationCoordinate2D)location {
|
|
498
|
+
//}
|
|
499
|
+
|
|
500
|
+
- (BOOL)didTapMyLocationButtonForMapView:(MFMapView *)mapView {
|
|
501
|
+
RMFMapView* reactMapView = (RMFMapView*) mapView;
|
|
502
|
+
return [reactMapView didTapMyLocationButton];
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
- (UIView *)mapView:(MFMapView *)mapView markerInfoWindow:(MFMarker *)marker {
|
|
506
|
+
return nil;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
@end
|