From 02583d412e6680732829fe32e2af44d88c7ac2e2 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 22 Nov 2024 15:39:10 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/main'
---
src/pages/layout/components/scomponents/layersControl.vue | 95 +++++++++++++++++++------------
src/pages/layout/components/scomponents/cesium/AmapMercatorTilingScheme/index.js | 4
src/hooks/initMap.js | 19 +++---
src/router/index.js | 12 ++--
4 files changed, 76 insertions(+), 54 deletions(-)
diff --git a/src/hooks/initMap.js b/src/hooks/initMap.js
index f2cd3fa..b0ee407 100644
--- a/src/hooks/initMap.js
+++ b/src/hooks/initMap.js
@@ -2,25 +2,25 @@
* @Author: shuishen 1109946754@qq.com
* @Date: 2024-10-25 15:09:55
* @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2024-11-13 16:37:17
+ * @LastEditTime: 2024-11-22 14:54:14
* @FilePath: \bigScreen\src\hooks\initMap.js
* @Description:
*
* Copyright (c) 2024 by shuishen, All Rights Reserved.
*/
-let viewer = null
+window.$viewer = null
const { VITE_APP_BASE } = import.meta.env
import { useMap } from 'store/map'
import { nextTick, onMounted, onUnmounted } from 'vue'
import * as turf from '@turf/turf'
-import * as Cesium from 'cesium'
-import 'cesium/Build/Cesium/Widgets/widgets.css'
+// import * as Cesium from 'cesium'
+// import 'cesium/Build/Cesium/Widgets/widgets.css'
export function readyViewer () {
const store = useMap()
function initMap () {
- if (viewer) return
+ if (window.$viewer) return
nextTick(() => {
DC.ready({
@@ -29,9 +29,8 @@
turf,
}).then(() => {
- viewer = new DC.Viewer('viewer-container')
- viewer.locationBar.enable = true
- window.$viewer = viewer
+ window.$viewer = new DC.Viewer('viewer-container')
+ window.$viewer.locationBar.enable = true
window.$viewer.zoomToPosition(new DC.Position(
115.1048036679409,
@@ -52,8 +51,8 @@
})
onUnmounted(() => {
- viewer.destroy()
- viewer = null
+ window.$viewer.destroy()
+ window.$viewer = null
delete window.$viewer
store.setLoadMap(false)
})
diff --git a/src/pages/layout/components/scomponents/cesium/AmapMercatorTilingScheme/index.js b/src/pages/layout/components/scomponents/cesium/AmapMercatorTilingScheme/index.js
index 322aeb2..19d9d9d 100644
--- a/src/pages/layout/components/scomponents/cesium/AmapMercatorTilingScheme/index.js
+++ b/src/pages/layout/components/scomponents/cesium/AmapMercatorTilingScheme/index.js
@@ -2,8 +2,8 @@
* @Author: GuLiMmo 2820890765@qq.com
* @Date: 2024-05-11 09:18:29
* @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2024-10-28 20:14:09
- * @FilePath: \bigScreen\src\views\layout\components\scomponents\cesium\AmapMercatorTilingScheme\index.js
+ * @LastEditTime: 2024-11-21 18:17:18
+ * @FilePath: \bigScreen\src\pages\layout\components\scomponents\cesium\AmapMercatorTilingScheme\index.js
* @Description: 高德地图纠偏
* Copyright (c) 2024 by GuLiMmo, All Rights Reserved.
*/
diff --git a/src/pages/layout/components/scomponents/layersControl.vue b/src/pages/layout/components/scomponents/layersControl.vue
index 985d357..20be92c 100644
--- a/src/pages/layout/components/scomponents/layersControl.vue
+++ b/src/pages/layout/components/scomponents/layersControl.vue
@@ -2,7 +2,7 @@
* @Author: shuishen 1109946754@qq.com
* @Date: 2024-10-31 10:47:29
* @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2024-11-19 15:53:37
+ * @LastEditTime: 2024-11-22 15:37:11
* @FilePath: \bigScreen\src\pages\layout\components\scomponents\layersControl.vue
* @Description:
*
@@ -78,6 +78,9 @@
const treeRef = ref(null)
const Cesium = DC.getLib('Cesium')
+
+console.log(Cesium, 45646465)
+
const treeProps = {
indent: 16,
showLabelLine: true,
@@ -551,9 +554,9 @@
}
}
-let addTileLayers = {}
-let tileLayers = new DC.TilesetLayer('tileLayers')
-window.$viewer.addLayer(tileLayers)
+window.addTileLayers = {}
+window.tileLayers = new DC.TilesetLayer('tileLayers')
+window.$viewer.addLayer(window.tileLayers)
const handleCheckChange = (data) => {
let options = treeRef.value?.getCheckedNodes()
@@ -565,21 +568,40 @@
// const Cesium = DC
if (item.subType == '3Dtile') {
- if (!addTileLayers[item.layerName]) {
- addTileLayers[item.layerName] = item.urlData.map(i => {
- let tile = new DC.Tileset(i.url)
+ if (!window.addTileLayers[item.layerName]) {
+ // window.addTileLayers[item.layerName] = []
+ // let tile = window.$viewer.delegate.scene.primitives.add(new Cesium.Cesium3DTileset({
+ // url: '/zhyq/mx/tile_01/tileset.json',
+ // }))
- tileLayers.addOverlay(tile)
+ // console.log(tile, new Cesium.Cesium3DTileset({
+ // url: '/zhyq/mx/tile_01/tileset.json',
+ // }), 121323)
+ // item.urlData.forEach(i => {
+
+ // })
+
+
+
+ window.addTileLayers[item.layerName] = item.urlData.map(i => {
+ let tile = new DC.Tileset(i.url, {
+ maximumMemoryUsage: 1024 * 1024 * 1024,
+ maximumScreenSpaceError: 48,
+ skipLevels: 5,
+ skipLevelOfDetail: true,
+ skipScreenSpaceErrorFactor: 128
+ })
+
+ window.tileLayers.addOverlay(tile)
return tile
})
-
} else {
- addTileLayers[item.layerName].forEach(i => i.show = true)
+ window.addTileLayers[item.layerName].forEach(i => i.show = true)
}
} else if (item.subType == 'labelPoint') {
- if (!addTileLayers[item.layerName]) {
- addTileLayers[item.layerName] = new DC.HtmlLayer(item.layerName)
- window.$viewer.addLayer(addTileLayers[item.layerName])
+ if (!window.addTileLayers[item.layerName]) {
+ window.addTileLayers[item.layerName] = new DC.HtmlLayer(item.layerName)
+ window.$viewer.addLayer(window.addTileLayers[item.layerName])
item.method(item.params).then(res => {
let data = res.data.data.records
@@ -618,16 +640,16 @@
divIcon.on(DC.MouseEventType.CLICK, incident)
- addTileLayers[item.layerName].addOverlay(divIcon)
+ window.addTileLayers[item.layerName].addOverlay(divIcon)
})
})
} else {
- addTileLayers[item.layerName].show = true
+ window.addTileLayers[item.layerName].show = true
}
} else if (item.subType == 'geojsonWall') {
- if (!addTileLayers[item.layerName]) {
- addTileLayers[item.layerName] = new DC.VectorLayer(item.layerName)
- window.$viewer.addLayer(addTileLayers[item.layerName])
+ if (!window.addTileLayers[item.layerName]) {
+ window.addTileLayers[item.layerName] = new DC.VectorLayer(item.layerName)
+ window.$viewer.addLayer(window.addTileLayers[item.layerName])
item.source.features.forEach(i => {
let wall = new DC.Wall(
@@ -640,20 +662,20 @@
speed: 8
})
})
- addTileLayers[item.layerName].addOverlay(wall)
+ window.addTileLayers[item.layerName].addOverlay(wall)
})
} else {
- addTileLayers[item.layerName].show = true
+ window.addTileLayers[item.layerName].show = true
}
// 飞到园区范围
window.$viewer.flyTo(addTileLayers[item.layerName])
// console.log('flyToyqfw********2222222222*******************************', addTileLayers[item.layerName])
} else if (item.subType == 'geojsonPipe') {
- if (!addTileLayers[item.layerName]) {
- addTileLayers[item.layerName] = new DC.VectorLayer(item.layerName)
- window.$viewer.addLayer(addTileLayers[item.layerName])
+ if (!window.addTileLayers[item.layerName]) {
+ window.addTileLayers[item.layerName] = new DC.VectorLayer(item.layerName)
+ window.$viewer.addLayer(window.addTileLayers[item.layerName])
- function computeCircle(radius) {
+ function computeCircle (radius) {
var positions = []
for (var i = 0; i < 360; i++) {
var radians = DC.Math.toRadians(i)
@@ -674,29 +696,29 @@
polylineVolume.setStyle({
material: item.color
})
- addTileLayers[item.layerName].addOverlay(polylineVolume)
+ window.addTileLayers[item.layerName].addOverlay(polylineVolume)
})
} else {
- addTileLayers[item.layerName].show = true
+ window.addTileLayers[item.layerName].show = true
}
}
} else {
- if (addTileLayers[item.layerName]) {
+ if (window.addTileLayers[item.layerName]) {
if (item.subType == '3Dtile') {
- addTileLayers[item.layerName].forEach(i => i.show = false)
+ window.addTileLayers[item.layerName].forEach(i => i.show = false)
} else if (item.subType == 'labelPoint') {
- addTileLayers[item.layerName].show = false
+ window.addTileLayers[item.layerName].show = false
} else if (item.subType == 'geojsonWall') {
- addTileLayers[item.layerName].show = false
+ window.addTileLayers[item.layerName].show = false
} else if (item.subType == 'geojsonPipe') {
- addTileLayers[item.layerName].show = false
+ window.addTileLayers[item.layerName].show = false
}
}
}
})
}
-function findObjectById(data, id) {
+function findObjectById (data, id) {
// 遍历数据数组
for (let i = 0; i < data.length; i++) {
const item = data[i]
@@ -762,7 +784,7 @@
// });
// 销毁
-function destroy() {
+function destroy () {
let arr = Object.keys(addPupoLayers)
arr.filter(i => i != 'hgyq').forEach(i => {
addPupoLayers[i] && window.$viewer.removeLayer(addPupoLayers[i])
@@ -771,10 +793,11 @@
}
onUnmounted(() => {
- tileLayers && window.$viewer.removeLayer(tileLayers)
- let arr = Object.keys(addTileLayers)
+ window.tileLayers && window.$viewer.removeLayer(window.tileLayers)
+ delete window.tileLayers
+ let arr = Object.keys(window.addTileLayers)
arr.filter(i => i != 'hgyq').forEach(i => {
- addTileLayers[i] && window.$viewer.removeLayer(addTileLayers[i])
+ addTileLwindow.addTileLayersayers[i] && window.$viewer.removeLayer(window.addTileLayers[i])
})
// 弹窗销毁
destroy()
diff --git a/src/router/index.js b/src/router/index.js
index 1782af6..8a8d59b 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -2,7 +2,7 @@
* @Author: shuishen 1109946754@qq.com
* @Date: 2024-10-25 16:35:31
* @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2024-11-21 15:35:48
+ * @LastEditTime: 2024-11-21 15:44:21
* @FilePath: \bigScreen\src\router\index.js
* @Description:
*
@@ -14,11 +14,11 @@
const subLayout = () => import('@/pages/sub/index.vue')
const companyInfo = () => import('@/views/companyInfo/index.vue')
const routes = [
- {
- path: '/:catchAll(.*)',
- name: 'not-found',
- redirect: '/layout',
- },
+ // {
+ // path: '/:catchAll(.*)',
+ // name: 'not-found',
+ // redirect: '/layout',
+ // },
{
path: '',
redirect: '/layout',
--
Gitblit v1.9.3