From 3b0ad5f1959b91fd1c815acbffab2a0777b52847 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Tue, 18 Feb 2025 09:06:13 +0800
Subject: [PATCH] 提交带码
---
src/views/DronePilotDetails.vue | 71 +++++++++++++++++++----------------
src/views/hooks/droneFly.ts | 8 +++
src/views/DronePilotList.vue | 2
3 files changed, 46 insertions(+), 35 deletions(-)
diff --git a/src/views/DronePilotDetails.vue b/src/views/DronePilotDetails.vue
index 61c0e6f..19788af 100644
--- a/src/views/DronePilotDetails.vue
+++ b/src/views/DronePilotDetails.vue
@@ -251,6 +251,34 @@
}
//===============================
+// 获取实时航线
+const getWrjSsLx = () => {
+ if (window.cesiumViewer== null) return
+ globalViewer = window.cesiumViewer;
+ getWaylineFile(sbInfo.sn).then((res:any) => {
+ if (res.code != 200) return
+ ssLinePath.value = res.data
+ // globalViewer = window.cesiumViewer
+ // 先有航线,再飞行
+ generateCourse()
+ })
+}
+
+// 生成航线轨迹
+const generateCourse = async () => {
+ if (!ssLinePath.value) return
+ const { fileInfoObj } = await analyzeKmzFile(`${ssLinePath.value}?_t=${new Date().getTime()}`)
+ const xmlStr = await fileInfoObj['wpmz/template.kml']
+ const xmlJson = XMLToJSON(xmlStr)?.['Document']
+ const placemark = xmlJson.Folder.Placemark
+ if (placemark?.Polygon) {
+ // return 'planar'
+ planarWayline(ssLinePath.value, sbInfo.longitude, sbInfo.latitude)
+ } else {
+ // return 'point'
+ pointWayline(ssLinePath.value, sbInfo.longitude, sbInfo.latitude)
+ }
+}
// 监听ws
const messageHandler = async (payload: any) => {
@@ -269,6 +297,13 @@
}
case EBizCode.DockOsd: { // 机场
store.commit('SET_DOCK_INFO', payload.data)
+ break
+ }
+ case EBizCode.FlightTaskProgress: { // 获取进度
+ // 如果点击列表进入没有获取到航线文件,那么这里重新请求一次
+ if (ssLinePath.value == '') {
+ getWrjSsLx()
+ }
break
}
}
@@ -398,19 +433,6 @@
}
};
-// 获取实时航线
-const getWrjSsLx = () => {
- if (window.cesiumViewer== null) return
- globalViewer = window.cesiumViewer;
- getWaylineFile(sbInfo.sn).then((res:any) => {
- if (res.code != 200) return
- ssLinePath.value = res.data
- // globalViewer = window.cesiumViewer
- // 先有航线,再飞行
- generateCourse()
- })
-}
-
// 切换航线轨迹
const courseTrack = (data:any) => {
if (window.cesiumViewer== null) return
@@ -482,25 +504,6 @@
}, {deep: true})
-
-// 生成航线轨迹
-const generateCourse = async () => {
- // ssLinePath.value = 'https://wrj.shuixiongit.com/minio/cloud-bucket/wayline/20250211/wayline_1739254562374.kmz'
- if (!ssLinePath.value) return
- const { fileInfoObj } = await analyzeKmzFile(`${ssLinePath.value}?_t=${new Date().getTime()}`)
- const xmlStr = await fileInfoObj['wpmz/template.kml']
- const xmlJson = XMLToJSON(xmlStr)?.['Document']
- const placemark = xmlJson.Folder.Placemark
- console.log('看看航线值', sbInfo)
- if (placemark?.Polygon) {
- // return 'planar'
- planarWayline(ssLinePath.value, sbInfo.longitude, sbInfo.latitude)
- } else {
- // return 'point'
- pointWayline(ssLinePath.value, sbInfo.longitude, sbInfo.latitude)
- }
-}
-
let intervalId = null;
onMounted(async () => {
@@ -516,7 +519,9 @@
if (domain !== '0') {
await getPhoneLocation(false,workspaceId.value)
// // // 设置定时器,每隔 5 秒刷新一次数据
- intervalId = setInterval(getPhoneLocation, 5000);
+ intervalId = setInterval(()=> {
+ getPhoneLocation(false,workspaceId.value)
+ }, 5000);
}
});
diff --git a/src/views/DronePilotList.vue b/src/views/DronePilotList.vue
index f111234..f677d5a 100644
--- a/src/views/DronePilotList.vue
+++ b/src/views/DronePilotList.vue
@@ -21,7 +21,7 @@
</template>
</div>
<div class="drone-pilot-btns">
- <div class="drone-pilot" @click="dronePilotClick(false, 'drone')" :class="{ active:!droneOrPilot }">机场11</div>
+ <div class="drone-pilot" @click="dronePilotClick(false, 'drone')" :class="{ active:!droneOrPilot }">机场</div>
<div class="drone-pilot" @click="dronePilotClick(true, 'pilot')" :class="{ active:droneOrPilot }">遥控器</div>
</div>
</div>
diff --git a/src/views/hooks/droneFly.ts b/src/views/hooks/droneFly.ts
index e862907..c49b3da 100644
--- a/src/views/hooks/droneFly.ts
+++ b/src/views/hooks/droneFly.ts
@@ -566,6 +566,12 @@
// 获取手机定位和激光发射定位的高度和距离
function getTwoHeightWidth(workspaceId:String) {
+ // 国内地图不会为0或者小于0
+ console.log('自身定位经纬度1', me_latitude)
+ console.log('自身定位经纬度2', me_longitude)
+ console.log('激光扫过定位1', measure_target_latitude)
+ console.log('激光扫过定位2', measure_target_longitude)
+ if (me_latitude <= 0 || me_longitude <= 0 || measure_target_latitude <= 0 || measure_target_longitude <= 0) return
getTwoPointInfo(workspaceId,me_latitude,me_longitude,measure_target_latitude,measure_target_longitude).then((res:any) => {
const heightDifference = res.data.heightDifference
const distance = res.data.distance
@@ -641,7 +647,7 @@
});
}
// 查看两条线直接距离和高度
- // getTwoHeightWidth(workspaceId)
+ getTwoHeightWidth(workspaceId)
}, (error) => {
console.error('定位有误:', error);
});
--
Gitblit v1.9.3