react-native-map4d-map-dtqg 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +133 -41
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.9/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +60 -60
- package/android/src/main/AndroidManifest.xml +4 -4
- package/android/src/main/java/com/reactnativemap4dmap/ImageUtils.java +87 -87
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapModule.java +298 -298
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapPackage.java +35 -35
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapViewManager.java +31 -31
- package/android/src/main/java/com/reactnativemap4dmap/RMFBuilding.java +167 -167
- package/android/src/main/java/com/reactnativemap4dmap/RMFBuildingManager.java +121 -121
- package/android/src/main/java/com/reactnativemap4dmap/RMFCircle.java +105 -105
- package/android/src/main/java/com/reactnativemap4dmap/RMFCircleManager.java +121 -121
- package/android/src/main/java/com/reactnativemap4dmap/RMFDirectionsRenderer.java +502 -502
- package/android/src/main/java/com/reactnativemap4dmap/RMFDirectionsRendererManager.java +143 -143
- package/android/src/main/java/com/reactnativemap4dmap/RMFFeature.java +17 -17
- package/android/src/main/java/com/reactnativemap4dmap/RMFMapView.java +1172 -1172
- package/android/src/main/java/com/reactnativemap4dmap/RMFMapViewManager.java +231 -226
- package/android/src/main/java/com/reactnativemap4dmap/RMFMarker.java +412 -412
- package/android/src/main/java/com/reactnativemap4dmap/RMFMarkerManager.java +211 -211
- package/android/src/main/java/com/reactnativemap4dmap/RMFPOI.java +222 -222
- package/android/src/main/java/com/reactnativemap4dmap/RMFPOIManager.java +119 -119
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolygon.java +172 -172
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolygonManager.java +147 -147
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolyline.java +146 -146
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolylineManager.java +137 -137
- package/android/src/main/java/com/reactnativemap4dmap/RMFTileOverlay.java +95 -95
- package/android/src/main/java/com/reactnativemap4dmap/RMFTileOverlayManager.java +64 -64
- package/android/src/main/java/com/reactnativemap4dmap/SizeReportingShadowNode.java +31 -31
- package/android/src/main/java/com/reactnativemap4dmap/ViewAttacherGroup.java +31 -31
- package/android/src/main/java/com/reactnativemap4dmap/ViewChangesTracker.java +70 -70
- package/android/src/main/java/vn/map4d/map/annotations/RMFBitmapDescriptor.java +9 -9
- package/ios/Map4dMap.h +7 -7
- package/ios/Map4dMap.m +14 -14
- package/ios/Map4dMapViewManager.m +34 -34
- package/ios/RCTConvert+Map4dMap.h +33 -33
- package/ios/RCTConvert+Map4dMap.m +112 -112
- package/ios/RMFCircle.h +37 -37
- package/ios/RMFCircle.m +100 -100
- package/ios/RMFCircleManager.h +18 -18
- package/ios/RMFCircleManager.m +155 -155
- package/ios/RMFCircleMap4d.h +23 -23
- package/ios/RMFCircleMap4d.m +13 -13
- package/ios/RMFCoordinate.h +22 -22
- package/ios/RMFCoordinate.m +13 -13
- package/ios/RMFDirectionsMarkerOptions.h +24 -24
- package/ios/RMFDirectionsMarkerOptions.m +23 -23
- package/ios/RMFDirectionsRenderer.h +47 -47
- package/ios/RMFDirectionsRenderer.m +182 -182
- package/ios/RMFDirectionsRendererManager.h +17 -17
- package/ios/RMFDirectionsRendererManager.m +84 -84
- package/ios/RMFDirectionsRendererMap4d.h +21 -21
- package/ios/RMFDirectionsRendererMap4d.m +12 -12
- package/ios/RMFDummyView.h +6 -6
- package/ios/RMFDummyView.m +12 -12
- package/ios/RMFEventResponse.h +39 -39
- package/ios/RMFEventResponse.m +98 -98
- package/ios/RMFIcon.h +24 -24
- package/ios/RMFIcon.m +35 -35
- package/ios/RMFMapView.h +84 -84
- package/ios/RMFMapView.m +376 -376
- package/ios/RMFMapViewManager.h +17 -17
- package/ios/RMFMapViewManager.m +508 -493
- package/ios/RMFMarker.h +57 -57
- package/ios/RMFMarker.m +267 -267
- package/ios/RMFMarkerManager.h +17 -17
- package/ios/RMFMarkerManager.m +156 -156
- package/ios/RMFMarkerMap4d.h +19 -19
- package/ios/RMFMarkerMap4d.m +13 -13
- package/ios/RMFPOI.h +38 -38
- package/ios/RMFPOI.m +123 -123
- package/ios/RMFPOIManager.h +18 -18
- package/ios/RMFPOIManager.m +168 -168
- package/ios/RMFPOIMap4d.h +22 -22
- package/ios/RMFPOIMap4d.m +12 -12
- package/ios/RMFPolygon.h +41 -41
- package/ios/RMFPolygon.m +106 -106
- package/ios/RMFPolygonManager.h +18 -18
- package/ios/RMFPolygonManager.m +141 -141
- package/ios/RMFPolygonMap4d.h +23 -23
- package/ios/RMFPolygonMap4d.m +15 -15
- package/ios/RMFPolyline.h +38 -38
- package/ios/RMFPolyline.m +101 -101
- package/ios/RMFPolylineManager.h +18 -18
- package/ios/RMFPolylineManager.m +139 -139
- package/ios/RMFPolylineMap4d.h +22 -22
- package/ios/RMFPolylineMap4d.m +15 -15
- package/ios/building/RMFBuilding.h +41 -41
- package/ios/building/RMFBuilding.m +104 -104
- package/ios/building/RMFBuildingManager.h +19 -19
- package/ios/building/RMFBuildingManager.m +133 -133
- package/ios/building/RMFBuildingMap4d.h +23 -23
- package/ios/building/RMFBuildingMap4d.m +15 -15
- package/ios/overlays/RMFTileOverlay.h +36 -36
- package/ios/overlays/RMFTileOverlay.m +64 -64
- package/ios/overlays/RMFTileOverlayManager.h +17 -17
- package/ios/overlays/RMFTileOverlayManager.m +27 -27
- package/lib/commonjs/components/MFBanDoSo.js +109 -0
- package/lib/commonjs/components/MFBanDoSo.js.map +1 -0
- package/lib/commonjs/components/MFBuilding.js +26 -26
- package/lib/commonjs/components/MFBuilding.js.map +1 -1
- package/lib/commonjs/components/MFCircle.js +20 -20
- package/lib/commonjs/components/MFCircle.js.map +1 -1
- package/lib/commonjs/components/MFDirectionsRenderer.js +32 -32
- package/lib/commonjs/components/MFDirectionsRenderer.js.map +1 -1
- package/lib/commonjs/components/MFMapView.js +152 -71
- package/lib/commonjs/components/MFMapView.js.map +1 -1
- package/lib/commonjs/components/MFMarker.js +35 -35
- package/lib/commonjs/components/MFMarker.js.map +1 -1
- package/lib/commonjs/components/MFPOI.js +20 -20
- package/lib/commonjs/components/MFPOI.js.map +1 -1
- package/lib/commonjs/components/MFPolygon.js +22 -22
- package/lib/commonjs/components/MFPolygon.js.map +1 -1
- package/lib/commonjs/components/MFPolyline.js +18 -18
- package/lib/commonjs/components/MFPolyline.js.map +1 -1
- package/lib/commonjs/components/MFTileOverlay.js +9 -9
- package/lib/commonjs/components/MFTileOverlay.js.map +1 -1
- package/lib/commonjs/components/Map4dMapView.js.map +1 -1
- package/lib/commonjs/components/extends/AreaFocusManager.js +205 -0
- package/lib/commonjs/components/extends/AreaFocusManager.js.map +1 -0
- package/lib/commonjs/components/extends/AreaFocuser.js +73 -0
- package/lib/commonjs/components/extends/AreaFocuser.js.map +1 -0
- package/lib/commonjs/components/extends/BoundHelper.js +36 -0
- package/lib/commonjs/components/extends/BoundHelper.js.map +1 -0
- package/lib/commonjs/components/extends/area/AreaFocusAreas.js +167 -0
- package/lib/commonjs/components/extends/area/AreaFocusAreas.js.map +1 -0
- package/lib/commonjs/components/extends/area/AreaFocusGeometryUtils.js +164 -0
- package/lib/commonjs/components/extends/area/AreaFocusGeometryUtils.js.map +1 -0
- package/lib/commonjs/components/extends/area/AreaFocusSession.js +100 -0
- package/lib/commonjs/components/extends/area/AreaFocusSession.js.map +1 -0
- package/lib/commonjs/components/extends/area/AreaFocusTypes.js +40 -0
- package/lib/commonjs/components/extends/area/AreaFocusTypes.js.map +1 -0
- package/lib/commonjs/components/internal/DefaultRoadmapStyle.js +2288 -0
- package/lib/commonjs/components/internal/DefaultRoadmapStyle.js.map +1 -0
- package/lib/commonjs/components/internal/GeojsonStyleUtils.js +139 -0
- package/lib/commonjs/components/internal/GeojsonStyleUtils.js.map +1 -0
- package/lib/commonjs/index.js +16 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/MFBanDoSo.js +92 -0
- package/lib/module/components/MFBanDoSo.js.map +1 -0
- package/lib/module/components/MFBuilding.js +26 -26
- package/lib/module/components/MFBuilding.js.map +1 -1
- package/lib/module/components/MFCircle.js +20 -20
- package/lib/module/components/MFCircle.js.map +1 -1
- package/lib/module/components/MFDirectionsRenderer.js +32 -32
- package/lib/module/components/MFDirectionsRenderer.js.map +1 -1
- package/lib/module/components/MFMapView.js +149 -71
- package/lib/module/components/MFMapView.js.map +1 -1
- package/lib/module/components/MFMarker.js +35 -35
- package/lib/module/components/MFMarker.js.map +1 -1
- package/lib/module/components/MFPOI.js +20 -20
- package/lib/module/components/MFPOI.js.map +1 -1
- package/lib/module/components/MFPolygon.js +22 -22
- package/lib/module/components/MFPolygon.js.map +1 -1
- package/lib/module/components/MFPolyline.js +18 -18
- package/lib/module/components/MFPolyline.js.map +1 -1
- package/lib/module/components/MFTileOverlay.js +9 -9
- package/lib/module/components/MFTileOverlay.js.map +1 -1
- package/lib/module/components/Map4dMapView.js.map +1 -1
- package/lib/module/components/extends/AreaFocusManager.js +193 -0
- package/lib/module/components/extends/AreaFocusManager.js.map +1 -0
- package/lib/module/components/extends/AreaFocuser.js +64 -0
- package/lib/module/components/extends/AreaFocuser.js.map +1 -0
- package/lib/module/components/extends/BoundHelper.js +29 -0
- package/lib/module/components/extends/BoundHelper.js.map +1 -0
- package/lib/module/components/extends/area/AreaFocusAreas.js +156 -0
- package/lib/module/components/extends/area/AreaFocusAreas.js.map +1 -0
- package/lib/module/components/extends/area/AreaFocusGeometryUtils.js +153 -0
- package/lib/module/components/extends/area/AreaFocusGeometryUtils.js.map +1 -0
- package/lib/module/components/extends/area/AreaFocusSession.js +93 -0
- package/lib/module/components/extends/area/AreaFocusSession.js.map +1 -0
- package/lib/module/components/extends/area/AreaFocusTypes.js +33 -0
- package/lib/module/components/extends/area/AreaFocusTypes.js.map +1 -0
- package/lib/module/components/internal/DefaultRoadmapStyle.js +2281 -0
- package/lib/module/components/internal/DefaultRoadmapStyle.js.map +1 -0
- package/lib/module/components/internal/GeojsonStyleUtils.js +130 -0
- package/lib/module/components/internal/GeojsonStyleUtils.js.map +1 -0
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/components/Map4dMapView.d.ts +7 -7
- package/package.json +152 -152
- package/react-native-map4d-map.podspec +20 -20
- package/src/components/MFBanDoSo.js +124 -0
- package/src/components/MFBuilding.js +187 -187
- package/src/components/MFCircle.js +173 -173
- package/src/components/MFDirectionsRenderer.js +237 -237
- package/src/components/MFMapView.js +464 -373
- package/src/components/MFMarker.js +246 -246
- package/src/components/MFPOI.js +184 -184
- package/src/components/MFPolygon.js +186 -186
- package/src/components/MFPolyline.js +172 -172
- package/src/components/MFTileOverlay.js +45 -45
- package/src/components/Map4dMapView.tsx +26 -26
- package/src/components/extends/AreaFocusManager.js +196 -0
- package/src/components/extends/AreaFocuser.js +62 -0
- package/src/components/extends/BoundHelper.js +32 -0
- package/src/components/extends/area/AreaFocusAreas.js +164 -0
- package/src/components/extends/area/AreaFocusGeometryUtils.js +164 -0
- package/src/components/extends/area/AreaFocusSession.js +100 -0
- package/src/components/extends/area/AreaFocusTypes.js +36 -0
- package/src/components/internal/DefaultRoadmapStyle.js +3365 -0
- package/src/components/internal/GeojsonStyleUtils.js +143 -0
- package/src/index.js +25 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["viewPropTypes","ViewPropTypes","View","propTypes","coordinates","PropTypes","arrayOf","shape","latitude","number","isRequired","longitude","color","ColorPropType","width","lineStyle","oneOf","zIndex","visible","bool","userData","object","onPress","func","MFPolyline","React","Component","constructor","props","_onPress","bind","_ref","event","stopPropagation","ref","polyline","setCoordinates","_runCommand","setWidth","setColor","processColor","setVisible","setTouchable","touchable","setZIndex","setLineStyle","style","setUserData","_getHandle","findNodeHandle","name","args","Platform","OS","NativeModules","UIManager","dispatchViewManagerCommand","_uiManagerCommand","_mapManagerCommand","componentName","getViewManagerConfig","Commands","render","RMFPolyline","requireNativeComponent"],"sources":["MFPolyline.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\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 * An array of coordinates to describe the polyline\n */\n coordinates: PropTypes.arrayOf(\n PropTypes.shape({\n /**\n * Latitude/Longitude coordinates\n */\n latitude: PropTypes.number.isRequired,\n longitude: PropTypes.number.isRequired,\n })\n ),\n\n /**\n * The color to use for the path.\n */\n color: ColorPropType,\n\n /**\n * The stroke width to use for the path.\n */\n width: PropTypes.number,\n\n /**\n * The default style is `solid`.\n */\n lineStyle: PropTypes.oneOf(['solid', 'dotted']),\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 polyline\n */\n onPress: PropTypes.func,\n};\n\n\nclass MFPolyline 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.polyline = ref;\n }\n\n // TODO - bug\n setCoordinates(coordinates) {\n this._runCommand(\"setCoordinates\", [coordinates])\n }\n\n setWidth(width) {\n this._runCommand(\"setWidth\", [width])\n }\n\n setColor(color) {\n this._runCommand(\"setColor\", [processColor(color)])\n }\n\n setVisible(visible) {\n this._runCommand(\"setVisible\", [visible])\n }\n\n setTouchable(touchable) {\n this._runCommand(\"setTouchable\", [touchable])\n }\n\n setZIndex(zIndex) {\n this._runCommand(\"setZIndex\", [zIndex])\n }\n\n setLineStyle(style) {\n this._runCommand(\"setLineStyle\", [style])\n }\n\n setUserData(userData) {\n this._runCommand(\"setUserData\", [userData])\n }\n\n _getHandle() {\n return findNodeHandle(this.polyline);\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 = \"RMFPolyline\";\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[`RMFPolyline`][name];\n }\n\n render() {\n return <RMFPolyline\n {...this.props}\n ref={this._ref}\n onPress={this._onPress}\n />;\n }\n}\n\nMFPolyline.propTypes = propTypes;\n\nvar RMFPolyline = requireNativeComponent(`RMFPolyline`, MFPolyline);\n\nexport { MFPolyline }\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAQA;AACA,MAAMA,aAAa,GAAGC,6CAAA,IAAiBC,IAAI,CAACC,SAA5C;AAEA,MAAMA,SAAS,GAAG,EAChB,GAAGH,aADa;;EAGhB;AACF;AACA;EACEI,WAAW,EAAEC,kBAAA,CAAUC,OAAV,CACXD,kBAAA,CAAUE,KAA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CAAcC,SAAhC;IACA,MAAMI,aAAa,GAAG,aAAtB;;IAEA,IAAI,CAACJ,SAAS,CAACK,oBAAf,EAAqC;MACnC;MACA,OAAOL,SAAS,CAACI,aAAD,CAAT,CAAyBE,QAAzB,CAAkCX,IAAlC,CAAP;IACD,CAPqB,CAStB;;;IACA,OAAOK,SAAS,CAACK,oBAAV,CAA+BD,aAA/B,EAA8CE,QAA9C,CAAuDX,IAAvD,CAAP;EACD;;EAEDQ,kBAAkB,CAACR,IAAD,EAAO;IACvB,OAAOI,0BAAA,CAAe,aAAf,EAA6BJ,IAA7B,CAAP;EACD;;EAEDY,MAAM,GAAG;IACP,oBAAO,6BAAC,WAAD,eACD,KAAKlC,KADJ;MAEL,GAAG,EAAE,KAAKG,IAFL;MAGL,OAAO,EAAE,KAAKF;IAHT,GAAP;EAKD;;AAjGsC;;;AAoGzCL,UAAU,CAACrB,SAAX,GAAuBA,SAAvB;AAEA,IAAI4D,WAAW,GAAG,IAAAC,mCAAA,EAAwB,aAAxB,EAAsCxC,UAAtC,CAAlB"}
|
|
1
|
+
{"version":3,"names":["viewPropTypes","ViewPropTypes","View","propTypes","coordinates","PropTypes","arrayOf","shape","latitude","number","isRequired","longitude","color","ColorPropType","width","lineStyle","oneOf","zIndex","visible","bool","userData","object","onPress","func","MFPolyline","React","Component","constructor","props","_onPress","bind","_ref","event","stopPropagation","ref","polyline","setCoordinates","_runCommand","setWidth","setColor","processColor","setVisible","setTouchable","touchable","setZIndex","setLineStyle","style","setUserData","_getHandle","findNodeHandle","name","args","Platform","OS","NativeModules","UIManager","dispatchViewManagerCommand","_uiManagerCommand","_mapManagerCommand","componentName","getViewManagerConfig","Commands","render","RMFPolyline","requireNativeComponent"],"sources":["MFPolyline.js"],"sourcesContent":["import React from 'react';\r\nimport PropTypes from 'prop-types';\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 * An array of coordinates to describe the polyline\r\n */\r\n coordinates: PropTypes.arrayOf(\r\n PropTypes.shape({\r\n /**\r\n * Latitude/Longitude coordinates\r\n */\r\n latitude: PropTypes.number.isRequired,\r\n longitude: PropTypes.number.isRequired,\r\n })\r\n ),\r\n\r\n /**\r\n * The color to use for the path.\r\n */\r\n color: ColorPropType,\r\n\r\n /**\r\n * The stroke width to use for the path.\r\n */\r\n width: PropTypes.number,\r\n\r\n /**\r\n * The default style is `solid`.\r\n */\r\n lineStyle: PropTypes.oneOf(['solid', 'dotted']),\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 polyline\r\n */\r\n onPress: PropTypes.func,\r\n};\r\n\r\n\r\nclass MFPolyline 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.polyline = ref;\r\n }\r\n\r\n // TODO - bug\r\n setCoordinates(coordinates) {\r\n this._runCommand(\"setCoordinates\", [coordinates])\r\n }\r\n\r\n setWidth(width) {\r\n this._runCommand(\"setWidth\", [width])\r\n }\r\n\r\n setColor(color) {\r\n this._runCommand(\"setColor\", [processColor(color)])\r\n }\r\n\r\n setVisible(visible) {\r\n this._runCommand(\"setVisible\", [visible])\r\n }\r\n\r\n setTouchable(touchable) {\r\n this._runCommand(\"setTouchable\", [touchable])\r\n }\r\n\r\n setZIndex(zIndex) {\r\n this._runCommand(\"setZIndex\", [zIndex])\r\n }\r\n\r\n setLineStyle(style) {\r\n this._runCommand(\"setLineStyle\", [style])\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.polyline);\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 = \"RMFPolyline\";\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[`RMFPolyline`][name];\r\n }\r\n\r\n render() {\r\n return <RMFPolyline\r\n {...this.props}\r\n ref={this._ref}\r\n onPress={this._onPress}\r\n />;\r\n }\r\n}\r\n\r\nMFPolyline.propTypes = propTypes;\r\n\r\nvar RMFPolyline = requireNativeComponent(`RMFPolyline`, MFPolyline);\r\n\r\nexport { MFPolyline }\r\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAQA;AACA,MAAMA,aAAa,GAAGC,6CAAA,IAAiBC,IAAI,CAACC,SAA5C;AAEA,MAAMA,SAAS,GAAG,EAChB,GAAGH,aADa;;EAGhB;AACF;AACA;EACEI,WAAW,EAAEC,kBAAA,CAAUC,OAAV,CACXD,kBAAA,CAAUE,KAAV,CAAgB;IACd;AACN;AACA;IACMC,QAAQ,EAAEH,kBAAA,CAAUI,MAAV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,SAAS,CAACK,oBAAf,EAAqC;MACnC;MACA,OAAOL,SAAS,CAACI,aAAD,CAAT,CAAyBE,QAAzB,CAAkCX,IAAlC,CAAP;IACD,CAPqB,CAStB;;;IACA,OAAOK,SAAS,CAACK,oBAAV,CAA+BD,aAA/B,EAA8CE,QAA9C,CAAuDX,IAAvD,CAAP;EACD;;EAEDQ,kBAAkB,CAACR,IAAD,EAAO;IACvB,OAAOI,0BAAA,CAAe,aAAf,EAA6BJ,IAA7B,CAAP;EACD;;EAEDY,MAAM,GAAG;IACP,oBAAO,6BAAC,WAAD,eACD,KAAKlC,KADJ;MAEL,GAAG,EAAE,KAAKG,IAFL;MAGL,OAAO,EAAE,KAAKF;IAHT,GAAP;EAKD;;AAjGsC;;;AAoGzCL,UAAU,CAACrB,SAAX,GAAuBA,SAAvB;AAEA,IAAI4D,WAAW,GAAG,IAAAC,mCAAA,EAAwB,aAAxB,EAAsCxC,UAAtC,CAAlB"}
|
|
@@ -19,21 +19,21 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
19
19
|
const viewPropTypes = _deprecatedReactNativePropTypes.ViewPropTypes || _reactNative.View.propTypes;
|
|
20
20
|
const propTypes = { ...viewPropTypes,
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* The url template of the tile server. The patterns {x} {y} {z} will be replaced at runtime
|
|
24
|
-
* For example, https://tile.openstreetmap.de/{z}/{x}/{y}.png
|
|
22
|
+
/**
|
|
23
|
+
* The url template of the tile server. The patterns {x} {y} {z} will be replaced at runtime
|
|
24
|
+
* For example, https://tile.openstreetmap.de/{z}/{x}/{y}.png
|
|
25
25
|
*/
|
|
26
26
|
urlTemplate: _propTypes.default.string.isRequired,
|
|
27
27
|
|
|
28
|
-
/**
|
|
29
|
-
* visible
|
|
28
|
+
/**
|
|
29
|
+
* visible
|
|
30
30
|
*/
|
|
31
31
|
visible: _propTypes.default.bool,
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* The order in which this tile overlay is drawn with respect to other overlays. An overlay
|
|
35
|
-
* with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays
|
|
36
|
-
* with the same z-index is arbitrary. The default zIndex is 0.
|
|
33
|
+
/**
|
|
34
|
+
* The order in which this tile overlay is drawn with respect to other overlays. An overlay
|
|
35
|
+
* with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays
|
|
36
|
+
* with the same z-index is arbitrary. The default zIndex is 0.
|
|
37
37
|
*/
|
|
38
38
|
zIndex: _propTypes.default.number
|
|
39
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["viewPropTypes","ViewPropTypes","View","propTypes","urlTemplate","PropTypes","string","isRequired","visible","bool","zIndex","number","MFTileOverlay","React","Component","render","props","RMFTileOverlay","requireNativeComponent"],"sources":["MFTileOverlay.js"],"sourcesContent":["import PropTypes from \"prop-types\";\nimport React from 'react';\nimport {ViewPropTypes} from 'deprecated-react-native-prop-types';\nimport {\n requireNativeComponent,\n View,\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;\nconst propTypes = {\n ...viewPropTypes,\n\n /**\n * The url template of the tile server. The patterns {x} {y} {z} will be replaced at runtime\n * For example, https://tile.openstreetmap.de/{z}/{x}/{y}.png\n */\n urlTemplate: PropTypes.string.isRequired,\n\n /**\n * visible\n */\n visible: PropTypes.bool,\n\n /**\n * The order in which this tile overlay is drawn with respect to other overlays. An overlay\n * with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays\n * with the same z-index is arbitrary. The default zIndex is 0.\n */\n zIndex: PropTypes.number,\n};\n\nclass MFTileOverlay extends React.Component {\n render() {\n return <RMFTileOverlay\n {...this.props}\n />;\n }\n}\n\nMFTileOverlay.propTypes = propTypes;\n\nvar RMFTileOverlay = requireNativeComponent(`RMFTileOverlay`, MFTileOverlay);\n\nexport { MFTileOverlay }\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAKA;AACA,MAAMA,aAAa,GAAGC,6CAAA,IAAiBC,iBAAA,CAAKC,SAA5C;AACA,MAAMA,SAAS,GAAG,EAChB,GAAGH,aADa;;EAGhB;AACF;AACA;AACA;EACEI,WAAW,EAAEC,kBAAA,CAAUC,MAAV,CAAiBC,UAPd;;EAShB;AACF;AACA;EACEC,OAAO,EAAEH,kBAAA,CAAUI,IAZH;;EAchB;AACF;AACA;AACA;AACA;EACEC,MAAM,EAAEL,kBAAA,CAAUM;AAnBF,CAAlB;;AAsBA,MAAMC,aAAN,SAA4BC,cAAA,CAAMC,SAAlC,CAA4C;EAC1CC,MAAM,GAAG;IACP,oBAAO,6BAAC,cAAD,EACD,KAAKC,KADJ,CAAP;EAGD;;AALyC;;;AAQ5CJ,aAAa,CAACT,SAAd,GAA0BA,SAA1B;AAEA,IAAIc,cAAc,GAAG,IAAAC,mCAAA,EAAwB,gBAAxB,EAAyCN,aAAzC,CAArB"}
|
|
1
|
+
{"version":3,"names":["viewPropTypes","ViewPropTypes","View","propTypes","urlTemplate","PropTypes","string","isRequired","visible","bool","zIndex","number","MFTileOverlay","React","Component","render","props","RMFTileOverlay","requireNativeComponent"],"sources":["MFTileOverlay.js"],"sourcesContent":["import PropTypes from \"prop-types\";\r\nimport React from 'react';\r\nimport {ViewPropTypes} from 'deprecated-react-native-prop-types';\r\nimport {\r\n requireNativeComponent,\r\n View,\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\nconst propTypes = {\r\n ...viewPropTypes,\r\n\r\n /**\r\n * The url template of the tile server. The patterns {x} {y} {z} will be replaced at runtime\r\n * For example, https://tile.openstreetmap.de/{z}/{x}/{y}.png\r\n */\r\n urlTemplate: PropTypes.string.isRequired,\r\n\r\n /**\r\n * visible\r\n */\r\n visible: PropTypes.bool,\r\n\r\n /**\r\n * The order in which this tile overlay is drawn with respect to other overlays. An overlay\r\n * with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays\r\n * with the same z-index is arbitrary. The default zIndex is 0.\r\n */\r\n zIndex: PropTypes.number,\r\n};\r\n\r\nclass MFTileOverlay extends React.Component {\r\n render() {\r\n return <RMFTileOverlay\r\n {...this.props}\r\n />;\r\n }\r\n}\r\n\r\nMFTileOverlay.propTypes = propTypes;\r\n\r\nvar RMFTileOverlay = requireNativeComponent(`RMFTileOverlay`, MFTileOverlay);\r\n\r\nexport { MFTileOverlay }\r\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAKA;AACA,MAAMA,aAAa,GAAGC,6CAAA,IAAiBC,iBAAA,CAAKC,SAA5C;AACA,MAAMA,SAAS,GAAG,EAChB,GAAGH,aADa;;EAGhB;AACF;AACA;AACA;EACEI,WAAW,EAAEC,kBAAA,CAAUC,MAAV,CAAiBC,UAPd;;EAShB;AACF;AACA;EACEC,OAAO,EAAEH,kBAAA,CAAUI,IAZH;;EAchB;AACF;AACA;AACA;AACA;EACEC,MAAM,EAAEL,kBAAA,CAAUM;AAnBF,CAAlB;;AAsBA,MAAMC,aAAN,SAA4BC,cAAA,CAAMC,SAAlC,CAA4C;EAC1CC,MAAM,GAAG;IACP,oBAAO,6BAAC,cAAD,EACD,KAAKC,KADJ,CAAP;EAGD;;AALyC;;;AAQ5CJ,aAAa,CAACT,SAAd,GAA0BA,SAA1B;AAEA,IAAIc,cAAc,GAAG,IAAAC,mCAAA,EAAwB,gBAAxB,EAAyCN,aAAzC,CAArB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","ComponentName","Map4dMapView","UIManager","getViewManagerConfig","requireNativeComponent","Error"],"sources":["Map4dMapView.tsx"],"sourcesContent":["import {\n requireNativeComponent,\n UIManager,\n Platform,\n ViewStyle,\n } from 'react-native';\n \n const LINKING_ERROR =\n `The package 'react-native-map4d-map' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n \n type Map4dMapProps = {\n color: string;\n style: ViewStyle;\n };\n \n const ComponentName = 'Map4dMapView';\n \n export const Map4dMapView =\n UIManager.getViewManagerConfig(ComponentName) != null\n ? requireNativeComponent<Map4dMapProps>(ComponentName)\n : () => {\n throw new Error(LINKING_ERROR);\n };\n "],"mappings":";;;;;;;AAAA;;AAOE,MAAMA,aAAa,GAChB,iFAAD,GACAC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAWA,MAAMC,aAAa,GAAG,cAAtB;AAEO,MAAMC,YAAY,GACvBC,sBAAA,CAAUC,oBAAV,CAA+BH,aAA/B,KAAiD,IAAjD,GACI,IAAAI,mCAAA,EAAsCJ,aAAtC,CADJ,GAEI,MAAM;EACJ,MAAM,IAAIK,KAAJ,CAAUV,aAAV,CAAN;AACD,CALA"}
|
|
1
|
+
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","ComponentName","Map4dMapView","UIManager","getViewManagerConfig","requireNativeComponent","Error"],"sources":["Map4dMapView.tsx"],"sourcesContent":["import {\r\n requireNativeComponent,\r\n UIManager,\r\n Platform,\r\n ViewStyle,\r\n } from 'react-native';\r\n \r\n const LINKING_ERROR =\r\n `The package 'react-native-map4d-map' doesn't seem to be linked. Make sure: \\n\\n` +\r\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\r\n '- You rebuilt the app after installing the package\\n' +\r\n '- You are not using Expo managed workflow\\n';\r\n \r\n type Map4dMapProps = {\r\n color: string;\r\n style: ViewStyle;\r\n };\r\n \r\n const ComponentName = 'Map4dMapView';\r\n \r\n export const Map4dMapView =\r\n UIManager.getViewManagerConfig(ComponentName) != null\r\n ? requireNativeComponent<Map4dMapProps>(ComponentName)\r\n : () => {\r\n throw new Error(LINKING_ERROR);\r\n };\r\n "],"mappings":";;;;;;;AAAA;;AAOE,MAAMA,aAAa,GAChB,iFAAD,GACAC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAWA,MAAMC,aAAa,GAAG,cAAtB;AAEO,MAAMC,YAAY,GACvBC,sBAAA,CAAUC,oBAAV,CAA+BH,aAA/B,KAAiD,IAAjD,GACI,IAAAI,mCAAA,EAAsCJ,aAAtC,CADJ,GAEI,MAAM;EACJ,MAAM,IAAIK,KAAJ,CAAUV,aAAV,CAAN;AACD,CALA"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AreaFocusManager = void 0;
|
|
7
|
+
|
|
8
|
+
var _AreaFocusSession = require("./area/AreaFocusSession");
|
|
9
|
+
|
|
10
|
+
var _AreaFocusAreas = require("./area/AreaFocusAreas");
|
|
11
|
+
|
|
12
|
+
var _AreaFocusTypes = require("./area/AreaFocusTypes");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {'normal' | 'highlight'} FocusDisplay
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {{left?: number, right?: number, top?: number, bottom?: number}} FocusPadding
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {'province' | 'industrialZone' | 'economicZone' | 'ecoIndustrialZone' | 'freeTradeZone' | 'nonTariffZone' | 'otherZoneModel' | number} FocusType
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @typedef {Object} FocusOptions
|
|
28
|
+
* @property {FocusType} type
|
|
29
|
+
* @property {number=} id
|
|
30
|
+
* @property {string=} name
|
|
31
|
+
* @property {FocusDisplay=} display
|
|
32
|
+
* @property {FocusPadding=} padding
|
|
33
|
+
*/
|
|
34
|
+
const VIETNAM_MAINLAND_BOUNDS = {
|
|
35
|
+
minLat: 8.18,
|
|
36
|
+
minLng: 102.14,
|
|
37
|
+
maxLat: 23.4,
|
|
38
|
+
maxLng: 109.47
|
|
39
|
+
};
|
|
40
|
+
const FOCUS_TYPE_TO_INDUSTRIAL_ECONOMIC_TYPE = {
|
|
41
|
+
industrialZone: _AreaFocusTypes.IndustrialEconomicType.INDUSTRIAL_ZONE,
|
|
42
|
+
economicZone: _AreaFocusTypes.IndustrialEconomicType.ECONOMIC_ZONE,
|
|
43
|
+
ecoIndustrialZone: _AreaFocusTypes.IndustrialEconomicType.ECO_INDUSTRIAL_ZONE,
|
|
44
|
+
freeTradeZone: _AreaFocusTypes.IndustrialEconomicType.FREE_TRADE_ZONE,
|
|
45
|
+
nonTariffZone: _AreaFocusTypes.IndustrialEconomicType.NON_TARIFF_ZONE,
|
|
46
|
+
otherZoneModel: _AreaFocusTypes.IndustrialEconomicType.OTHER_ZONE_MODEL
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
class AreaFocusManager {
|
|
50
|
+
constructor(mapView) {
|
|
51
|
+
this.mapView = mapView;
|
|
52
|
+
this.currentSession = null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async _focusArea(area, options) {
|
|
56
|
+
this.clear();
|
|
57
|
+
|
|
58
|
+
if (!area) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
if (!(await area.load())) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const focusOptions = { ...(options || {})
|
|
68
|
+
};
|
|
69
|
+
const bounds = area.getBounds() || VIETNAM_MAINLAND_BOUNDS;
|
|
70
|
+
|
|
71
|
+
this._fitBounds(bounds, focusOptions);
|
|
72
|
+
|
|
73
|
+
this.currentSession = new _AreaFocusSession.AreaFocusSession(this.mapView, area, focusOptions);
|
|
74
|
+
this.currentSession.render();
|
|
75
|
+
return this.currentSession;
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error('Cannot focus area:', error);
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async _focusProvince(options) {
|
|
83
|
+
const provinceId = this._getProvinceId(options);
|
|
84
|
+
|
|
85
|
+
const provinceName = this._getProvinceName(options);
|
|
86
|
+
|
|
87
|
+
if (provinceId == null && !provinceName) {
|
|
88
|
+
this.clear();
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const area = provinceId != null ? new _AreaFocusAreas.ProvinceArea(provinceId) : _AreaFocusAreas.ProvinceArea.fromName(provinceName);
|
|
93
|
+
const display = options && options.display === 'highlight' ? 'highlight' : 'normal';
|
|
94
|
+
return this._focusArea(area, {
|
|
95
|
+
display,
|
|
96
|
+
padding: options ? options.padding : undefined
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @param {FocusOptions | null | undefined} focusOptions
|
|
101
|
+
* @returns {Promise<AreaFocusSession | null>}
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
async focus(focusOptions) {
|
|
106
|
+
if (focusOptions == null) {
|
|
107
|
+
this.clear();
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (focusOptions.type === 'province') {
|
|
112
|
+
return this._focusProvince(focusOptions);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (focusOptions.id == null) {
|
|
116
|
+
console.warn('Focus options must include an id for non-province types:', focusOptions);
|
|
117
|
+
this.clear();
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const industrialEconomicType = this._getIndustrialEconomicType(focusOptions.type);
|
|
122
|
+
|
|
123
|
+
if (industrialEconomicType != null) {
|
|
124
|
+
return this._focusArea(new _AreaFocusAreas.IndustrialEconomicArea(industrialEconomicType, focusOptions.id), {
|
|
125
|
+
display: focusOptions.display,
|
|
126
|
+
padding: focusOptions.padding
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
console.warn('Unsupported focus type:', focusOptions.type);
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
_getIndustrialEconomicType(type) {
|
|
135
|
+
if (typeof type === 'number') {
|
|
136
|
+
const values = Object.values(_AreaFocusTypes.IndustrialEconomicType);
|
|
137
|
+
return values.includes(type) ? type : null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (typeof type !== 'string') {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return FOCUS_TYPE_TO_INDUSTRIAL_ECONOMIC_TYPE[type] || null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
clear() {
|
|
148
|
+
if (this.currentSession) {
|
|
149
|
+
this.currentSession.destroy();
|
|
150
|
+
this.currentSession = null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
_fitBounds(bounds, options) {
|
|
155
|
+
if (!this.mapView || typeof this.mapView.fitBounds !== 'function' || !bounds) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
this.mapView.fitBounds({
|
|
160
|
+
bounds: {
|
|
161
|
+
southWest: {
|
|
162
|
+
latitude: bounds.minLat,
|
|
163
|
+
longitude: bounds.minLng
|
|
164
|
+
},
|
|
165
|
+
northEast: {
|
|
166
|
+
latitude: bounds.maxLat,
|
|
167
|
+
longitude: bounds.maxLng
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
padding: options ? options.padding : undefined
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
_getProvinceName(options) {
|
|
175
|
+
if (options == null || typeof options !== 'object') {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (typeof options.name === 'string') {
|
|
180
|
+
const name = options.name.trim();
|
|
181
|
+
return name.length > 0 ? name : null;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const optionKeys = Object.keys(options);
|
|
185
|
+
const unsupportedKeys = optionKeys.filter(key => key !== 'type' && key !== 'id' && key !== 'name' && key !== 'display' && key !== 'padding');
|
|
186
|
+
|
|
187
|
+
if (unsupportedKeys.length > 0) {
|
|
188
|
+
console.warn(`[AreaFocusManager] focusProvince expects options like { type: 'province', name: 'Ha Noi', display: 'highlight' }. Unsupported keys: ${unsupportedKeys.join(', ')}`);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
_getProvinceId(options) {
|
|
195
|
+
if (options == null || typeof options !== 'object') {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return typeof options.id === 'number' ? options.id : null;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
exports.AreaFocusManager = AreaFocusManager;
|
|
205
|
+
//# sourceMappingURL=AreaFocusManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["VIETNAM_MAINLAND_BOUNDS","minLat","minLng","maxLat","maxLng","FOCUS_TYPE_TO_INDUSTRIAL_ECONOMIC_TYPE","industrialZone","IndustrialEconomicType","INDUSTRIAL_ZONE","economicZone","ECONOMIC_ZONE","ecoIndustrialZone","ECO_INDUSTRIAL_ZONE","freeTradeZone","FREE_TRADE_ZONE","nonTariffZone","NON_TARIFF_ZONE","otherZoneModel","OTHER_ZONE_MODEL","AreaFocusManager","constructor","mapView","currentSession","_focusArea","area","options","clear","load","focusOptions","bounds","getBounds","_fitBounds","AreaFocusSession","render","error","console","_focusProvince","provinceId","_getProvinceId","provinceName","_getProvinceName","ProvinceArea","fromName","display","padding","undefined","focus","type","id","warn","industrialEconomicType","_getIndustrialEconomicType","IndustrialEconomicArea","values","Object","includes","destroy","fitBounds","southWest","latitude","longitude","northEast","name","trim","length","optionKeys","keys","unsupportedKeys","filter","key","join"],"sources":["AreaFocusManager.js"],"sourcesContent":["import {AreaFocusSession} from './area/AreaFocusSession'\r\nimport {ProvinceArea, IndustrialEconomicArea} from './area/AreaFocusAreas'\r\nimport {IndustrialEconomicType} from './area/AreaFocusTypes'\r\n\r\n/**\r\n * @typedef {'normal' | 'highlight'} FocusDisplay\r\n */\r\n\r\n/**\r\n * @typedef {{left?: number, right?: number, top?: number, bottom?: number}} FocusPadding\r\n */\r\n\r\n/**\r\n * @typedef {'province' | 'industrialZone' | 'economicZone' | 'ecoIndustrialZone' | 'freeTradeZone' | 'nonTariffZone' | 'otherZoneModel' | number} FocusType\r\n */\r\n\r\n/**\r\n * @typedef {Object} FocusOptions\r\n * @property {FocusType} type\r\n * @property {number=} id\r\n * @property {string=} name\r\n * @property {FocusDisplay=} display\r\n * @property {FocusPadding=} padding\r\n */\r\n\r\nconst VIETNAM_MAINLAND_BOUNDS = {\r\n minLat: 8.18,\r\n minLng: 102.14,\r\n maxLat: 23.4,\r\n maxLng: 109.47,\r\n}\r\n\r\nconst FOCUS_TYPE_TO_INDUSTRIAL_ECONOMIC_TYPE = {\r\n industrialZone: IndustrialEconomicType.INDUSTRIAL_ZONE,\r\n economicZone: IndustrialEconomicType.ECONOMIC_ZONE,\r\n ecoIndustrialZone: IndustrialEconomicType.ECO_INDUSTRIAL_ZONE,\r\n freeTradeZone: IndustrialEconomicType.FREE_TRADE_ZONE,\r\n nonTariffZone: IndustrialEconomicType.NON_TARIFF_ZONE,\r\n otherZoneModel: IndustrialEconomicType.OTHER_ZONE_MODEL,\r\n}\r\n\r\nexport class AreaFocusManager {\r\n constructor(mapView) {\r\n this.mapView = mapView\r\n this.currentSession = null\r\n }\r\n\r\n async _focusArea(area, options) {\r\n this.clear()\r\n\r\n if (!area) {\r\n return null\r\n }\r\n\r\n try {\r\n if (!(await area.load())) {\r\n return null\r\n }\r\n\r\n const focusOptions = {...(options || {})}\r\n const bounds = area.getBounds() || VIETNAM_MAINLAND_BOUNDS\r\n\r\n this._fitBounds(bounds, focusOptions)\r\n\r\n this.currentSession = new AreaFocusSession(this.mapView, area, focusOptions)\r\n this.currentSession.render()\r\n\r\n return this.currentSession\r\n }\r\n catch (error) {\r\n console.error('Cannot focus area:', error)\r\n return null\r\n }\r\n }\r\n\r\n async _focusProvince(options) {\r\n const provinceId = this._getProvinceId(options)\r\n const provinceName = this._getProvinceName(options)\r\n\r\n if (provinceId == null && !provinceName) {\r\n this.clear()\r\n return null\r\n }\r\n\r\n const area = provinceId != null ? new ProvinceArea(provinceId) : ProvinceArea.fromName(provinceName)\r\n const display = options && options.display === 'highlight' ? 'highlight' : 'normal'\r\n\r\n return this._focusArea(area, {\r\n display,\r\n padding: options ? options.padding : undefined,\r\n })\r\n }\r\n\r\n /**\r\n * @param {FocusOptions | null | undefined} focusOptions\r\n * @returns {Promise<AreaFocusSession | null>}\r\n */\r\n async focus(focusOptions) {\r\n if (focusOptions == null) {\r\n this.clear()\r\n return null\r\n }\r\n\r\n if (focusOptions.type === 'province') {\r\n return this._focusProvince(focusOptions)\r\n }\r\n\r\n if (focusOptions.id == null) {\r\n console.warn('Focus options must include an id for non-province types:', focusOptions)\r\n this.clear()\r\n return null\r\n }\r\n\r\n const industrialEconomicType = this._getIndustrialEconomicType(focusOptions.type)\r\n\r\n if (industrialEconomicType != null) {\r\n return this._focusArea(new IndustrialEconomicArea(industrialEconomicType, focusOptions.id), {\r\n display: focusOptions.display,\r\n padding: focusOptions.padding,\r\n })\r\n }\r\n\r\n console.warn('Unsupported focus type:', focusOptions.type)\r\n return null\r\n }\r\n\r\n _getIndustrialEconomicType(type) {\r\n if (typeof type === 'number') {\r\n const values = Object.values(IndustrialEconomicType)\r\n return values.includes(type) ? type : null\r\n }\r\n\r\n if (typeof type !== 'string') {\r\n return null\r\n }\r\n\r\n return FOCUS_TYPE_TO_INDUSTRIAL_ECONOMIC_TYPE[type] || null\r\n }\r\n\r\n clear() {\r\n if (this.currentSession) {\r\n this.currentSession.destroy()\r\n this.currentSession = null\r\n }\r\n }\r\n\r\n _fitBounds(bounds, options) {\r\n if (!this.mapView || typeof this.mapView.fitBounds !== 'function' || !bounds) {\r\n return\r\n }\r\n\r\n this.mapView.fitBounds({\r\n bounds: {\r\n southWest: {\r\n latitude: bounds.minLat,\r\n longitude: bounds.minLng,\r\n },\r\n northEast: {\r\n latitude: bounds.maxLat,\r\n longitude: bounds.maxLng,\r\n },\r\n },\r\n padding: options ? options.padding : undefined,\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 const name = options.name.trim()\r\n return name.length > 0 ? name : null\r\n }\r\n\r\n const optionKeys = Object.keys(options)\r\n const unsupportedKeys = optionKeys.filter((key) => key !== 'type' && key !== 'id' && key !== 'name' && key !== 'display' && key !== 'padding')\r\n\r\n if (unsupportedKeys.length > 0) {\r\n console.warn(\r\n `[AreaFocusManager] focusProvince expects options like { type: 'province', name: 'Ha Noi', display: 'highlight' }. Unsupported keys: ${unsupportedKeys.join(', ')}`\r\n )\r\n }\r\n\r\n return null\r\n }\r\n\r\n _getProvinceId(options) {\r\n if (options == null || typeof options !== 'object') {\r\n return null\r\n }\r\n\r\n return typeof options.id === 'number' ? options.id : null\r\n }\r\n}\r\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,uBAAuB,GAAG;EAC9BC,MAAM,EAAE,IADsB;EAE9BC,MAAM,EAAE,MAFsB;EAG9BC,MAAM,EAAE,IAHsB;EAI9BC,MAAM,EAAE;AAJsB,CAAhC;AAOA,MAAMC,sCAAsC,GAAG;EAC7CC,cAAc,EAA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D,OAAO,IAAP;IACD;;IAED,IAAI,OAAOA,OAAO,CAACqC,IAAf,KAAwB,QAA5B,EAAsC;MACpC,MAAMA,IAAI,GAAGrC,OAAO,CAACqC,IAAR,CAAaC,IAAb,EAAb;MACA,OAAOD,IAAI,CAACE,MAAL,GAAc,CAAd,GAAkBF,IAAlB,GAAyB,IAAhC;IACD;;IAED,MAAMG,UAAU,GAAGX,MAAM,CAACY,IAAP,CAAYzC,OAAZ,CAAnB;IACA,MAAM0C,eAAe,GAAGF,UAAU,CAACG,MAAX,CAAmBC,GAAD,IAASA,GAAG,KAAK,MAAR,IAAkBA,GAAG,KAAK,IAA1B,IAAkCA,GAAG,KAAK,MAA1C,IAAoDA,GAAG,KAAK,SAA5D,IAAyEA,GAAG,KAAK,SAA5G,CAAxB;;IAEA,IAAIF,eAAe,CAACH,MAAhB,GAAyB,CAA7B,EAAgC;MAC9B7B,OAAO,CAACc,IAAR,CACG,uIAAsIkB,eAAe,CAACG,IAAhB,CAAqB,IAArB,CAA2B,EADpK;IAGD;;IAED,OAAO,IAAP;EACD;;EAEDhC,cAAc,CAACb,OAAD,EAAU;IACtB,IAAIA,OAAO,IAAI,IAAX,IAAmB,OAAOA,OAAP,KAAmB,QAA1C,EAAoD;MAClD,OAAO,IAAP;IACD;;IAED,OAAO,OAAOA,OAAO,CAACuB,EAAf,KAAsB,QAAtB,GAAiCvB,OAAO,CAACuB,EAAzC,GAA8C,IAArD;EACD;;AAzJ2B"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AreaFocuser = void 0;
|
|
7
|
+
|
|
8
|
+
class AreaFocuser {
|
|
9
|
+
constructor(areaFocusManager) {
|
|
10
|
+
this._areaFocusManager = areaFocusManager;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @param {{name?: string, highlight?: boolean}=} options
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
async focusProvince(options) {
|
|
18
|
+
const provinceName = this._getProvinceName(options);
|
|
19
|
+
|
|
20
|
+
const shouldHighlight = this._shouldHighlight(options);
|
|
21
|
+
|
|
22
|
+
if (!provinceName) {
|
|
23
|
+
this._clear();
|
|
24
|
+
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (this._areaFocusManager) {
|
|
29
|
+
await this._areaFocusManager.focus({
|
|
30
|
+
type: 'province',
|
|
31
|
+
name: provinceName,
|
|
32
|
+
display: shouldHighlight ? 'highlight' : 'normal'
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_clear() {
|
|
38
|
+
if (this._areaFocusManager) {
|
|
39
|
+
this._areaFocusManager.clear();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
_getProvinceName(options) {
|
|
44
|
+
if (options == null || typeof options !== 'object') {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (typeof options.name === 'string') {
|
|
49
|
+
return options.name.trim();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const optionKeys = Object.keys(options);
|
|
53
|
+
const unsupportedKeys = optionKeys.filter(key => key !== 'name' && key !== 'highlight');
|
|
54
|
+
|
|
55
|
+
if (unsupportedKeys.length > 0) {
|
|
56
|
+
console.warn(`[AreaFocuser] focusProvince expects options like { name: 'Ha Noi', highlight: true }. Unsupported keys: ${unsupportedKeys.join(', ')}`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
_shouldHighlight(options) {
|
|
63
|
+
if (options == null || typeof options !== 'object') {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return options.highlight === true;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
exports.AreaFocuser = AreaFocuser;
|
|
73
|
+
//# sourceMappingURL=AreaFocuser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AreaFocuser","constructor","areaFocusManager","_areaFocusManager","focusProvince","options","provinceName","_getProvinceName","shouldHighlight","_shouldHighlight","_clear","focus","type","name","display","clear","trim","optionKeys","Object","keys","unsupportedKeys","filter","key","length","console","warn","join","highlight"],"sources":["AreaFocuser.js"],"sourcesContent":["export class AreaFocuser {\r\n\r\n constructor(areaFocusManager) {\r\n this._areaFocusManager = areaFocusManager\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._clear()\r\n return\r\n }\r\n\r\n if (this._areaFocusManager) {\r\n await this._areaFocusManager.focus({\r\n type: 'province',\r\n name: provinceName,\r\n display: shouldHighlight ? 'highlight' : 'normal',\r\n })\r\n }\r\n }\r\n\r\n _clear() {\r\n if (this._areaFocusManager) {\r\n this._areaFocusManager.clear()\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}"],"mappings":";;;;;;;AAAO,MAAMA,WAAN,CAAkB;EAEvBC,WAA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EDjB,gBAAgB,CAACJ,OAAD,EAAU;IACxB,IAAIA,OAAO,IAAI,IAAX,IAAmB,OAAOA,OAAP,KAAmB,QAA1C,EAAoD;MAClD,OAAO,KAAP;IACD;;IAED,OAAOA,OAAO,CAACsB,SAAR,KAAsB,IAA7B;EACD;;AA5DsB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BoundHelper = void 0;
|
|
7
|
+
|
|
8
|
+
class BoundHelper {
|
|
9
|
+
static createEmptyBounds() {
|
|
10
|
+
return {
|
|
11
|
+
minLat: Infinity,
|
|
12
|
+
minLng: Infinity,
|
|
13
|
+
maxLat: -Infinity,
|
|
14
|
+
maxLng: -Infinity
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static updateBounds(bounds, lat, lng) {
|
|
19
|
+
bounds.minLat = Math.min(bounds.minLat, lat);
|
|
20
|
+
bounds.minLng = Math.min(bounds.minLng, lng);
|
|
21
|
+
bounds.maxLat = Math.max(bounds.maxLat, lat);
|
|
22
|
+
bounds.maxLng = Math.max(bounds.maxLng, lng);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static isValidBounds(bounds) {
|
|
26
|
+
if (!bounds) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return !(bounds.minLat === Infinity || bounds.minLng === Infinity || bounds.maxLat === -Infinity || bounds.maxLng === -Infinity);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
exports.BoundHelper = BoundHelper;
|
|
36
|
+
//# sourceMappingURL=BoundHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BoundHelper","createEmptyBounds","minLat","Infinity","minLng","maxLat","maxLng","updateBounds","bounds","lat","lng","Math","min","max","isValidBounds"],"sources":["BoundHelper.js"],"sourcesContent":["class BoundHelper {\r\n static createEmptyBounds() {\r\n return {\r\n minLat: Infinity,\r\n minLng: Infinity,\r\n maxLat: -Infinity,\r\n maxLng: -Infinity,\r\n }\r\n }\r\n\r\n static updateBounds(bounds, lat, lng) {\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 static isValidBounds(bounds) {\r\n if (!bounds) {\r\n return false\r\n }\r\n\r\n return !(\r\n bounds.minLat === Infinity ||\r\n bounds.minLng === Infinity ||\r\n bounds.maxLat === -Infinity ||\r\n bounds.maxLng === -Infinity\r\n )\r\n }\r\n}\r\n\r\nexport {BoundHelper}"],"mappings":";;;;;;;AAAA,MAAMA,WAAN,CAAkB;EACQ,OAAjBC,iBAAiB,GAAG;IACzB,OAAO;MACLC,MAAM,EAAEC,QADH;MAELC,MAAM,EAAED,QAFH;MAGLE,MAAM,EAAE,CAACF,QAHJ;MAILG,MAAM,EAAE,CAACH;IAJJ,CAAP;EAMD;;EAEkB,OAAZI,YAAY,CAACC,MAAD,EAASC,GAAT,EAAcC,GAAd,EAAmB;IACpCF,MAAM,CAACN,MAAP,GAAgBS,IAAI,CAACC,GAAL,CAASJ,MAAM,CAACN,MAAhB,EAAwBO,GAAxB,CAAhB;IACAD,MAAM,CAACJ,MAAP,GAAgBO,IAAI,CAACC,GAAL,CAASJ,MAAM,CAACJ,MAAhB,EAAwBM,GAAxB,CAAhB;IACAF,MAAM,CAACH,MAAP,GAAgBM,IAAI,CAACE,GAAL,CAASL,MAAM,CAACH,MAAhB,EAAwBI,GAAxB,CAAhB;IACAD,MAAM,CAACF,MAAP,GAAgBK,IAAI,CAACE,GAAL,CAASL,MAAM,CAACF,MAAhB,EAAwBI,GAAxB,CAAhB;EACD;;EAEmB,OAAbI,aAAa,CAACN,MAAD,EAAS;IAC3B,IAAI,CAACA,MAAL,EAAa;MACX,OAAO,KAAP;IACD;;IAED,OAAO,EACLA,MAAM,CAACN,MAAP,KAAkBC,QAAlB,IACAK,MAAM,CAACJ,MAAP,KAAkBD,QADlB,IAEAK,MAAM,CAACH,MAAP,KAAkB,CAACF,QAFnB,IAGAK,MAAM,CAACF,MAAP,KAAkB,CAACH,QAJd,CAAP;EAMD;;AA5Be"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ProvinceArea = exports.IndustrialEconomicArea = void 0;
|
|
7
|
+
|
|
8
|
+
var _AreaFocusGeometryUtils = require("./AreaFocusGeometryUtils");
|
|
9
|
+
|
|
10
|
+
var _AreaFocusTypes = require("./AreaFocusTypes");
|
|
11
|
+
|
|
12
|
+
const INDUSTRIAL_ECONOMIC_PATH_BY_TYPE = {
|
|
13
|
+
[_AreaFocusTypes.IndustrialEconomicType.INDUSTRIAL_ZONE]: 'khu-cong-nghiep',
|
|
14
|
+
[_AreaFocusTypes.IndustrialEconomicType.ECONOMIC_ZONE]: 'khu-kinh-te',
|
|
15
|
+
[_AreaFocusTypes.IndustrialEconomicType.ECO_INDUSTRIAL_ZONE]: 'khu-cong-nghiep-sinh-thai',
|
|
16
|
+
[_AreaFocusTypes.IndustrialEconomicType.FREE_TRADE_ZONE]: 'khu-thuong-mai-tu-do',
|
|
17
|
+
[_AreaFocusTypes.IndustrialEconomicType.NON_TARIFF_ZONE]: 'khu-phi-thue-quan',
|
|
18
|
+
[_AreaFocusTypes.IndustrialEconomicType.OTHER_ZONE_MODEL]: 'mo-hinh-khu-khac'
|
|
19
|
+
};
|
|
20
|
+
const BDS_API_BASE_URL = 'https://cmcdtqg-gateway.dieuhanhso.vn/staging';
|
|
21
|
+
|
|
22
|
+
class ProvinceArea {
|
|
23
|
+
constructor(id) {
|
|
24
|
+
this.id = id;
|
|
25
|
+
this.name = null;
|
|
26
|
+
this.loaded = false;
|
|
27
|
+
this.geometryData = null;
|
|
28
|
+
this.bounds = null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static fromName(name) {
|
|
32
|
+
const area = new ProvinceArea(null);
|
|
33
|
+
area.name = name;
|
|
34
|
+
return area;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async load() {
|
|
38
|
+
if (this.loaded) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const hasValidId = typeof this.id === 'number';
|
|
43
|
+
const hasValidName = typeof this.name === 'string' && this.name.trim() !== '';
|
|
44
|
+
|
|
45
|
+
if (!hasValidId && !hasValidName) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const normalizedName = hasValidName ? this.name.trim() : null;
|
|
50
|
+
const url = hasValidId ? `${BDS_API_BASE_URL}/bds/api/dmhc/TinhThanh/${this.id}/geometry` : `${BDS_API_BASE_URL}/bds/api/dmhc/TinhThanh/geometry?ten=${encodeURIComponent(normalizedName)}`;
|
|
51
|
+
const response = await fetch(url);
|
|
52
|
+
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const data = await response.json();
|
|
58
|
+
|
|
59
|
+
if (!data.success) {
|
|
60
|
+
console.error('Fetch province area data failed:', data.message);
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const areaData = data.data;
|
|
65
|
+
const geometry = areaData && areaData.geometry ? areaData.geometry : null;
|
|
66
|
+
|
|
67
|
+
if (!geometry) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this.geometryData = {
|
|
72
|
+
name: areaData && areaData.name ? areaData.name : normalizedName,
|
|
73
|
+
geometry
|
|
74
|
+
};
|
|
75
|
+
this.bounds = (0, _AreaFocusGeometryUtils.getViewboxFromGeometry)(geometry);
|
|
76
|
+
this.loaded = true;
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
getGeometryData() {
|
|
81
|
+
return this.geometryData;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
getBounds() {
|
|
85
|
+
return this.bounds;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
getId() {
|
|
89
|
+
return this.id != null ? this.id : `province-${this.name || 'unknown'}`;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
exports.ProvinceArea = ProvinceArea;
|
|
95
|
+
|
|
96
|
+
class IndustrialEconomicArea {
|
|
97
|
+
constructor(type, id) {
|
|
98
|
+
this.type = type;
|
|
99
|
+
this.id = id;
|
|
100
|
+
this.loaded = false;
|
|
101
|
+
this.geometryData = null;
|
|
102
|
+
this.bounds = null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async load() {
|
|
106
|
+
if (this.loaded) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (typeof this.id !== 'number') {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const pathSegment = INDUSTRIAL_ECONOMIC_PATH_BY_TYPE[this.type];
|
|
115
|
+
|
|
116
|
+
if (!pathSegment) {
|
|
117
|
+
console.error('Unsupported industrial/economic area type:', this.type);
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const url = `${BDS_API_BASE_URL}/bds/api/kcnkkt/${pathSegment}/${this.id}/geometry`;
|
|
122
|
+
const response = await fetch(url);
|
|
123
|
+
|
|
124
|
+
if (!response.ok) {
|
|
125
|
+
console.error('Failed to fetch industrial zone data:', response.status, response.statusText);
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const data = await response.json();
|
|
130
|
+
|
|
131
|
+
if (!data.success) {
|
|
132
|
+
console.error('API returned error:', data.message);
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const areaData = data.data;
|
|
137
|
+
const geometry = areaData && areaData.geometry ? areaData.geometry : null;
|
|
138
|
+
|
|
139
|
+
if (!geometry) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
this.geometryData = {
|
|
144
|
+
name: areaData && areaData.name ? areaData.name : null,
|
|
145
|
+
geometry
|
|
146
|
+
};
|
|
147
|
+
this.bounds = (0, _AreaFocusGeometryUtils.getViewboxFromGeometry)(geometry);
|
|
148
|
+
this.loaded = true;
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
getGeometryData() {
|
|
153
|
+
return this.geometryData;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
getBounds() {
|
|
157
|
+
return this.bounds;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
getId() {
|
|
161
|
+
return this.id;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
exports.IndustrialEconomicArea = IndustrialEconomicArea;
|
|
167
|
+
//# sourceMappingURL=AreaFocusAreas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["INDUSTRIAL_ECONOMIC_PATH_BY_TYPE","IndustrialEconomicType","INDUSTRIAL_ZONE","ECONOMIC_ZONE","ECO_INDUSTRIAL_ZONE","FREE_TRADE_ZONE","NON_TARIFF_ZONE","OTHER_ZONE_MODEL","BDS_API_BASE_URL","ProvinceArea","constructor","id","name","loaded","geometryData","bounds","fromName","area","load","hasValidId","hasValidName","trim","normalizedName","url","encodeURIComponent","response","fetch","ok","data","json","success","console","error","message","areaData","geometry","getViewboxFromGeometry","getGeometryData","getBounds","getId","IndustrialEconomicArea","type","pathSegment","status","statusText"],"sources":["AreaFocusAreas.js"],"sourcesContent":["import {getViewboxFromGeometry} from './AreaFocusGeometryUtils'\r\nimport {IndustrialEconomicType} from './AreaFocusTypes'\r\n\r\nconst INDUSTRIAL_ECONOMIC_PATH_BY_TYPE = {\r\n [IndustrialEconomicType.INDUSTRIAL_ZONE]: 'khu-cong-nghiep',\r\n [IndustrialEconomicType.ECONOMIC_ZONE]: 'khu-kinh-te',\r\n [IndustrialEconomicType.ECO_INDUSTRIAL_ZONE]: 'khu-cong-nghiep-sinh-thai',\r\n [IndustrialEconomicType.FREE_TRADE_ZONE]: 'khu-thuong-mai-tu-do',\r\n [IndustrialEconomicType.NON_TARIFF_ZONE]: 'khu-phi-thue-quan',\r\n [IndustrialEconomicType.OTHER_ZONE_MODEL]: 'mo-hinh-khu-khac',\r\n}\r\n\r\nconst BDS_API_BASE_URL = 'https://cmcdtqg-gateway.dieuhanhso.vn/staging'\r\n\r\nclass ProvinceArea {\r\n constructor(id) {\r\n this.id = id\r\n this.name = null\r\n this.loaded = false\r\n this.geometryData = null\r\n this.bounds = null\r\n }\r\n\r\n static fromName(name) {\r\n const area = new ProvinceArea(null)\r\n area.name = name\r\n return area\r\n }\r\n\r\n async load() {\r\n if (this.loaded) {\r\n return true\r\n }\r\n\r\n const hasValidId = typeof this.id === 'number'\r\n const hasValidName = typeof this.name === 'string' && this.name.trim() !== ''\r\n\r\n if (!hasValidId && !hasValidName) {\r\n return false\r\n }\r\n\r\n const normalizedName = hasValidName ? this.name.trim() : null\r\n const url = hasValidId\r\n ? `${BDS_API_BASE_URL}/bds/api/dmhc/TinhThanh/${this.id}/geometry`\r\n : `${BDS_API_BASE_URL}/bds/api/dmhc/TinhThanh/geometry?ten=${encodeURIComponent(normalizedName)}`\r\n\r\n const response = await fetch(url)\r\n\r\n if (!response.ok) {\r\n return false\r\n }\r\n\r\n const data = await response.json()\r\n\r\n if (!data.success) {\r\n console.error('Fetch province area data failed:', data.message)\r\n return false\r\n }\r\n\r\n const areaData = data.data\r\n const geometry = areaData && areaData.geometry ? areaData.geometry : null\r\n\r\n if (!geometry) {\r\n return false\r\n }\r\n\r\n this.geometryData = {\r\n name: areaData && areaData.name ? areaData.name : normalizedName,\r\n geometry,\r\n }\r\n this.bounds = getViewboxFromGeometry(geometry)\r\n this.loaded = true\r\n\r\n return true\r\n }\r\n\r\n getGeometryData() {\r\n return this.geometryData\r\n }\r\n\r\n getBounds() {\r\n return this.bounds\r\n }\r\n\r\n getId() {\r\n return this.id != null ? this.id : `province-${this.name || 'unknown'}`\r\n }\r\n}\r\n\r\nclass IndustrialEconomicArea {\r\n constructor(type, id) {\r\n this.type = type\r\n this.id = id\r\n this.loaded = false\r\n this.geometryData = null\r\n this.bounds = null\r\n }\r\n\r\n async load() {\r\n if (this.loaded) {\r\n return true\r\n }\r\n\r\n if (typeof this.id !== 'number') {\r\n return false\r\n }\r\n\r\n const pathSegment = INDUSTRIAL_ECONOMIC_PATH_BY_TYPE[this.type]\r\n\r\n if (!pathSegment) {\r\n console.error('Unsupported industrial/economic area type:', this.type)\r\n return false\r\n }\r\n\r\n const url = `${BDS_API_BASE_URL}/bds/api/kcnkkt/${pathSegment}/${this.id}/geometry`\r\n\r\n const response = await fetch(url)\r\n\r\n if (!response.ok) {\r\n console.error('Failed to fetch industrial zone data:', response.status, response.statusText)\r\n return false\r\n }\r\n\r\n const data = await response.json()\r\n\r\n if (!data.success) {\r\n console.error('API returned error:', data.message)\r\n return false\r\n }\r\n\r\n const areaData = data.data\r\n const geometry = areaData && areaData.geometry ? areaData.geometry : null\r\n\r\n if (!geometry) {\r\n return false\r\n }\r\n\r\n this.geometryData = {\r\n name: areaData && areaData.name ? areaData.name : null,\r\n geometry,\r\n }\r\n this.bounds = getViewboxFromGeometry(geometry)\r\n this.loaded = true\r\n\r\n return true\r\n }\r\n\r\n getGeometryData() {\r\n return this.geometryData\r\n }\r\n\r\n getBounds() {\r\n return this.bounds\r\n }\r\n\r\n getId() {\r\n return this.id\r\n }\r\n}\r\n\r\nexport {\r\n ProvinceArea,\r\n IndustrialEconomicArea,\r\n}\r\n"],"mappings":";;;;;;;AAAA;;AACA;;AA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