From 7e3753d954e1f2fc37b1970cb4fef8f8d59ad0fc Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 11 Nov 2024 18:33:25 +0800
Subject: [PATCH] layout页面调整

---
 src/views/layout/components/scomponents/layersControl.vue |  125 +++++++++++++++++++++++++++++------------
 1 files changed, 89 insertions(+), 36 deletions(-)

diff --git a/src/views/layout/components/scomponents/layersControl.vue b/src/views/layout/components/scomponents/layersControl.vue
index b04e267..c40416c 100644
--- a/src/views/layout/components/scomponents/layersControl.vue
+++ b/src/views/layout/components/scomponents/layersControl.vue
@@ -2,11 +2,11 @@
  * @Author: shuishen 1109946754@qq.com
  * @Date: 2024-10-31 10:47:29
  * @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2024-11-07 17:17:21
+ * @LastEditTime: 2024-11-09 15:08:15
  * @FilePath: \bigScreen\src\views\layout\components\scomponents\layersControl.vue
- * @Description: 
- * 
- * Copyright (c) 2024 by shuishen, All Rights Reserved. 
+ * @Description:
+ *
+ * Copyright (c) 2024 by shuishen, All Rights Reserved.
 -->
 <template>
   <public-box>
@@ -50,13 +50,16 @@
 import { getList } from "@/api/space/space"
 import { getList as getRiskList } from "@/api/riskSource/riskSource"
 import yqfw from "@/assets/json/yqfw"
-import pipeLine from "@/assets/json/line"
+import gsgw from "@/assets/json/gsgw"
+import rqgw from "@/assets/json/rqgw"
+import wsgw from "@/assets/json/wsgw"
+import ysgw from "@/assets/json/ysgw"
 import { onUnmounted } from 'vue'
 
 const { VITE_APP_BASE } = import.meta.env
 
 const treeRef = ref(null)
-
+const Cesium = DC.getLib('Cesium')
 const treeProps = {
   indent: 16,
   showLabelLine: true,
@@ -65,7 +68,7 @@
 const data = [
   {
     id: '1',
-    label: '化工园区',
+    label: '园区倾斜摄影',
     type: 'layer',
     subType: '3Dtile',
     url: VITE_APP_BASE + 'mx/tileset.json',
@@ -81,6 +84,8 @@
     params: {
       size: 1000
     },
+    backgroundIcon: VITE_APP_BASE + 'img/mapicon/qy.png',
+    showPanel: false,
     layerName: 'qyfb'
   },
 
@@ -190,6 +195,8 @@
       size: 1000
     },
     showParams: 'category',
+    backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy.png',
+    showPanel: false,
     layerName: 'fxy'
   },
 
@@ -205,10 +212,50 @@
   {
     id: '6',
     label: '地下管网',
-    type: 'layer',
-    subType: 'geojsonPipe',
-    layerName: 'dxgw',
-    source: pipeLine
+    children: [
+      // 给水管网、污水管网、燃气管网、雨水管网
+      {
+        id: '6-1',
+        label: '给水管网',
+        type: 'layer',
+        subType: 'geojsonPipe',
+        layerName: 'gsgw',
+        source: gsgw,
+        color: DC.Color.BLUE,
+        height: 1,
+      },
+      {
+        id: '6-2',
+        label: '污水管网',
+        type: 'layer',
+        subType: 'geojsonPipe',
+        layerName: 'wsgw',
+        source: wsgw,
+        color: DC.Color.BLACK,
+        height: 2,
+      },
+      {
+        id: '6-3',
+        label: '燃气管网',
+        type: 'layer',
+        subType: 'geojsonPipe',
+        layerName: 'rqgw',
+        source: rqgw,
+        color: DC.Color.RED,
+        height: 3,
+      },
+      {
+        id: '6-4',
+        label: '雨水管网',
+        type: 'layer',
+        subType: 'geojsonPipe',
+        layerName: 'ysgw',
+        source: ysgw,
+        color: DC.Color.CYAN,
+        height: 4,
+      },
+
+    ]
   },
 ]
 
