智慧园区前端大屏
shuishen
2025-02-20 c76b6b7d56a681f4c0e62764fd922f90b4df03dd
src/pages/map/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-12-02 22:04:17
 * @LastEditTime: 2025-02-19 11:42:40
 * @FilePath: \bigScreen\src\pages\map\components\scomponents\layersControl.vue
 * @Description:
 *
@@ -50,10 +50,13 @@
</template>
<script setup>
let addPupoLayers = {}
let addPopLayers = {}
let addTileLayers = {}
let tileLayers = new DC.TilesetLayer('tileLayers')
window.$viewer.addLayer(tileLayers)
let planToBuild = new DC.HtmlLayer('planToBuild')
window.$viewer.addLayer(planToBuild)
const {
  show: showLayerControl
@@ -67,24 +70,30 @@
import panorama from './popup/panorama.vue'
import { getPage } from '@/api/indParkInfo'
import { getPage as getfirmPage } from '@/api/firmInfo/firmInfo'
import { getList, getGouQu } from "@/api/space/space"
import { getList, getGouQu, updateSpace } from "@/api/space/space"
import { getList as getRiskList } from "@/api/riskSource/riskSource"
import { getPanoramaList } from "@/api/panorama/"
import yqfw from "@/assets/json/yqfw"
import gsgw from "@/assets/json/gsgw"
import rqgw from "@/assets/json/rqgw"
// 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 track from "@/assets/json/track"
import { onUnmounted } from 'vue'
import EventBus from 'utils/bus'
import { usePointStore } from 'store/usepoint'
const pointStore = usePointStore()
import { useMap } from 'store/map'
const mapStore = useMap()
import { useRouter } from 'vue-router'
const router = useRouter()
import {
  ElMessage
} from 'element-plus'
const { VITE_APP_BASE } = import.meta.env
// , '7', 
let indexPoint = ref(['1', '5'])
let indexPoint = ref(['1', '5', '7', '8'])
const treeRef = ref(null)
@@ -101,6 +110,16 @@
  panoramaShow.value = false
}
const baseRcImages = new window.$Cesium.WebMapTileServiceImageryProvider({
  url: '/arcgis117/rest/services/DTFW/rcgyyyx/MapServer/WMTS',
  layer: 'DTFW_rcgyyyx',
  style: 'default',
  format: 'image/png',
  tileMatrixSetID: 'default028mm',
  tilingScheme: new window.$Cesium.GeographicTilingScheme(),
  tileMatrixLabels: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19']
})
const data = [
  {
    id: '1',
@@ -109,25 +128,14 @@
    subType: '3Dtile',
    urlData: [
      {
        url: VITE_APP_BASE + 'newMx/mx/tile_01/tileset.json',
        label: 'tile_01'
        url: '/3Dtile/rcmx_t/part1/tileset.json',
        label: 'part1'
      },
      {
        url: VITE_APP_BASE + 'newMx/mx/tile_02/tileset.json',
        label: 'tile_02'
        url: '/3Dtile/rcmx_t/part2/tileset.json',
        label: 'part2'
      },
      {
        url: VITE_APP_BASE + 'newMx/mx/tile_03/tileset.json',
        label: 'tile_03'
      },
      {
        url: VITE_APP_BASE + 'newMx/mx/tile_04/tileset.json',
        label: 'tile_04'
      },
      {
        url: VITE_APP_BASE + 'newMx/mx/tile_05/tileset.json',
        label: 'tile_05'
      },
    ],
    layerName: 'hgyq'
  },
@@ -152,30 +160,32 @@
    label: '应急空间',
    children: [
      {
        parentId: '3',
        id: '3-1',
        label: '应急池',
        label: '雨水池',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
        params: {
          type: 1,
          size: 1000
          size: 1000,
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/yjc.png',
        className: 'yjc-box',
        showPanel: false,
        layerName: 'yjc',
        layerName: 'cq-yssjc',
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
          destroy()
          // if (!attrParams.imageUrl) {
          //   return
          // }
          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPupoLayers[attrParams.name])
          destroyPop()
          if (!attrParams.firmName) {
            return
          }
          addPopLayers[attrParams.id] = new DC.HtmlLayer(attrParams.id)
          window.$viewer.addLayer(addPopLayers[attrParams.id])
          let iconEl = `<div class="marsBlueGradientPnl">
            <div>${attrParams.fullName}</div>
            <div>企业名称:${attrParams.firmName}</div>
            <div>作用:${attrParams.mainFuncName}</div>
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
@@ -184,38 +194,40 @@
                  </div>`
          )
          let incident = () => {
            destroy()
            destroyPop()
          }
          divIcon.on(DC.MouseEventType.CLICK, incident)
          addPupoLayers[attrParams.name].addOverlay(divIcon)
          addPopLayers[attrParams.id].addOverlay(divIcon)
        }
      },
      {
        parentId: '3',
        id: '3-2',
        label: '阀门',
        label: '应急池',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
        params: {
          type: 2,
          size: 1000
          size: 1000,
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/ysf.png',
        className: 'ysf-box',
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/yjc.png',
        className: 'yjc-box',
        showPanel: false,
        layerName: 'fm',
        layerName: 'sg-yjc',
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
          destroy()
          if (!attrParams.imageUrl) {
          destroyPop()
          if (!attrParams.firmName) {
            return
          }
          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPupoLayers[attrParams.name])
          addPopLayers[attrParams.id] = new DC.HtmlLayer(attrParams.id)
          window.$viewer.addLayer(addPopLayers[attrParams.id])
          let iconEl = `<div class="marsBlueGradientPnl">
                  <div>${attrParams.fullName}</div>
                  <img src="${attrParams.imageUrl}" width="160" height="160" />
            <div>企业名称:${attrParams.firmName}</div>
            <div>作用:${attrParams.mainFuncName}</div>
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
@@ -224,64 +236,58 @@
                  </div>`
          )
          let incident = () => {
            destroy()
            destroyPop()
          }
          divIcon.on(DC.MouseEventType.CLICK, incident)
          addPupoLayers[attrParams.name].addOverlay(divIcon)
          addPopLayers[attrParams.id].addOverlay(divIcon)
        }
      },
      {
        parentId: '3',
        id: '3-3',
        label: '公共管网',
        children: [
          // 给水管网、污水管网、燃气管网、雨水管网
          {
            id: '3-3-2',
            label: '污水管网',
            type: 'layer',
            subType: 'geojsonPipe',
            layerName: 'wsgw',
            source: wsgw,
            color: DC.Color.DARKBLUE.withAlpha(0.9),
            height: 60.2,
          },
          {
            id: '3-3-4',
            label: '雨水管网',
            type: 'layer',
            subType: 'geojsonPipe',
            layerName: 'ysgw',
            source: ysgw,
            color: DC.Color.CYAN.withAlpha(0.9),
            height: 60,
          },
          {
            id: '3-3-1',
            label: '给水管网',
            type: 'layer',
            subType: 'geojsonPipe',
            layerName: 'gsgw',
            source: gsgw,
            color: DC.Color.BLUE.withAlpha(0.9),
            height: 60.4,
          },
          {
            id: '3-3-3',
            label: '燃气管网',
            type: 'layer',
            subType: 'geojsonPipe',
            layerName: 'rqgw',
            source: rqgw,
            color: DC.Color.RED.withAlpha(0.9),
            height: 60.6,
          },
        ]
        label: '切断阀',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
        params: {
          type: 3,
          size: 1000
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/ysf.png',
        className: 'ysf-box',
        showPanel: false,
        layerName: 'qdf',
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
          destroyPop()
          if (!attrParams.firmName) {
            return
          }
          addPopLayers[attrParams.id] = new DC.HtmlLayer(attrParams.id)
          window.$viewer.addLayer(addPopLayers[attrParams.id])
          let iconEl = `<div class="marsBlueGradientPnl">
            <div>企业名称:${attrParams.firmName}</div>
            <div>作用:${attrParams.mainFuncName}</div>
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
            `<div class="public-map-popup-two">
                    ${iconEl}
                  </div>`
          )
          let incident = () => {
            destroyPop()
          }
          divIcon.on(DC.MouseEventType.CLICK, incident)
          addPopLayers[attrParams.id].addOverlay(divIcon)
        }
      },
      {
        id: '3-4',
        label: '污水提升泵站',
        label: '闸坝',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
@@ -289,37 +295,16 @@
          type: 4,
          size: 1000
        },
        layerName: 'wstsbz',
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
          destroy()
          if (!attrParams.imageUrl) {
            return
          }
          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPupoLayers[attrParams.name])
          let iconEl = `<div class="marsBlueGradientPnl">
                  <div>${attrParams.fullName}</div>
                  <img src="${attrParams.imageUrl}" width="160" height="160" />
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
            `<div class="public-map-popup-two">
                    ${iconEl}
                  </div>`
          )
          let incident = () => {
            destroy()
          }
          divIcon.on(DC.MouseEventType.CLICK, incident)
          addPupoLayers[attrParams.name].addOverlay(divIcon)
        }
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/zb.png',
        className: 'sk-box',
        showPanel: false,
        layerName: 'zb'
      },
      {
        parentId: '3',
        id: '3-5',
        label: '水库',
        label: '湿地',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
@@ -327,40 +312,41 @@
          type: 5,
          size: 1000
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/sk.png',
        className: 'sk-box',
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/sd.png',
        className: 'xfs-box',
        showPanel: false,
        layerName: 'sk',
        layerName: 'sd',
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
          destroy()
          if (!attrParams.imageUrl) {
          destroyPop()
          if (!attrParams.firmName) {
            return
          }
          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPupoLayers[attrParams.name])
          addPopLayers[attrParams.id] = new DC.HtmlLayer(attrParams.id)
          window.$viewer.addLayer(addPopLayers[attrParams.id])
          let iconEl = `<div class="marsBlueGradientPnl">
                   <div>${attrParams.fullName}</div>
                  <img src="${attrParams.imageUrl}" width="160" height="160" />
                </div>`
      <div>企业名称:${attrParams.firmName}</div>
      <div>作用:${attrParams.mainFuncName}</div>
          </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
            `<div class="public-map-popup-two">
                    ${iconEl}
                  </div>`
              ${iconEl}
            </div>`
          )
          let incident = () => {
            destroy()
            destroyPop()
          }
          divIcon.on(DC.MouseEventType.CLICK, incident)
          addPupoLayers[attrParams.name].addOverlay(divIcon)
          addPopLayers[attrParams.id].addOverlay(divIcon)
        }
      },
      {
        parentId: '3',
        id: '3-6',
        label: '应急泵',
        label: '坑塘',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
@@ -368,22 +354,22 @@
          type: 6,
          size: 1000
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/yjb.png',
        className: 'yjb-box',
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/kt.png',
        className: 'sk-box',
        showPanel: false,
        layerName: 'yjb',
        layerName: 'kt',
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
          destroy()
          if (!attrParams.imageUrl) {
          destroyPop()
          if (!attrParams.firmName) {
            return
          }
          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPupoLayers[attrParams.name])
          addPopLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPopLayers[attrParams.name])
          let iconEl = `<div class="marsBlueGradientPnl">
                  <div>${attrParams.fullName}</div>
                  <img src="${attrParams.imageUrl}" width="160" height="160" />
            <div>企业名称:${attrParams.firmName}</div>
            <div>作用:${attrParams.mainFuncName}</div>
                </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
@@ -392,74 +378,53 @@
                  </div>`
          )
          let incident = () => {
            destroy()
            destroyPop()
          }
          divIcon.on(DC.MouseEventType.CLICK, incident)
          addPupoLayers[attrParams.name].addOverlay(divIcon)
          addPopLayers[attrParams.name].addOverlay(divIcon)
        }
      },
      {
        parentId: '3',
        id: '3-8',
        label: '沟渠',
        type: 'layer',
        subType: 'geojsonPolygon',
        method: getGouQu,
        params: {
          type: 8,
          size: 1000
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/gouqu.png',
        className: 'xfs-box',
        showPanel: false,
        layerName: 'gouqu'
      },
      // {
      //   id: '3-9',
      //   label: '废水处理站',
      //   type: 'layer',
      //   subType: 'labelPoint',
      //   method: getList,
      //   params: {
      //     type: 9,
      //     size: 1000
      //     // name: '吉水县绿源污水处理厂',
      //   },
      //   backgroundIcon: VITE_APP_BASE + 'img/mapicon/wsclc.png',
      //   className: 'xfs-box',
      //   showPanel: false,
      //   layerName: 'fsclz'
      // },
      {
        id: '3-10',
        label: '排水口',
        label: '桥梁',
        type: 'layer',
        subType: 'labelPoint',
        method: getList,
        params: {
          type: 10,
          type: 8,
          size: 1000
        },
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/psk.png',
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/ql.png',
        className: 'xfs-box',
        showPanel: false,
        layerName: 'psk'
        layerName: 'ql'
      },
      // {
      //   id: '3-11',
      //   label: '污水池',
      //   type: 'layer',
      //   subType: 'labelPoint',
      //   method: getList,
      //   params: {
      //     type: 11,
      //     size: 1000
      //   },
      //   backgroundIcon: VITE_APP_BASE + 'img/mapicon/wsc.png',
      //   className: 'xfs-box',
      //   showPanel: false,
      //   layerName: 'wsc'
      // }
      {
        parentId: '3',
        id: '3-9',
        label: '雨水管网',
        type: 'layer',
        subType: 'geojsonPipe',
        layerName: 'ysgw',
        source: ysgw,
        color: DC.Color.CYAN.withAlpha(0.9),
        height: 30,
      },
      {
        parentId: '3',
        id: '3-10',
        label: '排洪渠',
        type: 'layer',
        subType: 'geojsonPolygon',
        layerName: 'track',
        source: track,
        color: DC.Color.BLUE.withAlpha(0.9),
        height: 30,
      },
    ]
  },
@@ -468,6 +433,7 @@
    label: '风险源',
    children: [
      {
        parentId: '4',
        id: '4-1',
        label: '一般',
        type: 'layer',
@@ -482,14 +448,17 @@
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy-yb.png',
        showPanel: false,
        layerName: 'fxyOrdinary',
        customWx: true,
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
          destroy()
          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPupoLayers[attrParams.name])
          destroyPop()
          addPopLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPopLayers[attrParams.name])
          let iconEl = `<div class="marsBlueGradientPnl">
            <li>${attrParams.name || ''}</li>
            <li>企业名称:${attrParams.firmName || ''}</li>
            <li>风险等级:${attrParams.riskLevelName || ''}</li>
            <li>行业类别:${attrParams.name || ''}</li>
            </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
@@ -498,13 +467,14 @@
                  </div>`
          )
          let incident = () => {
            destroy()
            destroyPop()
          }
          divIcon.on(DC.MouseEventType.CLICK, incident)
          addPupoLayers[attrParams.name].addOverlay(divIcon)
          addPopLayers[attrParams.name].addOverlay(divIcon)
        }
      },
      {
        parentId: '4',
        id: '4-2',
        label: '较大',
        type: 'layer',
@@ -515,18 +485,21 @@
          size: 1000
        },
        showParams: 'category',
        className: 'fxy-larger',
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy-jd.png',
        className: 'fxy-larger-b',
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy-zd-b.png',
        showPanel: false,
        layerName: 'fxyLarger',
        customWx: true,
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
          destroy()
          addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPupoLayers[attrParams.name])
          destroyPop()
          addPopLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPopLayers[attrParams.name])
          let iconEl = `<div class="marsBlueGradientPnl"> 
            <li>${attrParams.name || ''}</li>
            <li>企业名称:${attrParams.firmName || ''}</li>
            <li>风险等级:${attrParams.riskLevelName || ''}</li>
            <li>行业类别:${attrParams.name || ''}</li>
            </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
@@ -535,10 +508,92 @@
                  </div>`
          )
          let incident = () => {
            destroy()
            destroyPop()
          }
          divIcon.on(DC.MouseEventType.CLICK, incident)
          addPupoLayers[attrParams.name].addOverlay(divIcon)
          addPopLayers[attrParams.name].addOverlay(divIcon)
        }
      },
      {
        parentId: '4',
        id: '4-3',
        label: '重大',
        type: 'layer',
        subType: 'labelPoint',
        method: getRiskList,
        params: {
          riskLevel: 3,
          size: 1000
        },
        showParams: 'category',
        className: 'fxy-larger',
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy-jd.png',
        showPanel: false,
        layerName: 'fxyLargerB',
        customWx: true,
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
          destroyPop()
          addPopLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPopLayers[attrParams.name])
          let iconEl = `<div class="marsBlueGradientPnl">
            <li>企业名称:${attrParams.firmName || ''}</li>
            <li>风险等级:${attrParams.riskLevelName || ''}</li>
            <li>行业类别:${attrParams.name || ''}</li>
            </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
            `<div class="public-map-popup-three">
                    ${iconEl}
                  </div>`
          )
          let incident = () => {
            destroyPop()
          }
          divIcon.on(DC.MouseEventType.CLICK, incident)
          addPopLayers[attrParams.name].addOverlay(divIcon)
        }
      },
      {
        parentId: '4',
        id: '4-9',
        label: '其他',
        type: 'layer',
        subType: 'labelPoint',
        method: getRiskList,
        params: {
          riskLevel: 9,
          size: 1000
        },
        showParams: 'category',
        className: 'fxy-zd',
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy-zd.png',
        showPanel: false,
        layerName: 'fxyZdLarger',
        customWx: true,
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
          destroyPop()
          addPopLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
          window.$viewer.addLayer(addPopLayers[attrParams.name])
          let iconEl = `<div class="marsBlueGradientPnl">
            <li>${attrParams.firmName || ''}</li>
            <li>${attrParams.name || ''}</li>
            <li>${attrParams.riskLevelName || ''}</li>
            </div>`
          let divIcon = new DC.DivIcon(
            new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
            `<div class="public-map-popup-three">
                    ${iconEl}
                  </div>`
          )
          let incident = () => {
            destroyPop()
          }
          divIcon.on(DC.MouseEventType.CLICK, incident)
          addPopLayers[attrParams.name].addOverlay(divIcon)
        }
      }
    ]
