@sword916/vae-map-plus 1.0.0

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.
Files changed (86) hide show
  1. package/README.md +3 -0
  2. package/build/index.mjs +113 -0
  3. package/examples/App.vue +18 -0
  4. package/examples/index.js +13 -0
  5. package/examples/router/index.js +35 -0
  6. package/examples/views/amap.vue +29 -0
  7. package/examples/views/amarker.vue +58 -0
  8. package/examples/views/buffer.vue +66 -0
  9. package/examples/views/cluster.vue +74 -0
  10. package/examples/views/cover.vue +85 -0
  11. package/examples/views/draw-line.vue +49 -0
  12. package/examples/views/draw.vue +54 -0
  13. package/examples/views/echarts.vue +142 -0
  14. package/examples/views/emarker.vue +39 -0
  15. package/examples/views/image.vue +182 -0
  16. package/examples/views/index.vue +61 -0
  17. package/examples/views/lrmap.vue +108 -0
  18. package/examples/views/map.vue +82 -0
  19. package/examples/views/measure.vue +86 -0
  20. package/examples/views/parts/popup.vue +39 -0
  21. package/examples/views/parts/tooltip.vue +39 -0
  22. package/examples/views/push-area.vue +52 -0
  23. package/examples/views/push-line.vue +84 -0
  24. package/examples/views/trace.vue +49 -0
  25. package/index.html +13 -0
  26. package/jsconfig.json +17 -0
  27. package/package.json +47 -0
  28. package/public/favicon.ico +0 -0
  29. package/public/images/game.png +0 -0
  30. package/public/images/grid.png +0 -0
  31. package/public/images/marker.png +0 -0
  32. package/public/index.html +30 -0
  33. package/src/components/resize-listener/component.jsx +30 -0
  34. package/src/components/resize-listener/index.js +3 -0
  35. package/src/composables/useAutoMessage.js +41 -0
  36. package/src/composables/useContextMenu.js +99 -0
  37. package/src/composables/useMapMeasure.js +191 -0
  38. package/src/composables/useResizeObserver.js +81 -0
  39. package/src/mixins/message.js +1 -0
  40. package/src/packages/index.js +16 -0
  41. package/src/packages/vae-amap/index.js +8 -0
  42. package/src/packages/vae-amap/style.less +9 -0
  43. package/src/packages/vae-amap/vae-amap.jsx +98 -0
  44. package/src/packages/vae-cloudmap/ctrl-context-menu/index.vue +74 -0
  45. package/src/packages/vae-cloudmap/ctrl-draw/index.vue +499 -0
  46. package/src/packages/vae-cloudmap/ctrl-draw-line/index.vue +161 -0
  47. package/src/packages/vae-cloudmap/index.js +57 -0
  48. package/src/packages/vae-cloudmap/scripts/L.MarkerCluster/index.js +2690 -0
  49. package/src/packages/vae-cloudmap/scripts/L.MarkerCluster/style.css +14 -0
  50. package/src/packages/vae-cloudmap/scripts/L.Vae.CRS/index.js +212 -0
  51. package/src/packages/vae-cloudmap/scripts/L.Vae.Client/index.js +780 -0
  52. package/src/packages/vae-cloudmap/scripts/Mixin.ContextMenu/index.js +101 -0
  53. package/src/packages/vae-cloudmap/style.less +163 -0
  54. package/src/packages/vae-cloudmap/vae-cloudmap.jsx +272 -0
  55. package/src/packages/vae-map/ctrl-context-menu/index.vue +74 -0
  56. package/src/packages/vae-map/ctrl-draw/index.vue +498 -0
  57. package/src/packages/vae-map/ctrl-draw-line/index.vue +128 -0
  58. package/src/packages/vae-map/index.js +59 -0
  59. package/src/packages/vae-map/scripts/L.MarkerCluster/index.js +2690 -0
  60. package/src/packages/vae-map/scripts/L.MarkerCluster/style.css +14 -0
  61. package/src/packages/vae-map/scripts/L.Vae.CRS/index.js +114 -0
  62. package/src/packages/vae-map/scripts/L.Vae.Client/index.js +548 -0
  63. package/src/packages/vae-map/scripts/Mixin.ContextMenu/index.js +1 -0
  64. package/src/packages/vae-map/style.less +161 -0
  65. package/src/packages/vae-map/vae-lrmap.jsx +237 -0
  66. package/src/packages/vae-map/vae-map.jsx +135 -0
  67. package/src/plugins/L.AnimatedMarker/index.js +158 -0
  68. package/src/plugins/L.EchartsLayer/index.js +339 -0
  69. package/src/plugins/L.ElasticMarker/index.js +162 -0
  70. package/src/plugins/L.FootageCalculator.Area/index.js +263 -0
  71. package/src/plugins/L.FootageCalculator.Line/index.js +273 -0
  72. package/src/plugins/L.GeoUtil/buffer.js +67 -0
  73. package/src/plugins/L.GeoUtil/index.js +284 -0
  74. package/src/plugins/L.Glyphicon/index.js +91 -0
  75. package/src/plugins/L.Glyphicon/style.less +37 -0
  76. package/src/plugins/L.MarkerClusterX/index.js +93 -0
  77. package/src/plugins/L.MarkerClusterX/style.less +162 -0
  78. package/src/plugins/L.SafeDivOverlay/index.js +55 -0
  79. package/src/plugins/L.TileLayer.ChinaProvider/index.js +108 -0
  80. package/src/plugins/L.VuePopup/index.js +67 -0
  81. package/src/plugins/L.VueTooltip/index.js +63 -0
  82. package/src/plugins/Mixin.Map.Measure/index.js +248 -0
  83. package/src/plugins/globals/index.js +7 -0
  84. package/src/utils/index.js +36 -0
  85. package/src/utils/resize-event.js +45 -0
  86. package/vite.config.mjs +25 -0
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ ### vae-map
2
+
3
+ #### map components and plugins
@@ -0,0 +1,113 @@
1
+ import path from 'path'
2
+ import { promises as fs } from 'fs'
3
+ import { fileURLToPath } from 'url'
4
+ import { build } from 'vite'
5
+ import vue from '@vitejs/plugin-vue'
6
+ import vueJsx from '@vitejs/plugin-vue-jsx'
7
+
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
9
+ const rootDir = path.resolve(__dirname, '..')
10
+
11
+ const external = [
12
+ 'vue',
13
+ 'lodash',
14
+ 'axios',
15
+ 'leaflet',
16
+ 'proj4',
17
+ 'proj4leaflet',
18
+ 'leaflet-geometryutil',
19
+ 'jquery',
20
+ 'uuid',
21
+ '@geoman-io/leaflet-geoman-free',
22
+ '@turf/buffer',
23
+ 'leaflet.markercluster',
24
+ 'echarts'
25
+ ]
26
+
27
+ const packageEntries = [
28
+ { entry: 'src/packages/index.js', outDir: 'lib' },
29
+ { entry: 'src/packages/vae-amap/index.js', outDir: 'lib/vae-amap' },
30
+ { entry: 'src/packages/vae-map/index.js', outDir: 'lib/vae-map' },
31
+ { entry: 'src/packages/vae-cloudmap/index.js', outDir: 'lib/vae-cloudmap' }
32
+ ]
33
+
34
+ const pluginEntries = [
35
+ 'globals',
36
+ 'L.AnimatedMarker',
37
+ 'L.EchartsLayer',
38
+ 'L.FootageCalculator.Area',
39
+ 'L.FootageCalculator.Line',
40
+ 'L.GeoUtil',
41
+ 'L.Glyphicon',
42
+ 'L.MarkerClusterX',
43
+ 'L.SafeDivOverlay',
44
+ 'L.TileLayer.ChinaProvider',
45
+ 'L.VuePopup',
46
+ 'L.VueTooltip',
47
+ 'Mixin.Map.Measure'
48
+ ].map((name) => ({
49
+ entry: `src/plugins/${name}/index.js`,
50
+ outDir: `plugins/${name}`
51
+ }))
52
+
53
+ function createViteConfig(entry, outDir) {
54
+ return {
55
+ configFile: false,
56
+ plugins: [vue(), vueJsx()],
57
+ resolve: {
58
+ alias: {
59
+ '@': path.resolve(rootDir, 'src')
60
+ }
61
+ },
62
+ build: {
63
+ outDir: path.resolve(rootDir, outDir),
64
+ emptyOutDir: true,
65
+ sourcemap: false,
66
+ cssCodeSplit: false,
67
+ lib: {
68
+ entry: path.resolve(rootDir, entry),
69
+ formats: ['es'],
70
+ fileName: () => 'index'
71
+ },
72
+ rollupOptions: {
73
+ external,
74
+ output: {
75
+ entryFileNames: 'index.js',
76
+ assetFileNames: ({ name }) => {
77
+ if (name?.endsWith('.css')) {
78
+ return 'style.css'
79
+ }
80
+ return 'assets/[name][extname]'
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
87
+
88
+ async function removeDirIfExists(target) {
89
+ await fs.rm(path.resolve(rootDir, target), { recursive: true, force: true })
90
+ }
91
+
92
+ async function buildEntry({ entry, outDir }) {
93
+ await build(createViteConfig(entry, outDir))
94
+ console.log(`built ${entry} -> ${outDir}`)
95
+ }
96
+
97
+ async function run() {
98
+ await removeDirIfExists('lib')
99
+ await removeDirIfExists('plugins')
100
+
101
+ for (const item of packageEntries) {
102
+ await buildEntry(item)
103
+ }
104
+
105
+ for (const item of pluginEntries) {
106
+ await buildEntry(item)
107
+ }
108
+ }
109
+
110
+ run().catch((error) => {
111
+ console.error(error)
112
+ process.exit(1)
113
+ })
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <router-view />
3
+ </template>
4
+
5
+ <style lang="less">
6
+ html,body{
7
+ width: 100%;
8
+ height: 100%;
9
+ }
10
+ #app {
11
+ width: 100%;
12
+ height: 100%;
13
+ margin: 0;
14
+ padding: 0;
15
+ overflow: hidden;
16
+ font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
17
+ }
18
+ </style>
@@ -0,0 +1,13 @@
1
+ import { createApp } from 'vue'
2
+ import ElementPlus from 'element-plus'
3
+ import 'element-plus/dist/index.css'
4
+ import '@fortawesome/fontawesome-free/css/all.css'
5
+ import App from './App.vue'
6
+ import router from './router'
7
+ import VaeMap from '@/packages'
8
+
9
+ createApp(App)
10
+ .use(router)
11
+ .use(ElementPlus)
12
+ .use(VaeMap)
13
+ .mount('#app')
@@ -0,0 +1,35 @@
1
+ import { createRouter, createWebHashHistory } from 'vue-router'
2
+
3
+ const routes = [
4
+ {
5
+ path: '/',
6
+ redirect: '/views/map'
7
+ },
8
+ {
9
+ path: '/views',
10
+ component: () => import('../views/index.vue'),
11
+ children: [
12
+ { path: 'amap', component: () => import('../views/amap.vue') },
13
+ { path: 'map', component: () => import('../views/map.vue') },
14
+ { path: 'lrmap', component: () => import('../views/lrmap.vue') },
15
+ { path: 'push-area', component: () => import('../views/push-area.vue') },
16
+ { path: 'push-line', component: () => import('../views/push-line.vue') },
17
+ { path: 'echarts', component: () => import('../views/echarts.vue') },
18
+ { path: 'trace', component: () => import('../views/trace.vue') },
19
+ { path: 'cluster', component: () => import('../views/cluster.vue') },
20
+ { path: 'cover', component: () => import('../views/cover.vue') },
21
+ { path: 'draw', component: () => import('../views/draw.vue') },
22
+ { path: 'draw-line', component: () => import('../views/draw-line.vue') },
23
+ { path: 'measure', component: () => import('../views/measure.vue') },
24
+ { path: 'amarker', component: () => import('../views/amarker.vue') },
25
+ { path: 'emarker', component: () => import('../views/emarker.vue') },
26
+ { path: 'buffer', component: () => import('../views/buffer.vue') },
27
+ { path: 'image', component: () => import('../views/image.vue') }
28
+ ]
29
+ }
30
+ ]
31
+
32
+ export default createRouter({
33
+ history: createWebHashHistory(import.meta.env.BASE_URL),
34
+ routes
35
+ })
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <vae-amap :api-key="key" :options="options" @amap-ready="setOptions" @init-map="initMap" />
3
+ </template>
4
+
5
+ <script setup>
6
+ import { ref } from 'vue'
7
+
8
+ const amap = ref(null)
9
+ const key = '1a346e3ea95a3227a097cabf11a901b7'
10
+ const options = ref(null)
11
+
12
+ const setOptions = async () => {
13
+ options.value = {
14
+ viewMode: '3D',
15
+ zoom: 8,
16
+ layers: [new AMap.TileLayer.Satellite(), new AMap.Buildings()]
17
+ }
18
+ }
19
+
20
+ const initMap = (value) => {
21
+ amap.value = value
22
+ amap.value.setZoom(12, false, 2500)
23
+ amap.value.setRotation(45, false, 2500)
24
+ amap.value.setPitch(45, false, 2500)
25
+ amap.value.on('zoomend', () => {
26
+ amap.value.setZoom(18, false, 2500)
27
+ }, amap.value, true)
28
+ }
29
+ </script>
@@ -0,0 +1,58 @@
1
+ <template>
2
+ <div class="map-container">
3
+ <vae-map :base-layers="baseLayers" @init-map="initMap" />
4
+ <div class="tools">
5
+ <el-button size="small" @click="startMove">开始</el-button>
6
+ <el-button size="small" @click="pauseMove">暂停</el-button>
7
+ <el-button size="small" @click="continueMove">继续</el-button>
8
+ <el-button size="small" @click="stopMove">结束</el-button>
9
+ </div>
10
+ </div>
11
+ </template>
12
+
13
+ <script setup>
14
+ import { ref } from 'vue'
15
+
16
+ const latLngs = [
17
+ { lat: 34.26572889446933, lng: 117.14584350585939 },
18
+ { lat: 34.25324367127495, lng: 117.20352172851564 },
19
+ { lat: 34.27083595165, lng: 117.23888397216798 },
20
+ { lat: 34.25920275895473, lng: 117.30411529541017 },
21
+ { lat: 34.288991865037524, lng: 117.35321044921876 },
22
+ { lat: 34.277077489205695, lng: 117.3992156982422 }
23
+ ]
24
+
25
+ const map = ref(null)
26
+ const baseLayers = ['GaoDe.Normal.Map']
27
+ const aMarker = ref(null)
28
+
29
+ const initMap = (value) => {
30
+ map.value = value
31
+ aMarker.value = L.animatedMarker({ latLngs })
32
+ .setLatLng(latLngs[0])
33
+ .setIcon(L.glyphicon({
34
+ icon: 'fas fa-baby',
35
+ color: 'black'
36
+ }))
37
+ .addTo(map.value)
38
+ }
39
+
40
+ const startMove = () => aMarker.value?.startMove()
41
+ const pauseMove = () => aMarker.value?.pauseMove()
42
+ const continueMove = () => aMarker.value?.continueMove()
43
+ const stopMove = () => aMarker.value?.stopMove()
44
+ </script>
45
+
46
+ <style lang="less" scoped>
47
+ .map-container {
48
+ height: 100%;
49
+ position: relative;
50
+
51
+ .tools {
52
+ position: absolute;
53
+ right: 10px;
54
+ top: 10px;
55
+ z-index: 2000;
56
+ }
57
+ }
58
+ </style>
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <vae-map base-layers="GaoDe.Normal.Map" @init-map="initMap" />
3
+ </template>
4
+
5
+ <script setup>
6
+ const lineLatLngs = [
7
+ { lat: 34.31614748988616, lng: 117.32368469238283 },
8
+ { lat: 34.293104769231974, lng: 117.31870651245119 },
9
+ { lat: 34.29367205056199, lng: 117.32385635375978 },
10
+ { lat: 34.29672112208355, lng: 117.32248306274415 },
11
+ { lat: 34.297572006012544, lng: 117.32591629028322 },
12
+ { lat: 34.30062093597998, lng: 117.32419967651369 },
13
+ { lat: 34.302322616209494, lng: 117.32909202575685 },
14
+ { lat: 34.30437876715258, lng: 117.32643127441408 },
15
+ { lat: 34.305513173709706, lng: 117.31441497802736 },
16
+ { lat: 34.29728837899387, lng: 117.31184005737306 }
17
+ ]
18
+
19
+ const areaLatLngs = [
20
+ { lat: 34.308136430179374, lng: 117.34376907348634 },
21
+ { lat: 34.30189719938442, lng: 117.34196662902833 },
22
+ { lat: 34.30033731925641, lng: 117.3494338989258 },
23
+ { lat: 34.30714385628804, lng: 117.35355377197267 },
24
+ { lat: 34.31118497662593, lng: 117.34848976135255 }
25
+ ]
26
+
27
+ const pointLatLng = { lat: 34.29587022953563, lng: 117.33552932739259 }
28
+ const baseLayers = L.layerGroup()
29
+ const bufferLayers = L.layerGroup()
30
+
31
+ const bufferLine = () => {
32
+ L.polyline(lineLatLngs).addTo(baseLayers)
33
+ const bufferLatLngs = L.GeoUtil.bufferLine(lineLatLngs, 100)
34
+ L.polygon(bufferLatLngs, { weight: 0, color: 'violet' }).addTo(bufferLayers)
35
+ }
36
+
37
+ const bufferArea = () => {
38
+ L.polygon(areaLatLngs).addTo(baseLayers)
39
+ const bufferLatLngs = L.GeoUtil.bufferArea(areaLatLngs, 100)
40
+ L.polygon(bufferLatLngs, { weight: 0, color: 'DarkTurquoise' }).addTo(bufferLayers)
41
+ }
42
+
43
+ const bufferPoint = () => {
44
+ L.circleMarker(pointLatLng).addTo(baseLayers)
45
+ const bufferLatLngs = L.GeoUtil.bufferPoint(pointLatLng, 500)
46
+ L.polygon(bufferLatLngs, { weight: 0, color: 'greenyellow' }).addTo(bufferLayers)
47
+ }
48
+
49
+ const initMap = (map) => {
50
+ map.addLayer(baseLayers)
51
+ map.addLayer(bufferLayers)
52
+ map.on('click', (event) => {
53
+ console.log(event.latlng)
54
+ })
55
+
56
+ baseLayers.clearLayers()
57
+ bufferLayers.clearLayers()
58
+ bufferLine()
59
+ bufferArea()
60
+ bufferPoint()
61
+
62
+ _.delay(() => {
63
+ map.fitBounds(L.latLngBounds([...lineLatLngs, ...areaLatLngs, pointLatLng]))
64
+ }, 250)
65
+ }
66
+ </script>
@@ -0,0 +1,74 @@
1
+ <template>
2
+ <div class="map-container">
3
+ <vae-map :base-layers="['GaoDe.Normal.Map']" @init-map="initMap" />
4
+ <div class="tools">
5
+ <el-button size="small" @click="setIconStyle('blue')">蓝色</el-button>
6
+ <el-button size="small" @click="setIconStyle('red')">红色</el-button>
7
+ <el-button size="small" @click="setIconStyle('yellow')">黄色</el-button>
8
+ <el-button size="small" @click="setIconStyle('orange')">橙色</el-button>
9
+ <el-button size="small" @click="setIconStyle('gray')">灰色</el-button>
10
+ <el-button size="small" @click="setIconStyle('cyan')">青绿</el-button>
11
+ <el-button size="small" @click="setIconStyle('purple')">紫色</el-button>
12
+ <el-button size="small" @click="setIconStyle('pink')">粉色</el-button>
13
+ <el-button size="small" @click="setIconStyle('transparent')">透明</el-button>
14
+ </div>
15
+ </div>
16
+ </template>
17
+
18
+ <script setup>
19
+ import { ref } from 'vue'
20
+
21
+ const map = ref(null)
22
+ const baseLayers = ref(new L.MarkerClusterGroupX())
23
+
24
+ const getRandomLatLng = () => {
25
+ const bounds = L.latLngBounds([
26
+ { lat: 35.097439809364204, lng: 115.25756835937501 },
27
+ { lat: 33.8247936182649, lng: 114.74670410156251 },
28
+ { lat: 33.50475906922609, lng: 118.27331542968751 },
29
+ { lat: 34.800272350556824, lng: 118.6358642578125 }
30
+ ])
31
+ const north = bounds.getNorth()
32
+ const south = bounds.getSouth()
33
+ const east = bounds.getEast()
34
+ const west = bounds.getWest()
35
+ const lat = (north - south) * Math.random() + south
36
+ const lng = (east - west) * Math.random() + west
37
+ return L.latLng(lat, lng)
38
+ }
39
+
40
+ const addMarkers = () => {
41
+ for (let i = 0; i < 200; i += 1) {
42
+ const latLng = getRandomLatLng()
43
+ L.marker(latLng).addTo(baseLayers.value)
44
+ L.marker(latLng).addTo(baseLayers.value)
45
+ }
46
+ }
47
+
48
+ const setIconStyle = (color) => {
49
+ baseLayers.value.clearLayers()
50
+ baseLayers.value = new L.MarkerClusterGroupX({
51
+ iconStyle: color
52
+ }).addTo(map.value)
53
+ addMarkers()
54
+ }
55
+
56
+ const initMap = (value) => {
57
+ map.value = value
58
+ setIconStyle()
59
+ }
60
+ </script>
61
+
62
+ <style lang="less" scoped>
63
+ .map-container {
64
+ height: 100%;
65
+ position: relative;
66
+
67
+ .tools {
68
+ position: absolute;
69
+ right: 10px;
70
+ top: 10px;
71
+ z-index: 2000;
72
+ }
73
+ }
74
+ </style>
@@ -0,0 +1,85 @@
1
+ <template>
2
+ <div class="map-container">
3
+ <vae-lrmap :options="options" @init-map="initMap" @reload-map="hdReloadMap" />
4
+ <div class="tools">
5
+ <el-button size="small" @click="reloadBJ54">BJ54</el-button>
6
+ <el-button size="small" @click="reloadEPSG3857">L.CRS.EPSG3857</el-button>
7
+ <el-button size="small" @click="addNewMap">puzzle</el-button>
8
+ </div>
9
+ </div>
10
+ </template>
11
+
12
+ <script setup>
13
+ import { computed, ref } from 'vue'
14
+
15
+ const optionsBJ54 = {
16
+ url: 'http://58.218.64.10:38500/',
17
+ dsname: 'XS_MLGIS',
18
+ crs: 'bj54',
19
+ defaultLayerSets: ['矿井充水性图>8煤']
20
+ }
21
+
22
+ const optionsEPSG3857 = {
23
+ url: 'http://58.218.64.10:38500/',
24
+ dsname: 'XS_MLGIS',
25
+ crs: L.CRS.EPSG3857,
26
+ wmscrs: 'bj54',
27
+ defaultLayerSets: ['矿井充水性图>8煤']
28
+ }
29
+
30
+ const map = ref(null)
31
+ const options = ref(optionsBJ54)
32
+ const tdtLayer = ref(null)
33
+
34
+ const vae = computed(() => map.value?.vae)
35
+
36
+ const initMap = (value) => {
37
+ map.value = value
38
+ tdtLayer.value = L.tileLayer.chinaProvider('TianDiTu.Satellite.Map@1a346e3ea95a3227a097cabf11a901b7')
39
+ }
40
+
41
+ const hdReloadMap = (value) => {
42
+ map.value = value
43
+ if (options.value === optionsBJ54) {
44
+ map.value.removeLayer(tdtLayer.value)
45
+ } else {
46
+ tdtLayer.value.addTo(map.value).bringToBack()
47
+ }
48
+ }
49
+
50
+ const reloadBJ54 = () => {
51
+ options.value = optionsBJ54
52
+ vae.value?.reloadMap()
53
+ }
54
+
55
+ const reloadEPSG3857 = () => {
56
+ options.value = optionsEPSG3857
57
+ vae.value?.reloadMap()
58
+ }
59
+
60
+ const addNewMap = () => {
61
+ const client = new L.Vae.Client({
62
+ dsname: 'XGKGIS',
63
+ url: 'http://58.218.64.10:28406/',
64
+ crs: 'bj54',
65
+ defaultLayerSets: ['采掘工程平面图']
66
+ })
67
+ client.createTileLayer().then((layer) => {
68
+ layer.addTo(map.value)
69
+ })
70
+ }
71
+ </script>
72
+
73
+ <style lang="less" scoped>
74
+ .map-container {
75
+ height: 100%;
76
+ position: relative;
77
+
78
+ .tools {
79
+ position: absolute;
80
+ right: 10px;
81
+ top: 10px;
82
+ z-index: 2000;
83
+ }
84
+ }
85
+ </style>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <div class="map-container">
3
+ <vae-lrmap :options="options" @init-map="initMap" />
4
+ <vae-map-ctrl-draw-line ref="drawRef" @on-create="handleCreatePolyline" @on-save="saveItems" />
5
+ </div>
6
+ </template>
7
+
8
+ <script setup>
9
+ import { ref } from 'vue'
10
+
11
+ const initData = {
12
+ latLngs: [
13
+ [4425993, 548012],
14
+ [4425462, 548656]
15
+ ]
16
+ }
17
+
18
+ const drawRef = ref(null)
19
+ const map = ref(null)
20
+ const options = {
21
+ url: 'http://58.218.64.10:38500/',
22
+ dsname: 'XS_MLGIS',
23
+ crs: 'bj54',
24
+ defaultLayerSets: ['采掘工程平面图>8煤']
25
+ }
26
+
27
+ const initMap = (value) => {
28
+ map.value = value
29
+ drawRef.value?.enable(map.value, initData)
30
+ }
31
+
32
+ const handleCreatePolyline = (polyline) => {
33
+ polyline.bindTooltip('polyline', {
34
+ permanent: true,
35
+ direction: 'right'
36
+ })
37
+ }
38
+
39
+ const saveItems = (data) => {
40
+ console.log(data)
41
+ }
42
+ </script>
43
+
44
+ <style lang="less" scoped>
45
+ .map-container {
46
+ height: 100%;
47
+ position: relative;
48
+ }
49
+ </style>
@@ -0,0 +1,54 @@
1
+ <template>
2
+ <div class="map-container">
3
+ <vae-lrmap :options="options" @init-map="initMap" />
4
+ <vae-map-ctrl-draw ref="drawRef" @on-create="handleCreatePolygon" @on-save="saveItems" />
5
+ </div>
6
+ </template>
7
+
8
+ <script setup>
9
+ import { ref } from 'vue'
10
+
11
+ const initData = {
12
+ latLngs: [
13
+ [37.83858083450778, 112.11063490845389],
14
+ [37.82919941967444, 112.11496488333559],
15
+ [37.83846349063635, 112.14989225592417],
16
+ [37.846981386397296, 112.14555284783862]
17
+ ],
18
+ htIndex: [0, 1, 3, 2]
19
+ }
20
+
21
+ const drawRef = ref(null)
22
+ const map = ref(null)
23
+ const options = {
24
+ url: 'http://58.218.64.10:38500/',
25
+ dsname: 'XS_MLGIS',
26
+ crs: 'bj54',
27
+ defaultLayerSets: ['采掘工程平面图>8煤']
28
+ }
29
+
30
+ const initMap = (value) => {
31
+ map.value = value
32
+ drawRef.value?.enable(map.value, initData)
33
+ }
34
+
35
+ const handleCreatePolygon = (polygon) => {
36
+ polygon.bindTooltip('polygon', {
37
+ permanent: true,
38
+ direction: 'right'
39
+ })
40
+ }
41
+
42
+ const saveItems = (data) => {
43
+ data.latLngs?.forEach((latLng) => {
44
+ console.log(latLng.lat, latLng.lng)
45
+ })
46
+ }
47
+ </script>
48
+
49
+ <style lang="less" scoped>
50
+ .map-container {
51
+ height: 100%;
52
+ position: relative;
53
+ }
54
+ </style>