react-native-map4d-map-dtqg 0.1.1 → 0.1.3
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 -88
- 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/Map4dMap.xcodeproj/project.pbxproj +2 -2
- package/ios/Map4dMapViewManager.m +34 -34
- package/ios/RCTConvert+Map4dMap.h +33 -33
- package/ios/RCTConvert+Map4dMap.m +112 -112
- package/ios/RMFCircle.h +37 -37
- package/ios/RMFCircle.m +100 -100
- package/ios/RMFCircleManager.h +18 -18
- package/ios/RMFCircleManager.m +155 -155
- package/ios/RMFCircleMap4d.h +23 -23
- package/ios/RMFCircleMap4d.m +13 -13
- package/ios/RMFCoordinate.h +22 -22
- package/ios/RMFCoordinate.m +13 -13
- package/ios/RMFDirectionsMarkerOptions.h +24 -24
- package/ios/RMFDirectionsMarkerOptions.m +23 -23
- package/ios/RMFDirectionsRenderer.h +47 -47
- package/ios/RMFDirectionsRenderer.m +182 -182
- package/ios/RMFDirectionsRendererManager.h +17 -17
- package/ios/RMFDirectionsRendererManager.m +84 -84
- package/ios/RMFDirectionsRendererMap4d.h +21 -21
- package/ios/RMFDirectionsRendererMap4d.m +12 -12
- package/ios/RMFDummyView.h +6 -6
- package/ios/RMFDummyView.m +12 -12
- package/ios/RMFEventResponse.h +39 -39
- package/ios/RMFEventResponse.m +98 -98
- package/ios/RMFIcon.h +24 -24
- package/ios/RMFIcon.m +35 -35
- package/ios/RMFMapView.h +84 -84
- package/ios/RMFMapView.m +376 -376
- package/ios/RMFMapViewManager.h +17 -17
- package/ios/RMFMapViewManager.m +509 -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 +89 -70
- 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 +21 -259
- package/lib/commonjs/components/extends/AreaFocuser.js.map +1 -1
- 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 +8 -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 +88 -70
- 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 +21 -259
- package/lib/module/components/extends/AreaFocuser.js.map +1 -1
- 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 +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/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 -447
- 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 +61 -338
- 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 -23
- 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 +0 -2
- package/android/.gradle/config.properties +0 -2
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/AndroidProjectSystem.xml +0 -6
- package/android/.idea/caches/deviceStreaming.xml +0 -1570
- package/android/.idea/copilot.data.migration.ask2agent.xml +0 -6
- package/android/.idea/gradle.xml +0 -12
- package/android/.idea/migrations.xml +0 -10
- package/android/.idea/misc.xml +0 -10
- package/android/.idea/runConfigurations.xml +0 -17
- package/android/.idea/vcs.xml +0 -6
- package/android/local.properties +0 -8
|
@@ -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';\
|
|
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,KAAV,CAAgB;IACd;AACN;AACA;IACMC,QAAQ,EAAEH,kBAAA,CAAUI,MAAV,CAAiBC,UAJb;IAKdC,SAAS,EAAEN,kBAAA,CAAUI,MAAV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ACI,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\";\
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","ComponentName","Map4dMapView","UIManager","getViewManagerConfig","requireNativeComponent","Error"],"sources":["Map4dMapView.tsx"],"sourcesContent":["import {\
|
|
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"}
|
|
@@ -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'\nimport {ProvinceArea, IndustrialEconomicArea} from './area/AreaFocusAreas'\nimport {IndustrialEconomicType} from './area/AreaFocusTypes'\n\n/**\n * @typedef {'normal' | 'highlight'} FocusDisplay\n */\n\n/**\n * @typedef {{left?: number, right?: number, top?: number, bottom?: number}} FocusPadding\n */\n\n/**\n * @typedef {'province' | 'industrialZone' | 'economicZone' | 'ecoIndustrialZone' | 'freeTradeZone' | 'nonTariffZone' | 'otherZoneModel' | number} FocusType\n */\n\n/**\n * @typedef {Object} FocusOptions\n * @property {FocusType} type\n * @property {number=} id\n * @property {string=} name\n * @property {FocusDisplay=} display\n * @property {FocusPadding=} padding\n */\n\nconst VIETNAM_MAINLAND_BOUNDS = {\n minLat: 8.18,\n minLng: 102.14,\n maxLat: 23.4,\n maxLng: 109.47,\n}\n\nconst FOCUS_TYPE_TO_INDUSTRIAL_ECONOMIC_TYPE = {\n industrialZone: IndustrialEconomicType.INDUSTRIAL_ZONE,\n economicZone: IndustrialEconomicType.ECONOMIC_ZONE,\n ecoIndustrialZone: IndustrialEconomicType.ECO_INDUSTRIAL_ZONE,\n freeTradeZone: IndustrialEconomicType.FREE_TRADE_ZONE,\n nonTariffZone: IndustrialEconomicType.NON_TARIFF_ZONE,\n otherZoneModel: IndustrialEconomicType.OTHER_ZONE_MODEL,\n}\n\nexport class AreaFocusManager {\n constructor(mapView) {\n this.mapView = mapView\n this.currentSession = null\n }\n\n async _focusArea(area, options) {\n this.clear()\n\n if (!area) {\n return null\n }\n\n try {\n if (!(await area.load())) {\n return null\n }\n\n const focusOptions = {...(options || {})}\n const bounds = area.getBounds() || VIETNAM_MAINLAND_BOUNDS\n\n this._fitBounds(bounds, focusOptions)\n\n this.currentSession = new AreaFocusSession(this.mapView, area, focusOptions)\n this.currentSession.render()\n\n return this.currentSession\n }\n catch (error) {\n console.error('Cannot focus area:', error)\n return null\n }\n }\n\n async _focusProvince(options) {\n const provinceId = this._getProvinceId(options)\n const provinceName = this._getProvinceName(options)\n\n if (provinceId == null && !provinceName) {\n this.clear()\n return null\n }\n\n const area = provinceId != null ? new ProvinceArea(provinceId) : ProvinceArea.fromName(provinceName)\n const display = options && options.display === 'highlight' ? 'highlight' : 'normal'\n\n return this._focusArea(area, {\n display,\n padding: options ? options.padding : undefined,\n })\n }\n\n /**\n * @param {FocusOptions | null | undefined} focusOptions\n * @returns {Promise<AreaFocusSession | null>}\n */\n async focus(focusOptions) {\n if (focusOptions == null) {\n this.clear()\n return null\n }\n\n if (focusOptions.type === 'province') {\n return this._focusProvince(focusOptions)\n }\n\n if (focusOptions.id == null) {\n console.warn('Focus options must include an id for non-province types:', focusOptions)\n this.clear()\n return null\n }\n\n const industrialEconomicType = this._getIndustrialEconomicType(focusOptions.type)\n\n if (industrialEconomicType != null) {\n return this._focusArea(new IndustrialEconomicArea(industrialEconomicType, focusOptions.id), {\n display: focusOptions.display,\n padding: focusOptions.padding,\n })\n }\n\n console.warn('Unsupported focus type:', focusOptions.type)\n return null\n }\n\n _getIndustrialEconomicType(type) {\n if (typeof type === 'number') {\n const values = Object.values(IndustrialEconomicType)\n return values.includes(type) ? type : null\n }\n\n if (typeof type !== 'string') {\n return null\n }\n\n return FOCUS_TYPE_TO_INDUSTRIAL_ECONOMIC_TYPE[type] || null\n }\n\n clear() {\n if (this.currentSession) {\n this.currentSession.destroy()\n this.currentSession = null\n }\n }\n\n _fitBounds(bounds, options) {\n if (!this.mapView || typeof this.mapView.fitBounds !== 'function' || !bounds) {\n return\n }\n\n this.mapView.fitBounds({\n bounds: {\n southWest: {\n latitude: bounds.minLat,\n longitude: bounds.minLng,\n },\n northEast: {\n latitude: bounds.maxLat,\n longitude: bounds.maxLng,\n },\n },\n padding: options ? options.padding : undefined,\n })\n }\n\n _getProvinceName(options) {\n if (options == null || typeof options !== 'object') {\n return null\n }\n\n if (typeof options.name === 'string') {\n const name = options.name.trim()\n return name.length > 0 ? name : null\n }\n\n const optionKeys = Object.keys(options)\n const unsupportedKeys = optionKeys.filter((key) => key !== 'type' && key !== 'id' && key !== 'name' && key !== 'display' && key !== 'padding')\n\n if (unsupportedKeys.length > 0) {\n console.warn(\n `[AreaFocusManager] focusProvince expects options like { type: 'province', name: 'Ha Noi', display: 'highlight' }. Unsupported keys: ${unsupportedKeys.join(', ')}`\n )\n }\n\n return null\n }\n\n _getProvinceId(options) {\n if (options == null || typeof options !== 'object') {\n return null\n }\n\n return typeof options.id === 'number' ? options.id : null\n }\n}\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,EAAEC,sCAAA,CAAuBC,eADM;EAE7CC,YAAY,EAAEF,sCAAA,CAAuBG,aAFQ;EAG7CC,iBAAiB,EAAEJ,sCAAA,CAAuBK,mBAHG;EAI7CC,aAAa,EAAEN,sCAAA,CAAuBO,eAJO;EAK7CC,aAAa,EAAER,sCAAA,CAAuBS,eALO;EAM7CC,cAAc,EAAEV,sCAAA,CAAuBW;AANM,CAA/C;;AASO,MAAMC,gBAAN,CAAuB;EAC5BC,WAAW,CAACC,OAAD,EAAU;IACnB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,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"}
|
|
@@ -6,100 +6,41 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.AreaFocuser = void 0;
|
|
7
7
|
|
|
8
8
|
class AreaFocuser {
|
|
9
|
-
constructor(
|
|
10
|
-
this.
|
|
11
|
-
this.highlightPaths = [];
|
|
12
|
-
this.highlightPolygonId = 'area-focuser-highlight-polygon';
|
|
9
|
+
constructor(areaFocusManager) {
|
|
10
|
+
this._areaFocusManager = areaFocusManager;
|
|
13
11
|
}
|
|
14
|
-
/**
|
|
15
|
-
* @param {{name?: string, highlight?: boolean}=} options
|
|
12
|
+
/**
|
|
13
|
+
* @param {{name?: string, highlight?: boolean}=} options
|
|
16
14
|
*/
|
|
17
15
|
|
|
18
16
|
|
|
19
17
|
async focusProvince(options) {
|
|
20
|
-
const provinceName = this.
|
|
21
|
-
|
|
18
|
+
const provinceName = this._getProvinceName(options);
|
|
19
|
+
|
|
20
|
+
const shouldHighlight = this._shouldHighlight(options);
|
|
22
21
|
|
|
23
22
|
if (!provinceName) {
|
|
24
|
-
this.
|
|
25
|
-
|
|
23
|
+
this._clear();
|
|
24
|
+
|
|
26
25
|
return;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (!response.ok) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const data = await response.json();
|
|
39
|
-
|
|
40
|
-
if (data.code !== 'ok') {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const feature = data.result && data.result.features && data.result.features.length > 0 ? data.result.features[0] : null;
|
|
45
|
-
|
|
46
|
-
if (!feature) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const geometry = feature.geometry;
|
|
51
|
-
|
|
52
|
-
if (!geometry) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
let bounds = null;
|
|
57
|
-
const viewbox = feature.properties && feature.properties.viewbox ? feature.properties.viewbox : null;
|
|
58
|
-
|
|
59
|
-
if (viewbox != null && viewbox.trim() != '') {
|
|
60
|
-
bounds = this.parseViewbox(viewbox);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (!bounds) {
|
|
64
|
-
bounds = this.getViewboxFromGeometry(geometry);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (!bounds) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
this.mapView.fitBounds({
|
|
72
|
-
bounds: {
|
|
73
|
-
southWest: {
|
|
74
|
-
latitude: bounds[0],
|
|
75
|
-
longitude: bounds[1]
|
|
76
|
-
},
|
|
77
|
-
northEast: {
|
|
78
|
-
latitude: bounds[2],
|
|
79
|
-
longitude: bounds[3]
|
|
80
|
-
}
|
|
81
|
-
}
|
|
28
|
+
if (this._areaFocusManager) {
|
|
29
|
+
await this._areaFocusManager.focus({
|
|
30
|
+
type: 'province',
|
|
31
|
+
name: provinceName,
|
|
32
|
+
display: shouldHighlight ? 'highlight' : 'normal'
|
|
82
33
|
});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (shouldHighlight) {
|
|
86
|
-
const polygon = this.getHighlightPolygonProps();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
87
36
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
zIndex: 999
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
} else {
|
|
95
|
-
this.clearHighlightPolygon();
|
|
96
|
-
}
|
|
97
|
-
} catch (error) {
|
|
98
|
-
console.error('Cannot focus province:', error);
|
|
37
|
+
_clear() {
|
|
38
|
+
if (this._areaFocusManager) {
|
|
39
|
+
this._areaFocusManager.clear();
|
|
99
40
|
}
|
|
100
41
|
}
|
|
101
42
|
|
|
102
|
-
|
|
43
|
+
_getProvinceName(options) {
|
|
103
44
|
if (options == null || typeof options !== 'object') {
|
|
104
45
|
return null;
|
|
105
46
|
}
|
|
@@ -118,7 +59,7 @@ class AreaFocuser {
|
|
|
118
59
|
return null;
|
|
119
60
|
}
|
|
120
61
|
|
|
121
|
-
|
|
62
|
+
_shouldHighlight(options) {
|
|
122
63
|
if (options == null || typeof options !== 'object') {
|
|
123
64
|
return false;
|
|
124
65
|
}
|
|
@@ -126,185 +67,6 @@ class AreaFocuser {
|
|
|
126
67
|
return options.highlight === true;
|
|
127
68
|
}
|
|
128
69
|
|
|
129
|
-
parseViewbox(viewbox) {
|
|
130
|
-
const bounds = viewbox.split(',').map(Number);
|
|
131
|
-
|
|
132
|
-
if (bounds.length != 4) {
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const [minLat, minLng, maxLat, maxLng] = bounds;
|
|
137
|
-
|
|
138
|
-
if (Number.isNaN(minLat) || Number.isNaN(minLng) || Number.isNaN(maxLat) || Number.isNaN(maxLng)) {
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return [minLat, minLng, maxLat, maxLng];
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
getViewboxFromGeometry(geometry) {
|
|
146
|
-
const bounds = {
|
|
147
|
-
minLat: Infinity,
|
|
148
|
-
minLng: Infinity,
|
|
149
|
-
maxLat: -Infinity,
|
|
150
|
-
maxLng: -Infinity
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const updateBounds = function (coordinate) {
|
|
154
|
-
if (coordinate.length < 2) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const lng = coordinate[0];
|
|
159
|
-
const lat = coordinate[1];
|
|
160
|
-
|
|
161
|
-
if (Number.isNaN(lat) || Number.isNaN(lng)) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
bounds.minLat = Math.min(bounds.minLat, lat);
|
|
166
|
-
bounds.minLng = Math.min(bounds.minLng, lng);
|
|
167
|
-
bounds.maxLat = Math.max(bounds.maxLat, lat);
|
|
168
|
-
bounds.maxLng = Math.max(bounds.maxLng, lng);
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
if (geometry.type === 'Polygon') {
|
|
172
|
-
const polygons = geometry.coordinates;
|
|
173
|
-
polygons.forEach(function (ring) {
|
|
174
|
-
ring.forEach(function (coordinate) {
|
|
175
|
-
updateBounds(coordinate);
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
if (geometry.type === 'MultiPolygon') {
|
|
181
|
-
const multiPolygons = geometry.coordinates;
|
|
182
|
-
multiPolygons.forEach(function (polygon) {
|
|
183
|
-
polygon.forEach(function (ring) {
|
|
184
|
-
ring.forEach(function (coordinate) {
|
|
185
|
-
updateBounds(coordinate);
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (bounds.minLat === Infinity || bounds.minLng === Infinity || bounds.maxLat === -Infinity || bounds.maxLng === -Infinity) {
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return [bounds.minLat, bounds.minLng, bounds.maxLat, bounds.maxLng];
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
createHighlightPaths(geometry) {
|
|
199
|
-
this.clearHighlightPaths();
|
|
200
|
-
const paths = this.createWorldMaskPaths(geometry);
|
|
201
|
-
|
|
202
|
-
if (paths.length <= 1) {
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
this.highlightPaths = paths;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
clearHighlightPaths() {
|
|
210
|
-
this.highlightPaths = [];
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
clearHighlightPolygon() {
|
|
214
|
-
if (!this.mapView) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
this.mapView._removePolygon(this.highlightPolygonId);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
getHighlightPolygonProps() {
|
|
222
|
-
if (!this.highlightPaths || this.highlightPaths.length <= 1) {
|
|
223
|
-
return null;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
const [coordinates, ...holes] = this.highlightPaths;
|
|
227
|
-
return {
|
|
228
|
-
coordinates,
|
|
229
|
-
holes,
|
|
230
|
-
fillColor: "#0000001E",
|
|
231
|
-
strokeColor: "#FF0000FF",
|
|
232
|
-
strokeWidth: 2.0
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
createWorldMaskPaths(geometry) {
|
|
237
|
-
const worldPath = [{
|
|
238
|
-
longitude: -180,
|
|
239
|
-
latitude: -90
|
|
240
|
-
}, {
|
|
241
|
-
longitude: 180,
|
|
242
|
-
latitude: -90
|
|
243
|
-
}, {
|
|
244
|
-
longitude: 180,
|
|
245
|
-
latitude: 90
|
|
246
|
-
}, {
|
|
247
|
-
longitude: -180,
|
|
248
|
-
latitude: 90
|
|
249
|
-
}, {
|
|
250
|
-
longitude: -180,
|
|
251
|
-
latitude: -90
|
|
252
|
-
}];
|
|
253
|
-
const paths = [worldPath];
|
|
254
|
-
const holes = this.getHolePathsFromGeometry(geometry);
|
|
255
|
-
holes.forEach(hole => {
|
|
256
|
-
paths.push(hole);
|
|
257
|
-
});
|
|
258
|
-
return paths;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
getHolePathsFromGeometry(geometry) {
|
|
262
|
-
const paths = [];
|
|
263
|
-
|
|
264
|
-
if (geometry.type == 'Polygon') {
|
|
265
|
-
const polygon = geometry.coordinates;
|
|
266
|
-
|
|
267
|
-
if (polygon.length > 0) {
|
|
268
|
-
paths.push(this.convertAndClosePath(polygon[0]));
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
if (geometry.type == 'MultiPolygon') {
|
|
273
|
-
const multiPolygon = geometry.coordinates;
|
|
274
|
-
multiPolygon.forEach(polygon => {
|
|
275
|
-
if (polygon.length > 0) {
|
|
276
|
-
paths.push(this.convertAndClosePath(polygon[0]));
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
return paths;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
convertAndClosePath(path) {
|
|
285
|
-
if (path.length == 0) {
|
|
286
|
-
return [];
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
const coordinatePath = path.filter(point => point.length >= 2).map(point => ({
|
|
290
|
-
latitude: point[1],
|
|
291
|
-
longitude: point[0]
|
|
292
|
-
}));
|
|
293
|
-
|
|
294
|
-
if (coordinatePath.length == 0) {
|
|
295
|
-
return [];
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
const firstPoint = coordinatePath[0];
|
|
299
|
-
const lastPoint = coordinatePath[coordinatePath.length - 1];
|
|
300
|
-
|
|
301
|
-
if (firstPoint.latitude == lastPoint.latitude && firstPoint.longitude == lastPoint.longitude) {
|
|
302
|
-
return coordinatePath;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
return [...coordinatePath, firstPoint];
|
|
306
|
-
}
|
|
307
|
-
|
|
308
70
|
}
|
|
309
71
|
|
|
310
72
|
exports.AreaFocuser = AreaFocuser;
|