@@ -581,7 +636,17 @@
      panoramaShow.value = true
    }
  },
  {
    id: '8',
    label: '瑞昌影像',
    type: 'layer',
    subType: 'baseMap',
    layerName: 'baseMap',
    source: baseRcImages,
  },
  /* {
    id: '8',
    label: '地面全景分布',
    type: 'layer',
@@ -608,7 +673,7 @@
      panoramaUrl.value = attrParams.url
      panoramaShow.value = true
    }
  },
  }, */
]
// let modellayer = new DC.VectorLayer("modellayer").addTo(window.$viewer)
@@ -661,7 +726,10 @@
  }
}
let moveEntity = null
const handleCheckChange = (data) => {
  let options = treeRef.value?.getCheckedNodes()
  collectedNodes.value = []
  collectNodesWithFlag(data)
@@ -674,10 +742,10 @@
        if (!addTileLayers[item.layerName]) {
          // addTileLayers[item.layerName] = []
          // let tile = window.$viewer.delegate.scene.primitives.add(new window.$Cesium.Cesium3DTileset({
          //   url: '/zhyq/mx/tile_01/tileset.json',
          //   url: '/zhyq-lc/mx/tile_01/tileset.json',
          // }))
          //   url: '/zhyq/mx/tile_01/tileset.json',
          //   url: '/zhyq-lc/mx/tile_01/tileset.json',
          // }), 121323)
          // item.urlData.forEach(i => {
@@ -685,20 +753,34 @@
          addTileLayers[item.layerName] = []
          item.urlData.forEach((m, ind) => {
            addTileLayers[item.layerName][ind] = new DC.Tileset(m.url, {
              maximumMemoryUsage: 1024,
              maximumScreenSpaceError: 8,
              skipLevels: 5,
              // maximumMemoryUsage: 1024,
              // maximumScreenSpaceError: 8,
              // skipLevels: 5,
              // skipLevelOfDetail: true,
              // skipScreenSpaceErrorFactor: 128,
              // progressiveResolutionHeightFraction: 0.5,
              // baseScreenSpaceError: 1024
              skipLevelOfDetail: true,
              baseScreenSpaceError: 1024,
              maximumScreenSpaceError: 16, // 数值加大,能让最终成像变模糊
              skipScreenSpaceErrorFactor: 128,
              progressiveResolutionHeightFraction: 0.5,
              baseScreenSpaceError: 1024
              skipLevels: 5,
              immediatelyLoadDesiredLevelOfDetail: false,
              loadSiblings: true, // 如果为true则不会在已加载完概况房屋后,自动从中心开始超清化房屋
              cullWithChildrenBounds: true,
              cullRequestsWhileMoving: true,
              cullRequestsWhileMovingMultiplier: 10, // 值越小能够更快的剔除
              preloadWhenHidden: true,
              preferLeaves: true,
              maximumMemoryUsage: 1024, // 内存分配变小有利于倾斜摄影数据回收,提升性能体验
              progressiveResolutionHeightFraction: 0.3, // 数值偏于0能够让初始加载变得模糊
              dynamicScreenSpaceErrorDensity: 0.5, // 数值加大,能让周边加载变快
              dynamicScreenSpaceErrorFactor: 1, // 不知道起了什么作用没,反正放着吧先
              dynamicScreenSpaceError: true, // 根据测试,有了这个后,会在真正的全屏加载完之后才清晰化房屋
            })
            addTileLayers[item.layerName][ind].setSplitDirection(1)
            // tile.setHeight(-420)
            // tile.setSplitDirection(-1)
            window.$viewer.sceneSplit.addTileset(addTileLayers[item.layerName][ind])
            tileLayers.addOverlay(addTileLayers[item.layerName][ind])
            window.$viewer.sceneSplit.enable = false
          })
        } else {
          addTileLayers[item.layerName].forEach(m => m.show = true)
@@ -743,7 +825,19 @@
              if (item.incident) incident = item.incident
              divIcon.on(DC.MouseEventType.CLICK, incident)
              divIcon.on(DC.MouseEventType.CLICK, (e) => {
                if (mapStore.editPoint) {
                  moveEntity = e
                  return
                }
                if (mapStore.startCustomWx && item.customWx) {
                  EventBus.emit('wxEntityClick', e)
                  return
                }
                incident(e)
              })
              addTileLayers[item.layerName].addOverlay(divIcon)
            })
