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,302 @@
|
|
|
1
|
+
export class AreaFocuser {
|
|
2
|
+
constructor(mapView) {
|
|
3
|
+
this.mapView = mapView;
|
|
4
|
+
this.highlightPaths = [];
|
|
5
|
+
this.highlightPolygonId = 'area-focuser-highlight-polygon';
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @param {{name?: string, highlight?: boolean}=} options
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
async focusProvince(options) {
|
|
13
|
+
const provinceName = this.getProvinceName(options);
|
|
14
|
+
const shouldHighlight = this.shouldHighlight(options);
|
|
15
|
+
|
|
16
|
+
if (!provinceName) {
|
|
17
|
+
this.clearHighlightPaths();
|
|
18
|
+
this.clearHighlightPolygon();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const url = `https://api-app-cdtqg.map4d.vn/map/country/geometry?name=${encodeURIComponent(provinceName)}`;
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
const response = await fetch(url);
|
|
26
|
+
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const data = await response.json();
|
|
32
|
+
|
|
33
|
+
if (data.code !== 'ok') {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const feature = data.result && data.result.features && data.result.features.length > 0 ? data.result.features[0] : null;
|
|
38
|
+
|
|
39
|
+
if (!feature) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const geometry = feature.geometry;
|
|
44
|
+
|
|
45
|
+
if (!geometry) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let bounds = null;
|
|
50
|
+
const viewbox = feature.properties && feature.properties.viewbox ? feature.properties.viewbox : null;
|
|
51
|
+
|
|
52
|
+
if (viewbox != null && viewbox.trim() != '') {
|
|
53
|
+
bounds = this.parseViewbox(viewbox);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!bounds) {
|
|
57
|
+
bounds = this.getViewboxFromGeometry(geometry);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!bounds) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
this.mapView.fitBounds({
|
|
65
|
+
bounds: {
|
|
66
|
+
southWest: {
|
|
67
|
+
latitude: bounds[0],
|
|
68
|
+
longitude: bounds[1]
|
|
69
|
+
},
|
|
70
|
+
northEast: {
|
|
71
|
+
latitude: bounds[2],
|
|
72
|
+
longitude: bounds[3]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
this.createHighlightPaths(geometry);
|
|
77
|
+
|
|
78
|
+
if (shouldHighlight) {
|
|
79
|
+
const polygon = this.getHighlightPolygonProps();
|
|
80
|
+
|
|
81
|
+
if (polygon) {
|
|
82
|
+
this.mapView._addPolygon({ ...polygon,
|
|
83
|
+
id: this.highlightPolygonId,
|
|
84
|
+
zIndex: 999
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
this.clearHighlightPolygon();
|
|
89
|
+
}
|
|
90
|
+
} catch (error) {
|
|
91
|
+
console.error('Cannot focus province:', error);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
getProvinceName(options) {
|
|
96
|
+
if (options == null || typeof options !== 'object') {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (typeof options.name === 'string') {
|
|
101
|
+
return options.name.trim();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const optionKeys = Object.keys(options);
|
|
105
|
+
const unsupportedKeys = optionKeys.filter(key => key !== 'name' && key !== 'highlight');
|
|
106
|
+
|
|
107
|
+
if (unsupportedKeys.length > 0) {
|
|
108
|
+
console.warn(`[AreaFocuser] focusProvince expects options like { name: 'Ha Noi', highlight: true }. Unsupported keys: ${unsupportedKeys.join(', ')}`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
shouldHighlight(options) {
|
|
115
|
+
if (options == null || typeof options !== 'object') {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return options.highlight === true;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
parseViewbox(viewbox) {
|
|
123
|
+
const bounds = viewbox.split(',').map(Number);
|
|
124
|
+
|
|
125
|
+
if (bounds.length != 4) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const [minLat, minLng, maxLat, maxLng] = bounds;
|
|
130
|
+
|
|
131
|
+
if (Number.isNaN(minLat) || Number.isNaN(minLng) || Number.isNaN(maxLat) || Number.isNaN(maxLng)) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return [minLat, minLng, maxLat, maxLng];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
getViewboxFromGeometry(geometry) {
|
|
139
|
+
const bounds = {
|
|
140
|
+
minLat: Infinity,
|
|
141
|
+
minLng: Infinity,
|
|
142
|
+
maxLat: -Infinity,
|
|
143
|
+
maxLng: -Infinity
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const updateBounds = function (coordinate) {
|
|
147
|
+
if (coordinate.length < 2) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const lng = coordinate[0];
|
|
152
|
+
const lat = coordinate[1];
|
|
153
|
+
|
|
154
|
+
if (Number.isNaN(lat) || Number.isNaN(lng)) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
bounds.minLat = Math.min(bounds.minLat, lat);
|
|
159
|
+
bounds.minLng = Math.min(bounds.minLng, lng);
|
|
160
|
+
bounds.maxLat = Math.max(bounds.maxLat, lat);
|
|
161
|
+
bounds.maxLng = Math.max(bounds.maxLng, lng);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
if (geometry.type === 'Polygon') {
|
|
165
|
+
const polygons = geometry.coordinates;
|
|
166
|
+
polygons.forEach(function (ring) {
|
|
167
|
+
ring.forEach(function (coordinate) {
|
|
168
|
+
updateBounds(coordinate);
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (geometry.type === 'MultiPolygon') {
|
|
174
|
+
const multiPolygons = geometry.coordinates;
|
|
175
|
+
multiPolygons.forEach(function (polygon) {
|
|
176
|
+
polygon.forEach(function (ring) {
|
|
177
|
+
ring.forEach(function (coordinate) {
|
|
178
|
+
updateBounds(coordinate);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (bounds.minLat === Infinity || bounds.minLng === Infinity || bounds.maxLat === -Infinity || bounds.maxLng === -Infinity) {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return [bounds.minLat, bounds.minLng, bounds.maxLat, bounds.maxLng];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
createHighlightPaths(geometry) {
|
|
192
|
+
this.clearHighlightPaths();
|
|
193
|
+
const paths = this.createWorldMaskPaths(geometry);
|
|
194
|
+
|
|
195
|
+
if (paths.length <= 1) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
this.highlightPaths = paths;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
clearHighlightPaths() {
|
|
203
|
+
this.highlightPaths = [];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
clearHighlightPolygon() {
|
|
207
|
+
if (!this.mapView) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
this.mapView._removePolygon(this.highlightPolygonId);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
getHighlightPolygonProps() {
|
|
215
|
+
if (!this.highlightPaths || this.highlightPaths.length <= 1) {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const [coordinates, ...holes] = this.highlightPaths;
|
|
220
|
+
return {
|
|
221
|
+
coordinates,
|
|
222
|
+
holes,
|
|
223
|
+
fillColor: "#0000001E",
|
|
224
|
+
strokeColor: "#FF0000FF",
|
|
225
|
+
strokeWidth: 2.0
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
createWorldMaskPaths(geometry) {
|
|
230
|
+
const worldPath = [{
|
|
231
|
+
longitude: -180,
|
|
232
|
+
latitude: -90
|
|
233
|
+
}, {
|
|
234
|
+
longitude: 180,
|
|
235
|
+
latitude: -90
|
|
236
|
+
}, {
|
|
237
|
+
longitude: 180,
|
|
238
|
+
latitude: 90
|
|
239
|
+
}, {
|
|
240
|
+
longitude: -180,
|
|
241
|
+
latitude: 90
|
|
242
|
+
}, {
|
|
243
|
+
longitude: -180,
|
|
244
|
+
latitude: -90
|
|
245
|
+
}];
|
|
246
|
+
const paths = [worldPath];
|
|
247
|
+
const holes = this.getHolePathsFromGeometry(geometry);
|
|
248
|
+
holes.forEach(hole => {
|
|
249
|
+
paths.push(hole);
|
|
250
|
+
});
|
|
251
|
+
return paths;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
getHolePathsFromGeometry(geometry) {
|
|
255
|
+
const paths = [];
|
|
256
|
+
|
|
257
|
+
if (geometry.type == 'Polygon') {
|
|
258
|
+
const polygon = geometry.coordinates;
|
|
259
|
+
|
|
260
|
+
if (polygon.length > 0) {
|
|
261
|
+
paths.push(this.convertAndClosePath(polygon[0]));
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (geometry.type == 'MultiPolygon') {
|
|
266
|
+
const multiPolygon = geometry.coordinates;
|
|
267
|
+
multiPolygon.forEach(polygon => {
|
|
268
|
+
if (polygon.length > 0) {
|
|
269
|
+
paths.push(this.convertAndClosePath(polygon[0]));
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return paths;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
convertAndClosePath(path) {
|
|
278
|
+
if (path.length == 0) {
|
|
279
|
+
return [];
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const coordinatePath = path.filter(point => point.length >= 2).map(point => ({
|
|
283
|
+
latitude: point[1],
|
|
284
|
+
longitude: point[0]
|
|
285
|
+
}));
|
|
286
|
+
|
|
287
|
+
if (coordinatePath.length == 0) {
|
|
288
|
+
return [];
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const firstPoint = coordinatePath[0];
|
|
292
|
+
const lastPoint = coordinatePath[coordinatePath.length - 1];
|
|
293
|
+
|
|
294
|
+
if (firstPoint.latitude == lastPoint.latitude && firstPoint.longitude == lastPoint.longitude) {
|
|
295
|
+
return coordinatePath;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
return [...coordinatePath, firstPoint];
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
}
|
|
302
|
+
//# 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":"AAAA,OAAO,MAAMA,WAAN,CAAkB;EAEvBC,WAAW,CAACC,OAAD,EAAU;IACnB,KAAKA,OAAL,GAAeA,OAAf;IACA,KAAKC,cAAL,GAAsB,EAAtB;IACA,KAAKC,kBAAL,GAA0B,gCAA1B;EACD;EAED;AACF;AACA;;;EACqB,MAAbC,aAAa,CAACC,OAAD,EAAU;IAC3B,MAAMC,YAAY,GAAG,KAAKC,eAAL,CAAqBF,OAArB,CAArB;IACA,MAAMG,eAAe,GAAG,KAAKA,eA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O,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/module/index.js
CHANGED
|
@@ -7,5 +7,6 @@ import { MFPOI } from './components/MFPOI';
|
|
|
7
7
|
import { MFDirectionsRenderer } from './components/MFDirectionsRenderer';
|
|
8
8
|
import { MFTileOverlay } from './components/MFTileOverlay';
|
|
9
9
|
import { MFBuilding } from './components/MFBuilding';
|
|
10
|
-
|
|
10
|
+
import { AreaFocuser } from './components/extends/AreaFocuser';
|
|
11
|
+
export { MFMapView, MFMarker, MFCircle, MFPolyline, MFPolygon, MFPOI, MFDirectionsRenderer, MFTileOverlay, MFBuilding, AreaFocuser };
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MFMapView","MFMarker","MFCircle","MFPolyline","MFPolygon","MFPOI","MFDirectionsRenderer","MFTileOverlay","MFBuilding"],"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":"AAAA,SAAQA,SAAR,QAAwB,wBAAxB;AACA,SAAQC,QAAR,QAAuB,uBAAvB;AACA,SAAQC,QAAR,QAAuB,uBAAvB;AACA,SAAQC,UAAR,QAAyB,yBAAzB;AACA,SAAQC,SAAR,QAAwB,wBAAxB;AACA,SAAQC,KAAR,QAAoB,oBAApB;AACA,SAAQC,oBAAR,QAAmC,mCAAnC;AACA,SAAQC,aAAR,QAA4B,4BAA5B;AACA,SAAQC,UAAR,QAAyB,yBAAzB;AAEA,
|
|
1
|
+
{"version":3,"names":["MFMapView","MFMarker","MFCircle","MFPolyline","MFPolygon","MFPOI","MFDirectionsRenderer","MFTileOverlay","MFBuilding","AreaFocuser"],"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,SAAQA,SAAR,QAAwB,wBAAxB;AACA,SAAQC,QAAR,QAAuB,uBAAvB;AACA,SAAQC,QAAR,QAAuB,uBAAvB;AACA,SAAQC,UAAR,QAAyB,yBAAzB;AACA,SAAQC,SAAR,QAAwB,wBAAxB;AACA,SAAQC,KAAR,QAAoB,oBAApB;AACA,SAAQC,oBAAR,QAAmC,mCAAnC;AACA,SAAQC,aAAR,QAA4B,4BAA5B;AACA,SAAQC,UAAR,QAAyB,yBAAzB;AACA,SAAQC,WAAR,QAA0B,kCAA1B;AAEA,SACET,SADF,EAEEC,QAFF,EAGEC,QAHF,EAIEC,UAJF,EAKEC,SALF,EAMEC,KANF,EAOEC,oBAPF,EAQEC,aARF,EASEC,UATF,EAUEC,WAVF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ViewStyle } from 'react-native';
|
|
2
|
-
declare type Map4dMapProps = {
|
|
3
|
-
color: string;
|
|
4
|
-
style: ViewStyle;
|
|
5
|
-
};
|
|
6
|
-
export declare const Map4dMapView: import("react-native").HostComponent<Map4dMapProps> | (() => never);
|
|
7
|
-
export {};
|
|
1
|
+
import { ViewStyle } from 'react-native';
|
|
2
|
+
declare type Map4dMapProps = {
|
|
3
|
+
color: string;
|
|
4
|
+
style: ViewStyle;
|
|
5
|
+
};
|
|
6
|
+
export declare const Map4dMapView: import("react-native").HostComponent<Map4dMapProps> | (() => never);
|
|
7
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,152 +1,152 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-native-map4d-map-dtqg",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Map4dMap SDK for React Native",
|
|
5
|
-
"main": "lib/commonjs/index",
|
|
6
|
-
"module": "lib/module/index",
|
|
7
|
-
"types": "lib/typescript/index.d.ts",
|
|
8
|
-
"react-native": "src/index",
|
|
9
|
-
"source": "src/index",
|
|
10
|
-
"files": [
|
|
11
|
-
"src",
|
|
12
|
-
"lib",
|
|
13
|
-
"android",
|
|
14
|
-
"ios",
|
|
15
|
-
"cpp",
|
|
16
|
-
"react-native-map4d-map.podspec",
|
|
17
|
-
"!lib/typescript/example",
|
|
18
|
-
"!android/build",
|
|
19
|
-
"!ios/build",
|
|
20
|
-
"!**/__tests__",
|
|
21
|
-
"!**/__fixtures__",
|
|
22
|
-
"!**/__mocks__"
|
|
23
|
-
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"test": "jest",
|
|
26
|
-
"typescript": "tsc --noEmit",
|
|
27
|
-
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
28
|
-
"prepare": "bob build",
|
|
29
|
-
"release": "release-it",
|
|
30
|
-
"example": "yarn --cwd example",
|
|
31
|
-
"pods": "cd example && pod-install --quiet",
|
|
32
|
-
"bootstrap": "yarn example && yarn && yarn pods"
|
|
33
|
-
},
|
|
34
|
-
"keywords": [
|
|
35
|
-
"react",
|
|
36
|
-
"react-native",
|
|
37
|
-
"react-component",
|
|
38
|
-
"map",
|
|
39
|
-
"mapview",
|
|
40
|
-
"map4d",
|
|
41
|
-
"iotlink"
|
|
42
|
-
],
|
|
43
|
-
"repository": "https://github.com/map4d/map4d-map-react-native",
|
|
44
|
-
"author": "IOTLink <admin@iotlink.com.vn> (https://iotlink.com.vn/)",
|
|
45
|
-
"license": "MIT",
|
|
46
|
-
"bugs": {
|
|
47
|
-
"url": "https://github.com/map4d/map4d-map-react-native/issues"
|
|
48
|
-
},
|
|
49
|
-
"homepage": "https://github.com/map4d/map4d-map-react-native#readme",
|
|
50
|
-
"publishConfig": {
|
|
51
|
-
"registry": "https://registry.npmjs.org/"
|
|
52
|
-
},
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
"@commitlint/config-conventional": "^11.0.0",
|
|
55
|
-
"@react-native-community/eslint-config": "^2.0.0",
|
|
56
|
-
"@release-it/conventional-changelog": "^2.0.0",
|
|
57
|
-
"@types/jest": "^26.0.0",
|
|
58
|
-
"@types/react": "^16.9.19",
|
|
59
|
-
"@types/react-native": "0.62.13",
|
|
60
|
-
"commitlint": "^11.0.0",
|
|
61
|
-
"deprecated-react-native-prop-types": "^2.3.0",
|
|
62
|
-
"eslint": "^7.2.0",
|
|
63
|
-
"eslint-config-prettier": "^7.0.0",
|
|
64
|
-
"eslint-plugin-prettier": "^3.1.3",
|
|
65
|
-
"husky": "^6.0.0",
|
|
66
|
-
"jest": "^26.0.1",
|
|
67
|
-
"pod-install": "^0.1.0",
|
|
68
|
-
"prettier": "^2.0.5",
|
|
69
|
-
"react": "16.13.1",
|
|
70
|
-
"react-native": "0.63.4",
|
|
71
|
-
"react-native-builder-bob": "^0.18.2",
|
|
72
|
-
"release-it": "^14.2.2",
|
|
73
|
-
"typescript": "^4.1.3"
|
|
74
|
-
},
|
|
75
|
-
"peerDependencies": {
|
|
76
|
-
"react": "*",
|
|
77
|
-
"react-native": "*"
|
|
78
|
-
},
|
|
79
|
-
"jest": {
|
|
80
|
-
"preset": "react-native",
|
|
81
|
-
"modulePathIgnorePatterns": [
|
|
82
|
-
"<rootDir>/example/node_modules",
|
|
83
|
-
"<rootDir>/lib/"
|
|
84
|
-
]
|
|
85
|
-
},
|
|
86
|
-
"commitlint": {
|
|
87
|
-
"extends": [
|
|
88
|
-
"@commitlint/config-conventional"
|
|
89
|
-
]
|
|
90
|
-
},
|
|
91
|
-
"release-it": {
|
|
92
|
-
"git": {
|
|
93
|
-
"commitMessage": "chore: release ${version}",
|
|
94
|
-
"tagName": "v${version}"
|
|
95
|
-
},
|
|
96
|
-
"npm": {
|
|
97
|
-
"publish": true
|
|
98
|
-
},
|
|
99
|
-
"github": {
|
|
100
|
-
"release": true
|
|
101
|
-
},
|
|
102
|
-
"plugins": {
|
|
103
|
-
"@release-it/conventional-changelog": {
|
|
104
|
-
"preset": "angular"
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
"eslintConfig": {
|
|
109
|
-
"root": true,
|
|
110
|
-
"extends": [
|
|
111
|
-
"@react-native-community",
|
|
112
|
-
"prettier"
|
|
113
|
-
],
|
|
114
|
-
"rules": {
|
|
115
|
-
"prettier/prettier": [
|
|
116
|
-
"error",
|
|
117
|
-
{
|
|
118
|
-
"quoteProps": "consistent",
|
|
119
|
-
"singleQuote": true,
|
|
120
|
-
"tabWidth": 2,
|
|
121
|
-
"trailingComma": "es5",
|
|
122
|
-
"useTabs": false
|
|
123
|
-
}
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
"eslintIgnore": [
|
|
128
|
-
"node_modules/",
|
|
129
|
-
"lib/"
|
|
130
|
-
],
|
|
131
|
-
"prettier": {
|
|
132
|
-
"quoteProps": "consistent",
|
|
133
|
-
"singleQuote": true,
|
|
134
|
-
"tabWidth": 2,
|
|
135
|
-
"trailingComma": "es5",
|
|
136
|
-
"useTabs": false
|
|
137
|
-
},
|
|
138
|
-
"react-native-builder-bob": {
|
|
139
|
-
"source": "src",
|
|
140
|
-
"output": "lib",
|
|
141
|
-
"targets": [
|
|
142
|
-
"commonjs",
|
|
143
|
-
"module",
|
|
144
|
-
[
|
|
145
|
-
"typescript",
|
|
146
|
-
{
|
|
147
|
-
"project": "tsconfig.build.json"
|
|
148
|
-
}
|
|
149
|
-
]
|
|
150
|
-
]
|
|
151
|
-
}
|
|
152
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-map4d-map-dtqg",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Map4dMap SDK for React Native",
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index",
|
|
9
|
+
"source": "src/index",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"android",
|
|
14
|
+
"ios",
|
|
15
|
+
"cpp",
|
|
16
|
+
"react-native-map4d-map.podspec",
|
|
17
|
+
"!lib/typescript/example",
|
|
18
|
+
"!android/build",
|
|
19
|
+
"!ios/build",
|
|
20
|
+
"!**/__tests__",
|
|
21
|
+
"!**/__fixtures__",
|
|
22
|
+
"!**/__mocks__"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"test": "jest",
|
|
26
|
+
"typescript": "tsc --noEmit",
|
|
27
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
28
|
+
"prepare": "bob build",
|
|
29
|
+
"release": "release-it",
|
|
30
|
+
"example": "yarn --cwd example",
|
|
31
|
+
"pods": "cd example && pod-install --quiet",
|
|
32
|
+
"bootstrap": "yarn example && yarn && yarn pods"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"react",
|
|
36
|
+
"react-native",
|
|
37
|
+
"react-component",
|
|
38
|
+
"map",
|
|
39
|
+
"mapview",
|
|
40
|
+
"map4d",
|
|
41
|
+
"iotlink"
|
|
42
|
+
],
|
|
43
|
+
"repository": "https://github.com/map4d/map4d-map-react-native",
|
|
44
|
+
"author": "IOTLink <admin@iotlink.com.vn> (https://iotlink.com.vn/)",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/map4d/map4d-map-react-native/issues"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/map4d/map4d-map-react-native#readme",
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"registry": "https://registry.npmjs.org/"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@commitlint/config-conventional": "^11.0.0",
|
|
55
|
+
"@react-native-community/eslint-config": "^2.0.0",
|
|
56
|
+
"@release-it/conventional-changelog": "^2.0.0",
|
|
57
|
+
"@types/jest": "^26.0.0",
|
|
58
|
+
"@types/react": "^16.9.19",
|
|
59
|
+
"@types/react-native": "0.62.13",
|
|
60
|
+
"commitlint": "^11.0.0",
|
|
61
|
+
"deprecated-react-native-prop-types": "^2.3.0",
|
|
62
|
+
"eslint": "^7.2.0",
|
|
63
|
+
"eslint-config-prettier": "^7.0.0",
|
|
64
|
+
"eslint-plugin-prettier": "^3.1.3",
|
|
65
|
+
"husky": "^6.0.0",
|
|
66
|
+
"jest": "^26.0.1",
|
|
67
|
+
"pod-install": "^0.1.0",
|
|
68
|
+
"prettier": "^2.0.5",
|
|
69
|
+
"react": "16.13.1",
|
|
70
|
+
"react-native": "0.63.4",
|
|
71
|
+
"react-native-builder-bob": "^0.18.2",
|
|
72
|
+
"release-it": "^14.2.2",
|
|
73
|
+
"typescript": "^4.1.3"
|
|
74
|
+
},
|
|
75
|
+
"peerDependencies": {
|
|
76
|
+
"react": "*",
|
|
77
|
+
"react-native": "*"
|
|
78
|
+
},
|
|
79
|
+
"jest": {
|
|
80
|
+
"preset": "react-native",
|
|
81
|
+
"modulePathIgnorePatterns": [
|
|
82
|
+
"<rootDir>/example/node_modules",
|
|
83
|
+
"<rootDir>/lib/"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
"commitlint": {
|
|
87
|
+
"extends": [
|
|
88
|
+
"@commitlint/config-conventional"
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
"release-it": {
|
|
92
|
+
"git": {
|
|
93
|
+
"commitMessage": "chore: release ${version}",
|
|
94
|
+
"tagName": "v${version}"
|
|
95
|
+
},
|
|
96
|
+
"npm": {
|
|
97
|
+
"publish": true
|
|
98
|
+
},
|
|
99
|
+
"github": {
|
|
100
|
+
"release": true
|
|
101
|
+
},
|
|
102
|
+
"plugins": {
|
|
103
|
+
"@release-it/conventional-changelog": {
|
|
104
|
+
"preset": "angular"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"eslintConfig": {
|
|
109
|
+
"root": true,
|
|
110
|
+
"extends": [
|
|
111
|
+
"@react-native-community",
|
|
112
|
+
"prettier"
|
|
113
|
+
],
|
|
114
|
+
"rules": {
|
|
115
|
+
"prettier/prettier": [
|
|
116
|
+
"error",
|
|
117
|
+
{
|
|
118
|
+
"quoteProps": "consistent",
|
|
119
|
+
"singleQuote": true,
|
|
120
|
+
"tabWidth": 2,
|
|
121
|
+
"trailingComma": "es5",
|
|
122
|
+
"useTabs": false
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"eslintIgnore": [
|
|
128
|
+
"node_modules/",
|
|
129
|
+
"lib/"
|
|
130
|
+
],
|
|
131
|
+
"prettier": {
|
|
132
|
+
"quoteProps": "consistent",
|
|
133
|
+
"singleQuote": true,
|
|
134
|
+
"tabWidth": 2,
|
|
135
|
+
"trailingComma": "es5",
|
|
136
|
+
"useTabs": false
|
|
137
|
+
},
|
|
138
|
+
"react-native-builder-bob": {
|
|
139
|
+
"source": "src",
|
|
140
|
+
"output": "lib",
|
|
141
|
+
"targets": [
|
|
142
|
+
"commonjs",
|
|
143
|
+
"module",
|
|
144
|
+
[
|
|
145
|
+
"typescript",
|
|
146
|
+
{
|
|
147
|
+
"project": "tsconfig.build.json"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
}
|