jihongshun
2025-09-10 b963a6899bb6c8eee695bc7c5ba1a865c7028cb3
fix++
已修改5个文件
150 ■■■■ 文件已修改
package.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/components/cesium-map.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/flightRouteSimulation/index.vue 111 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/shootPoint/components/shootPointDialog.vue 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json
@@ -59,7 +59,8 @@
    "vue-meta": "2.4.0",
    "vue-router": "3.4.9",
    "vuedraggable": "2.24.3",
    "vuex": "3.6.0"
    "vuex": "3.6.0",
    "xml2js": "^0.6.2"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "4.4.6",
src/utils/components/cesium-map.vue
@@ -155,6 +155,7 @@
      viewer.scene.globe.depthTestAgainstTerrain = true;
      viewer.scene.globe.showGroundAtmosphere = true;
      viewer.scene._hdr = false;
      // 去掉entity的点击事件
      viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(
        Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK
src/views/system/flightRouteSimulation/index.vue
@@ -35,6 +35,11 @@
      //     roll:0,
      //     speed: 10           // 速度(公里/小时)
      //   },
      //   {
      //     time: '2025-04-01T13:01:00Z', // ISO 8601格式时间
      //     position: {
@@ -116,6 +121,30 @@
      try {
        const arrayBuffer = await this.readFileAsArrayBuffer(file);
        this.waypoints = await this.parseKMZ(arrayBuffer);
        const dealArr = [];
        console.log(">> this.waypoints:", this.waypoints);
        for (let i = 0; i < this.waypoints.length - 1; i++) {
            dealArr.push(this.waypoints[i]); // Push the current element
            const current = this.waypoints[i];
            const next = this.waypoints[i + 1];
            // Create a new element with the current lng, lat and next heading, pitch, roll
            dealArr.push({
                "lng": current.lng,
                "lat": current.lat,
                "alt": current.alt,
                'flyHeading':next.flyHeading,
                "heading": next.heading,
                "pitch": next.pitch,
                "roll": next.roll
            });
        }
        // Push the last element without any change
        dealArr.push(this.waypoints[this.waypoints.length - 1]);
        console.log(dealArr)
        // this.waypoints = dealArr
        console.log(">> this.waypoints:", this.waypoints);
        this.fileInfo = `
@@ -127,7 +156,8 @@
        const startDate = new Date("2025-04-01T13:00:00Z");
        const speeds = [10, 10, 20, 30, 80, 100, 60, 50, 40, 30, 20, 10]; // 自定义速度
        const result = this.waypoints.map((item, index) => {
        // const result = this.waypoints.map((item, index) => {
        const result = dealArr.map((item, index) => {
          // 每次加一天
          const time = new Date(startDate.getTime() + index * 60 * 1000).toISOString();
          return {
@@ -140,7 +170,8 @@
            heading:item.heading|| 0,
            pitch:item.pitch|| 0,
            roll:item.roll || 0,
            speed: speeds[index] || 0
            speed: speeds[index] || 0,
            flyHeading:item.flyHeading
          };
        });
        this.trajectoryData = result
@@ -189,35 +220,64 @@
        // 提取 action 里的参数
        let heading = null;
        let gimbalPitch = null, gimbalRoll = null, gimbalYaw = null;
        // 初始化 Pitch, Roll 和 Heading
        let totalPitch = 0;
        let totalRoll = 0;
        let totalHeading = 0;
        let flyHeadingData = 0;
        if (placemark["wpml:actionGroup"]?.[0]?.["wpml:action"]) {
          placemark["wpml:actionGroup"][0]["wpml:action"].forEach(action => {
            let params = action["wpml:actionActuatorFuncParam"]?.[0];
            // 处理 gimbalRotate 和 rotateYaw 函数
            if (action['wpml:actionActuatorFunc'].includes("gimbalRotate")) {
                // 获取每个角度值
                const gimbalPitch = parseFloat(action['wpml:actionActuatorFuncParam'][0]["wpml:gimbalPitchRotateAngle"][0]);
                const gimbalRoll = parseFloat(action['wpml:actionActuatorFuncParam'][0]["wpml:gimbalRollRotateAngle"][0]);
                const gimbalYaw = parseFloat(action['wpml:actionActuatorFuncParam'][0]["wpml:gimbalYawRotateAngle"][0]);
            if (!params) return;
            // 飞机航向角
            if (action["wpml:actionActuatorFunc"]?.[0] === "rotateYaw" &&
                params["wpml:aircraftHeading"]) {
              heading = Number(params["wpml:aircraftHeading"][0]);
                // 累加 Pitch, Roll 和 Heading
                totalPitch += gimbalPitch;
                totalRoll += gimbalRoll;
                totalHeading += gimbalYaw;
            }
            // 云台角度
            if (action["wpml:actionActuatorFunc"]?.[0] === "gimbalRotate") {
              if (params["wpml:gimbalPitchRotateAngle"])
                gimbalPitch = Number(params["wpml:gimbalPitchRotateAngle"][0]);
              if (params["wpml:gimbalRollRotateAngle"])
                gimbalRoll = Number(params["wpml:gimbalRollRotateAngle"][0]);
              if (params["wpml:gimbalYawRotateAngle"])
                gimbalYaw = Number(params["wpml:gimbalYawRotateAngle"][0]);
            // 处理 rotateYaw 函数
            if (action['wpml:actionActuatorFunc'].includes("rotateYaw")) {
                // 获取 aircraftHeading
                const aircraftHeading = parseFloat(action['wpml:actionActuatorFuncParam'][0]["wpml:aircraftHeading"][0]);
                flyHeadingData = aircraftHeading
                // 将 aircraftHeading 累加到 totalHeading
                totalHeading += aircraftHeading;
            }
            // action['wpml:actionActuatorFuncParam'][0].['wpml:gimbalPitchRotateAngle']
            // let params = action["wpml:actionActuatorFuncParam"]?.[0];
            // if (!params) return;
            // // 飞机航向角
            // if (action["wpml:actionActuatorFunc"]?.[0] === "rotateYaw" &&
            //     params["wpml:aircraftHeading"]) {
            //   heading = Number(params["wpml:aircraftHeading"][0]);
            // }
            // // 云台角度
            // if (action["wpml:actionActuatorFunc"]?.[0] === "gimbalRotate") {
            //   if (params["wpml:gimbalPitchRotateAngle"])
            //     gimbalPitch = Number(params["wpml:gimbalPitchRotateAngle"][0]);
            //   if (params["wpml:gimbalRollRotateAngle"])
            //     gimbalRoll = Number(params["wpml:gimbalRollRotateAngle"][0]);
            //   if (params["wpml:gimbalYawRotateAngle"])
            //     gimbalYaw = Number(params["wpml:gimbalYawRotateAngle"][0]);
            // }
          });
        }
        // 输出结果
      console.log("Total Pitch:", totalPitch);
      console.log("Total Roll:", totalRoll);
      console.log("Total Heading:", totalHeading);
        if (coords) {
          coords.trim().split(" ").forEach(coord => {
            const [lng, lat] = coord.split(",").map(Number);
            //,heading:gimbalYaw || 0,pitch:gimbalPitch|| 0,roll:gimbalRoll|| 0
            points.push({ lng, lat, alt: height,heading:gimbalYaw || 0,pitch:gimbalPitch|| 0,roll:gimbalRoll|| 0 });
            points.push({ lng, lat, alt: height,heading:totalHeading  || 0,pitch:totalPitch || 0,roll:totalRoll|| 0 ,flyHeading:flyHeadingData});
          });
        }
      });
@@ -372,10 +432,15 @@
        this.positionProperty.addSample(time, position)
        speedProperty.addSample(time, data.speed)
            // 计算朝向四元数
        // const hpr = new Cesium.HeadingPitchRoll(
        //     Cesium.Math.toRadians(data.heading),
        //     Cesium.Math.toRadians(data.pitch),
        //     Cesium.Math.toRadians(data.roll)
        // );
        const hpr = new Cesium.HeadingPitchRoll(
            Cesium.Math.toRadians(data.heading),
            Cesium.Math.toRadians(data.pitch),
            Cesium.Math.toRadians(data.roll)
            Cesium.Math.toRadians(data.flyHeading),
            Cesium.Math.toRadians(0),
            Cesium.Math.toRadians(0)
        );
        const quaternion = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);
        
src/views/system/shootPoint/components/shootPointDialog.vue
@@ -738,7 +738,6 @@
          });
      })
      console.log(this.treeData)
      this.dialogVisible = false
      // const dealArr = this.submitDealData()
      const transformed = this.treeData.map((ground, index) => {
        const pointNumber = index + 1;
@@ -753,11 +752,32 @@
              longitude: ground.longitude,
              pointNumber: 1,
              targetName: ground.label,
              actions:child.actions.map((item, index) => ({
                actionIndex: index.toString(),
                actionType: typeDictionary[item.type] || "", // 如果类型不存在字典中,默认空字符串
                actionValue: item.extra.value
              }))
              // actions:child.actions.map((item, index) => ({
              //   actionIndex: index.toString(),
              //   actionType: typeDictionary[item.type] || "", // 如果类型不存在字典中,默认空字符串
              //   actionValue: item.extra.value
              // }))
              actions:child.actions.map(action => {
                console.log(action)
                switch (action.type) {
                  case "悬停":
                    return { hoverTime: parseFloat(action.extra.value) };
                  case "变倍":
                    return { zoom: parseFloat(action.extra.value) };
                  case "开始录像":
                    return { startRecord: true };
                  case "结束录像":
                    return { stopRecord: true };
                  case "拍照":
                    // const [takePhotoType, useGlobalImageFormat] = action.actionValue.split('-');
                    return {
                      takePhotoType: 0,
                      useGlobalImageFormat: 0
                    };
                  default:
                    return {};
                }
              })
            }
          ],
          latitude: child.latitude,
@@ -779,6 +799,7 @@
          message: '新增模板成功',
          type: 'success'
        })
        this.dialogVisible = false
        this.$emit('on-submit')
        this.$emit('close')
      }
vue.config.js
@@ -9,8 +9,8 @@
const name = process.env.VUE_APP_TITLE || '电力巡检航线规划'; // 网页标题
// const baseUrl = 'http://192.168.1.5:7070'; // 后端接口
const baseUrl = 'http://192.168.1.25:7070'; // 后端接口
// const baseUrl = 'http://192.168.1.13:8080'; // 后端接口
const port = process.env.port || process.env.npm_config_port || 80; // 端口