react-native-map4d-map-dtqg 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +88 -41
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.9/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.9/gc.properties +0 -0
- package/android/.gradle/9.0-milestone-1/checksums/checksums.lock +0 -0
- package/android/.gradle/9.0-milestone-1/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/9.0-milestone-1/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/9.0-milestone-1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/9.0-milestone-1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/9.0-milestone-1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/config.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/AndroidProjectSystem.xml +6 -0
- package/android/.idea/caches/deviceStreaming.xml +1570 -0
- package/android/.idea/copilot.data.migration.ask2agent.xml +6 -0
- package/android/.idea/gradle.xml +12 -0
- package/android/.idea/migrations.xml +10 -0
- package/android/.idea/misc.xml +10 -0
- package/android/.idea/runConfigurations.xml +17 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/build.gradle +60 -60
- package/android/local.properties +8 -0
- package/android/src/main/AndroidManifest.xml +4 -4
- package/android/src/main/java/com/reactnativemap4dmap/ImageUtils.java +87 -87
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapModule.java +298 -298
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapPackage.java +35 -35
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapViewManager.java +31 -31
- package/android/src/main/java/com/reactnativemap4dmap/RMFBuilding.java +167 -167
- package/android/src/main/java/com/reactnativemap4dmap/RMFBuildingManager.java +121 -121
- package/android/src/main/java/com/reactnativemap4dmap/RMFCircle.java +105 -105
- package/android/src/main/java/com/reactnativemap4dmap/RMFCircleManager.java +121 -121
- package/android/src/main/java/com/reactnativemap4dmap/RMFDirectionsRenderer.java +502 -502
- package/android/src/main/java/com/reactnativemap4dmap/RMFDirectionsRendererManager.java +143 -143
- package/android/src/main/java/com/reactnativemap4dmap/RMFFeature.java +17 -17
- package/android/src/main/java/com/reactnativemap4dmap/RMFMapView.java +1172 -1172
- package/android/src/main/java/com/reactnativemap4dmap/RMFMapViewManager.java +226 -226
- package/android/src/main/java/com/reactnativemap4dmap/RMFMarker.java +412 -412
- package/android/src/main/java/com/reactnativemap4dmap/RMFMarkerManager.java +211 -211
- package/android/src/main/java/com/reactnativemap4dmap/RMFPOI.java +222 -222
- package/android/src/main/java/com/reactnativemap4dmap/RMFPOIManager.java +119 -119
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolygon.java +172 -172
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolygonManager.java +147 -147
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolyline.java +146 -146
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolylineManager.java +137 -137
- package/android/src/main/java/com/reactnativemap4dmap/RMFTileOverlay.java +95 -95
- package/android/src/main/java/com/reactnativemap4dmap/RMFTileOverlayManager.java +64 -64
- package/android/src/main/java/com/reactnativemap4dmap/SizeReportingShadowNode.java +31 -31
- package/android/src/main/java/com/reactnativemap4dmap/ViewAttacherGroup.java +31 -31
- package/android/src/main/java/com/reactnativemap4dmap/ViewChangesTracker.java +70 -70
- package/android/src/main/java/vn/map4d/map/annotations/RMFBitmapDescriptor.java +9 -9
- package/ios/Map4dMap.h +7 -7
- package/ios/Map4dMap.m +14 -14
- package/ios/Map4dMapViewManager.m +34 -34
- package/ios/RCTConvert+Map4dMap.h +33 -33
- package/ios/RCTConvert+Map4dMap.m +112 -112
- package/ios/RMFCircle.h +37 -37
- package/ios/RMFCircle.m +100 -100
- package/ios/RMFCircleManager.h +18 -18
- package/ios/RMFCircleManager.m +155 -155
- package/ios/RMFCircleMap4d.h +23 -23
- package/ios/RMFCircleMap4d.m +13 -13
- package/ios/RMFCoordinate.h +22 -22
- package/ios/RMFCoordinate.m +13 -13
- package/ios/RMFDirectionsMarkerOptions.h +24 -24
- package/ios/RMFDirectionsMarkerOptions.m +23 -23
- package/ios/RMFDirectionsRenderer.h +47 -47
- package/ios/RMFDirectionsRenderer.m +182 -182
- package/ios/RMFDirectionsRendererManager.h +17 -17
- package/ios/RMFDirectionsRendererManager.m +84 -84
- package/ios/RMFDirectionsRendererMap4d.h +21 -21
- package/ios/RMFDirectionsRendererMap4d.m +12 -12
- package/ios/RMFDummyView.h +6 -6
- package/ios/RMFDummyView.m +12 -12
- package/ios/RMFEventResponse.h +39 -39
- package/ios/RMFEventResponse.m +98 -98
- package/ios/RMFIcon.h +24 -24
- package/ios/RMFIcon.m +35 -35
- package/ios/RMFMapView.h +84 -84
- package/ios/RMFMapView.m +376 -376
- package/ios/RMFMapViewManager.h +17 -17
- package/ios/RMFMapViewManager.m +493 -493
- package/ios/RMFMarker.h +57 -57
- package/ios/RMFMarker.m +267 -267
- package/ios/RMFMarkerManager.h +17 -17
- package/ios/RMFMarkerManager.m +156 -156
- package/ios/RMFMarkerMap4d.h +19 -19
- package/ios/RMFMarkerMap4d.m +13 -13
- package/ios/RMFPOI.h +38 -38
- package/ios/RMFPOI.m +123 -123
- package/ios/RMFPOIManager.h +18 -18
- package/ios/RMFPOIManager.m +168 -168
- package/ios/RMFPOIMap4d.h +22 -22
- package/ios/RMFPOIMap4d.m +12 -12
- package/ios/RMFPolygon.h +41 -41
- package/ios/RMFPolygon.m +106 -106
- package/ios/RMFPolygonManager.h +18 -18
- package/ios/RMFPolygonManager.m +141 -141
- package/ios/RMFPolygonMap4d.h +23 -23
- package/ios/RMFPolygonMap4d.m +15 -15
- package/ios/RMFPolyline.h +38 -38
- package/ios/RMFPolyline.m +101 -101
- package/ios/RMFPolylineManager.h +18 -18
- package/ios/RMFPolylineManager.m +139 -139
- package/ios/RMFPolylineMap4d.h +22 -22
- package/ios/RMFPolylineMap4d.m +15 -15
- package/ios/building/RMFBuilding.h +41 -41
- package/ios/building/RMFBuilding.m +104 -104
- package/ios/building/RMFBuildingManager.h +19 -19
- package/ios/building/RMFBuildingManager.m +133 -133
- package/ios/building/RMFBuildingMap4d.h +23 -23
- package/ios/building/RMFBuildingMap4d.m +15 -15
- package/ios/overlays/RMFTileOverlay.h +36 -36
- package/ios/overlays/RMFTileOverlay.m +64 -64
- package/ios/overlays/RMFTileOverlayManager.h +17 -17
- package/ios/overlays/RMFTileOverlayManager.m +27 -27
- package/lib/commonjs/components/MFBuilding.js +26 -26
- package/lib/commonjs/components/MFBuilding.js.map +1 -1
- package/lib/commonjs/components/MFCircle.js +20 -20
- package/lib/commonjs/components/MFCircle.js.map +1 -1
- package/lib/commonjs/components/MFDirectionsRenderer.js +32 -32
- package/lib/commonjs/components/MFDirectionsRenderer.js.map +1 -1
- package/lib/commonjs/components/MFMapView.js +133 -71
- package/lib/commonjs/components/MFMapView.js.map +1 -1
- package/lib/commonjs/components/MFMarker.js +35 -35
- package/lib/commonjs/components/MFMarker.js.map +1 -1
- package/lib/commonjs/components/MFPOI.js +20 -20
- package/lib/commonjs/components/MFPOI.js.map +1 -1
- package/lib/commonjs/components/MFPolygon.js +22 -22
- package/lib/commonjs/components/MFPolygon.js.map +1 -1
- package/lib/commonjs/components/MFPolyline.js +18 -18
- package/lib/commonjs/components/MFPolyline.js.map +1 -1
- package/lib/commonjs/components/MFTileOverlay.js +9 -9
- package/lib/commonjs/components/MFTileOverlay.js.map +1 -1
- package/lib/commonjs/components/Map4dMapView.js.map +1 -1
- package/lib/commonjs/components/extends/AreaFocuser.js +311 -0
- package/lib/commonjs/components/extends/AreaFocuser.js.map +1 -0
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/MFBuilding.js +26 -26
- package/lib/module/components/MFBuilding.js.map +1 -1
- package/lib/module/components/MFCircle.js +20 -20
- package/lib/module/components/MFCircle.js.map +1 -1
- package/lib/module/components/MFDirectionsRenderer.js +32 -32
- package/lib/module/components/MFDirectionsRenderer.js.map +1 -1
- package/lib/module/components/MFMapView.js +131 -71
- package/lib/module/components/MFMapView.js.map +1 -1
- package/lib/module/components/MFMarker.js +35 -35
- package/lib/module/components/MFMarker.js.map +1 -1
- package/lib/module/components/MFPOI.js +20 -20
- package/lib/module/components/MFPOI.js.map +1 -1
- package/lib/module/components/MFPolygon.js +22 -22
- package/lib/module/components/MFPolygon.js.map +1 -1
- package/lib/module/components/MFPolyline.js +18 -18
- package/lib/module/components/MFPolyline.js.map +1 -1
- package/lib/module/components/MFTileOverlay.js +9 -9
- package/lib/module/components/MFTileOverlay.js.map +1 -1
- package/lib/module/components/Map4dMapView.js.map +1 -1
- package/lib/module/components/extends/AreaFocuser.js +302 -0
- package/lib/module/components/extends/AreaFocuser.js.map +1 -0
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/components/Map4dMapView.d.ts +7 -7
- package/package.json +152 -152
- package/react-native-map4d-map.podspec +20 -20
- package/src/components/MFBuilding.js +187 -187
- package/src/components/MFCircle.js +173 -173
- package/src/components/MFDirectionsRenderer.js +237 -237
- package/src/components/MFMapView.js +447 -373
- package/src/components/MFMarker.js +246 -246
- package/src/components/MFPOI.js +184 -184
- package/src/components/MFPolygon.js +186 -186
- package/src/components/MFPolyline.js +172 -172
- package/src/components/MFTileOverlay.js +45 -45
- package/src/components/Map4dMapView.tsx +26 -26
- package/src/components/extends/AreaFocuser.js +339 -0
- package/src/index.js +23 -21
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AreaFocuser = void 0;
|
|
7
|
+
|
|
8
|
+
class AreaFocuser {
|
|
9
|
+
constructor(mapView) {
|
|
10
|
+
this.mapView = mapView;
|
|
11
|
+
this.highlightPaths = [];
|
|
12
|
+
this.highlightPolygonId = 'area-focuser-highlight-polygon';
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @param {{name?: string, highlight?: boolean}=} options
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
async focusProvince(options) {
|
|
20
|
+
const provinceName = this.getProvinceName(options);
|
|
21
|
+
const shouldHighlight = this.shouldHighlight(options);
|
|
22
|
+
|
|
23
|
+
if (!provinceName) {
|
|
24
|
+
this.clearHighlightPaths();
|
|
25
|
+
this.clearHighlightPolygon();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const url = `https://api-app-cdtqg.map4d.vn/map/country/geometry?name=${encodeURIComponent(provinceName)}`;
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
const response = await fetch(url);
|
|
33
|
+
|
|
34
|
+
if (!response.ok) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const data = await response.json();
|
|
39
|
+
|
|
40
|
+
if (data.code !== 'ok') {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const feature = data.result && data.result.features && data.result.features.length > 0 ? data.result.features[0] : null;
|
|
45
|
+
|
|
46
|
+
if (!feature) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const geometry = feature.geometry;
|
|
51
|
+
|
|
52
|
+
if (!geometry) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let bounds = null;
|
|
57
|
+
const viewbox = feature.properties && feature.properties.viewbox ? feature.properties.viewbox : null;
|
|
58
|
+
|
|
59
|
+
if (viewbox != null && viewbox.trim() != '') {
|
|
60
|
+
bounds = this.parseViewbox(viewbox);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!bounds) {
|
|
64
|
+
bounds = this.getViewboxFromGeometry(geometry);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!bounds) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this.mapView.fitBounds({
|
|
72
|
+
bounds: {
|
|
73
|
+
southWest: {
|
|
74
|
+
latitude: bounds[0],
|
|
75
|
+
longitude: bounds[1]
|
|
76
|
+
},
|
|
77
|
+
northEast: {
|
|
78
|
+
latitude: bounds[2],
|
|
79
|
+
longitude: bounds[3]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
this.createHighlightPaths(geometry);
|
|
84
|
+
|
|
85
|
+
if (shouldHighlight) {
|
|
86
|
+
const polygon = this.getHighlightPolygonProps();
|
|
87
|
+
|
|
88
|
+
if (polygon) {
|
|
89
|
+
this.mapView._addPolygon({ ...polygon,
|
|
90
|
+
id: this.highlightPolygonId,
|
|
91
|
+
zIndex: 999
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
this.clearHighlightPolygon();
|
|
96
|
+
}
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.error('Cannot focus province:', error);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
getProvinceName(options) {
|
|
103
|
+
if (options == null || typeof options !== 'object') {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (typeof options.name === 'string') {
|
|
108
|
+
return options.name.trim();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const optionKeys = Object.keys(options);
|
|
112
|
+
const unsupportedKeys = optionKeys.filter(key => key !== 'name' && key !== 'highlight');
|
|
113
|
+
|
|
114
|
+
if (unsupportedKeys.length > 0) {
|
|
115
|
+
console.warn(`[AreaFocuser] focusProvince expects options like { name: 'Ha Noi', highlight: true }. Unsupported keys: ${unsupportedKeys.join(', ')}`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
shouldHighlight(options) {
|
|
122
|
+
if (options == null || typeof options !== 'object') {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return options.highlight === true;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
parseViewbox(viewbox) {
|
|
130
|
+
const bounds = viewbox.split(',').map(Number);
|
|
131
|
+
|
|
132
|
+
if (bounds.length != 4) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const [minLat, minLng, maxLat, maxLng] = bounds;
|
|
137
|
+
|
|
138
|
+
if (Number.isNaN(minLat) || Number.isNaN(minLng) || Number.isNaN(maxLat) || Number.isNaN(maxLng)) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return [minLat, minLng, maxLat, maxLng];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
getViewboxFromGeometry(geometry) {
|
|
146
|
+
const bounds = {
|
|
147
|
+
minLat: Infinity,
|
|
148
|
+
minLng: Infinity,
|
|
149
|
+
maxLat: -Infinity,
|
|
150
|
+
maxLng: -Infinity
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const updateBounds = function (coordinate) {
|
|
154
|
+
if (coordinate.length < 2) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const lng = coordinate[0];
|
|
159
|
+
const lat = coordinate[1];
|
|
160
|
+
|
|
161
|
+
if (Number.isNaN(lat) || Number.isNaN(lng)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
bounds.minLat = Math.min(bounds.minLat, lat);
|
|
166
|
+
bounds.minLng = Math.min(bounds.minLng, lng);
|
|
167
|
+
bounds.maxLat = Math.max(bounds.maxLat, lat);
|
|
168
|
+
bounds.maxLng = Math.max(bounds.maxLng, lng);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
if (geometry.type === 'Polygon') {
|
|
172
|
+
const polygons = geometry.coordinates;
|
|
173
|
+
polygons.forEach(function (ring) {
|
|
174
|
+
ring.forEach(function (coordinate) {
|
|
175
|
+
updateBounds(coordinate);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (geometry.type === 'MultiPolygon') {
|
|
181
|
+
const multiPolygons = geometry.coordinates;
|
|
182
|
+
multiPolygons.forEach(function (polygon) {
|
|
183
|
+
polygon.forEach(function (ring) {
|
|
184
|
+
ring.forEach(function (coordinate) {
|
|
185
|
+
updateBounds(coordinate);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (bounds.minLat === Infinity || bounds.minLng === Infinity || bounds.maxLat === -Infinity || bounds.maxLng === -Infinity) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return [bounds.minLat, bounds.minLng, bounds.maxLat, bounds.maxLng];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
createHighlightPaths(geometry) {
|
|
199
|
+
this.clearHighlightPaths();
|
|
200
|
+
const paths = this.createWorldMaskPaths(geometry);
|
|
201
|
+
|
|
202
|
+
if (paths.length <= 1) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
this.highlightPaths = paths;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
clearHighlightPaths() {
|
|
210
|
+
this.highlightPaths = [];
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
clearHighlightPolygon() {
|
|
214
|
+
if (!this.mapView) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
this.mapView._removePolygon(this.highlightPolygonId);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
getHighlightPolygonProps() {
|
|
222
|
+
if (!this.highlightPaths || this.highlightPaths.length <= 1) {
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const [coordinates, ...holes] = this.highlightPaths;
|
|
227
|
+
return {
|
|
228
|
+
coordinates,
|
|
229
|
+
holes,
|
|
230
|
+
fillColor: "#0000001E",
|
|
231
|
+
strokeColor: "#FF0000FF",
|
|
232
|
+
strokeWidth: 2.0
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
createWorldMaskPaths(geometry) {
|
|
237
|
+
const worldPath = [{
|
|
238
|
+
longitude: -180,
|
|
239
|
+
latitude: -90
|
|
240
|
+
}, {
|
|
241
|
+
longitude: 180,
|
|
242
|
+
latitude: -90
|
|
243
|
+
}, {
|
|
244
|
+
longitude: 180,
|
|
245
|
+
latitude: 90
|
|
246
|
+
}, {
|
|
247
|
+
longitude: -180,
|
|
248
|
+
latitude: 90
|
|
249
|
+
}, {
|
|
250
|
+
longitude: -180,
|
|
251
|
+
latitude: -90
|
|
252
|
+
}];
|
|
253
|
+
const paths = [worldPath];
|
|
254
|
+
const holes = this.getHolePathsFromGeometry(geometry);
|
|
255
|
+
holes.forEach(hole => {
|
|
256
|
+
paths.push(hole);
|
|
257
|
+
});
|
|
258
|
+
return paths;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
getHolePathsFromGeometry(geometry) {
|
|
262
|
+
const paths = [];
|
|
263
|
+
|
|
264
|
+
if (geometry.type == 'Polygon') {
|
|
265
|
+
const polygon = geometry.coordinates;
|
|
266
|
+
|
|
267
|
+
if (polygon.length > 0) {
|
|
268
|
+
paths.push(this.convertAndClosePath(polygon[0]));
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (geometry.type == 'MultiPolygon') {
|
|
273
|
+
const multiPolygon = geometry.coordinates;
|
|
274
|
+
multiPolygon.forEach(polygon => {
|
|
275
|
+
if (polygon.length > 0) {
|
|
276
|
+
paths.push(this.convertAndClosePath(polygon[0]));
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return paths;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
convertAndClosePath(path) {
|
|
285
|
+
if (path.length == 0) {
|
|
286
|
+
return [];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const coordinatePath = path.filter(point => point.length >= 2).map(point => ({
|
|
290
|
+
latitude: point[1],
|
|
291
|
+
longitude: point[0]
|
|
292
|
+
}));
|
|
293
|
+
|
|
294
|
+
if (coordinatePath.length == 0) {
|
|
295
|
+
return [];
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const firstPoint = coordinatePath[0];
|
|
299
|
+
const lastPoint = coordinatePath[coordinatePath.length - 1];
|
|
300
|
+
|
|
301
|
+
if (firstPoint.latitude == lastPoint.latitude && firstPoint.longitude == lastPoint.longitude) {
|
|
302
|
+
return coordinatePath;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
return [...coordinatePath, firstPoint];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
exports.AreaFocuser = AreaFocuser;
|
|
311
|
+
//# sourceMappingURL=AreaFocuser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AreaFocuser","constructor","mapView","highlightPaths","highlightPolygonId","focusProvince","options","provinceName","getProvinceName","shouldHighlight","clearHighlightPaths","clearHighlightPolygon","url","encodeURIComponent","response","fetch","ok","data","json","code","feature","result","features","length","geometry","bounds","viewbox","properties","trim","parseViewbox","getViewboxFromGeometry","fitBounds","southWest","latitude","longitude","northEast","createHighlightPaths","polygon","getHighlightPolygonProps","_addPolygon","id","zIndex","error","console","name","optionKeys","Object","keys","unsupportedKeys","filter","key","warn","join","highlight","split","map","Number","minLat","minLng","maxLat","maxLng","isNaN","Infinity","updateBounds","coordinate","lng","lat","Math","min","max","type","polygons","coordinates","forEach","ring","multiPolygons","paths","createWorldMaskPaths","_removePolygon","holes","fillColor","strokeColor","strokeWidth","worldPath","getHolePathsFromGeometry","hole","push","convertAndClosePath","multiPolygon","path","coordinatePath","point","firstPoint","lastPoint"],"sources":["AreaFocuser.js"],"sourcesContent":["export class AreaFocuser {\r\n\r\n constructor(mapView) {\r\n this.mapView = mapView\r\n this.highlightPaths = []\r\n this.highlightPolygonId = 'area-focuser-highlight-polygon'\r\n }\r\n\r\n /**\r\n * @param {{name?: string, highlight?: boolean}=} options\r\n */\r\n async focusProvince(options) {\r\n const provinceName = this.getProvinceName(options)\r\n const shouldHighlight = this.shouldHighlight(options)\r\n\r\n if (!provinceName) {\r\n this.clearHighlightPaths()\r\n this.clearHighlightPolygon()\r\n return\r\n }\r\n\r\n const url =\r\n `https://api-app-cdtqg.map4d.vn/map/country/geometry?name=${encodeURIComponent(provinceName)}`\r\n\r\n try {\r\n const response = await fetch(url)\r\n\r\n if (!response.ok) {\r\n return\r\n }\r\n\r\n const data = await response.json()\r\n\r\n if (data.code !== 'ok') {\r\n return\r\n }\r\n\r\n const feature =\r\n data.result && data.result.features && data.result.features.length > 0 ? data.result.features[0] : null\r\n\r\n if (!feature) {\r\n return\r\n }\r\n\r\n const geometry = feature.geometry\r\n if (!geometry) {\r\n return\r\n }\r\n\r\n let bounds = null\r\n\r\n const viewbox =\r\n feature.properties && feature.properties.viewbox ? feature.properties.viewbox : null\r\n\r\n if (viewbox != null && viewbox.trim() != '') {\r\n bounds = this.parseViewbox(viewbox)\r\n }\r\n\r\n if (!bounds) {\r\n bounds = this.getViewboxFromGeometry(geometry)\r\n }\r\n\r\n if (!bounds) {\r\n return\r\n }\r\n\r\n this.mapView.fitBounds({\r\n bounds: {\r\n southWest: {\r\n latitude: bounds[0],\r\n longitude: bounds[1],\r\n },\r\n northEast: {\r\n latitude: bounds[2],\r\n longitude: bounds[3],\r\n },\r\n }\r\n })\r\n\r\n this.createHighlightPaths(geometry)\r\n\r\n if (shouldHighlight) {\r\n const polygon = this.getHighlightPolygonProps()\r\n\r\n if (polygon) {\r\n this.mapView._addPolygon({\r\n ...polygon,\r\n id: this.highlightPolygonId,\r\n zIndex: 999,\r\n })\r\n }\r\n }\r\n else {\r\n this.clearHighlightPolygon()\r\n }\r\n }\r\n catch (error) {\r\n console.error('Cannot focus province:', error)\r\n }\r\n }\r\n\r\n getProvinceName(options) {\r\n if (options == null || typeof options !== 'object') {\r\n return null\r\n }\r\n\r\n if (typeof options.name === 'string') {\r\n return options.name.trim()\r\n }\r\n\r\n const optionKeys = Object.keys(options)\r\n const unsupportedKeys = optionKeys.filter((key) => key !== 'name' && key !== 'highlight')\r\n\r\n if (unsupportedKeys.length > 0) {\r\n console.warn(\r\n `[AreaFocuser] focusProvince expects options like { name: 'Ha Noi', highlight: true }. Unsupported keys: ${unsupportedKeys.join(', ')}`\r\n )\r\n }\r\n\r\n return null\r\n }\r\n\r\n shouldHighlight(options) {\r\n if (options == null || typeof options !== 'object') {\r\n return false\r\n }\r\n\r\n return options.highlight === true\r\n }\r\n\r\n parseViewbox(viewbox) {\r\n const bounds = viewbox.split(',').map(Number)\r\n\r\n if (bounds.length != 4) {\r\n return null\r\n }\r\n\r\n const [minLat, minLng, maxLat, maxLng] = bounds\r\n\r\n if (\r\n Number.isNaN(minLat) ||\r\n Number.isNaN(minLng) ||\r\n Number.isNaN(maxLat) ||\r\n Number.isNaN(maxLng)\r\n ) {\r\n return null\r\n }\r\n\r\n return [\r\n minLat,\r\n minLng,\r\n maxLat,\r\n maxLng,\r\n ]\r\n }\r\n\r\n getViewboxFromGeometry(geometry) {\r\n const bounds = {\r\n minLat: Infinity,\r\n minLng: Infinity,\r\n maxLat: -Infinity,\r\n maxLng: -Infinity,\r\n }\r\n\r\n const updateBounds = function (coordinate) {\r\n if (coordinate.length < 2) {\r\n return\r\n }\r\n\r\n const lng = coordinate[0]\r\n const lat = coordinate[1]\r\n\r\n if (Number.isNaN(lat) || Number.isNaN(lng)) {\r\n return\r\n }\r\n\r\n bounds.minLat = Math.min(bounds.minLat, lat)\r\n bounds.minLng = Math.min(bounds.minLng, lng)\r\n bounds.maxLat = Math.max(bounds.maxLat, lat)\r\n bounds.maxLng = Math.max(bounds.maxLng, lng)\r\n }\r\n\r\n if (geometry.type === 'Polygon') {\r\n const polygons = geometry.coordinates\r\n\r\n polygons.forEach(function (ring) {\r\n ring.forEach(function (coordinate) {\r\n updateBounds(coordinate)\r\n })\r\n })\r\n }\r\n\r\n if (geometry.type === 'MultiPolygon') {\r\n const multiPolygons = geometry.coordinates\r\n\r\n multiPolygons.forEach(function (polygon) {\r\n polygon.forEach(function (ring) {\r\n ring.forEach(function (coordinate) {\r\n updateBounds(coordinate)\r\n })\r\n })\r\n })\r\n }\r\n\r\n if (\r\n bounds.minLat === Infinity ||\r\n bounds.minLng === Infinity ||\r\n bounds.maxLat === -Infinity ||\r\n bounds.maxLng === -Infinity\r\n ) {\r\n return null\r\n }\r\n\r\n return [\r\n bounds.minLat,\r\n bounds.minLng,\r\n bounds.maxLat,\r\n bounds.maxLng,\r\n ]\r\n }\r\n\r\n createHighlightPaths(geometry) {\r\n this.clearHighlightPaths()\r\n\r\n const paths = this.createWorldMaskPaths(geometry)\r\n\r\n if (paths.length <= 1) {\r\n return\r\n }\r\n\r\n this.highlightPaths = paths\r\n }\r\n\r\n clearHighlightPaths() {\r\n this.highlightPaths = []\r\n }\r\n\r\n clearHighlightPolygon() {\r\n if (!this.mapView) {\r\n return\r\n }\r\n\r\n this.mapView._removePolygon(this.highlightPolygonId)\r\n }\r\n\r\n getHighlightPolygonProps() {\r\n if (!this.highlightPaths || this.highlightPaths.length <= 1) {\r\n return null\r\n }\r\n\r\n const [coordinates, ...holes] = this.highlightPaths\r\n\r\n return {\r\n coordinates,\r\n holes,\r\n fillColor: \"#0000001E\",\r\n strokeColor: \"#FF0000FF\",\r\n strokeWidth: 2.0,\r\n }\r\n }\r\n\r\n createWorldMaskPaths(geometry) {\r\n const worldPath = [\r\n { longitude: -180, latitude: -90 },\r\n { longitude: 180, latitude: -90 },\r\n { longitude: 180, latitude: 90 },\r\n { longitude: -180, latitude: 90 },\r\n { longitude: -180, latitude: -90 },\r\n ]\r\n\r\n const paths = [\r\n worldPath,\r\n ]\r\n\r\n const holes = this.getHolePathsFromGeometry(geometry)\r\n\r\n holes.forEach((hole) => {\r\n paths.push(hole)\r\n })\r\n\r\n return paths\r\n }\r\n\r\n getHolePathsFromGeometry(geometry) {\r\n const paths = []\r\n\r\n if (geometry.type == 'Polygon') {\r\n const polygon = geometry.coordinates\r\n\r\n if (polygon.length > 0) {\r\n paths.push(this.convertAndClosePath(polygon[0]))\r\n }\r\n }\r\n\r\n if (geometry.type == 'MultiPolygon') {\r\n const multiPolygon = geometry.coordinates\r\n\r\n multiPolygon.forEach((polygon) => {\r\n if (polygon.length > 0) {\r\n paths.push(this.convertAndClosePath(polygon[0]))\r\n }\r\n })\r\n }\r\n\r\n return paths\r\n }\r\n\r\n convertAndClosePath(path) {\r\n if (path.length == 0) {\r\n return []\r\n }\r\n\r\n const coordinatePath = path\r\n .filter((point) => point.length >= 2)\r\n .map((point) => ({\r\n latitude: point[1],\r\n longitude: point[0],\r\n }))\r\n\r\n if (coordinatePath.length == 0) {\r\n return []\r\n }\r\n\r\n const firstPoint = coordinatePath[0]\r\n const lastPoint = coordinatePath[coordinatePath.length - 1]\r\n\r\n if (\r\n firstPoint.latitude == lastPoint.latitude &&\r\n firstPoint.longitude == lastPoint.longitude\r\n ) {\r\n return coordinatePath\r\n }\r\n\r\n return [\r\n ...coordinatePath,\r\n firstPoint,\r\n ]\r\n }\r\n}"],"mappings":";;;;;;;AAAO,MAAMA,WAAN,CAAkB;EAEvBC,WAAW,CAACC,OAAD,EAAU;IACnB,KAAKA,OAAL,GAAeA,OAAf;IACA,KAAKC,cAAL,GAAsB,EAAt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AAL,CAAyBlD,OAAO,CAAC,CAAD,CAAhC,CAAX;QACD;MACF,CAJD;IAKD;;IAED,OAAOuC,KAAP;EACD;;EAEDW,mBAAmB,CAACE,IAAD,EAAO;IACxB,IAAIA,IAAI,CAAClE,MAAL,IAAe,CAAnB,EAAsB;MACpB,OAAO,EAAP;IACD;;IAED,MAAMmE,cAAc,GAAGD,IAAI,CACxBxC,MADoB,CACZ0C,KAAD,IAAWA,KAAK,CAACpE,MAAN,IAAgB,CADd,EAEpBgC,GAFoB,CAEfoC,KAAD,KAAY;MACf1D,QAAQ,EAAE0D,KAAK,CAAC,CAAD,CADA;MAEfzD,SAAS,EAAEyD,KAAK,CAAC,CAAD;IAFD,CAAZ,CAFgB,CAAvB;;IAOA,IAAID,cAAc,CAACnE,MAAf,IAAyB,CAA7B,EAAgC;MAC9B,OAAO,EAAP;IACD;;IAED,MAAMqE,UAAU,GAAGF,cAAc,CAAC,CAAD,CAAjC;IACA,MAAMG,SAAS,GAAGH,cAAc,CAACA,cAAc,CAACnE,MAAf,GAAwB,CAAzB,CAAhC;;IAEA,IACEqE,UAAU,CAAC3D,QAAX,IAAuB4D,SAAS,CAAC5D,QAAjC,IACA2D,UAAU,CAAC1D,SAAX,IAAwB2D,SAAS,CAAC3D,SAFpC,EAGE;MACA,OAAOwD,cAAP;IACD;;IAED,OAAO,CACL,GAAGA,cADE,EAELE,UAFK,CAAP;EAID;;AAjVsB"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "AreaFocuser", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _AreaFocuser.AreaFocuser;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "MFBuilding", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
@@ -75,4 +81,6 @@ var _MFDirectionsRenderer = require("./components/MFDirectionsRenderer");
|
|
|
75
81
|
var _MFTileOverlay = require("./components/MFTileOverlay");
|
|
76
82
|
|
|
77
83
|
var _MFBuilding = require("./components/MFBuilding");
|
|
84
|
+
|
|
85
|
+
var _AreaFocuser = require("./components/extends/AreaFocuser");
|
|
78
86
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.js"],"sourcesContent":["import {MFMapView} from './components/MFMapView'\nimport {MFMarker} from './components/MFMarker'\nimport {MFCircle} from './components/MFCircle'\nimport {MFPolyline} from './components/MFPolyline'\nimport {MFPolygon} from './components/MFPolygon'\nimport {MFPOI} from './components/MFPOI'\nimport {MFDirectionsRenderer} from './components/MFDirectionsRenderer'\nimport {MFTileOverlay} from './components/MFTileOverlay'\nimport {MFBuilding} from './components/MFBuilding'\n\nexport {\n MFMapView,\n MFMarker,\n MFCircle,\n MFPolyline,\n MFPolygon,\n MFPOI,\n MFDirectionsRenderer,\n MFTileOverlay,\n MFBuilding,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.js"],"sourcesContent":["import {MFMapView} from './components/MFMapView'\r\nimport {MFMarker} from './components/MFMarker'\r\nimport {MFCircle} from './components/MFCircle'\r\nimport {MFPolyline} from './components/MFPolyline'\r\nimport {MFPolygon} from './components/MFPolygon'\r\nimport {MFPOI} from './components/MFPOI'\r\nimport {MFDirectionsRenderer} from './components/MFDirectionsRenderer'\r\nimport {MFTileOverlay} from './components/MFTileOverlay'\r\nimport {MFBuilding} from './components/MFBuilding'\r\nimport {AreaFocuser} from './components/extends/AreaFocuser'\r\n\r\nexport {\r\n MFMapView,\r\n MFMarker,\r\n MFCircle,\r\n MFPolyline,\r\n MFPolygon,\r\n MFPOI,\r\n MFDirectionsRenderer,\r\n MFTileOverlay,\r\n MFBuilding,\r\n AreaFocuser,\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA"}
|
|
@@ -8,69 +8,69 @@ import { requireNativeComponent, Platform, NativeModules, findNodeHandle } from
|
|
|
8
8
|
const viewPropTypes = ViewPropTypes || View.propTypes;
|
|
9
9
|
const propTypes = { ...viewPropTypes,
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* The name of the building.
|
|
11
|
+
/**
|
|
12
|
+
* The name of the building.
|
|
13
13
|
*/
|
|
14
14
|
name: PropTypes.string,
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* The position of the building
|
|
16
|
+
/**
|
|
17
|
+
* The position of the building
|
|
18
18
|
*/
|
|
19
19
|
coordinate: PropTypes.shape({
|
|
20
|
-
/**
|
|
21
|
-
* Position for the building.
|
|
20
|
+
/**
|
|
21
|
+
* Position for the building.
|
|
22
22
|
*/
|
|
23
23
|
latitude: PropTypes.number.isRequired,
|
|
24
24
|
longitude: PropTypes.number.isRequired
|
|
25
25
|
}),
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
* The model URL for the building.
|
|
27
|
+
/**
|
|
28
|
+
* The model URL for the building.
|
|
29
29
|
*/
|
|
30
30
|
modelUrl: PropTypes.string,
|
|
31
31
|
|
|
32
|
-
/**
|
|
33
|
-
* The texture URL for the building.
|
|
32
|
+
/**
|
|
33
|
+
* The texture URL for the building.
|
|
34
34
|
*/
|
|
35
35
|
textureUrl: PropTypes.string,
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
* The scale of the building.
|
|
37
|
+
/**
|
|
38
|
+
* The scale of the building.
|
|
39
39
|
*/
|
|
40
40
|
scale: PropTypes.number,
|
|
41
41
|
|
|
42
|
-
/**
|
|
43
|
-
* The bearing of the building.
|
|
42
|
+
/**
|
|
43
|
+
* The bearing of the building.
|
|
44
44
|
*/
|
|
45
45
|
bearing: PropTypes.number,
|
|
46
46
|
|
|
47
|
-
/**
|
|
48
|
-
* The elevation of the building.
|
|
47
|
+
/**
|
|
48
|
+
* The elevation of the building.
|
|
49
49
|
*/
|
|
50
50
|
elevation: PropTypes.number,
|
|
51
51
|
|
|
52
|
-
/**
|
|
53
|
-
* Is the building selectable by the user ?
|
|
52
|
+
/**
|
|
53
|
+
* Is the building selectable by the user ?
|
|
54
54
|
*/
|
|
55
55
|
selected: PropTypes.bool,
|
|
56
56
|
|
|
57
|
-
/**
|
|
58
|
-
* touchable
|
|
57
|
+
/**
|
|
58
|
+
* touchable
|
|
59
59
|
*/
|
|
60
60
|
touchable: PropTypes.bool,
|
|
61
61
|
|
|
62
|
-
/**
|
|
63
|
-
* visible
|
|
62
|
+
/**
|
|
63
|
+
* visible
|
|
64
64
|
*/
|
|
65
65
|
visible: PropTypes.bool,
|
|
66
66
|
|
|
67
|
-
/**
|
|
68
|
-
* userData
|
|
67
|
+
/**
|
|
68
|
+
* userData
|
|
69
69
|
*/
|
|
70
70
|
userData: PropTypes.object,
|
|
71
71
|
|
|
72
|
-
/**
|
|
73
|
-
* Callback that is called when the user presses on the building
|
|
72
|
+
/**
|
|
73
|
+
* Callback that is called when the user presses on the building
|
|
74
74
|
*/
|
|
75
75
|
onPress: PropTypes.func
|
|
76
76
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","PropTypes","ViewPropTypes","requireNativeComponent","Platform","NativeModules","findNodeHandle","viewPropTypes","View","propTypes","name","string","coordinate","shape","latitude","number","isRequired","longitude","modelUrl","textureUrl","scale","bearing","elevation","selected","bool","touchable","visible","userData","object","onPress","func","MFBuilding","Component","constructor","props","_onPress","bind","_ref","event","stopPropagation","ref","building","setName","_runCommand","setScale","setBearing","setElevation","setSelected","setTouchable","setVisible","setUserData","_getHandle","args","OS","UIManager","dispatchViewManagerCommand","_uiManagerCommand","_mapManagerCommand","componentName","getViewManagerConfig","Commands","render","RMFBuilding"],"sources":["MFBuilding.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {ViewPropTypes} from 'deprecated-react-native-prop-types';\nimport {\n requireNativeComponent,\n Platform,\n NativeModules,\n findNodeHandle\n} from 'react-native';\n\n// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)\nconst viewPropTypes = ViewPropTypes || View.propTypes;\n\nconst propTypes = {\n ...viewPropTypes,\n\n /**\n * The name of the building.\n */\n name: PropTypes.string,\n\n /**\n * The position of the building\n */\n coordinate: PropTypes.shape({\n /**\n * Position for the building.\n */\n latitude: PropTypes.number.isRequired,\n longitude: PropTypes.number.isRequired,\n }),\n\n /**\n * The model URL for the building.\n */\n modelUrl: PropTypes.string,\n\n /**\n * The texture URL for the building.\n */\n textureUrl: PropTypes.string,\n\n /**\n * The scale of the building.\n */\n scale: PropTypes.number,\n\n /**\n * The bearing of the building.\n */\n bearing: PropTypes.number,\n\n /**\n * The elevation of the building.\n */\n elevation: PropTypes.number,\n\n /**\n * Is the building selectable by the user ?\n */\n selected: PropTypes.bool,\n\n /**\n * touchable\n */\n touchable: PropTypes.bool,\n\n /**\n * visible\n */\n visible: PropTypes.bool,\n\n /**\n * userData\n */\n userData:PropTypes.object,\n\n /**\n * Callback that is called when the user presses on the building\n */\n onPress: PropTypes.func,\n};\n\n\nclass MFBuilding extends React.Component {\n constructor(props) {\n super(props);\n this._onPress = this._onPress.bind(this)\n this._ref = this._ref.bind(this)\n }\n\n _onPress(event) {\n event.stopPropagation();\n if (this.props.onPress) {\n this.props.onPress(event);\n }\n }\n\n _ref(ref) {\n this.building = ref;\n }\n\n setName(name) {\n this._runCommand(\"setName\", [name])\n }\n\n setScale(scale) {\n this._runCommand(\"setScale\", [scale])\n }\n\n setBearing(bearing) {\n this._runCommand(\"setBearing\", [bearing])\n }\n\n setElevation(elevation) {\n this._runCommand(\"setElevation\", [elevation])\n }\n\n setSelected(selected) {\n this._runCommand(\"setSelected\", [selected])\n }\n\n setTouchable(touchable) {\n this._runCommand(\"setTouchable\", [touchable])\n }\n\n setVisible(visible) {\n this._runCommand(\"setVisible\", [visible])\n }\n\n setUserData(userData) {\n this._runCommand(\"setUserData\", [userData])\n }\n\n _getHandle() {\n return findNodeHandle(this.building);\n }\n\n _runCommand(name, args) {\n switch (Platform.OS) {\n case 'android':\n NativeModules.UIManager.dispatchViewManagerCommand(\n this._getHandle(),\n this._uiManagerCommand(name),\n args\n );\n break;\n\n case 'ios':\n this._mapManagerCommand(name)(this._getHandle(), ...args);\n break;\n\n default:\n break;\n }\n }\n\n _uiManagerCommand(name) {\n const UIManager = NativeModules.UIManager;\n const componentName = \"RMFBuilding\";\n\n if (!UIManager.getViewManagerConfig) {\n // RN < 0.58\n return UIManager[componentName].Commands[name];\n }\n\n // RN >= 0.58\n return UIManager.getViewManagerConfig(componentName).Commands[name];\n }\n\n _mapManagerCommand(name) {\n return NativeModules[`RMFBuilding`][name];\n }\n\n render() {\n return <RMFBuilding\n {...this.props}\n ref={this._ref}\n onPress={this._onPress}\n />;\n }\n}\n\nMFBuilding.propTypes = propTypes;\n\nvar RMFBuilding = requireNativeComponent(`RMFBuilding`, MFBuilding);\n\nexport { MFBuilding }"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAAQC,aAAR,QAA4B,oCAA5B;AACA,SACEC,sBADF,EAEEC,QAFF,EAGEC,aAHF,EAIEC,cAJF,QAKO,cALP,C,CAOA;;AACA,MAAMC,aAAa,GAAGL,aAAa,IAAIM,IAAI,CAACC,SAA5C;AAEA,MAAMA,SAAS,GAAG,EAChB,GAAGF,aADa;;EAGhB;AACF;AACA;EACEG,IAAI,EAAET,SAAS,CAACU,MANA;;EAQhB;AACF;AACA;EACEC,UAAU,EAAEX,SAAS,CAACY,KAAV,CAAgB;IAC1B;AACJ;AACA;IACIC,QAAQ,EAAEb,SAAS,CAACc,MAAV,CAAiBC,UAJD;IAK1BC,SAAS,EAAEhB,SAAS,CAACc,MAA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SAAhC;IACA,MAAMI,aAAa,GAAG,aAAtB;;IAEA,IAAI,CAACJ,SAAS,CAACK,oBAAf,EAAqC;MACnC;MACA,OAAOL,SAAS,CAACI,aAAD,CAAT,CAAyBE,QAAzB,CAAkClD,IAAlC,CAAP;IACD,CAPqB,CAStB;;;IACA,OAAO4C,SAAS,CAACK,oBAAV,CAA+BD,aAA/B,EAA8CE,QAA9C,CAAuDlD,IAAvD,CAAP;EACD;;EAED+C,kBAAkB,CAAC/C,IAAD,EAAO;IACvB,OAAOL,aAAa,CAAE,aAAF,CAAb,CAA6BK,IAA7B,CAAP;EACD;;EAEDmD,MAAM,GAAG;IACP,oBAAO,oBAAC,WAAD,eACD,KAAK3B,KADJ;MAEL,GAAG,EAAE,KAAKG,IAFL;MAGL,OAAO,EAAE,KAAKF;IAHT,GAAP;EAKD;;AAhGsC;;AAmGzCJ,UAAU,CAACtB,SAAX,GAAuBA,SAAvB;AAEA,IAAIqD,WAAW,GAAG3D,sBAAsB,CAAE,aAAF,EAAgB4B,UAAhB,CAAxC;AAEA,SAASA,UAAT"}
|
|
1
|
+
{"version":3,"names":["React","PropTypes","ViewPropTypes","requireNativeComponent","Platform","NativeModules","findNodeHandle","viewPropTypes","View","propTypes","name","string","coordinate","shape","latitude","number","isRequired","longitude","modelUrl","textureUrl","scale","bearing","elevation","selected","bool","touchable","visible","userData","object","onPress","func","MFBuilding","Component","constructor","props","_onPress","bind","_ref","event","stopPropagation","ref","building","setName","_runCommand","setScale","setBearing","setElevation","setSelected","setTouchable","setVisible","setUserData","_getHandle","args","OS","UIManager","dispatchViewManagerCommand","_uiManagerCommand","_mapManagerCommand","componentName","getViewManagerConfig","Commands","render","RMFBuilding"],"sources":["MFBuilding.js"],"sourcesContent":["import React from 'react';\r\nimport PropTypes from 'prop-types';\r\nimport {ViewPropTypes} from 'deprecated-react-native-prop-types';\r\nimport {\r\n requireNativeComponent,\r\n Platform,\r\n NativeModules,\r\n findNodeHandle\r\n} from 'react-native';\r\n\r\n// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)\r\nconst viewPropTypes = ViewPropTypes || View.propTypes;\r\n\r\nconst propTypes = {\r\n ...viewPropTypes,\r\n\r\n /**\r\n * The name of the building.\r\n */\r\n name: PropTypes.string,\r\n\r\n /**\r\n * The position of the building\r\n */\r\n coordinate: PropTypes.shape({\r\n /**\r\n * Position for the building.\r\n */\r\n latitude: PropTypes.number.isRequired,\r\n longitude: PropTypes.number.isRequired,\r\n }),\r\n\r\n /**\r\n * The model URL for the building.\r\n */\r\n modelUrl: PropTypes.string,\r\n\r\n /**\r\n * The texture URL for the building.\r\n */\r\n textureUrl: PropTypes.string,\r\n\r\n /**\r\n * The scale of the building.\r\n */\r\n scale: PropTypes.number,\r\n\r\n /**\r\n * The bearing of the building.\r\n */\r\n bearing: PropTypes.number,\r\n\r\n /**\r\n * The elevation of the building.\r\n */\r\n elevation: PropTypes.number,\r\n\r\n /**\r\n * Is the building selectable by the user ?\r\n */\r\n selected: PropTypes.bool,\r\n\r\n /**\r\n * touchable\r\n */\r\n touchable: PropTypes.bool,\r\n\r\n /**\r\n * visible\r\n */\r\n visible: PropTypes.bool,\r\n\r\n /**\r\n * userData\r\n */\r\n userData:PropTypes.object,\r\n\r\n /**\r\n * Callback that is called when the user presses on the building\r\n */\r\n onPress: PropTypes.func,\r\n};\r\n\r\n\r\nclass MFBuilding extends React.Component {\r\n constructor(props) {\r\n super(props);\r\n this._onPress = this._onPress.bind(this)\r\n this._ref = this._ref.bind(this)\r\n }\r\n\r\n _onPress(event) {\r\n event.stopPropagation();\r\n if (this.props.onPress) {\r\n this.props.onPress(event);\r\n }\r\n }\r\n\r\n _ref(ref) {\r\n this.building = ref;\r\n }\r\n\r\n setName(name) {\r\n this._runCommand(\"setName\", [name])\r\n }\r\n\r\n setScale(scale) {\r\n this._runCommand(\"setScale\", [scale])\r\n }\r\n\r\n setBearing(bearing) {\r\n this._runCommand(\"setBearing\", [bearing])\r\n }\r\n\r\n setElevation(elevation) {\r\n this._runCommand(\"setElevation\", [elevation])\r\n }\r\n\r\n setSelected(selected) {\r\n this._runCommand(\"setSelected\", [selected])\r\n }\r\n\r\n setTouchable(touchable) {\r\n this._runCommand(\"setTouchable\", [touchable])\r\n }\r\n\r\n setVisible(visible) {\r\n this._runCommand(\"setVisible\", [visible])\r\n }\r\n\r\n setUserData(userData) {\r\n this._runCommand(\"setUserData\", [userData])\r\n }\r\n\r\n _getHandle() {\r\n return findNodeHandle(this.building);\r\n }\r\n\r\n _runCommand(name, args) {\r\n switch (Platform.OS) {\r\n case 'android':\r\n NativeModules.UIManager.dispatchViewManagerCommand(\r\n this._getHandle(),\r\n this._uiManagerCommand(name),\r\n args\r\n );\r\n break;\r\n\r\n case 'ios':\r\n this._mapManagerCommand(name)(this._getHandle(), ...args);\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n }\r\n\r\n _uiManagerCommand(name) {\r\n const UIManager = NativeModules.UIManager;\r\n const componentName = \"RMFBuilding\";\r\n\r\n if (!UIManager.getViewManagerConfig) {\r\n // RN < 0.58\r\n return UIManager[componentName].Commands[name];\r\n }\r\n\r\n // RN >= 0.58\r\n return UIManager.getViewManagerConfig(componentName).Commands[name];\r\n }\r\n\r\n _mapManagerCommand(name) {\r\n return NativeModules[`RMFBuilding`][name];\r\n }\r\n\r\n render() {\r\n return <RMFBuilding\r\n {...this.props}\r\n ref={this._ref}\r\n onPress={this._onPress}\r\n />;\r\n }\r\n}\r\n\r\nMFBuilding.propTypes = propTypes;\r\n\r\nvar RMFBuilding = requireNativeComponent(`RMFBuilding`, MFBuilding);\r\n\r\nexport { MFBuilding }"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAAQC,aAAR,QAA4B,oCAA5B;AACA,SACEC,sBADF,EAEEC,QAFF,EAGEC,aAHF,EAIEC,cAJF,QAKO,cALP,C,CAOA;;AACA,MAAMC,aAAa,GAAGL,aAAa,IAAIM,IA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EADF,EAEE,KAAKK,iBAAL,CAAuB9C,IAAvB,CAFF,EAGE0C,IAHF;QAKA;;MAEF,KAAK,KAAL;QACE,KAAKK,kBAAL,CAAwB/C,IAAxB,EAA8B,KAAKyC,UAAL,EAA9B,EAAiD,GAAGC,IAApD;;QACA;;MAEF;QACE;IAdJ;EAgBD;;EAEDI,iBAAiB,CAAC9C,IAAD,EAAO;IACtB,MAAM4C,SAAS,GAAGjD,aAAa,CAACiD,SAAhC;IACA,MAAMI,aAAa,GAAG,aAAtB;;IAEA,IAAI,CAACJ,SAAS,CAACK,oBAAf,EAAqC;MACnC;MACA,OAAOL,SAAS,CAACI,aAAD,CAAT,CAAyBE,QAAzB,CAAkClD,IAAlC,CAAP;IACD,CAPqB,CAStB;;;IACA,OAAO4C,SAAS,CAACK,oBAAV,CAA+BD,aAA/B,EAA8CE,QAA9C,CAAuDlD,IAAvD,CAAP;EACD;;EAED+C,kBAAkB,CAAC/C,IAAD,EAAO;IACvB,OAAOL,aAAa,CAAE,aAAF,CAAb,CAA6BK,IAA7B,CAAP;EACD;;EAEDmD,MAAM,GAAG;IACP,oBAAO,oBAAC,WAAD,eACD,KAAK3B,KADJ;MAEL,GAAG,EAAE,KAAKG,IAFL;MAGL,OAAO,EAAE,KAAKF;IAHT,GAAP;EAKD;;AAhGsC;;AAmGzCJ,UAAU,CAACtB,SAAX,GAAuBA,SAAvB;AAEA,IAAIqD,WAAW,GAAG3D,sBAAsB,CAAE,aAAF,EAAgB4B,UAAhB,CAAxC;AAEA,SAASA,UAAT"}
|
|
@@ -8,54 +8,54 @@ import { requireNativeComponent, Platform, NativeModules, findNodeHandle, proces
|
|
|
8
8
|
const viewPropTypes = ViewPropTypes || View.propTypes;
|
|
9
9
|
const propTypes = { ...viewPropTypes,
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* The coordinate of the center of the circle
|
|
11
|
+
/**
|
|
12
|
+
* The coordinate of the center of the circle
|
|
13
13
|
*/
|
|
14
14
|
center: PropTypes.shape({
|
|
15
|
-
/**
|
|
16
|
-
* Coordinates for the center of the circle.
|
|
15
|
+
/**
|
|
16
|
+
* Coordinates for the center of the circle.
|
|
17
17
|
*/
|
|
18
18
|
latitude: PropTypes.number.isRequired,
|
|
19
19
|
longitude: PropTypes.number.isRequired
|
|
20
20
|
}).isRequired,
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* The radius of the circle to be drawn (in meters)
|
|
22
|
+
/**
|
|
23
|
+
* The radius of the circle to be drawn (in meters)
|
|
24
24
|
*/
|
|
25
25
|
radius: PropTypes.number.isRequired,
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
* The stroke width to use for the circle.
|
|
27
|
+
/**
|
|
28
|
+
* The stroke width to use for the circle.
|
|
29
29
|
*/
|
|
30
30
|
strokeWidth: PropTypes.number,
|
|
31
31
|
|
|
32
|
-
/**
|
|
33
|
-
* The stroke color to use for the circle.
|
|
32
|
+
/**
|
|
33
|
+
* The stroke color to use for the circle.
|
|
34
34
|
*/
|
|
35
35
|
strokeColor: ColorPropType,
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
* The fill color to use for the circle.
|
|
37
|
+
/**
|
|
38
|
+
* The fill color to use for the circle.
|
|
39
39
|
*/
|
|
40
40
|
fillColor: ColorPropType,
|
|
41
41
|
|
|
42
|
-
/**
|
|
43
|
-
* zIndex
|
|
42
|
+
/**
|
|
43
|
+
* zIndex
|
|
44
44
|
*/
|
|
45
45
|
zIndex: PropTypes.number,
|
|
46
46
|
|
|
47
|
-
/**
|
|
48
|
-
* visible
|
|
47
|
+
/**
|
|
48
|
+
* visible
|
|
49
49
|
*/
|
|
50
50
|
visible: PropTypes.bool,
|
|
51
51
|
|
|
52
|
-
/**
|
|
53
|
-
* userData
|
|
52
|
+
/**
|
|
53
|
+
* userData
|
|
54
54
|
*/
|
|
55
55
|
userData: PropTypes.object,
|
|
56
56
|
|
|
57
|
-
/**
|
|
58
|
-
* Callback that is called when the user presses on the circle
|
|
57
|
+
/**
|
|
58
|
+
* Callback that is called when the user presses on the circle
|
|
59
59
|
*/
|
|
60
60
|
onPress: PropTypes.func
|
|
61
61
|
}; // const defaultProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PropTypes","React","ViewPropTypes","ColorPropType","requireNativeComponent","Platform","NativeModules","findNodeHandle","processColor","viewPropTypes","View","propTypes","center","shape","latitude","number","isRequired","longitude","radius","strokeWidth","strokeColor","fillColor","zIndex","visible","bool","userData","object","onPress","func","MFCircle","Component","constructor","props","_onPress","bind","_ref","setCenter","_runCommand","setRadius","setFillColor","color","setStrokeColor","setStrokeWidth","width","setUserData","setZIndex","setVisible","_getHandle","circle","name","args","OS","UIManager","dispatchViewManagerCommand","_uiManagerCommand","_mapManagerCommand","componentName","getViewManagerConfig","Commands","event","stopPropagation","ref","render","RMFCircle"],"sources":["MFCircle.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport {ViewPropTypes, ColorPropType} from 'deprecated-react-native-prop-types';\nimport {\n requireNativeComponent,\n Platform,\n NativeModules,\n findNodeHandle,\n processColor\n} from 'react-native';\n\n// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)\nconst viewPropTypes = ViewPropTypes || View.propTypes;\n\nconst propTypes = {\n ...viewPropTypes,\n\n /**\n * The coordinate of the center of the circle\n */\n center: PropTypes.shape({\n /**\n * Coordinates for the center of the circle.\n */\n latitude: PropTypes.number.isRequired,\n longitude: PropTypes.number.isRequired,\n }).isRequired,\n\n /**\n * The radius of the circle to be drawn (in meters)\n */\n radius: PropTypes.number.isRequired,\n\n /**\n * The stroke width to use for the circle.\n */\n strokeWidth: PropTypes.number,\n\n /**\n * The stroke color to use for the circle.\n */\n strokeColor: ColorPropType,\n\n /**\n * The fill color to use for the circle.\n */\n fillColor: ColorPropType,\n\n /**\n * zIndex\n */\n zIndex: PropTypes.number,\n\n /**\n * visible\n */\n visible: PropTypes.bool,\n\n /**\n * userData\n */\n userData:PropTypes.object,\n\n /**\n * Callback that is called when the user presses on the circle\n */\n onPress: PropTypes.func,\n};\n\n// const defaultProps = {\n// strokeColor: '#000',\n// strokeWidth: 1,\n// };\n\nclass MFCircle extends React.Component {\n constructor(props) {\n super(props);\n this._onPress = this._onPress.bind(this)\n this._ref = this._ref.bind(this)\n }\n\n setCenter(center) {\n this._runCommand(\"setCenter\", [center])\n }\n setRadius(radius) {\n this._runCommand(\"setRadius\", [radius])\n }\n setFillColor(color) {\n this._runCommand(\"setFillColor\", [processColor(color)])\n }\n setStrokeColor(color) {\n this._runCommand(\"setStrokeColor\", [processColor(color)])\n }\n setStrokeWidth(width) {\n this._runCommand(\"setStrokeWidth\", [width])\n }\n setUserData(userData) {\n this._runCommand(\"setUserData\", [userData])\n }\n setZIndex(zIndex) {\n this._runCommand(\"setZIndex\", [zIndex])\n }\n setVisible(visible) {\n this._runCommand(\"setVisible\", [visible])\n }\n\n _getHandle() {\n return findNodeHandle(this.circle);\n }\n\n\n _runCommand(name, args) {\n switch (Platform.OS) {\n case 'android':\n NativeModules.UIManager.dispatchViewManagerCommand(\n this._getHandle(),\n this._uiManagerCommand(name),\n args\n );\n break;\n\n case 'ios':\n this._mapManagerCommand(name)(this._getHandle(), ...args);\n break;\n\n default:\n break;\n }\n }\n\n _uiManagerCommand(name) {\n const UIManager = NativeModules.UIManager;\n const componentName = \"RMFCircle\";\n\n if (!UIManager.getViewManagerConfig) {\n // RN < 0.58\n return UIManager[componentName].Commands[name];\n }\n\n // RN >= 0.58 \n return UIManager.getViewManagerConfig(componentName).Commands[name];\n }\n \n _mapManagerCommand(name) {\n return NativeModules[`RMFCircle`][name];\n }\n\n _onPress(event) {\n event.stopPropagation();\n if (this.props.onPress) {\n this.props.onPress(event);\n }\n }\n\n _ref(ref) {\n this.circle = ref;\n }\n\n render() {\n return <RMFCircle\n {...this.props}\n ref={this._ref}\n onPress={this._onPress}\n />;\n }\n}\n\nMFCircle.propTypes = propTypes;\n// MFCircle.defaultProps = defaultProps;\n\nvar RMFCircle = requireNativeComponent(`RMFCircle`, MFCircle);\n\nexport {MFCircle}\n"],"mappings":";;AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAAQC,aAAR,EAAuBC,aAAvB,QAA2C,oCAA3C;AACA,SACEC,sBADF,EAEEC,QAFF,EAGEC,aAHF,EAIEC,cAJF,EAKEC,YALF,QAMO,cANP,C,CAQA;;AACA,MAAMC,aAAa,GAAGP,aAAa,IAAIQ,IAAI,CAACC,SAA5C;AAEA,MAAMA,SAAS,GAAG,EAChB,GAAGF,aADa;;EAGhB;AACF;AACA;EACEG,MAAM,EAAEZ,SAAS,CAACa,KAAV,CAAgB;IACtB;AACJ;AACA;IACIC,QAAQ,EAAEd,SAAS,CAACe,MAAV,CAAiBC,UAJL;IAKtBC,SAAS,EAAEjB,SAAS,CAACe,MAAV,CAAiBC;EALN,CAAhB,EAMLA,UAZa;;EAchB;AACF;AACA;EACEE,MAAM,EAAElB,SAAS,CAACe,MAAV,CAAiBC,UAjBT;;EAmBhB;AACF;AACA;EACEG,WAAW,EAAEnB,SAAS,CAACe,MAtBP;;EAwBhB;AACF;AACA;EACEK,WAAW,EAAEjB,aA3BG;;EA6BhB;AACF;AACA;EACEkB,SAAS,EAAElB,aAhCK;;EAkChB;AACF;AACA;EACEmB,MAAM,EAAEtB,SAAS,CAACe,MArCF;;EAuChB;AACF;AACA;EACEQ,OAAO,EAAEvB,SAAS,CAACwB,IA1CH;;EA4ChB;AACF;AACA;EACEC,QAAQ,EAACzB,SAAS,CAAC0B,MA/CH;;EAiDhB;AACF;AACA;EACEC,OAAO,EAAE3B,SAAS,CAAC4B;AApDH,CAAlB,C,CAuDA;AACA;AACA;AACA;;AAEA,MAAMC,QAAN,SAAuB5B,KAAK,CAAC6B,SAA7B,CAAuC;EACrCC,WAAW,CAACC,KAAD,EAAQ;IACjB,MAAMA,KAAN;IACA,KAAKC,QAAL,GAAgB,KAAKA,QAAL,C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EC,IAHF;QAKA;;MAEF,KAAK,KAAL;QACE,KAAKK,kBAAL,CAAwBN,IAAxB,EAA8B,KAAKF,UAAL,EAA9B,EAAiD,GAAGG,IAApD;;QACA;;MAEF;QACE;IAdJ;EAgBD;;EAEDI,iBAAiB,CAACL,IAAD,EAAO;IACtB,MAAMG,SAAS,GAAG9C,aAAa,CAAC8C,SAAhC;IACA,MAAMI,aAAa,GAAG,WAAtB;;IAEA,IAAI,CAACJ,SAAS,CAACK,oBAAf,EAAqC;MACnC;MACA,OAAOL,SAAS,CAACI,aAAD,CAAT,CAAyBE,QAAzB,CAAkCT,IAAlC,CAAP;IACD,CAPqB,CAStB;;;IACA,OAAOG,SAAS,CAACK,oBAAV,CAA+BD,aAA/B,EAA8CE,QAA9C,CAAuDT,IAAvD,CAAP;EACD;;EAEDM,kBAAkB,CAACN,IAAD,EAAO;IACvB,OAAO3C,aAAa,CAAE,WAAF,CAAb,CAA2B2C,IAA3B,CAAP;EACD;;EAEDhB,QAAQ,CAAC0B,KAAD,EAAQ;IACdA,KAAK,CAACC,eAAN;;IACE,IAAI,KAAK5B,KAAL,CAAWL,OAAf,EAAwB;MACtB,KAAKK,KAAL,CAAWL,OAAX,CAAmBgC,KAAnB;IACH;EACF;;EAEDxB,IAAI,CAAC0B,GAAD,EAAM;IACR,KAAKb,MAAL,GAAca,GAAd;EACD;;EAEDC,MAAM,GAAG;IACP,oBAAO,oBAAC,SAAD,eACD,KAAK9B,KADJ;MAEL,GAAG,EAAE,KAAKG,IAFL;MAGL,OAAO,EAAE,KAAKF;IAHT,GAAP;EAKD;;AA1FoC;;AA6FvCJ,QAAQ,CAAClB,SAAT,GAAqBA,SAArB,C,CACA;;AAEA,IAAIoD,SAAS,GAAG3D,sBAAsB,CAAE,WAAF,EAAcyB,QAAd,CAAtC;AAEA,SAAQA,QAAR"}
|
|
1
|
+
{"version":3,"names":["PropTypes","React","ViewPropTypes","ColorPropType","requireNativeComponent","Platform","NativeModules","findNodeHandle","processColor","viewPropTypes","View","propTypes","center","shape","latitude","number","isRequired","longitude","radius","strokeWidth","strokeColor","fillColor","zIndex","visible","bool","userData","object","onPress","func","MFCircle","Component","constructor","props","_onPress","bind","_ref","setCenter","_runCommand","setRadius","setFillColor","color","setStrokeColor","setStrokeWidth","width","setUserData","setZIndex","setVisible","_getHandle","circle","name","args","OS","UIManager","dispatchViewManagerCommand","_uiManagerCommand","_mapManagerCommand","componentName","getViewManagerConfig","Commands","event","stopPropagation","ref","render","RMFCircle"],"sources":["MFCircle.js"],"sourcesContent":["import PropTypes from 'prop-types';\r\nimport React from 'react';\r\nimport {ViewPropTypes, ColorPropType} from 'deprecated-react-native-prop-types';\r\nimport {\r\n requireNativeComponent,\r\n Platform,\r\n NativeModules,\r\n findNodeHandle,\r\n processColor\r\n} from 'react-native';\r\n\r\n// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)\r\nconst viewPropTypes = ViewPropTypes || View.propTypes;\r\n\r\nconst propTypes = {\r\n ...viewPropTypes,\r\n\r\n /**\r\n * The coordinate of the center of the circle\r\n */\r\n center: PropTypes.shape({\r\n /**\r\n * Coordinates for the center of the circle.\r\n */\r\n latitude: PropTypes.number.isRequired,\r\n longitude: PropTypes.number.isRequired,\r\n }).isRequired,\r\n\r\n /**\r\n * The radius of the circle to be drawn (in meters)\r\n */\r\n radius: PropTypes.number.isRequired,\r\n\r\n /**\r\n * The stroke width to use for the circle.\r\n */\r\n strokeWidth: PropTypes.number,\r\n\r\n /**\r\n * The stroke color to use for the circle.\r\n */\r\n strokeColor: ColorPropType,\r\n\r\n /**\r\n * The fill color to use for the circle.\r\n */\r\n fillColor: ColorPropType,\r\n\r\n /**\r\n * zIndex\r\n */\r\n zIndex: PropTypes.number,\r\n\r\n /**\r\n * visible\r\n */\r\n visible: PropTypes.bool,\r\n\r\n /**\r\n * userData\r\n */\r\n userData:PropTypes.object,\r\n\r\n /**\r\n * Callback that is called when the user presses on the circle\r\n */\r\n onPress: PropTypes.func,\r\n};\r\n\r\n// const defaultProps = {\r\n// strokeColor: '#000',\r\n// strokeWidth: 1,\r\n// };\r\n\r\nclass MFCircle extends React.Component {\r\n constructor(props) {\r\n super(props);\r\n this._onPress = this._onPress.bind(this)\r\n this._ref = this._ref.bind(this)\r\n }\r\n\r\n setCenter(center) {\r\n this._runCommand(\"setCenter\", [center])\r\n }\r\n setRadius(radius) {\r\n this._runCommand(\"setRadius\", [radius])\r\n }\r\n setFillColor(color) {\r\n this._runCommand(\"setFillColor\", [processColor(color)])\r\n }\r\n setStrokeColor(color) {\r\n this._runCommand(\"setStrokeColor\", [processColor(color)])\r\n }\r\n setStrokeWidth(width) {\r\n this._runCommand(\"setStrokeWidth\", [width])\r\n }\r\n setUserData(userData) {\r\n this._runCommand(\"setUserData\", [userData])\r\n }\r\n setZIndex(zIndex) {\r\n this._runCommand(\"setZIndex\", [zIndex])\r\n }\r\n setVisible(visible) {\r\n this._runCommand(\"setVisible\", [visible])\r\n }\r\n\r\n _getHandle() {\r\n return findNodeHandle(this.circle);\r\n }\r\n\r\n\r\n _runCommand(name, args) {\r\n switch (Platform.OS) {\r\n case 'android':\r\n NativeModules.UIManager.dispatchViewManagerCommand(\r\n this._getHandle(),\r\n this._uiManagerCommand(name),\r\n args\r\n );\r\n break;\r\n\r\n case 'ios':\r\n this._mapManagerCommand(name)(this._getHandle(), ...args);\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n }\r\n\r\n _uiManagerCommand(name) {\r\n const UIManager = NativeModules.UIManager;\r\n const componentName = \"RMFCircle\";\r\n\r\n if (!UIManager.getViewManagerConfig) {\r\n // RN < 0.58\r\n return UIManager[componentName].Commands[name];\r\n }\r\n\r\n // RN >= 0.58 \r\n return UIManager.getViewManagerConfig(componentName).Commands[name];\r\n }\r\n \r\n _mapManagerCommand(name) {\r\n return NativeModules[`RMFCircle`][name];\r\n }\r\n\r\n _onPress(event) {\r\n event.stopPropagation();\r\n if (this.props.onPress) {\r\n this.props.onPress(event);\r\n }\r\n }\r\n\r\n _ref(ref) {\r\n this.circle = ref;\r\n }\r\n\r\n render() {\r\n return <RMFCircle\r\n {...this.props}\r\n ref={this._ref}\r\n onPress={this._onPress}\r\n />;\r\n }\r\n}\r\n\r\nMFCircle.propTypes = propTypes;\r\n// MFCircle.defaultProps = defaultProps;\r\n\r\nvar RMFCircle = requireNativeComponent(`RMFCircle`, MFCircle);\r\n\r\nexport {MFCircle}\r\n"],"mappings":";;AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAAQC,aAAR,EAAuBC,aAAvB,QAA2C,oCAA3C;AACA,SACEC,sBADF,EAEEC,QAFF,EAGEC,aAHF,EAIEC,cAJF,EAKEC,YALF,QAMO,cANP,C,CAQA;;AACA,MAAMC,aAAa,GAAGP,aAAa,IAAIQ,IAAI,CAACC,SAA5C;AAEA,MAAMA,SAAS,GAAG,EAChB,GAAGF,aADa;;EAGhB;AACF;AACA;EACEG,MAAM,EAAEZ,SAAS,CAACa,KAAV,CAAgB;IACtB;AACJ;AACA;IACIC,QAAQ,EAAEd,SAAS,CAACe,MAAV,CAAiBC,UAJL;IAKtBC,SAAS,EAAEjB,SAAS,CAACe,MAAV,CAAiBC;EALN,CAAhB,EAMLA,UAZa;;EAchB;AACF;AACA;EACEE,MAAM,EAAElB,SAAS,CAACe,MAAV,CAAiBC,UAjBT;;EAmBhB;AACF;AACA;EACEG,WAAW,EAAEnB,SAAS,CAACe,MAtBP;;EAwBhB;AACF;AACA;EACEK,WAAW,EAAEjB,aA3BG;;EA6BhB;AACF;AACA;EACEkB,SAAS,EAAElB,aAhCK;;EAkChB;AACF;AACA;EACEmB,MAAM,EAAEtB,SAAS,CAACe,MArCF;;EAuChB;AACF;AACA;EACEQ,OAAO,EAAEvB,SAAS,CAACwB,IA1CH;;EA4ChB;AACF;AACA;EACEC,QAAQ,EAACzB,SAAS,CAAC0B,MA/CH;;EAiDhB;AACF;AACA;EACEC,OAAO,EAAE3B,SAAS,CAA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