智慧园区前端大屏
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: 2025-01-08 17:28:02
 * @LastEditTime: 2025-02-19 11:42:40
 * @FilePath: \bigScreen\src\pages\map\components\scomponents\layersControl.vue
 * @Description:
 *
@@ -93,7 +93,7 @@
const { VITE_APP_BASE } = import.meta.env
// , '7', 
let indexPoint = ref(['1', '5', '7'])
let indexPoint = ref(['1', '5', '7', '8'])
const treeRef = ref(null)
@@ -110,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',
@@ -118,13 +128,14 @@
    subType: '3Dtile',
    urlData: [
      {
        url: '/3Dtile/rcmx/tile_01/tileset.json',
        label: 'tile_01'
        url: '/3Dtile/rcmx_t/part1/tileset.json',
        label: 'part1'
      },
      {
        url: '/3Dtile/rcmx/tile_02/tileset.json',
        label: 'tile_02'
        url: '/3Dtile/rcmx_t/part2/tileset.json',
        label: 'part2'
      },
    ],
    layerName: 'hgyq'
  },
@@ -391,17 +402,17 @@
        layerName: 'ql'
      },
      // {
      //   parentId: '3',
      //   id: '3-9',
      //   label: '雨水管网',
      //   type: 'layer',
      //   subType: 'geojsonPipe',
      //   layerName: 'ysgw',
      //   source: ysgw,
      //   color: DC.Color.CYAN.withAlpha(0.9),
      //   height: 48,
      // },
      {
        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',
@@ -437,6 +448,7 @@
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy-yb.png',
        showPanel: false,
        layerName: 'fxyOrdinary',
        customWx: true,
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
@@ -473,10 +485,11 @@
          size: 1000
        },
        showParams: 'category',
        className: 'fxy-larger',
        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
          // 删除
@@ -513,10 +526,11 @@
          size: 1000
        },
        showParams: 'category',
        className: 'fxy-larger-b',
        className: 'fxy-larger',
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy-jd.png',
        showPanel: false,
        layerName: 'fxyLargerB',
        customWx: true,
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
@@ -557,6 +571,7 @@
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/fxy-zd.png',
        showPanel: false,
        layerName: 'fxyZdLarger',
        customWx: true,
        incident: (e) => {
          const { attrParams } = e.overlay
          // 删除
@@ -620,6 +635,15 @@
      panoramaUrl.value = attrParams.url
      panoramaShow.value = true
    }
  },
  {
    id: '8',
    label: '瑞昌影像',
    type: 'layer',
    subType: 'baseMap',
    layerName: 'baseMap',
    source: baseRcImages,
  },
  /* {
@@ -737,10 +761,9 @@
              // progressiveResolutionHeightFraction: 0.5,
              // baseScreenSpaceError: 1024
              skipLevelOfDetail: true,
              baseScreenSpaceError: 1024,
              maximumScreenSpaceError: 32, // 数值加大,能让最终成像变模糊
              maximumScreenSpaceError: 16, // 数值加大,能让最终成像变模糊
              skipScreenSpaceErrorFactor: 128,
              skipLevels: 5,
              immediatelyLoadDesiredLevelOfDetail: false,
@@ -808,6 +831,11 @@
                  return
                }
                if (mapStore.startCustomWx && item.customWx) {
                  EventBus.emit('wxEntityClick', e)
                  return
                }
                incident(e)
              })
@@ -854,13 +882,14 @@
            }
            return positions
          }
          item.source.geometries.forEach(i => {
          item.source.features.forEach(i => {
            let polylineVolume = new DC.PolylineVolume(
              i.coordinates.map(d => [d[0], d[1], item.height].join(',')).join(';'),
              i.geometry.coordinates.map(d => [d[0], d[1], item.height].join(',')).join(';'),
              computeCircle(1.6)
            )
            if ('properties' in i && i.properties?.RefName.indexOf('拟建') != -1) {
            if ('RefName' in i.properties && i.properties.RefName.indexOf('拟建') != -1) {
              polylineVolume.setStyle({
                material: DC.Color.fromBytes(255, 0, 0, 230)
              })
@@ -911,11 +940,20 @@
        } 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])
@@ -985,9 +1023,9 @@
// 飞到园区范围
const flyToyqfw = () => {
  window.$viewer.zoomToPosition(new DC.Position(
    115.6050,
    29.7420,
    6000,
    115.6080,
    29.7880,
    3000,
    0,
    -45,
    0
@@ -1081,9 +1119,9 @@
  EventBus.emit('restHandleDelChange', `4-1`)
  EventBus.emit('restHandleDelChange', `4-2`)
  EventBus.emit('restHandleDelChange', `4-3`)
  EventBus.emit('restHandleDelChange', `4-9`)
  EventBus.emit('restHandleDelChange', `8`)
  destroyPop()
}
@@ -1117,11 +1155,13 @@
onUnmounted(() => {
  let arr = Object.keys(addTileLayers)
  arr.forEach(i => {
    if (i == 'hgyq') {
    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])
    }