yxl
2025-02-13 92f7479c89d8573d954e5bf37a464c1bbef396eb
src/assets/js/mapSetFunc.js
@@ -23,10 +23,18 @@
        this.creatQueryMeta(res);
        break;
      case "aroundPoi_2":
        this.addWfsLayer(res);
        // this.addWfsLayer(res);
        this.addTetrahedron(res);
        break;
      case "getParam":
        this.addTetrahedron(res);
        break;
      case "getTAIWAN":
        this.addWfsLayer(res);
        // this.addTetrahedron(res);
        break;
      case "attackentity":
        this.addPolyLine(res);
        break;
    }
  },
@@ -476,6 +484,41 @@
    });
  },
  //绘制线
  addPolyLine(res) {
    // 解析 LINESTRING 字符串为经纬度坐标数组
    const coordinates = res.bombpoint
      .replace("LINESTRING", "") // 去除 'LINESTRING' 部分
      .replace(/[()]/g, "") // 去除括号
      .split(",") // 按逗号分割
      .map(coord => {
        const [lon, lat] = coord.trim().split(" "); // 将每对坐标分开
        return [parseFloat(lon), parseFloat(lat)]; // 转换为数字
      });
    const positions = coordinates.map(coord => {
      return {
        x: coord[0],
        y: coord[1],
        z: 21
      };
    });
    positions.forEach((item, index) => {
      const particle = earthCtrl.factory.createParticleEffect("flame", item, {
        translation: SmartEarth.Cesium.Cartesian3.fromElements(0, 0, 0), //平移
        emissionRate: 500,
        startScale: 15,
        endScale: 45,
      });
      if (index == positions.length / 2) {
        earthCtrl.camera.flyTo(item.x, item.y, 3000, 0, -90, 0, 2);
      }
      this.layerList.push({
        layer: particle,
        func: 'attackentity'
      });
    })
  },
  removeAll() {
    store.state.setListColor = [];
    store.state.showLenged = false;
@@ -518,6 +561,11 @@
        this.layerList.splice(i, 1);
        i--;
      }
      else if (obj.func == "getTAIWAN") {
        this.layerList[i].layer.destroy();
        this.layerList.splice(i, 1);
        i--;
      }
      else if (obj.func == "radarMaskScan") {
        this.layerList[i].layer.deleteObject();
        this.layerList.splice(i, 1);
@@ -528,6 +576,11 @@
        this.layerList.splice(i, 1);
        i--;
      }
      else if (obj.func == "attackentity") {
        this.layerList[i].layer.deleteObject();
        this.layerList.splice(i, 1);
        i--;
      }
    }
    if (!window.terrain) {
      window.terrain = earthCtrl.factory.createTerrainLayer({