react-native-map4d-map-dtqg 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +133 -41
- 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/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 -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 +508 -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/MFBanDoSo.js +109 -0
- package/lib/commonjs/components/MFBanDoSo.js.map +1 -0
- 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 +152 -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/AreaFocusManager.js +205 -0
- package/lib/commonjs/components/extends/AreaFocusManager.js.map +1 -0
- package/lib/commonjs/components/extends/AreaFocuser.js +73 -0
- package/lib/commonjs/components/extends/AreaFocuser.js.map +1 -0
- package/lib/commonjs/components/extends/BoundHelper.js +36 -0
- package/lib/commonjs/components/extends/BoundHelper.js.map +1 -0
- package/lib/commonjs/components/extends/area/AreaFocusAreas.js +167 -0
- package/lib/commonjs/components/extends/area/AreaFocusAreas.js.map +1 -0
- package/lib/commonjs/components/extends/area/AreaFocusGeometryUtils.js +164 -0
- package/lib/commonjs/components/extends/area/AreaFocusGeometryUtils.js.map +1 -0
- package/lib/commonjs/components/extends/area/AreaFocusSession.js +100 -0
- package/lib/commonjs/components/extends/area/AreaFocusSession.js.map +1 -0
- package/lib/commonjs/components/extends/area/AreaFocusTypes.js +40 -0
- package/lib/commonjs/components/extends/area/AreaFocusTypes.js.map +1 -0
- package/lib/commonjs/components/internal/DefaultRoadmapStyle.js +2288 -0
- package/lib/commonjs/components/internal/DefaultRoadmapStyle.js.map +1 -0
- package/lib/commonjs/components/internal/GeojsonStyleUtils.js +139 -0
- package/lib/commonjs/components/internal/GeojsonStyleUtils.js.map +1 -0
- package/lib/commonjs/index.js +16 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/MFBanDoSo.js +92 -0
- package/lib/module/components/MFBanDoSo.js.map +1 -0
- 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 +149 -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/AreaFocusManager.js +193 -0
- package/lib/module/components/extends/AreaFocusManager.js.map +1 -0
- package/lib/module/components/extends/AreaFocuser.js +64 -0
- package/lib/module/components/extends/AreaFocuser.js.map +1 -0
- package/lib/module/components/extends/BoundHelper.js +29 -0
- package/lib/module/components/extends/BoundHelper.js.map +1 -0
- package/lib/module/components/extends/area/AreaFocusAreas.js +156 -0
- package/lib/module/components/extends/area/AreaFocusAreas.js.map +1 -0
- package/lib/module/components/extends/area/AreaFocusGeometryUtils.js +153 -0
- package/lib/module/components/extends/area/AreaFocusGeometryUtils.js.map +1 -0
- package/lib/module/components/extends/area/AreaFocusSession.js +93 -0
- package/lib/module/components/extends/area/AreaFocusSession.js.map +1 -0
- package/lib/module/components/extends/area/AreaFocusTypes.js +33 -0
- package/lib/module/components/extends/area/AreaFocusTypes.js.map +1 -0
- package/lib/module/components/internal/DefaultRoadmapStyle.js +2281 -0
- package/lib/module/components/internal/DefaultRoadmapStyle.js.map +1 -0
- package/lib/module/components/internal/GeojsonStyleUtils.js +130 -0
- package/lib/module/components/internal/GeojsonStyleUtils.js.map +1 -0
- package/lib/module/index.js +3 -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 -0
- 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 +464 -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/AreaFocusManager.js +196 -0
- package/src/components/extends/AreaFocuser.js +62 -0
- package/src/components/extends/BoundHelper.js +32 -0
- package/src/components/extends/area/AreaFocusAreas.js +164 -0
- package/src/components/extends/area/AreaFocusGeometryUtils.js +164 -0
- package/src/components/extends/area/AreaFocusSession.js +100 -0
- package/src/components/extends/area/AreaFocusTypes.js +36 -0
- package/src/components/internal/DefaultRoadmapStyle.js +3365 -0
- package/src/components/internal/GeojsonStyleUtils.js +143 -0
- package/src/index.js +25 -21
|
@@ -1,172 +1,172 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import {ViewPropTypes, ColorPropType} from 'deprecated-react-native-prop-types';
|
|
4
|
-
import {
|
|
5
|
-
requireNativeComponent,
|
|
6
|
-
Platform,
|
|
7
|
-
NativeModules,
|
|
8
|
-
findNodeHandle,
|
|
9
|
-
processColor
|
|
10
|
-
} from 'react-native';
|
|
11
|
-
|
|
12
|
-
// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
|
|
13
|
-
const viewPropTypes = ViewPropTypes || View.propTypes;
|
|
14
|
-
|
|
15
|
-
const propTypes = {
|
|
16
|
-
...viewPropTypes,
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* An array of coordinates to describe the polyline
|
|
20
|
-
*/
|
|
21
|
-
coordinates: PropTypes.arrayOf(
|
|
22
|
-
PropTypes.shape({
|
|
23
|
-
/**
|
|
24
|
-
* Latitude/Longitude coordinates
|
|
25
|
-
*/
|
|
26
|
-
latitude: PropTypes.number.isRequired,
|
|
27
|
-
longitude: PropTypes.number.isRequired,
|
|
28
|
-
})
|
|
29
|
-
),
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* The color to use for the path.
|
|
33
|
-
*/
|
|
34
|
-
color: ColorPropType,
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The stroke width to use for the path.
|
|
38
|
-
*/
|
|
39
|
-
width: PropTypes.number,
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The default style is `solid`.
|
|
43
|
-
*/
|
|
44
|
-
lineStyle: PropTypes.oneOf(['solid', 'dotted']),
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* zIndex
|
|
48
|
-
*/
|
|
49
|
-
zIndex: PropTypes.number,
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* visible
|
|
53
|
-
*/
|
|
54
|
-
visible: PropTypes.bool,
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* userData
|
|
58
|
-
*/
|
|
59
|
-
userData:PropTypes.object,
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Callback that is called when the user presses on the polyline
|
|
63
|
-
*/
|
|
64
|
-
onPress: PropTypes.func,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
class MFPolyline extends React.Component {
|
|
69
|
-
constructor(props) {
|
|
70
|
-
super(props);
|
|
71
|
-
this._onPress = this._onPress.bind(this)
|
|
72
|
-
this._ref = this._ref.bind(this)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
_onPress(event) {
|
|
76
|
-
event.stopPropagation();
|
|
77
|
-
if (this.props.onPress) {
|
|
78
|
-
this.props.onPress(event);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
_ref(ref) {
|
|
83
|
-
this.polyline = ref;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// TODO - bug
|
|
87
|
-
setCoordinates(coordinates) {
|
|
88
|
-
this._runCommand("setCoordinates", [coordinates])
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
setWidth(width) {
|
|
92
|
-
this._runCommand("setWidth", [width])
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
setColor(color) {
|
|
96
|
-
this._runCommand("setColor", [processColor(color)])
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
setVisible(visible) {
|
|
100
|
-
this._runCommand("setVisible", [visible])
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
setTouchable(touchable) {
|
|
104
|
-
this._runCommand("setTouchable", [touchable])
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
setZIndex(zIndex) {
|
|
108
|
-
this._runCommand("setZIndex", [zIndex])
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
setLineStyle(style) {
|
|
112
|
-
this._runCommand("setLineStyle", [style])
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
setUserData(userData) {
|
|
116
|
-
this._runCommand("setUserData", [userData])
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
_getHandle() {
|
|
120
|
-
return findNodeHandle(this.polyline);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
_runCommand(name, args) {
|
|
124
|
-
switch (Platform.OS) {
|
|
125
|
-
case 'android':
|
|
126
|
-
NativeModules.UIManager.dispatchViewManagerCommand(
|
|
127
|
-
this._getHandle(),
|
|
128
|
-
this._uiManagerCommand(name),
|
|
129
|
-
args
|
|
130
|
-
);
|
|
131
|
-
break;
|
|
132
|
-
|
|
133
|
-
case 'ios':
|
|
134
|
-
this._mapManagerCommand(name)(this._getHandle(), ...args);
|
|
135
|
-
break;
|
|
136
|
-
|
|
137
|
-
default:
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
_uiManagerCommand(name) {
|
|
143
|
-
const UIManager = NativeModules.UIManager;
|
|
144
|
-
const componentName = "RMFPolyline";
|
|
145
|
-
|
|
146
|
-
if (!UIManager.getViewManagerConfig) {
|
|
147
|
-
// RN < 0.58
|
|
148
|
-
return UIManager[componentName].Commands[name];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// RN >= 0.58
|
|
152
|
-
return UIManager.getViewManagerConfig(componentName).Commands[name];
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
_mapManagerCommand(name) {
|
|
156
|
-
return NativeModules[`RMFPolyline`][name];
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
render() {
|
|
160
|
-
return <RMFPolyline
|
|
161
|
-
{...this.props}
|
|
162
|
-
ref={this._ref}
|
|
163
|
-
onPress={this._onPress}
|
|
164
|
-
/>;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
MFPolyline.propTypes = propTypes;
|
|
169
|
-
|
|
170
|
-
var RMFPolyline = requireNativeComponent(`RMFPolyline`, MFPolyline);
|
|
171
|
-
|
|
172
|
-
export { MFPolyline }
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import {ViewPropTypes, ColorPropType} from 'deprecated-react-native-prop-types';
|
|
4
|
+
import {
|
|
5
|
+
requireNativeComponent,
|
|
6
|
+
Platform,
|
|
7
|
+
NativeModules,
|
|
8
|
+
findNodeHandle,
|
|
9
|
+
processColor
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
|
|
12
|
+
// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
|
|
13
|
+
const viewPropTypes = ViewPropTypes || View.propTypes;
|
|
14
|
+
|
|
15
|
+
const propTypes = {
|
|
16
|
+
...viewPropTypes,
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* An array of coordinates to describe the polyline
|
|
20
|
+
*/
|
|
21
|
+
coordinates: PropTypes.arrayOf(
|
|
22
|
+
PropTypes.shape({
|
|
23
|
+
/**
|
|
24
|
+
* Latitude/Longitude coordinates
|
|
25
|
+
*/
|
|
26
|
+
latitude: PropTypes.number.isRequired,
|
|
27
|
+
longitude: PropTypes.number.isRequired,
|
|
28
|
+
})
|
|
29
|
+
),
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The color to use for the path.
|
|
33
|
+
*/
|
|
34
|
+
color: ColorPropType,
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The stroke width to use for the path.
|
|
38
|
+
*/
|
|
39
|
+
width: PropTypes.number,
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The default style is `solid`.
|
|
43
|
+
*/
|
|
44
|
+
lineStyle: PropTypes.oneOf(['solid', 'dotted']),
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* zIndex
|
|
48
|
+
*/
|
|
49
|
+
zIndex: PropTypes.number,
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* visible
|
|
53
|
+
*/
|
|
54
|
+
visible: PropTypes.bool,
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* userData
|
|
58
|
+
*/
|
|
59
|
+
userData:PropTypes.object,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Callback that is called when the user presses on the polyline
|
|
63
|
+
*/
|
|
64
|
+
onPress: PropTypes.func,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class MFPolyline extends React.Component {
|
|
69
|
+
constructor(props) {
|
|
70
|
+
super(props);
|
|
71
|
+
this._onPress = this._onPress.bind(this)
|
|
72
|
+
this._ref = this._ref.bind(this)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
_onPress(event) {
|
|
76
|
+
event.stopPropagation();
|
|
77
|
+
if (this.props.onPress) {
|
|
78
|
+
this.props.onPress(event);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
_ref(ref) {
|
|
83
|
+
this.polyline = ref;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// TODO - bug
|
|
87
|
+
setCoordinates(coordinates) {
|
|
88
|
+
this._runCommand("setCoordinates", [coordinates])
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
setWidth(width) {
|
|
92
|
+
this._runCommand("setWidth", [width])
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
setColor(color) {
|
|
96
|
+
this._runCommand("setColor", [processColor(color)])
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
setVisible(visible) {
|
|
100
|
+
this._runCommand("setVisible", [visible])
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
setTouchable(touchable) {
|
|
104
|
+
this._runCommand("setTouchable", [touchable])
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
setZIndex(zIndex) {
|
|
108
|
+
this._runCommand("setZIndex", [zIndex])
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
setLineStyle(style) {
|
|
112
|
+
this._runCommand("setLineStyle", [style])
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
setUserData(userData) {
|
|
116
|
+
this._runCommand("setUserData", [userData])
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
_getHandle() {
|
|
120
|
+
return findNodeHandle(this.polyline);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
_runCommand(name, args) {
|
|
124
|
+
switch (Platform.OS) {
|
|
125
|
+
case 'android':
|
|
126
|
+
NativeModules.UIManager.dispatchViewManagerCommand(
|
|
127
|
+
this._getHandle(),
|
|
128
|
+
this._uiManagerCommand(name),
|
|
129
|
+
args
|
|
130
|
+
);
|
|
131
|
+
break;
|
|
132
|
+
|
|
133
|
+
case 'ios':
|
|
134
|
+
this._mapManagerCommand(name)(this._getHandle(), ...args);
|
|
135
|
+
break;
|
|
136
|
+
|
|
137
|
+
default:
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
_uiManagerCommand(name) {
|
|
143
|
+
const UIManager = NativeModules.UIManager;
|
|
144
|
+
const componentName = "RMFPolyline";
|
|
145
|
+
|
|
146
|
+
if (!UIManager.getViewManagerConfig) {
|
|
147
|
+
// RN < 0.58
|
|
148
|
+
return UIManager[componentName].Commands[name];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// RN >= 0.58
|
|
152
|
+
return UIManager.getViewManagerConfig(componentName).Commands[name];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
_mapManagerCommand(name) {
|
|
156
|
+
return NativeModules[`RMFPolyline`][name];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
render() {
|
|
160
|
+
return <RMFPolyline
|
|
161
|
+
{...this.props}
|
|
162
|
+
ref={this._ref}
|
|
163
|
+
onPress={this._onPress}
|
|
164
|
+
/>;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
MFPolyline.propTypes = propTypes;
|
|
169
|
+
|
|
170
|
+
var RMFPolyline = requireNativeComponent(`RMFPolyline`, MFPolyline);
|
|
171
|
+
|
|
172
|
+
export { MFPolyline }
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import {ViewPropTypes} from 'deprecated-react-native-prop-types';
|
|
4
|
-
import {
|
|
5
|
-
requireNativeComponent,
|
|
6
|
-
View,
|
|
7
|
-
} from 'react-native';
|
|
8
|
-
|
|
9
|
-
// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
|
|
10
|
-
const viewPropTypes = ViewPropTypes || View.propTypes;
|
|
11
|
-
const propTypes = {
|
|
12
|
-
...viewPropTypes,
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The url template of the tile server. The patterns {x} {y} {z} will be replaced at runtime
|
|
16
|
-
* For example, https://tile.openstreetmap.de/{z}/{x}/{y}.png
|
|
17
|
-
*/
|
|
18
|
-
urlTemplate: PropTypes.string.isRequired,
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* visible
|
|
22
|
-
*/
|
|
23
|
-
visible: PropTypes.bool,
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The order in which this tile overlay is drawn with respect to other overlays. An overlay
|
|
27
|
-
* with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays
|
|
28
|
-
* with the same z-index is arbitrary. The default zIndex is 0.
|
|
29
|
-
*/
|
|
30
|
-
zIndex: PropTypes.number,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
class MFTileOverlay extends React.Component {
|
|
34
|
-
render() {
|
|
35
|
-
return <RMFTileOverlay
|
|
36
|
-
{...this.props}
|
|
37
|
-
/>;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
MFTileOverlay.propTypes = propTypes;
|
|
42
|
-
|
|
43
|
-
var RMFTileOverlay = requireNativeComponent(`RMFTileOverlay`, MFTileOverlay);
|
|
44
|
-
|
|
45
|
-
export { MFTileOverlay }
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {ViewPropTypes} from 'deprecated-react-native-prop-types';
|
|
4
|
+
import {
|
|
5
|
+
requireNativeComponent,
|
|
6
|
+
View,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
|
|
9
|
+
// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
|
|
10
|
+
const viewPropTypes = ViewPropTypes || View.propTypes;
|
|
11
|
+
const propTypes = {
|
|
12
|
+
...viewPropTypes,
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The url template of the tile server. The patterns {x} {y} {z} will be replaced at runtime
|
|
16
|
+
* For example, https://tile.openstreetmap.de/{z}/{x}/{y}.png
|
|
17
|
+
*/
|
|
18
|
+
urlTemplate: PropTypes.string.isRequired,
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* visible
|
|
22
|
+
*/
|
|
23
|
+
visible: PropTypes.bool,
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The order in which this tile overlay is drawn with respect to other overlays. An overlay
|
|
27
|
+
* with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays
|
|
28
|
+
* with the same z-index is arbitrary. The default zIndex is 0.
|
|
29
|
+
*/
|
|
30
|
+
zIndex: PropTypes.number,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
class MFTileOverlay extends React.Component {
|
|
34
|
+
render() {
|
|
35
|
+
return <RMFTileOverlay
|
|
36
|
+
{...this.props}
|
|
37
|
+
/>;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
MFTileOverlay.propTypes = propTypes;
|
|
42
|
+
|
|
43
|
+
var RMFTileOverlay = requireNativeComponent(`RMFTileOverlay`, MFTileOverlay);
|
|
44
|
+
|
|
45
|
+
export { MFTileOverlay }
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
requireNativeComponent,
|
|
3
|
-
UIManager,
|
|
4
|
-
Platform,
|
|
5
|
-
ViewStyle,
|
|
6
|
-
} from 'react-native';
|
|
7
|
-
|
|
8
|
-
const LINKING_ERROR =
|
|
9
|
-
`The package 'react-native-map4d-map' doesn't seem to be linked. Make sure: \n\n` +
|
|
10
|
-
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
11
|
-
'- You rebuilt the app after installing the package\n' +
|
|
12
|
-
'- You are not using Expo managed workflow\n';
|
|
13
|
-
|
|
14
|
-
type Map4dMapProps = {
|
|
15
|
-
color: string;
|
|
16
|
-
style: ViewStyle;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const ComponentName = 'Map4dMapView';
|
|
20
|
-
|
|
21
|
-
export const Map4dMapView =
|
|
22
|
-
UIManager.getViewManagerConfig(ComponentName) != null
|
|
23
|
-
? requireNativeComponent<Map4dMapProps>(ComponentName)
|
|
24
|
-
: () => {
|
|
25
|
-
throw new Error(LINKING_ERROR);
|
|
26
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
requireNativeComponent,
|
|
3
|
+
UIManager,
|
|
4
|
+
Platform,
|
|
5
|
+
ViewStyle,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
|
|
8
|
+
const LINKING_ERROR =
|
|
9
|
+
`The package 'react-native-map4d-map' doesn't seem to be linked. Make sure: \n\n` +
|
|
10
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
11
|
+
'- You rebuilt the app after installing the package\n' +
|
|
12
|
+
'- You are not using Expo managed workflow\n';
|
|
13
|
+
|
|
14
|
+
type Map4dMapProps = {
|
|
15
|
+
color: string;
|
|
16
|
+
style: ViewStyle;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const ComponentName = 'Map4dMapView';
|
|
20
|
+
|
|
21
|
+
export const Map4dMapView =
|
|
22
|
+
UIManager.getViewManagerConfig(ComponentName) != null
|
|
23
|
+
? requireNativeComponent<Map4dMapProps>(ComponentName)
|
|
24
|
+
: () => {
|
|
25
|
+
throw new Error(LINKING_ERROR);
|
|
26
|
+
};
|
|
27
27
|
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import {AreaFocusSession} from './area/AreaFocusSession'
|
|
2
|
+
import {ProvinceArea, IndustrialEconomicArea} from './area/AreaFocusAreas'
|
|
3
|
+
import {IndustrialEconomicType} from './area/AreaFocusTypes'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {'normal' | 'highlight'} FocusDisplay
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {{left?: number, right?: number, top?: number, bottom?: number}} FocusPadding
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {'province' | 'industrialZone' | 'economicZone' | 'ecoIndustrialZone' | 'freeTradeZone' | 'nonTariffZone' | 'otherZoneModel' | number} FocusType
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {Object} FocusOptions
|
|
19
|
+
* @property {FocusType} type
|
|
20
|
+
* @property {number=} id
|
|
21
|
+
* @property {string=} name
|
|
22
|
+
* @property {FocusDisplay=} display
|
|
23
|
+
* @property {FocusPadding=} padding
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const VIETNAM_MAINLAND_BOUNDS = {
|
|
27
|
+
minLat: 8.18,
|
|
28
|
+
minLng: 102.14,
|
|
29
|
+
maxLat: 23.4,
|
|
30
|
+
maxLng: 109.47,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const FOCUS_TYPE_TO_INDUSTRIAL_ECONOMIC_TYPE = {
|
|
34
|
+
industrialZone: IndustrialEconomicType.INDUSTRIAL_ZONE,
|
|
35
|
+
economicZone: IndustrialEconomicType.ECONOMIC_ZONE,
|
|
36
|
+
ecoIndustrialZone: IndustrialEconomicType.ECO_INDUSTRIAL_ZONE,
|
|
37
|
+
freeTradeZone: IndustrialEconomicType.FREE_TRADE_ZONE,
|
|
38
|
+
nonTariffZone: IndustrialEconomicType.NON_TARIFF_ZONE,
|
|
39
|
+
otherZoneModel: IndustrialEconomicType.OTHER_ZONE_MODEL,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class AreaFocusManager {
|
|
43
|
+
constructor(mapView) {
|
|
44
|
+
this.mapView = mapView
|
|
45
|
+
this.currentSession = null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async _focusArea(area, options) {
|
|
49
|
+
this.clear()
|
|
50
|
+
|
|
51
|
+
if (!area) {
|
|
52
|
+
return null
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
if (!(await area.load())) {
|
|
57
|
+
return null
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const focusOptions = {...(options || {})}
|
|
61
|
+
const bounds = area.getBounds() || VIETNAM_MAINLAND_BOUNDS
|
|
62
|
+
|
|
63
|
+
this._fitBounds(bounds, focusOptions)
|
|
64
|
+
|
|
65
|
+
this.currentSession = new AreaFocusSession(this.mapView, area, focusOptions)
|
|
66
|
+
this.currentSession.render()
|
|
67
|
+
|
|
68
|
+
return this.currentSession
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
console.error('Cannot focus area:', error)
|
|
72
|
+
return null
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async _focusProvince(options) {
|
|
77
|
+
const provinceId = this._getProvinceId(options)
|
|
78
|
+
const provinceName = this._getProvinceName(options)
|
|
79
|
+
|
|
80
|
+
if (provinceId == null && !provinceName) {
|
|
81
|
+
this.clear()
|
|
82
|
+
return null
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const area = provinceId != null ? new ProvinceArea(provinceId) : ProvinceArea.fromName(provinceName)
|
|
86
|
+
const display = options && options.display === 'highlight' ? 'highlight' : 'normal'
|
|
87
|
+
|
|
88
|
+
return this._focusArea(area, {
|
|
89
|
+
display,
|
|
90
|
+
padding: options ? options.padding : undefined,
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @param {FocusOptions | null | undefined} focusOptions
|
|
96
|
+
* @returns {Promise<AreaFocusSession | null>}
|
|
97
|
+
*/
|
|
98
|
+
async focus(focusOptions) {
|
|
99
|
+
if (focusOptions == null) {
|
|
100
|
+
this.clear()
|
|
101
|
+
return null
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (focusOptions.type === 'province') {
|
|
105
|
+
return this._focusProvince(focusOptions)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (focusOptions.id == null) {
|
|
109
|
+
console.warn('Focus options must include an id for non-province types:', focusOptions)
|
|
110
|
+
this.clear()
|
|
111
|
+
return null
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const industrialEconomicType = this._getIndustrialEconomicType(focusOptions.type)
|
|
115
|
+
|
|
116
|
+
if (industrialEconomicType != null) {
|
|
117
|
+
return this._focusArea(new IndustrialEconomicArea(industrialEconomicType, focusOptions.id), {
|
|
118
|
+
display: focusOptions.display,
|
|
119
|
+
padding: focusOptions.padding,
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
console.warn('Unsupported focus type:', focusOptions.type)
|
|
124
|
+
return null
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
_getIndustrialEconomicType(type) {
|
|
128
|
+
if (typeof type === 'number') {
|
|
129
|
+
const values = Object.values(IndustrialEconomicType)
|
|
130
|
+
return values.includes(type) ? type : null
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (typeof type !== 'string') {
|
|
134
|
+
return null
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return FOCUS_TYPE_TO_INDUSTRIAL_ECONOMIC_TYPE[type] || null
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
clear() {
|
|
141
|
+
if (this.currentSession) {
|
|
142
|
+
this.currentSession.destroy()
|
|
143
|
+
this.currentSession = null
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
_fitBounds(bounds, options) {
|
|
148
|
+
if (!this.mapView || typeof this.mapView.fitBounds !== 'function' || !bounds) {
|
|
149
|
+
return
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
this.mapView.fitBounds({
|
|
153
|
+
bounds: {
|
|
154
|
+
southWest: {
|
|
155
|
+
latitude: bounds.minLat,
|
|
156
|
+
longitude: bounds.minLng,
|
|
157
|
+
},
|
|
158
|
+
northEast: {
|
|
159
|
+
latitude: bounds.maxLat,
|
|
160
|
+
longitude: bounds.maxLng,
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
padding: options ? options.padding : undefined,
|
|
164
|
+
})
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
_getProvinceName(options) {
|
|
168
|
+
if (options == null || typeof options !== 'object') {
|
|
169
|
+
return null
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (typeof options.name === 'string') {
|
|
173
|
+
const name = options.name.trim()
|
|
174
|
+
return name.length > 0 ? name : null
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const optionKeys = Object.keys(options)
|
|
178
|
+
const unsupportedKeys = optionKeys.filter((key) => key !== 'type' && key !== 'id' && key !== 'name' && key !== 'display' && key !== 'padding')
|
|
179
|
+
|
|
180
|
+
if (unsupportedKeys.length > 0) {
|
|
181
|
+
console.warn(
|
|
182
|
+
`[AreaFocusManager] focusProvince expects options like { type: 'province', name: 'Ha Noi', display: 'highlight' }. Unsupported keys: ${unsupportedKeys.join(', ')}`
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return null
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
_getProvinceId(options) {
|
|
190
|
+
if (options == null || typeof options !== 'object') {
|
|
191
|
+
return null
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return typeof options.id === 'number' ? options.id : null
|
|
195
|
+
}
|
|
196
|
+
}
|