yxl
2025-01-14 266bf7454bcd0e3d814c974c6b0b05349fe549db
src/assets/js/mapSetFunc.js
@@ -13,6 +13,9 @@
      case "aroundPoi":
        this.creatAroundPoi(res);
        break;
      case "getStrike":
        this.creatAroundPoi(res);
        break;
      case "queryRelationship":
        this.creatQueryRelationship(res);
        break;
@@ -395,6 +398,7 @@
    });
    this.addRaderLayer(res);
  },
  //雷达遮罩扫描
  addRaderLayer(res) {
    //雷达遮罩扫描(自定义)
    const option = {
@@ -421,6 +425,12 @@
  },
  //视锥
  addTetrahedron(res) {
    const modelLayer = mapServer.listData.filter((obj) => {
      if (obj.name == config.modelLayer) {
        return obj;
      }
    });
    let ids = [];
    res.data.forEach((item,index) => {
      const tetrahedron = earthCtrl.factory.addTetrahedron({
        position: {
@@ -429,58 +439,41 @@
          height: item.height
        },
        multiple: 0.05,
        scale: new SmartEarth.Cesium.Cartesian3(100, 100, 100),
        scale: new SmartEarth.Cesium.Cartesian3(30, 30, 30),
        color: "#FF0000",
        outlineColor: "#FF0000"
      });
      if (index == 0) {
        earthCtrl.camera.flyTo(item.lontitude, item.lattitude, 5000, 0, -90, 0, 2);
        const modelLayer = mapServer.listData.filter((obj) => {
          if (obj.name == config.modelLayer) {
            return obj;
          }
        // 将经纬度转换为Cartesian3坐标
        const position = Cesium.Cartesian3.fromDegrees(item.lontitude, item.lattitude - 0.01, 500);
        // 创建一个边界球 (Bounding Sphere),假设半径为500
        const boundingSphere = new Cesium.BoundingSphere(position, 1000);
        // 使用 flyToBoundingSphere 定位相机
        earthCtrl.viewer.camera.flyToBoundingSphere(boundingSphere, {
          duration: 3.0,  // 飞行的时间
          offset: new Cesium.HeadingPitchRange(0, Cesium.Math.toRadians(-30), 6.28316028073749),
        });
        // debugger
        if (modelLayer.length <= 0) return;
        // earthCtrl.userScene.flyTo(modelLayer[0].layer);
        // modelLayer[0].layer.style = new Cesium.Cesium3DTileStyle({
        //   color: {
        //     evaluateColor: (feature) => {
        //       const id = feature.getProperty("id");
        //       // if (id === 'de9b9f1f-bea5-11ef-bbd1-ac82473c08a6') {
        //       //   debugger
        //       //   // const boundingVolume = feature.tileset.root.boundingVolume
        //       //   // const center = Cesium.BoundingVolume.computeBoundingVolume(boundingVolume, feature.tileset.root.transform);
        //       //   // debugger
        //       //   earthCtrl.viewer.camera.flyTo({
        //       //     destination: center,
        //       //     duration: 2.0
        //       //   });
        //       //   // earthCtrl.userScene.flyTo(feature);
        //       //   // return new SmartEarth.Cesium.Color.fromCssColorString(
        //       //   //   '#FF0000'
        //       //   // );
        //       // }
        //       // console.log("id**********", id);
        //       // const color = res.filter((item) => {
        //       //   if (item.ids.indexOf(id) > -1) {
        //       //     return item;
        //       //   }
        //       // });
        //       // if (color.length > 0) {
        //         // return new SmartEarth.Cesium.Color.fromCssColorString(
        //         //   color[0].color
        //         // );
        //       // }
        //     }
        //   }
        // });
        // earthCtrl.camera.flyTo(item.lontitude, item.lattitude, 5000, 0, -90, 0, 2);
      }
      ids.push(item.uuid);
      this.layerList.push({
        layer: tetrahedron,
        func: 'tetrahedron'
      });
    })
    });
    modelLayer[0].layer.style = new Cesium.Cesium3DTileStyle({
      color: {
        evaluateColor: (feature) => {
          const id = feature.getProperty("id");
          if (ids.indexOf(id) > -1) {
            console.log("id**********", id);
            return new SmartEarth.Cesium.Color.fromCssColorString(
              '#FF0000'
            );
          }
        }
      }
    });
  },
  removeAll() {