react-native-map4d-map-dtqg 0.1.1 → 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/README.md +64 -19
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/android/src/main/java/com/reactnativemap4dmap/RMFMapViewManager.java +5 -0
- package/ios/RMFMapViewManager.m +15 -0
- package/lib/commonjs/components/MFBanDoSo.js +109 -0
- package/lib/commonjs/components/MFBanDoSo.js.map +1 -0
- package/lib/commonjs/components/MFMapView.js +20 -1
- package/lib/commonjs/components/MFMapView.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 +19 -257
- 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/MFMapView.js +19 -1
- package/lib/module/components/MFMapView.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 +19 -257
- 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/package.json +1 -1
- package/src/components/MFBanDoSo.js +124 -0
- package/src/components/MFMapView.js +19 -2
- package/src/components/extends/AreaFocusManager.js +196 -0
- package/src/components/extends/AreaFocuser.js +17 -294
- 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 +2 -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/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/config.properties +0 -2
- 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
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
class BoundHelper {
|
|
2
|
+
static createEmptyBounds() {
|
|
3
|
+
return {
|
|
4
|
+
minLat: Infinity,
|
|
5
|
+
minLng: Infinity,
|
|
6
|
+
maxLat: -Infinity,
|
|
7
|
+
maxLng: -Infinity,
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static updateBounds(bounds, lat, lng) {
|
|
12
|
+
bounds.minLat = Math.min(bounds.minLat, lat)
|
|
13
|
+
bounds.minLng = Math.min(bounds.minLng, lng)
|
|
14
|
+
bounds.maxLat = Math.max(bounds.maxLat, lat)
|
|
15
|
+
bounds.maxLng = Math.max(bounds.maxLng, lng)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static isValidBounds(bounds) {
|
|
19
|
+
if (!bounds) {
|
|
20
|
+
return false
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return !(
|
|
24
|
+
bounds.minLat === Infinity ||
|
|
25
|
+
bounds.minLng === Infinity ||
|
|
26
|
+
bounds.maxLat === -Infinity ||
|
|
27
|
+
bounds.maxLng === -Infinity
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export {BoundHelper}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import {getViewboxFromGeometry} from './AreaFocusGeometryUtils'
|
|
2
|
+
import {IndustrialEconomicType} from './AreaFocusTypes'
|
|
3
|
+
|
|
4
|
+
const INDUSTRIAL_ECONOMIC_PATH_BY_TYPE = {
|
|
5
|
+
[IndustrialEconomicType.INDUSTRIAL_ZONE]: 'khu-cong-nghiep',
|
|
6
|
+
[IndustrialEconomicType.ECONOMIC_ZONE]: 'khu-kinh-te',
|
|
7
|
+
[IndustrialEconomicType.ECO_INDUSTRIAL_ZONE]: 'khu-cong-nghiep-sinh-thai',
|
|
8
|
+
[IndustrialEconomicType.FREE_TRADE_ZONE]: 'khu-thuong-mai-tu-do',
|
|
9
|
+
[IndustrialEconomicType.NON_TARIFF_ZONE]: 'khu-phi-thue-quan',
|
|
10
|
+
[IndustrialEconomicType.OTHER_ZONE_MODEL]: 'mo-hinh-khu-khac',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const BDS_API_BASE_URL = 'https://cmcdtqg-gateway.dieuhanhso.vn/staging'
|
|
14
|
+
|
|
15
|
+
class ProvinceArea {
|
|
16
|
+
constructor(id) {
|
|
17
|
+
this.id = id
|
|
18
|
+
this.name = null
|
|
19
|
+
this.loaded = false
|
|
20
|
+
this.geometryData = null
|
|
21
|
+
this.bounds = null
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static fromName(name) {
|
|
25
|
+
const area = new ProvinceArea(null)
|
|
26
|
+
area.name = name
|
|
27
|
+
return area
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async load() {
|
|
31
|
+
if (this.loaded) {
|
|
32
|
+
return true
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const hasValidId = typeof this.id === 'number'
|
|
36
|
+
const hasValidName = typeof this.name === 'string' && this.name.trim() !== ''
|
|
37
|
+
|
|
38
|
+
if (!hasValidId && !hasValidName) {
|
|
39
|
+
return false
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const normalizedName = hasValidName ? this.name.trim() : null
|
|
43
|
+
const url = hasValidId
|
|
44
|
+
? `${BDS_API_BASE_URL}/bds/api/dmhc/TinhThanh/${this.id}/geometry`
|
|
45
|
+
: `${BDS_API_BASE_URL}/bds/api/dmhc/TinhThanh/geometry?ten=${encodeURIComponent(normalizedName)}`
|
|
46
|
+
|
|
47
|
+
const response = await fetch(url)
|
|
48
|
+
|
|
49
|
+
if (!response.ok) {
|
|
50
|
+
return false
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const data = await response.json()
|
|
54
|
+
|
|
55
|
+
if (!data.success) {
|
|
56
|
+
console.error('Fetch province area data failed:', data.message)
|
|
57
|
+
return false
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const areaData = data.data
|
|
61
|
+
const geometry = areaData && areaData.geometry ? areaData.geometry : null
|
|
62
|
+
|
|
63
|
+
if (!geometry) {
|
|
64
|
+
return false
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
this.geometryData = {
|
|
68
|
+
name: areaData && areaData.name ? areaData.name : normalizedName,
|
|
69
|
+
geometry,
|
|
70
|
+
}
|
|
71
|
+
this.bounds = getViewboxFromGeometry(geometry)
|
|
72
|
+
this.loaded = true
|
|
73
|
+
|
|
74
|
+
return true
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
getGeometryData() {
|
|
78
|
+
return this.geometryData
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getBounds() {
|
|
82
|
+
return this.bounds
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
getId() {
|
|
86
|
+
return this.id != null ? this.id : `province-${this.name || 'unknown'}`
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
class IndustrialEconomicArea {
|
|
91
|
+
constructor(type, id) {
|
|
92
|
+
this.type = type
|
|
93
|
+
this.id = id
|
|
94
|
+
this.loaded = false
|
|
95
|
+
this.geometryData = null
|
|
96
|
+
this.bounds = null
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async load() {
|
|
100
|
+
if (this.loaded) {
|
|
101
|
+
return true
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (typeof this.id !== 'number') {
|
|
105
|
+
return false
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const pathSegment = INDUSTRIAL_ECONOMIC_PATH_BY_TYPE[this.type]
|
|
109
|
+
|
|
110
|
+
if (!pathSegment) {
|
|
111
|
+
console.error('Unsupported industrial/economic area type:', this.type)
|
|
112
|
+
return false
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const url = `${BDS_API_BASE_URL}/bds/api/kcnkkt/${pathSegment}/${this.id}/geometry`
|
|
116
|
+
|
|
117
|
+
const response = await fetch(url)
|
|
118
|
+
|
|
119
|
+
if (!response.ok) {
|
|
120
|
+
console.error('Failed to fetch industrial zone data:', response.status, response.statusText)
|
|
121
|
+
return false
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const data = await response.json()
|
|
125
|
+
|
|
126
|
+
if (!data.success) {
|
|
127
|
+
console.error('API returned error:', data.message)
|
|
128
|
+
return false
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const areaData = data.data
|
|
132
|
+
const geometry = areaData && areaData.geometry ? areaData.geometry : null
|
|
133
|
+
|
|
134
|
+
if (!geometry) {
|
|
135
|
+
return false
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
this.geometryData = {
|
|
139
|
+
name: areaData && areaData.name ? areaData.name : null,
|
|
140
|
+
geometry,
|
|
141
|
+
}
|
|
142
|
+
this.bounds = getViewboxFromGeometry(geometry)
|
|
143
|
+
this.loaded = true
|
|
144
|
+
|
|
145
|
+
return true
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
getGeometryData() {
|
|
149
|
+
return this.geometryData
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
getBounds() {
|
|
153
|
+
return this.bounds
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
getId() {
|
|
157
|
+
return this.id
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export {
|
|
162
|
+
ProvinceArea,
|
|
163
|
+
IndustrialEconomicArea,
|
|
164
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import {BoundHelper} from '../BoundHelper'
|
|
2
|
+
|
|
3
|
+
const WORLD_MASK_PATH = [
|
|
4
|
+
{ longitude: -180, latitude: -90 },
|
|
5
|
+
{ longitude: 180, latitude: -90 },
|
|
6
|
+
{ longitude: 180, latitude: 90 },
|
|
7
|
+
{ longitude: -180, latitude: 90 },
|
|
8
|
+
{ longitude: -180, latitude: -90 },
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
function parseViewbox(viewbox) {
|
|
12
|
+
const bounds = viewbox.split(',').map(Number)
|
|
13
|
+
|
|
14
|
+
if (bounds.length != 4) {
|
|
15
|
+
return null
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const [minLat, minLng, maxLat, maxLng] = bounds
|
|
19
|
+
|
|
20
|
+
if (
|
|
21
|
+
Number.isNaN(minLat) ||
|
|
22
|
+
Number.isNaN(minLng) ||
|
|
23
|
+
Number.isNaN(maxLat) ||
|
|
24
|
+
Number.isNaN(maxLng)
|
|
25
|
+
) {
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
minLat,
|
|
31
|
+
minLng,
|
|
32
|
+
maxLat,
|
|
33
|
+
maxLng,
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function getViewboxFromGeometry(geometry) {
|
|
38
|
+
if (!geometry || typeof geometry !== 'object') {
|
|
39
|
+
return null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const bounds = BoundHelper.createEmptyBounds()
|
|
43
|
+
|
|
44
|
+
const updateBounds = (coordinate) => {
|
|
45
|
+
if (!Array.isArray(coordinate) || coordinate.length < 2) {
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const lng = coordinate[0]
|
|
50
|
+
const lat = coordinate[1]
|
|
51
|
+
|
|
52
|
+
if (Number.isNaN(lat) || Number.isNaN(lng)) {
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
BoundHelper.updateBounds(bounds, lat, lng)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (geometry.type === 'Polygon') {
|
|
60
|
+
geometry.coordinates.forEach((ring) => {
|
|
61
|
+
ring.forEach((coordinate) => {
|
|
62
|
+
updateBounds(coordinate)
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (geometry.type === 'MultiPolygon') {
|
|
68
|
+
geometry.coordinates.forEach((polygon) => {
|
|
69
|
+
polygon.forEach((ring) => {
|
|
70
|
+
ring.forEach((coordinate) => {
|
|
71
|
+
updateBounds(coordinate)
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!BoundHelper.isValidBounds(bounds)) {
|
|
78
|
+
return null
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return bounds
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function convertAndClosePath(path) {
|
|
85
|
+
if (!Array.isArray(path) || path.length == 0) {
|
|
86
|
+
return []
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const coordinatePath = path
|
|
90
|
+
.filter((point) => Array.isArray(point) && point.length >= 2)
|
|
91
|
+
.map((point) => ({
|
|
92
|
+
latitude: point[1],
|
|
93
|
+
longitude: point[0],
|
|
94
|
+
}))
|
|
95
|
+
|
|
96
|
+
if (coordinatePath.length == 0) {
|
|
97
|
+
return []
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const firstPoint = coordinatePath[0]
|
|
101
|
+
const lastPoint = coordinatePath[coordinatePath.length - 1]
|
|
102
|
+
|
|
103
|
+
if (
|
|
104
|
+
firstPoint.latitude == lastPoint.latitude &&
|
|
105
|
+
firstPoint.longitude == lastPoint.longitude
|
|
106
|
+
) {
|
|
107
|
+
return coordinatePath
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return [
|
|
111
|
+
...coordinatePath,
|
|
112
|
+
firstPoint,
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function areaGeometryToPolygonPaths(geometry) {
|
|
117
|
+
const paths = []
|
|
118
|
+
|
|
119
|
+
if (!geometry || typeof geometry !== 'object') {
|
|
120
|
+
return paths
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (geometry.type === 'Polygon') {
|
|
124
|
+
if (Array.isArray(geometry.coordinates) && geometry.coordinates.length > 0) {
|
|
125
|
+
const path = convertAndClosePath(geometry.coordinates[0])
|
|
126
|
+
if (path.length > 0) {
|
|
127
|
+
paths.push(path)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return paths
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (geometry.type === 'MultiPolygon') {
|
|
134
|
+
geometry.coordinates.forEach((polygonCoordinates) => {
|
|
135
|
+
if (!Array.isArray(polygonCoordinates) || polygonCoordinates.length === 0) {
|
|
136
|
+
return
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const path = convertAndClosePath(polygonCoordinates[0])
|
|
140
|
+
if (path.length > 0) {
|
|
141
|
+
paths.push(path)
|
|
142
|
+
}
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return paths
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function createWorldMaskPaths(geometry) {
|
|
150
|
+
const holes = areaGeometryToPolygonPaths(geometry)
|
|
151
|
+
|
|
152
|
+
return [
|
|
153
|
+
WORLD_MASK_PATH,
|
|
154
|
+
...holes,
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export {
|
|
159
|
+
WORLD_MASK_PATH,
|
|
160
|
+
parseViewbox,
|
|
161
|
+
getViewboxFromGeometry,
|
|
162
|
+
areaGeometryToPolygonPaths,
|
|
163
|
+
createWorldMaskPaths,
|
|
164
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import {
|
|
2
|
+
areaGeometryToPolygonPaths,
|
|
3
|
+
createWorldMaskPaths,
|
|
4
|
+
} from './AreaFocusGeometryUtils'
|
|
5
|
+
|
|
6
|
+
class AreaFocusSession {
|
|
7
|
+
constructor(mapView, area, options) {
|
|
8
|
+
this.mapView = mapView
|
|
9
|
+
this.area = area
|
|
10
|
+
this.options = options || {}
|
|
11
|
+
this.polygonIds = []
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
render() {
|
|
15
|
+
this.clearPolygons()
|
|
16
|
+
|
|
17
|
+
const data = this.area.getGeometryData()
|
|
18
|
+
if (!data || !data.geometry) {
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const highlight = this.options.display === 'highlight'
|
|
23
|
+
|
|
24
|
+
if (highlight) {
|
|
25
|
+
this.renderHighlight(data.geometry)
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
this.renderNormal(data.geometry)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
destroy() {
|
|
33
|
+
this.clearPolygons()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
renderNormal(geometry) {
|
|
37
|
+
const polygons = areaGeometryToPolygonPaths(geometry)
|
|
38
|
+
|
|
39
|
+
polygons.forEach((coordinates, index) => {
|
|
40
|
+
this.addPolygon({
|
|
41
|
+
id: `${String(this.area.getId ? this.area.getId() : 'area')}-normal-${index}`,
|
|
42
|
+
coordinates,
|
|
43
|
+
fillColor: '#2196F3BF',
|
|
44
|
+
strokeColor: '#0D47A1FF',
|
|
45
|
+
strokeWidth: 1.5,
|
|
46
|
+
visible: true,
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
renderHighlight(geometry) {
|
|
52
|
+
const paths = createWorldMaskPaths(geometry)
|
|
53
|
+
|
|
54
|
+
if (paths.length <= 1) {
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const [coordinates, ...holes] = paths
|
|
59
|
+
|
|
60
|
+
this.addPolygon({
|
|
61
|
+
id: `${String(this.area.getId ? this.area.getId() : 'area')}-highlight`,
|
|
62
|
+
coordinates,
|
|
63
|
+
holes,
|
|
64
|
+
fillColor: '#0000001E',
|
|
65
|
+
strokeColor: '#FF0000FF',
|
|
66
|
+
strokeWidth: 2,
|
|
67
|
+
zIndex: 999,
|
|
68
|
+
visible: true,
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
addPolygon(polygon) {
|
|
73
|
+
if (!this.mapView || typeof this.mapView._addPolygon !== 'function') {
|
|
74
|
+
return
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const id = this.mapView._addPolygon(polygon)
|
|
78
|
+
|
|
79
|
+
if (id != null) {
|
|
80
|
+
this.polygonIds.push(id)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
clearPolygons() {
|
|
85
|
+
if (!this.mapView || typeof this.mapView._removePolygon !== 'function') {
|
|
86
|
+
this.polygonIds = []
|
|
87
|
+
return
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
this.polygonIds.forEach((id) => {
|
|
91
|
+
this.mapView._removePolygon(id)
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
this.polygonIds = []
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export {
|
|
99
|
+
AreaFocusSession,
|
|
100
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {{type: 'Point', coordinates: [number, number]}} PointGeometry
|
|
3
|
+
* @typedef {Array<Array<[number, number]>>} PolygonCoordinates
|
|
4
|
+
* @typedef {{type: 'Polygon', coordinates: PolygonCoordinates}} PolygonGeometry
|
|
5
|
+
* @typedef {{type: 'MultiPolygon', coordinates: Array<PolygonCoordinates>}} MultiPolygonGeometry
|
|
6
|
+
* @typedef {PointGeometry | PolygonGeometry | MultiPolygonGeometry} AreaGeometry
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {Object} GeometryData
|
|
11
|
+
* @property {string=} name
|
|
12
|
+
* @property {AreaGeometry=} geometry
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {Object} FocusableArea
|
|
17
|
+
* @property {boolean} loaded
|
|
18
|
+
* @property {boolean} editable
|
|
19
|
+
* @property {() => Promise<boolean>} load
|
|
20
|
+
* @property {() => GeometryData | null} getGeometryData
|
|
21
|
+
* @property {() => {minLat: number, minLng: number, maxLat: number, maxLng: number} | null} getBounds
|
|
22
|
+
* @property {() => string | number | null=} getId
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const IndustrialEconomicType = {
|
|
26
|
+
INDUSTRIAL_ZONE: 1,
|
|
27
|
+
ECONOMIC_ZONE: 2,
|
|
28
|
+
ECO_INDUSTRIAL_ZONE: 3,
|
|
29
|
+
FREE_TRADE_ZONE: 4,
|
|
30
|
+
NON_TARIFF_ZONE: 5,
|
|
31
|
+
OTHER_ZONE_MODEL: 6,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
IndustrialEconomicType,
|
|
36
|
+
}
|