智慧园区前端大屏
linwe
2024-11-25 d47bdf72ffca6d8692413c53fed83e9c22881e23
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-23 17:09:04
 * @LastEditTime: 2024-11-25 15:32:31
 * @FilePath: \bigScreen\src\pages\layout\components\scomponents\layersControl.vue
 * @Description:
 *
@@ -124,7 +124,28 @@
      {
        url: VITE_APP_BASE + 'newMx/mx/tile_05/tileset.json',
        label: 'tile_05'
      }
      },
      // {
      //   url: 'http://localhost:9003/model/ZOebpNa0/tileset.json',
      //   label: 'tile_01'
      // },
      // {
      //   url: 'http://localhost:9003/model/QKYdBZ0b/tileset.json',
      //   label: 'tile_02'
      // },
      // {
      //   url: 'http://localhost:9003/model/QrimOmf3/tileset.json',
      //   label: 'tile_03'
      // },
      // {
      //   url: 'http://localhost:9003/model/S7E9aUgj/tileset.json',
      //   label: 'tile_04'
      // },
      // {
      //   url: 'http://localhost:9003/model/WYUq33vu/tileset.json',
      //   label: 'tile_05'
      // },
    ],
    layerName: 'hgyq'
  },
@@ -781,7 +802,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 < 360; i++) {
              var radians = DC.Math.toRadians(i)
@@ -814,16 +835,16 @@
          item.method(item.params).then(res => {
            let data = res.data.data.records
            data.forEach(i => {
              let stl = '';
              let stl = ''
              try {
                let geom = JSON.parse(i.geom);
                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(';');
                  stl = geom.coordinates[0][0].map(d => d[0] + ',' + d[1]).join(';')
                } else {
                  console.error('Invalid geom structure');
                  console.error('Invalid geom structure')
                }
              } catch (error) {
                console.error('Failed to parse geom:', error);
                console.error('Failed to parse geom:', error)
              }
              let polygon = new DC.Polygon(stl)
              polygon.setStyle({
@@ -856,7 +877,7 @@
  })
}
function findObjectById(data, id) {
function findObjectById (data, id) {
  // 遍历数据数组
  for (let i = 0; i < data.length; i++) {
    const item = data[i]
@@ -931,7 +952,7 @@
// });
// 销毁
function destroy() {
function destroy () {
  let arr = Object.keys(addPupoLayers)
  arr.filter(i => i != 'hgyq').forEach(i => {
    addPupoLayers[i] && window.$viewer.removeLayer(addPupoLayers[i])