jihongshun
2 天以前 0dc7fbac552884839ee89807e0140d6bf6d1f005
fix创建多个设备 第n个转的时候
已修改1个文件
56 ■■■■ 文件已修改
src/views/system/project/components/addPorjectDialog.vue 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/project/components/addPorjectDialog.vue
@@ -347,33 +347,37 @@
    },
    rotateAllPoints(dataList,towerLongitude,towerLatitude,towerhHight) {
      return dataList.map(item => {
        const towerPoint = Cesium.Cartesian3.fromDegrees(towerLongitude, towerLatitude, towerhHight);
        const newGround = {
          ...item,
        };
        console.log(newGround)
        // 处理子空中点
        newGround.children = item.children.map(child => {
          const airPoint = Cesium.Cartesian3.fromDegrees(child.longitude, child.latitude, child.height);
          const rotatedAirPoint = this.rotateAroundPoint( airPoint,towerPoint, rotationAngle);
          const rotatedAirCarto = Cesium.Cartographic.fromCartesian(rotatedAirPoint);
          child.longitude = Cesium.Math.toDegrees(rotatedAirCarto.longitude)
          child.latitude = Cesium.Math.toDegrees(rotatedAirCarto.latitude)
          child.height = rotatedAirCarto.height
          child.children = child.children.map(sonChild => {
            const groundPoint = Cesium.Cartesian3.fromDegrees(sonChild.longitude, sonChild.latitude, sonChild.height);
            const newGroundPoint = this.rotateAroundPoint( groundPoint,towerPoint, rotationAngle);
            const newGroundCarto = Cesium.Cartographic.fromCartesian(newGroundPoint);
            return {
              ...sonChild,
              longitude: Cesium.Math.toDegrees(newGroundCarto.longitude),
              latitude: Cesium.Math.toDegrees(newGroundCarto.latitude),
              height: newGroundCarto.height
            };
        if(!item.isDeal) {
          const towerPoint = Cesium.Cartesian3.fromDegrees(towerLongitude, towerLatitude, towerhHight);
          const newGround = {
            ...item,
          };
          if(item.id == this.deviceId ){
            item.isDeal = true
          }
          // 处理子空中点
          newGround.children = item.children?.map(child => {
            const airPoint = Cesium.Cartesian3.fromDegrees(child.longitude, child.latitude, child.height);
            const rotatedAirPoint = this.rotateAroundPoint( airPoint,towerPoint, rotationAngle);
            const rotatedAirCarto = Cesium.Cartographic.fromCartesian(rotatedAirPoint);
            child.longitude = Cesium.Math.toDegrees(rotatedAirCarto.longitude)
            child.latitude = Cesium.Math.toDegrees(rotatedAirCarto.latitude)
            child.height = rotatedAirCarto.height
            child.children = child.children?.map(sonChild => {
              const groundPoint = Cesium.Cartesian3.fromDegrees(sonChild.longitude, sonChild.latitude, sonChild.height);
              const newGroundPoint = this.rotateAroundPoint( groundPoint,towerPoint, rotationAngle);
              const newGroundCarto = Cesium.Cartographic.fromCartesian(newGroundPoint);
              return {
                ...sonChild,
                longitude: Cesium.Math.toDegrees(newGroundCarto.longitude),
                latitude: Cesium.Math.toDegrees(newGroundCarto.latitude),
                height: newGroundCarto.height
              };
            });
          });
        });
        return newGround;
          return newGround;
        }
      });
    },
    // 计算点A绕点B逆时针旋转指定角度后的新位置