@sword916/vae-map-plus 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +5376 -0
- package/lib/style.css +1 -0
- package/lib/vae-amap/favicon.ico +0 -0
- package/lib/vae-amap/images/game.png +0 -0
- package/lib/vae-amap/images/grid.png +0 -0
- package/lib/vae-amap/images/marker.png +0 -0
- package/lib/vae-amap/index.js +209 -0
- package/lib/vae-amap/style.css +1 -0
- package/lib/vae-cloudmap/favicon.ico +0 -0
- package/lib/vae-cloudmap/images/game.png +0 -0
- package/lib/vae-cloudmap/images/grid.png +0 -0
- package/lib/vae-cloudmap/images/marker.png +0 -0
- package/lib/vae-cloudmap/index.html +30 -0
- package/lib/vae-cloudmap/index.js +4085 -0
- package/lib/vae-cloudmap/style.css +1 -0
- package/lib/vae-map/favicon.ico +0 -0
- package/lib/vae-map/images/game.png +0 -0
- package/lib/vae-map/images/grid.png +0 -0
- package/lib/vae-map/images/marker.png +0 -0
- package/lib/vae-map/index.html +30 -0
- package/lib/vae-map/index.js +4322 -0
- package/lib/vae-map/style.css +1 -0
- package/package.json +1 -1
- package/plugins/L.AnimatedMarker/favicon.ico +0 -0
- package/plugins/L.AnimatedMarker/images/game.png +0 -0
- package/plugins/L.AnimatedMarker/images/grid.png +0 -0
- package/plugins/L.AnimatedMarker/images/marker.png +0 -0
- package/plugins/L.AnimatedMarker/index.html +30 -0
- package/plugins/L.AnimatedMarker/index.js +83 -0
- package/plugins/L.EchartsLayer/favicon.ico +0 -0
- package/plugins/L.EchartsLayer/images/game.png +0 -0
- package/plugins/L.EchartsLayer/images/grid.png +0 -0
- package/plugins/L.EchartsLayer/images/marker.png +0 -0
- package/plugins/L.EchartsLayer/index.html +30 -0
- package/plugins/L.EchartsLayer/index.js +176 -0
- package/plugins/L.FootageCalculator.Area/favicon.ico +0 -0
- package/plugins/L.FootageCalculator.Area/images/game.png +0 -0
- package/plugins/L.FootageCalculator.Area/images/grid.png +0 -0
- package/plugins/L.FootageCalculator.Area/images/marker.png +0 -0
- package/plugins/L.FootageCalculator.Area/index.html +30 -0
- package/plugins/L.FootageCalculator.Area/index.js +418 -0
- package/plugins/L.FootageCalculator.Line/favicon.ico +0 -0
- package/plugins/L.FootageCalculator.Line/images/game.png +0 -0
- package/plugins/L.FootageCalculator.Line/images/grid.png +0 -0
- package/plugins/L.FootageCalculator.Line/images/marker.png +0 -0
- package/plugins/L.FootageCalculator.Line/index.html +30 -0
- package/plugins/L.FootageCalculator.Line/index.js +416 -0
- package/plugins/L.GeoUtil/favicon.ico +0 -0
- package/plugins/L.GeoUtil/images/game.png +0 -0
- package/plugins/L.GeoUtil/images/grid.png +0 -0
- package/plugins/L.GeoUtil/images/marker.png +0 -0
- package/plugins/L.GeoUtil/index.html +30 -0
- package/plugins/L.GeoUtil/index.js +279 -0
- package/plugins/L.Glyphicon/favicon.ico +0 -0
- package/plugins/L.Glyphicon/images/game.png +0 -0
- package/plugins/L.Glyphicon/images/grid.png +0 -0
- package/plugins/L.Glyphicon/images/marker.png +0 -0
- package/plugins/L.Glyphicon/index.html +30 -0
- package/plugins/L.Glyphicon/index.js +57 -0
- package/plugins/L.Glyphicon/style.css +1 -0
- package/plugins/L.MarkerClusterX/favicon.ico +0 -0
- package/plugins/L.MarkerClusterX/images/game.png +0 -0
- package/plugins/L.MarkerClusterX/images/grid.png +0 -0
- package/plugins/L.MarkerClusterX/images/marker.png +0 -0
- package/plugins/L.MarkerClusterX/index.html +30 -0
- package/plugins/L.MarkerClusterX/index.js +33 -0
- package/plugins/L.MarkerClusterX/style.css +1 -0
- package/plugins/L.SafeDivOverlay/favicon.ico +0 -0
- package/plugins/L.SafeDivOverlay/images/game.png +0 -0
- package/plugins/L.SafeDivOverlay/images/grid.png +0 -0
- package/plugins/L.SafeDivOverlay/images/marker.png +0 -0
- package/plugins/L.SafeDivOverlay/index.html +30 -0
- package/plugins/L.SafeDivOverlay/index.js +26 -0
- package/plugins/L.TileLayer.ChinaProvider/favicon.ico +0 -0
- package/plugins/L.TileLayer.ChinaProvider/images/game.png +0 -0
- package/plugins/L.TileLayer.ChinaProvider/images/grid.png +0 -0
- package/plugins/L.TileLayer.ChinaProvider/images/marker.png +0 -0
- package/plugins/L.TileLayer.ChinaProvider/index.html +30 -0
- package/plugins/L.TileLayer.ChinaProvider/index.js +91 -0
- package/plugins/L.VuePopup/favicon.ico +0 -0
- package/plugins/L.VuePopup/images/game.png +0 -0
- package/plugins/L.VuePopup/images/grid.png +0 -0
- package/plugins/L.VuePopup/images/marker.png +0 -0
- package/plugins/L.VuePopup/index.html +30 -0
- package/plugins/L.VuePopup/index.js +68 -0
- package/plugins/L.VueTooltip/favicon.ico +0 -0
- package/plugins/L.VueTooltip/images/game.png +0 -0
- package/plugins/L.VueTooltip/images/grid.png +0 -0
- package/plugins/L.VueTooltip/images/marker.png +0 -0
- package/plugins/L.VueTooltip/index.html +30 -0
- package/plugins/L.VueTooltip/index.js +68 -0
- package/plugins/Mixin.Map.Measure/favicon.ico +0 -0
- package/plugins/Mixin.Map.Measure/images/game.png +0 -0
- package/plugins/Mixin.Map.Measure/images/grid.png +0 -0
- package/plugins/Mixin.Map.Measure/images/marker.png +0 -0
- package/plugins/Mixin.Map.Measure/index.html +30 -0
- package/plugins/Mixin.Map.Measure/index.js +84 -0
- package/plugins/globals/favicon.ico +0 -0
- package/plugins/globals/images/game.png +0 -0
- package/plugins/globals/images/grid.png +0 -0
- package/plugins/globals/images/marker.png +0 -0
- package/plugins/globals/index.html +30 -0
- package/plugins/globals/index.js +4 -0
- package/build/index.mjs +0 -113
- package/examples/App.vue +0 -18
- package/examples/index.js +0 -13
- package/examples/router/index.js +0 -35
- package/examples/views/amap.vue +0 -29
- package/examples/views/amarker.vue +0 -58
- package/examples/views/buffer.vue +0 -66
- package/examples/views/cluster.vue +0 -74
- package/examples/views/cover.vue +0 -85
- package/examples/views/draw-line.vue +0 -49
- package/examples/views/draw.vue +0 -54
- package/examples/views/echarts.vue +0 -142
- package/examples/views/emarker.vue +0 -39
- package/examples/views/image.vue +0 -182
- package/examples/views/index.vue +0 -61
- package/examples/views/lrmap.vue +0 -108
- package/examples/views/map.vue +0 -82
- package/examples/views/measure.vue +0 -86
- package/examples/views/parts/popup.vue +0 -39
- package/examples/views/parts/tooltip.vue +0 -39
- package/examples/views/push-area.vue +0 -52
- package/examples/views/push-line.vue +0 -84
- package/examples/views/trace.vue +0 -49
- package/jsconfig.json +0 -17
- package/src/components/resize-listener/component.jsx +0 -30
- package/src/components/resize-listener/index.js +0 -3
- package/src/composables/useAutoMessage.js +0 -41
- package/src/composables/useContextMenu.js +0 -99
- package/src/composables/useMapMeasure.js +0 -191
- package/src/composables/useResizeObserver.js +0 -81
- package/src/mixins/message.js +0 -1
- package/src/packages/index.js +0 -16
- package/src/packages/vae-amap/index.js +0 -8
- package/src/packages/vae-amap/style.less +0 -9
- package/src/packages/vae-amap/vae-amap.jsx +0 -98
- package/src/packages/vae-cloudmap/ctrl-context-menu/index.vue +0 -74
- package/src/packages/vae-cloudmap/ctrl-draw/index.vue +0 -499
- package/src/packages/vae-cloudmap/ctrl-draw-line/index.vue +0 -161
- package/src/packages/vae-cloudmap/index.js +0 -57
- package/src/packages/vae-cloudmap/scripts/L.MarkerCluster/index.js +0 -2690
- package/src/packages/vae-cloudmap/scripts/L.MarkerCluster/style.css +0 -14
- package/src/packages/vae-cloudmap/scripts/L.Vae.CRS/index.js +0 -212
- package/src/packages/vae-cloudmap/scripts/L.Vae.Client/index.js +0 -780
- package/src/packages/vae-cloudmap/scripts/Mixin.ContextMenu/index.js +0 -101
- package/src/packages/vae-cloudmap/style.less +0 -163
- package/src/packages/vae-cloudmap/vae-cloudmap.jsx +0 -272
- package/src/packages/vae-map/ctrl-context-menu/index.vue +0 -74
- package/src/packages/vae-map/ctrl-draw/index.vue +0 -498
- package/src/packages/vae-map/ctrl-draw-line/index.vue +0 -128
- package/src/packages/vae-map/index.js +0 -59
- package/src/packages/vae-map/scripts/L.MarkerCluster/index.js +0 -2690
- package/src/packages/vae-map/scripts/L.MarkerCluster/style.css +0 -14
- package/src/packages/vae-map/scripts/L.Vae.CRS/index.js +0 -114
- package/src/packages/vae-map/scripts/L.Vae.Client/index.js +0 -548
- package/src/packages/vae-map/scripts/Mixin.ContextMenu/index.js +0 -1
- package/src/packages/vae-map/style.less +0 -161
- package/src/packages/vae-map/vae-lrmap.jsx +0 -237
- package/src/packages/vae-map/vae-map.jsx +0 -135
- package/src/plugins/L.AnimatedMarker/index.js +0 -158
- package/src/plugins/L.EchartsLayer/index.js +0 -339
- package/src/plugins/L.ElasticMarker/index.js +0 -162
- package/src/plugins/L.FootageCalculator.Area/index.js +0 -263
- package/src/plugins/L.FootageCalculator.Line/index.js +0 -273
- package/src/plugins/L.GeoUtil/buffer.js +0 -67
- package/src/plugins/L.GeoUtil/index.js +0 -284
- package/src/plugins/L.Glyphicon/index.js +0 -91
- package/src/plugins/L.Glyphicon/style.less +0 -37
- package/src/plugins/L.MarkerClusterX/index.js +0 -93
- package/src/plugins/L.MarkerClusterX/style.less +0 -162
- package/src/plugins/L.SafeDivOverlay/index.js +0 -55
- package/src/plugins/L.TileLayer.ChinaProvider/index.js +0 -108
- package/src/plugins/L.VuePopup/index.js +0 -67
- package/src/plugins/L.VueTooltip/index.js +0 -63
- package/src/plugins/Mixin.Map.Measure/index.js +0 -248
- package/src/plugins/globals/index.js +0 -7
- package/src/utils/index.js +0 -36
- package/src/utils/resize-event.js +0 -45
- /package/{public → lib}/favicon.ico +0 -0
- /package/{public → lib}/images/game.png +0 -0
- /package/{public → lib}/images/grid.png +0 -0
- /package/{public → lib}/images/marker.png +0 -0
- /package/{public → lib/vae-amap}/index.html +0 -0
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import L from 'leaflet'
|
|
2
|
-
|
|
3
|
-
const PATCH_FLAG = '_safeDivOverlayPatched'
|
|
4
|
-
|
|
5
|
-
function canUpdateOverlay(overlay) {
|
|
6
|
-
return !!(
|
|
7
|
-
overlay &&
|
|
8
|
-
overlay._map &&
|
|
9
|
-
overlay._latlng &&
|
|
10
|
-
overlay._container
|
|
11
|
-
)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function wrapOverlayMethod(target, methodName) {
|
|
15
|
-
if (!target?.prototype?.[methodName]) {
|
|
16
|
-
return
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const methodFlag = `${PATCH_FLAG}_${methodName}`
|
|
20
|
-
if (target.prototype[methodFlag]) {
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const originalMethod = target.prototype[methodName]
|
|
25
|
-
|
|
26
|
-
target.include({
|
|
27
|
-
[methodFlag]: true,
|
|
28
|
-
[methodName](...args) {
|
|
29
|
-
if (!canUpdateOverlay(this)) {
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return originalMethod.apply(this, args)
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function patchLeafletInstance(leaflet) {
|
|
39
|
-
if (!leaflet || leaflet[PATCH_FLAG]) {
|
|
40
|
-
return
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
wrapOverlayMethod(leaflet.Tooltip, '_animateZoom')
|
|
44
|
-
wrapOverlayMethod(leaflet.Tooltip, '_updatePosition')
|
|
45
|
-
wrapOverlayMethod(leaflet.Popup, '_animateZoom')
|
|
46
|
-
wrapOverlayMethod(leaflet.Popup, '_updatePosition')
|
|
47
|
-
|
|
48
|
-
leaflet[PATCH_FLAG] = true
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
patchLeafletInstance(L)
|
|
52
|
-
|
|
53
|
-
if (typeof window !== 'undefined' && window.L && window.L !== L) {
|
|
54
|
-
patchLeafletInstance(window.L)
|
|
55
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
// 国内TMS提供方
|
|
2
|
-
const providers = {
|
|
3
|
-
|
|
4
|
-
TianDiTu: {
|
|
5
|
-
Normal: {
|
|
6
|
-
Map: "https://t{s}.tianditu.gov.cn/DataServer?T=vec_w&X={x}&Y={y}&L={z}&tk={key}",
|
|
7
|
-
Annotion: "https://t{s}.tianditu.gov.cn/DataServer?T=cva_w&X={x}&Y={y}&L={z}&tk={key}",
|
|
8
|
-
},
|
|
9
|
-
Satellite: {
|
|
10
|
-
Map: "https://t{s}.tianditu.gov.cn/DataServer?T=img_w&X={x}&Y={y}&L={z}&tk={key}",
|
|
11
|
-
Annotion: "https://t{s}.tianditu.gov.cn/DataServer?T=cia_w&X={x}&Y={y}&L={z}&tk={key}",
|
|
12
|
-
},
|
|
13
|
-
Terrain: {
|
|
14
|
-
Map: "https://t{s}.tianditu.gov.cn/DataServer?T=ter_w&X={x}&Y={y}&L={z}&tk={key}",
|
|
15
|
-
Annotion: "https://t{s}.tianditu.gov.cn/DataServer?T=cta_w&X={x}&Y={y}&L={z}&tk={key}"
|
|
16
|
-
},
|
|
17
|
-
Subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
|
|
18
|
-
key: "1a346e3ea95a3227a097cabf11a901b7"
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
GaoDe: {
|
|
22
|
-
Normal: {
|
|
23
|
-
Map: 'https://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}',
|
|
24
|
-
},
|
|
25
|
-
Satellite: {
|
|
26
|
-
Map: 'https://webst0{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
|
|
27
|
-
Annotion: 'https://webst0{s}.is.autonavi.com/appmaptile?style=8&x={x}&y={y}&z={z}'
|
|
28
|
-
},
|
|
29
|
-
Subdomains: ["1", "2", "3", "4"]
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
GaoDe_Mobile: {
|
|
33
|
-
Normal: {
|
|
34
|
-
Map: 'https://wprd0{s}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=7'
|
|
35
|
-
},
|
|
36
|
-
Satellite: {
|
|
37
|
-
Map: 'https://wprd0{s}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=6',
|
|
38
|
-
Annotion: 'https://wprd0{s}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=2&style=8'
|
|
39
|
-
},
|
|
40
|
-
Subdomains: ["1", "2", "3", "4"]
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
Google: {
|
|
44
|
-
Normal: {
|
|
45
|
-
Map: "https://www.google.cn/maps/vt?lyrs=m&gl=cn&x={x}&y={y}&z={z}"
|
|
46
|
-
},
|
|
47
|
-
Satellite: {
|
|
48
|
-
Map: "https://www.google.cn/maps/vt?lyrs=s&gl=cn&x={x}&y={y}&z={z}",
|
|
49
|
-
Annotion: "https://www.google.cn/maps/vt?lyrs=h&gl=cn&x={x}&y={y}&z={z}"
|
|
50
|
-
},
|
|
51
|
-
Subdomains: []
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
Geoq: {
|
|
55
|
-
Normal: {
|
|
56
|
-
Map: "https://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}",
|
|
57
|
-
PurplishBlue: "https://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}",
|
|
58
|
-
Gray: "https://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetGray/MapServer/tile/{z}/{y}/{x}",
|
|
59
|
-
Warm: "https://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetWarm/MapServer/tile/{z}/{y}/{x}"
|
|
60
|
-
},
|
|
61
|
-
Theme: {
|
|
62
|
-
Hydro: "https://thematic.geoq.cn/arcgis/rest/services/ThematicMaps/WorldHydroMap/MapServer/tile/{z}/{y}/{x}",
|
|
63
|
-
Division: "https://thematic.geoq.cn/arcgis/rest/services/ThematicMaps/administrative_division_boundaryandlabel/MapServer/tile/{z}/{y}/{x}"
|
|
64
|
-
},
|
|
65
|
-
Subdomains: []
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
L.TileLayer.ChinaProvider = L.TileLayer.extend({
|
|
70
|
-
|
|
71
|
-
initialize(type, options = {}) {
|
|
72
|
-
|
|
73
|
-
const [base, key] = type.split('@')
|
|
74
|
-
const parts = base.split('.')
|
|
75
|
-
if (parts[0] && parts.length == 3) {
|
|
76
|
-
const providerName = parts[0]
|
|
77
|
-
const mapName = parts[1]
|
|
78
|
-
const mapType = parts[2]
|
|
79
|
-
const provider = providers[providerName]
|
|
80
|
-
if (provider) {
|
|
81
|
-
const target = provider?.[mapName]?.[mapType]
|
|
82
|
-
if (target) {
|
|
83
|
-
if (provider.hasOwnProperty('key') && !key) {
|
|
84
|
-
console.error(`provider '${providerName}' need a key`)
|
|
85
|
-
} else {
|
|
86
|
-
const baseOptions = {
|
|
87
|
-
maxZoom: 24,
|
|
88
|
-
subdomains: provider.Subdomains,
|
|
89
|
-
key
|
|
90
|
-
}
|
|
91
|
-
L.TileLayer.prototype.initialize.call(this, target, L.extend(baseOptions, options))
|
|
92
|
-
}
|
|
93
|
-
} else {
|
|
94
|
-
console.error(`provider not found '${type}'`)
|
|
95
|
-
}
|
|
96
|
-
} else {
|
|
97
|
-
console.error(`provider not found '${type}'`)
|
|
98
|
-
}
|
|
99
|
-
} else {
|
|
100
|
-
console.error(`provider not found '${type}'`)
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
L.tileLayer.chinaProvider = function (type, options) {
|
|
107
|
-
return new L.TileLayer.ChinaProvider(type, options)
|
|
108
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { createApp } from 'vue'
|
|
2
|
-
import { idGen } from '@/utils'
|
|
3
|
-
import { observeElementResize } from '@/composables/useResizeObserver'
|
|
4
|
-
|
|
5
|
-
L.VuePopup = L.Popup.extend({
|
|
6
|
-
app: null,
|
|
7
|
-
stopResize: null,
|
|
8
|
-
|
|
9
|
-
options: {
|
|
10
|
-
vueInstance: null,
|
|
11
|
-
props: null
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
initialize(options) {
|
|
15
|
-
L.setOptions(this, options)
|
|
16
|
-
this._bindEvents()
|
|
17
|
-
L.Popup.prototype.initialize.call(this, _.omit(this.options, ['vueInstance', 'props']))
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
_bindEvents() {
|
|
21
|
-
if (!this.options.vueInstance) {
|
|
22
|
-
return
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
this.on('add', () => {
|
|
26
|
-
const handleResize = () => {
|
|
27
|
-
this._updateVuePopup()
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const uuid = `vue-popup-${idGen()}`
|
|
31
|
-
this.setContent(`<div id="${uuid}"></div>`)
|
|
32
|
-
|
|
33
|
-
queueMicrotask(() => {
|
|
34
|
-
const mountEl = document.getElementById(uuid)
|
|
35
|
-
if (!mountEl) {
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
this.app = createApp(this.options.vueInstance, this.options.props ?? {})
|
|
39
|
-
this.app.mount(mountEl)
|
|
40
|
-
this.stopResize = observeElementResize(mountEl, handleResize)
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
this.on('remove', () => {
|
|
45
|
-
this.stopResize?.()
|
|
46
|
-
this.stopResize = null
|
|
47
|
-
this.app?.unmount()
|
|
48
|
-
this.app = null
|
|
49
|
-
})
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
_updateVuePopup() {
|
|
53
|
-
if (!this._map || !this._latlng || !this._container) {
|
|
54
|
-
return
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
this._container.style.visibility = 'hidden'
|
|
58
|
-
this._updateLayout()
|
|
59
|
-
this._updatePosition()
|
|
60
|
-
this._container.style.visibility = ''
|
|
61
|
-
this._adjustPan()
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
L.vuePopup = function (options) {
|
|
66
|
-
return new L.VuePopup(options)
|
|
67
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { createApp } from 'vue'
|
|
2
|
-
import { idGen } from '@/utils'
|
|
3
|
-
import { observeElementResize } from '@/composables/useResizeObserver'
|
|
4
|
-
|
|
5
|
-
L.VueTooltip = L.Tooltip.extend({
|
|
6
|
-
app: null,
|
|
7
|
-
stopResize: null,
|
|
8
|
-
|
|
9
|
-
options: {
|
|
10
|
-
vueInstance: null,
|
|
11
|
-
props: null
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
initialize(options) {
|
|
15
|
-
L.setOptions(this, options)
|
|
16
|
-
this._bindEvents()
|
|
17
|
-
L.Tooltip.prototype.initialize.call(this, _.omit(this.options, ['vueInstance', 'props']))
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
_bindEvents() {
|
|
21
|
-
if (!this.options.vueInstance) {
|
|
22
|
-
return
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
this.on('add', () => {
|
|
26
|
-
const handleResize = () => {
|
|
27
|
-
this._updateVueTooltip()
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const uuid = `vue-tooltip-${idGen()}`
|
|
31
|
-
this.setContent(`<div id="${uuid}"></div>`)
|
|
32
|
-
|
|
33
|
-
queueMicrotask(() => {
|
|
34
|
-
const mountEl = document.getElementById(uuid)
|
|
35
|
-
if (!mountEl) {
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
this.app = createApp(this.options.vueInstance, this.options.props ?? {})
|
|
39
|
-
this.app.mount(mountEl)
|
|
40
|
-
this.stopResize = observeElementResize(mountEl, handleResize)
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
this.on('remove', () => {
|
|
45
|
-
this.stopResize?.()
|
|
46
|
-
this.stopResize = null
|
|
47
|
-
this.app?.unmount()
|
|
48
|
-
this.app = null
|
|
49
|
-
})
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
_updateVueTooltip() {
|
|
53
|
-
if (!this._map || !this._latlng || !this._container) {
|
|
54
|
-
return
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
this._updatePosition()
|
|
58
|
-
}
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
L.vueTooltip = function (options) {
|
|
62
|
-
return new L.VueTooltip(options)
|
|
63
|
-
}
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import { onBeforeUnmount, ref } from 'vue'
|
|
2
|
-
|
|
3
|
-
// 地图实例
|
|
4
|
-
let map
|
|
5
|
-
|
|
6
|
-
// 绘制层,放置绘制的覆盖物和文字提示
|
|
7
|
-
let drawItems = L.featureGroup()
|
|
8
|
-
|
|
9
|
-
// 绘制辅助层,放置绘制过程中的提示覆盖物和提示信息
|
|
10
|
-
let drawHelpItems = L.featureGroup()
|
|
11
|
-
|
|
12
|
-
// 鼠标当前经纬度
|
|
13
|
-
let currentLatLng
|
|
14
|
-
|
|
15
|
-
// 测距:节点集
|
|
16
|
-
let lineVertexes = []
|
|
17
|
-
|
|
18
|
-
// 测距:当前距离
|
|
19
|
-
let lineCurrentDistance
|
|
20
|
-
|
|
21
|
-
// 测距:当前距离提示标注
|
|
22
|
-
let lineHintMarker
|
|
23
|
-
|
|
24
|
-
// 测面积:节点集
|
|
25
|
-
let polygonVertexes = []
|
|
26
|
-
|
|
27
|
-
// 测面积:当前面积
|
|
28
|
-
let polygonCurrentArea
|
|
29
|
-
|
|
30
|
-
// 测面积:面积提示标注
|
|
31
|
-
let polygonHintMarker
|
|
32
|
-
|
|
33
|
-
// 测面积:提示多边形
|
|
34
|
-
let polygonHintpolygon
|
|
35
|
-
|
|
36
|
-
// 绘制事件集
|
|
37
|
-
const Events = {
|
|
38
|
-
|
|
39
|
-
// 管理绘制的覆盖物
|
|
40
|
-
onLayerCreate(e) {
|
|
41
|
-
e.layer.remove().addTo(drawItems)
|
|
42
|
-
|
|
43
|
-
// 添加测面积标注
|
|
44
|
-
if (e.shape == 'Polygon') {
|
|
45
|
-
const hintMarkerIcon = createTextIcon(L.GeoUtil.readableArea(polygonCurrentArea))
|
|
46
|
-
L.marker(currentLatLng, { interactive: false }).setIcon(hintMarkerIcon).addTo(drawItems)
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
// 绘制开始
|
|
51
|
-
onDrawStart(e) {
|
|
52
|
-
const workingLayer = e.workingLayer
|
|
53
|
-
// 测距
|
|
54
|
-
if (e.shape == 'Line') {
|
|
55
|
-
map.on('mousemove', handleMouseMoveAtLine)
|
|
56
|
-
workingLayer.on('pm:vertexadded', vertex => {
|
|
57
|
-
const hintMarker = L.marker(vertex.latlng, { interactive: false })
|
|
58
|
-
lineVertexes = workingLayer._latlngs
|
|
59
|
-
if (lineVertexes.length == 1) {
|
|
60
|
-
hintMarker.setIcon(createTextIcon('测距起点')).addTo(drawHelpItems)
|
|
61
|
-
} else {
|
|
62
|
-
const distanceText = L.GeometryUtil.readableDistance(lineCurrentDistance)
|
|
63
|
-
hintMarker.setIcon(createTextIcon(distanceText)).addTo(drawHelpItems)
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
// 测面积
|
|
68
|
-
else if (e.shape == 'Polygon') {
|
|
69
|
-
map.on('mousemove', handleMouseMoveAtPolygon)
|
|
70
|
-
workingLayer.on('pm:vertexadded', vertex => {
|
|
71
|
-
polygonVertexes = workingLayer._latlngs
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
// 绘制结束
|
|
77
|
-
onDrawEnd(e) {
|
|
78
|
-
// 重置测距
|
|
79
|
-
if (e.shape == 'Line') {
|
|
80
|
-
map.off('mousemove', handleMouseMoveAtLine)
|
|
81
|
-
if (lineHintMarker) {
|
|
82
|
-
drawHelpItems.removeLayer(lineHintMarker)
|
|
83
|
-
lineHintMarker = null
|
|
84
|
-
}
|
|
85
|
-
lineVertexes = []
|
|
86
|
-
currentLatLng = null
|
|
87
|
-
lineCurrentDistance = null
|
|
88
|
-
}
|
|
89
|
-
// 重置测面积
|
|
90
|
-
else if (e.shape == 'Polygon') {
|
|
91
|
-
map.off('mousemove', handleMouseMoveAtPolygon)
|
|
92
|
-
if (polygonHintMarker) {
|
|
93
|
-
drawHelpItems.removeLayer(polygonHintMarker)
|
|
94
|
-
polygonHintMarker = null
|
|
95
|
-
}
|
|
96
|
-
if (polygonHintpolygon) {
|
|
97
|
-
drawHelpItems.removeLayer(polygonHintpolygon)
|
|
98
|
-
polygonHintpolygon = null
|
|
99
|
-
}
|
|
100
|
-
polygonVertexes = []
|
|
101
|
-
currentLatLng = null
|
|
102
|
-
polygonCurrentArea = null
|
|
103
|
-
}
|
|
104
|
-
// 转移辅助层至绘制层,避免开始新绘制时被清理
|
|
105
|
-
drawHelpItems.eachLayer(layer => {
|
|
106
|
-
drawHelpItems.removeLayer(layer)
|
|
107
|
-
layer.addTo(drawItems)
|
|
108
|
-
})
|
|
109
|
-
drawHelpItems.clearLayers()
|
|
110
|
-
|
|
111
|
-
// 绘制结束,取消事件监听
|
|
112
|
-
unregisterDrawEvents()
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// 注册绘制事件
|
|
118
|
-
const registerDrawEvents = () => {
|
|
119
|
-
map.on('pm:create', Events.onLayerCreate)
|
|
120
|
-
map.on('pm:drawstart', Events.onDrawStart)
|
|
121
|
-
map.on('pm:drawend', Events.onDrawEnd)
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// 取消注册绘制事件
|
|
125
|
-
const unregisterDrawEvents = () => {
|
|
126
|
-
map.off('pm:create', Events.onLayerCreate)
|
|
127
|
-
map.off('pm:drawstart', Events.onDrawStart)
|
|
128
|
-
map.off('pm:drawend', Events.onDrawEnd)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// 测距:响应鼠标移动(计算距离,更新提示)
|
|
132
|
-
const handleMouseMoveAtLine = _.throttle(e => {
|
|
133
|
-
// 更新位置
|
|
134
|
-
currentLatLng = e.latlng
|
|
135
|
-
// 更新节点集
|
|
136
|
-
const currentLatLngs = _.concat(lineVertexes, currentLatLng)
|
|
137
|
-
// 更新当前距离
|
|
138
|
-
lineCurrentDistance = L.GeoUtil.distanceByLatLngs(currentLatLngs, map)
|
|
139
|
-
// 更新提示
|
|
140
|
-
if (lineVertexes.length > 0) {
|
|
141
|
-
const hintMarkerIcon = createTextIcon(L.GeometryUtil.readableDistance(lineCurrentDistance), 'dark')
|
|
142
|
-
if (lineHintMarker) {
|
|
143
|
-
lineHintMarker.setIcon(hintMarkerIcon).setLatLng(currentLatLng)
|
|
144
|
-
} else {
|
|
145
|
-
lineHintMarker = L.marker(currentLatLng, { interactive: false }).setIcon(hintMarkerIcon).addTo(drawHelpItems)
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}, 20)
|
|
149
|
-
|
|
150
|
-
// 测面积:响应鼠标移动(计算面积,更新提示)
|
|
151
|
-
const handleMouseMoveAtPolygon = _.throttle(e => {
|
|
152
|
-
// 更新位置
|
|
153
|
-
currentLatLng = e.latlng
|
|
154
|
-
// 更新节点集
|
|
155
|
-
const currentLatLngs = _.concat(polygonVertexes, currentLatLng)
|
|
156
|
-
// 根据CRS选择算法
|
|
157
|
-
let useLatLng = true
|
|
158
|
-
if (map.vae && !map.vae.crs.code) {
|
|
159
|
-
useLatLng = false
|
|
160
|
-
}
|
|
161
|
-
// 使用simple坐标系时,将LatLng转为Point处理
|
|
162
|
-
polygonCurrentArea = useLatLng ?
|
|
163
|
-
L.GeoUtil.areaByLatLngs(currentLatLngs) :
|
|
164
|
-
L.GeoUtil.areaByPoints(currentLatLngs.map(v => ({ x: v.lat, y: v.lng })))
|
|
165
|
-
// 更新提示
|
|
166
|
-
if (polygonVertexes.length > 1) {
|
|
167
|
-
const hintMarkerIcon = createTextIcon(L.GeoUtil.readableArea(polygonCurrentArea), 'dark')
|
|
168
|
-
if (polygonHintMarker) {
|
|
169
|
-
polygonHintMarker.setIcon(hintMarkerIcon).setLatLng(currentLatLng)
|
|
170
|
-
} else {
|
|
171
|
-
polygonHintMarker = L.marker(currentLatLng, { interactive: false }).setIcon(hintMarkerIcon).addTo(drawHelpItems)
|
|
172
|
-
}
|
|
173
|
-
if (polygonHintpolygon) {
|
|
174
|
-
polygonHintpolygon.setLatLngs(currentLatLngs)
|
|
175
|
-
} else {
|
|
176
|
-
polygonHintpolygon = L.polygon(polygonVertexes, { stroke: false, fillOpacity: 0.1 }).addTo(drawHelpItems)
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}, 20)
|
|
180
|
-
|
|
181
|
-
// 创建文字标签
|
|
182
|
-
const createTextIcon = (value, className) => {
|
|
183
|
-
const iconWidth = value.length > 6 ? (value.length - 6) * 5 + 60 : 60
|
|
184
|
-
return L.divIcon({
|
|
185
|
-
html: `<div>${value}</div>`,
|
|
186
|
-
className: `icon--simple-text ${className}`,
|
|
187
|
-
iconSize: [iconWidth, 18]
|
|
188
|
-
})
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// 地图测量组合式函数
|
|
192
|
-
export function useMapMeasure() {
|
|
193
|
-
const DrawStatus = ref(false)
|
|
194
|
-
|
|
195
|
-
// 启动插件
|
|
196
|
-
const EnableMeasure = v => {
|
|
197
|
-
map = v
|
|
198
|
-
map.pm.setLang('zh')
|
|
199
|
-
|
|
200
|
-
drawItems.clearLayers().addTo(map)
|
|
201
|
-
drawHelpItems.clearLayers().addTo(map)
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// 开始绘制
|
|
205
|
-
const StartMeasure = shape => {
|
|
206
|
-
registerDrawEvents()
|
|
207
|
-
map.pm.enableDraw(shape)
|
|
208
|
-
DrawStatus.value = true
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// 取消当前绘制
|
|
212
|
-
const CancelMeasure = () => {
|
|
213
|
-
// 清理辅助层,避免在DrawEnd中被转移
|
|
214
|
-
drawHelpItems.clearLayers()
|
|
215
|
-
map.pm.Draw.getShapes().forEach(v => {
|
|
216
|
-
map.pm.disableDraw(v)
|
|
217
|
-
})
|
|
218
|
-
// 画布空白时,切换绘制状态
|
|
219
|
-
if (drawItems.getLayers().length == 0) {
|
|
220
|
-
DrawStatus.value = false
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// 结束绘制,清理画布
|
|
225
|
-
const ClearMeasure = () => {
|
|
226
|
-
CancelMeasure()
|
|
227
|
-
drawItems.clearLayers()
|
|
228
|
-
DrawStatus.value = false
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
onBeforeUnmount(() => {
|
|
232
|
-
ClearMeasure()
|
|
233
|
-
if (map) {
|
|
234
|
-
map.removeLayer(drawItems)
|
|
235
|
-
map.removeLayer(drawHelpItems)
|
|
236
|
-
}
|
|
237
|
-
})
|
|
238
|
-
|
|
239
|
-
return {
|
|
240
|
-
DrawStatus,
|
|
241
|
-
EnableMeasure,
|
|
242
|
-
StartMeasure,
|
|
243
|
-
CancelMeasure,
|
|
244
|
-
ClearMeasure
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
export default useMapMeasure
|
package/src/utils/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { v4 as uuid } from 'uuid'
|
|
2
|
-
|
|
3
|
-
// 生成UUID
|
|
4
|
-
export const idGen = () => _.replace(uuid(), /-/g, '')
|
|
5
|
-
|
|
6
|
-
// 获取树结构首个断言为真的节点
|
|
7
|
-
export function getTreeNode(tree, predicate) {
|
|
8
|
-
// 转换断言
|
|
9
|
-
if (predicate && _.isPlainObject(predicate)) {
|
|
10
|
-
let predicateObj = predicate
|
|
11
|
-
predicate = function (e) {
|
|
12
|
-
let result = true
|
|
13
|
-
Object.keys(predicateObj).forEach(v => {
|
|
14
|
-
if (e[v] != predicateObj[v]) {
|
|
15
|
-
result = false
|
|
16
|
-
}
|
|
17
|
-
})
|
|
18
|
-
return result
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
// 递归
|
|
22
|
-
function recurTree(src = [], result) {
|
|
23
|
-
src.forEach(e => {
|
|
24
|
-
if (predicate && _.isObject(predicate) && !result) {
|
|
25
|
-
if (predicate(e)) {
|
|
26
|
-
result = e
|
|
27
|
-
} else if (e.children && Array.isArray(e.children)) {
|
|
28
|
-
result = recurTree(e.children, result) || result
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
return result
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return recurTree(tree)
|
|
36
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { observeElementResize } from '@/composables/useResizeObserver'
|
|
2
|
-
|
|
3
|
-
const legacyRegistry = new WeakMap()
|
|
4
|
-
|
|
5
|
-
export const addResizeListener = function (element, fn) {
|
|
6
|
-
if (!element || typeof fn !== 'function') {
|
|
7
|
-
return
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
let listeners = legacyRegistry.get(element)
|
|
11
|
-
if (!listeners) {
|
|
12
|
-
listeners = new Map()
|
|
13
|
-
legacyRegistry.set(element, listeners)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (listeners.has(fn)) {
|
|
17
|
-
return
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const stop = observeElementResize(element, fn)
|
|
21
|
-
listeners.set(fn, stop)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const removeResizeListener = function (element, fn) {
|
|
25
|
-
if (!element) {
|
|
26
|
-
return
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const listeners = legacyRegistry.get(element)
|
|
30
|
-
if (!listeners) {
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const stop = listeners.get(fn)
|
|
35
|
-
if (!stop) {
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
stop()
|
|
40
|
-
listeners.delete(fn)
|
|
41
|
-
|
|
42
|
-
if (listeners.size === 0) {
|
|
43
|
-
legacyRegistry.delete(element)
|
|
44
|
-
}
|
|
45
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|