@@ -224,10 +271,10 @@
     return 'arr'
   }
 }
-// 用于存储收集到的节点的数组  
+// 用于存储收集到的节点的数组
 const collectedNodes = reactive([])
 
-// 递归函数,收集所有 flag 为 true 的子节点  
+// 递归函数,收集所有 flag 为 true 的子节点
 const collectNodesWithFlag = (nodes) => {
   if (checkType(nodes) == 'obj') {
     if (nodes.type == 'layer') {
@@ -265,16 +312,7 @@
       if (item.subType == '3Dtile') {
         if (!addTileLayers[item.layerName]) {
           addTileLayers[item.layerName] = new DC.Tileset(
-            item.url,
-            {
-              maximumMemoryUsage: 128,
-              progressiveResolutionHeightFraction: 0.5,
-              dynamicScreenSpaceErrorDensity: 0.1,
-              cullWithChildrenBounds: false,
-              maximumScreenSpaceError: 256,
-              skipLevelOfDetail: true,
-              preferLeaves: true
-            })
+            item.url)
 
           tileLayers.addOverlay(addTileLayers[item.layerName])
         } else {
@@ -291,13 +329,28 @@
             let data = res.data.data.records
 
             data.filter(i => i.lng && i.lng != '' && i.lat && i.lat != '').forEach(i => {
+              let iconEl = ''
+
+              if ('showPanel' in item && item.showPanel == false) {
+                if (item.backgroundIcon) {
+                  iconEl = `
+                  <div class="map-name">${i[item.showParams] || i.name}</div>
+                  <div class="map-icon">
+                    <img src="${item.backgroundIcon}">
+                  </div>
+                  `
+                }
+              } else {
+                iconEl = `<div class="marsBlueGradientPnl">
+                  <div>${i[item.showParams] || i.name}</div>
+                </div>`
+              }
+
               let divIcon = new DC.DivIcon(
                 new DC.Position(i.lng, i.lat, 0),
                 `<div class="public-map-popup">
-                <div class="marsBlueGradientPnl">
-                  <div>${i[item.showParams] || i.name}</div>
-                </div>
-              </div>`
+                    ${iconEl}
+                  </div>`
               )
 
               addTileLayers[item.layerName].addOverlay(divIcon)
@@ -313,13 +366,13 @@
 
           item.source.features.forEach(i => {
             let wall = new DC.Wall(
-              i.geometry.coordinates[0].map(d => [...d, 200].join(',')).join(';')
+              i.geometry.coordinates[0].map(d => [...d, 125].join(',')).join(';')
             )
 
             wall.setStyle({
               material: new DC.WallTrailMaterialProperty({
-                color: DC.Color.GREEN,
-                speed: 2
+                color: Cesium.Color.fromBytes(0, 123, 255, 180),
+                speed: 10
               })
             })
             addTileLayers[item.layerName].addOverlay(wall)
@@ -332,7 +385,7 @@
           addTileLayers[item.layerName] = new DC.VectorLayer(item.layerName)
           window.$viewer.addLayer(addTileLayers[item.layerName])
 
-          function computeCircle(radius) {
+          function computeCircle (radius) {
             var positions = []
             for (var i = 0; i < 1080; i++) {
               var radians = DC.Math.toRadians(i)
@@ -351,7 +404,7 @@
             )
 
             polylineVolume.setStyle({
-              material: DC.Color.RED
+              material: item.color
             })
             addTileLayers[item.layerName].addOverlay(polylineVolume)
           })
@@ -376,9 +429,9 @@
 }
 
 onMounted(() => {
-  // handleCheckChange(data.filter(i => i.id == '1'), {
-  //   checkedKeys: ['1']
-  // })
+  handleCheckChange(data.filter(i => i.id == '1'), {
+    checkedKeys: ['1']
+  })
 })
 
 onUnmounted(() => {
@@ -416,4 +469,4 @@
     }
   }
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3