智慧园区前端大屏
shuishen
2024-12-09 650c3e0c40a9422f4d4ef1255d7813272a40d167
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-06 16:13:43
 * @LastEditTime: 2024-12-09 11:52:35
 * @FilePath: \bigScreen\src\pages\map\components\scomponents\layersControl.vue
 * @Description:
 *
@@ -54,6 +54,9 @@
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
@@ -900,8 +903,26 @@
            if (i.properties.RefName.indexOf('拟建') != -1) {
              polylineVolume.setStyle({
                material: DC.Color.fromBytes(234, 93, 240, 230)
                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
@@ -953,6 +974,10 @@
          window.$viewer && window.$viewer.removeLayer(addTileLayers[item.layerName])
          addTileLayers[item.layerName] = null
          delete addTileLayers[item.layerName]
          if (item.layerName == 'ysgw' && planToBuild) {
            planToBuild.clear()
          }
        }
      }
    }
@@ -1107,6 +1132,13 @@
    window.$viewer && window.$viewer.removeLayer(tileLayers)
    tileLayers = null
  }
  if (planToBuild) {
    planToBuild.remove()
    window.$viewer && window.$viewer.removeLayer(planToBuild)
    planToBuild = null
  }
  // 弹窗销毁
  destroyPop()
  addPopLayers = null