@@ -795,9 +889,34 @@
              computeCircle(1.6)
            )
            polylineVolume.setStyle({
              material: item.color
            })
            if ('RefName' in i.properties && i.properties.RefName.indexOf('拟建') != -1) {
              polylineVolume.setStyle({
                material: DC.Color.fromBytes(255, 0, 0, 230)
              })
              let features = window.$turf.featureCollection(
                i.geometry.coordinates.map(d => window.$turf.point([d[0], d[1]]))
              )
              let planCenter = window.$turf.center(features)
              let planDivIcon = new DC.DivIcon(
                new DC.Position(planCenter.geometry.coordinates[0], planCenter.geometry.coordinates[1], 60.5),
                `<div class="public-map-popup">
                     <div class="map-name">拟建</div>
                  <div class="map-icon">
                    <img src="${VITE_APP_BASE + 'img/mapicon/nj-ys.png'}">
                  </div>
                  </div>`
              )
              planToBuild.addOverlay(planDivIcon)
            } else {
              polylineVolume.setStyle({
                material: item.color
              })
            }
            addTileLayers[item.layerName].addOverlay(polylineVolume)
          })
        } else {
@@ -807,42 +926,43 @@
        if (!addTileLayers[item.layerName]) {
          addTileLayers[item.layerName] = new DC.VectorLayer(item.layerName)
          window.$viewer.addLayer(addTileLayers[item.layerName])
          item.method(item.params).then(res => {
            let data = res.data.data.records
            data.forEach(i => {
              let stl = ''
              try {
                let geom = JSON.parse(i.geom)
                if (geom && geom.coordinates && geom.coordinates[0]) {
                  stl = geom.coordinates[0][0].map(d => d[0] + ',' + d[1]).join(';')
                } else {
                  console.error('Invalid geom structure')
                }
              } catch (error) {
                console.error('Failed to parse geom:', error)
              }
              let polygon = new DC.Polygon(stl)
              polygon.setStyle({
                width: 2,
                material: DC.Color.BLUE,
                clampToGround: true
              })
              addTileLayers[item.layerName].addOverlay(polygon)
          item.source.features.forEach(i => {
            let Polyline = new DC.Polyline(i.geometry.coordinates.map(d => [...d, item.height].join(',')).join(';'))
            Polyline.setStyle({
              width: 3,
              material: DC.Color.BLUE,
              clampToGround: true
            })
            addTileLayers[item.layerName].addOverlay(Polyline)
          })
        } else {
          addTileLayers[item.layerName].show = true
        }
      } else if (item.subType == 'baseMap') {
        if (addTileLayers[item.layerName]) {
          addTileLayers[item.layerName].show = true
          return
        }
        addTileLayers[item.layerName] = window.$viewer?.imageryLayers.addImageryProvider(item.source)
      }
    } else {
      if (addTileLayers[item.layerName]) {
        if (item.subType == '3Dtile') {
          addTileLayers[item.layerName].forEach(m => m.show = false)
        } else if (item.subType == 'baseMap') {
          addTileLayers[item.layerName].show = false
        } else {
          addTileLayers[item.layerName].clear()
          window.$viewer && window.$viewer.removeLayer(addTileLayers[item.layerName])
          addTileLayers[item.layerName] = null
          delete addTileLayers[item.layerName]
          if (item.layerName == 'ysgw' && planToBuild) {
            planToBuild.clear()
          }
        }
      }
    }
@@ -884,22 +1004,28 @@
}
const restHandleDelChange = (key) => {
  let checkIds = treeRef.value?.getCheckedKeys()
  if (checkIds && !checkIds.some(i => i == key)) {
    return
  }
  treeRef.value?.setCheckedKeys(checkIds.filter(i => i.indexOf(key)))
  handleCheckChange([findObjectById(data, key)])
  let selectData = findObjectById(data, key)
  let parentId = null
  if (selectData && 'parentId' in selectData) parentId = selectData.parentId
  treeRef.value?.setCheckedKeys(checkIds.filter(i => i.indexOf(key) && i != parentId))
  handleCheckChange([selectData])
}
// 飞到园区范围
const flyToyqfw = () => {
  window.$viewer.zoomToPosition(new DC.Position(
    115.1021,
    27.2360,
    5000,
    115.6080,
    29.7880,
    3000,
    0,
    -45,
    0
@@ -910,11 +1036,68 @@
EventBus.on('restHandleCheckChange', restHandleCheckChange)
EventBus.on('restHandleDelChange', restHandleDelChange)
EventBus.on('flyToyqfw', flyToyqfw)
EventBus.on('destroyPop', destroyPop)
let tooltip = window.$viewer.tooltip
const viewerMouseMove = (e) => {
  if (mapStore.editPoint) {
    if (moveEntity != null) {
      if (e.wgs84Position && e.wgs84Position.alt > 0) {
        moveEntity.overlay.position = new DC.Position(e.wgs84Position.lng, e.wgs84Position.lat, e.wgs84Position.alt)
      } else {
        moveEntity.overlay.position = new DC.Position(e.wgs84SurfacePosition.lng, e.wgs84SurfacePosition.lat, e.wgs84SurfacePosition.alt)
      }
      tooltip.showAt({ x: e.windowPosition.x + 10, y: e.windowPosition.y }, '右键结束编辑')
    } else {
      tooltip.showAt({ x: e.windowPosition.x + 10, y: e.windowPosition.y }, '左键选中点位,开始编辑')
    }
  }
}
window.$viewer.on(DC.MouseEventType.MOUSE_MOVE, viewerMouseMove)
const viewerRightClick = (e) => {
  if (mapStore.editPoint && moveEntity != null) {
    tooltip.enable = false
    let lng, lat, ele
    const { attrParams } = moveEntity.overlay
    console.log(e, 2222)
    if (e.wgs84Position && e.wgs84Position.alt > 0) {
      lng = e.wgs84Position.lng
      lat = e.wgs84Position.lat
      ele = e.wgs84Position.alt
    } else {
      lng = e.wgs84SurfacePosition.lng
      lat = e.wgs84SurfacePosition.lat
      ele = e.wgs84SurfacePosition.alt
    }
    updateSpace({
      id: attrParams.id,
      lng,
      lat,
      ele: Math.ceil(ele)
    }).then(res => {
      moveEntity = null
      mapStore.setEditPoint(false)
      ElMessage({
        message: '修改成功',
        type: 'success',
      })
    })
  }
}
window.$viewer.on(DC.MouseEventType.RIGHT_CLICK, viewerRightClick)
onMounted(() => {
  setTimeout(() => {
    // handleCheckChange(data.filter(i => indexPoint.value.includes(i.id)))
  }, 3000)
  handleCheckChange(data.filter(i => indexPoint.value.includes(i.id)))
})
// const sharedData = computed(() => pointStore.sharedData);
@@ -924,25 +1107,22 @@
// 关闭所有选中的,除了倾斜,园区分布,空中全景
const closeAll = () => {
  EventBus.emit('restHandleDelChange', `2`)
  EventBus.emit('restHandleDelChange', `3`)
  EventBus.emit('restHandleDelChange', `3-1`)
  EventBus.emit('restHandleDelChange', `3-2`)
  EventBus.emit('restHandleDelChange', `3-3`)
  EventBus.emit('restHandleDelChange', `3-3-1`)
  EventBus.emit('restHandleDelChange', `3-3-2`)
  EventBus.emit('restHandleDelChange', `3-3-3`)
  EventBus.emit('restHandleDelChange', `3-3-4`)
  EventBus.emit('restHandleDelChange', `3-4`)
  EventBus.emit('restHandleDelChange', `3-5`)
  EventBus.emit('restHandleDelChange', `3-6`)
  EventBus.emit('restHandleDelChange', `3-7`)
  EventBus.emit('restHandleDelChange', `3-8`)
  EventBus.emit('restHandleDelChange', `3-9`)
  EventBus.emit('restHandleDelChange', `4`)
  EventBus.emit('restHandleDelChange', `4-1`)
  EventBus.emit('restHandleDelChange', `4-2`)
  EventBus.emit('restHandleDelChange', `8`)
  destroy()
  EventBus.emit('restHandleDelChange', `4-3`)
  EventBus.emit('restHandleDelChange', `4-9`)
  destroyPop()
}
// const sharedData = computed(() => pointStore.sharedData);
@@ -958,28 +1138,35 @@
)
// 销毁
function destroy () {
  let arr = Object.keys(addPupoLayers)
  arr.filter(i => i != 'hgyq').forEach(i => {
    addPupoLayers[i] && window.$viewer && window.$viewer.removeLayer(addPupoLayers[i])
    addPupoLayers[i] = null
    delete addPupoLayers[i]
  })
  addPupoLayers = {}
function destroyPop () {
  if (addPopLayers && addPopLayers != null) {
    let arr = Object.keys(addPopLayers)
    if (arr.length > 0) {
      arr.forEach(i => {
        addPopLayers[i] && window.$viewer && window.$viewer.removeLayer(addPopLayers[i])
        addPopLayers[i] = null
        delete addPopLayers[i]
      })
      addPopLayers = {}
    }
  }
}
onUnmounted(() => {
  let arr = Object.keys(addTileLayers)
  arr.forEach(i => {
    if (i == 'hgyq') {
      tileLayers.removeOverlay(addTileLayers[i])
      addTileLayers[i] = null
      delete addTileLayers[i]
    if (i == 'hgyq' || i == 'hgyqT') {
      addTileLayers[i].forEach(t => {
        tileLayers.removeOverlay(t)
        t = null
      })
    } else if (i == 'baseMap') {
      window.$viewer?.imageryLayers.remove(addTileLayers[i])
    } else {
      addTileLayers[i] && window.$viewer && window.$viewer.removeLayer(addTileLayers[i])
      addTileLayers[i] = null
      delete addTileLayers[i]
    }
    addTileLayers[i] = null
    delete addTileLayers[i]
  })
  addTileLayers = null
@@ -988,9 +1175,19 @@
    window.$viewer && window.$viewer.removeLayer(tileLayers)
    tileLayers = null
  }
  if (planToBuild) {
    planToBuild.remove()
    window.$viewer && window.$viewer.removeLayer(planToBuild)
    planToBuild = null
  }
  // 弹窗销毁
  destroy()
  addPupoLayers = null
  destroyPop()
  addPopLayers = null
  window.$viewer && window.$viewer.off(DC.MouseEventType.MOUSE_MOVE, viewerMouseMove)
  window.$viewer && window.$viewer.off(DC.MouseEventType.RIGHT_CLICK, viewerRightClick)
  EventBus.off('restHandleCheckChange', restHandleCheckChange)
  EventBus.off('restHandleDelChange', restHandleDelChange)