From 4b57dc340f08f7c517a5eb255275b91785724c53 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 10 Feb 2025 18:21:21 +0800
Subject: [PATCH] 增加app设备定位和激光扫射定位以及目标高度和测距距离
---
src/views/hooks/droneFly.ts | 75 ++++++++++++++++++++++++++++++++++---
1 files changed, 69 insertions(+), 6 deletions(-)
diff --git a/src/views/hooks/droneFly.ts b/src/views/hooks/droneFly.ts
index 98a25ed..d0391ab 100644
--- a/src/views/hooks/droneFly.ts
+++ b/src/views/hooks/droneFly.ts
@@ -10,6 +10,8 @@
// 无人机实体
let droneEntity = null
+// 激光实体
+let laserEntity = null
export function droneFly () {
const store = useMyStore()
let deviceInfo = {} // 无人机信息
@@ -35,11 +37,8 @@
deviceInfo = data.deviceInfo[`${sn}`]
// 机场信息
dockInfo = data.dockInfo[`${dockSn}`]
- // console.log('是吧',dockInfo)
- // console.log('踩踩踩', deviceInfo)
- // console.log('踩踩踩', dockInfo)
viewDroneInfo = viewDroneInfo
- // console.log('1111', deviceInfo.longitude)
+ console.log('打印我想看的',viewDroneInfo.longitude)
// 当前飞行任务创建时间
if (data.currentType === EDeviceTypeName.Aircraft && deviceInfo) {
const droneLngLat = {
@@ -55,7 +54,6 @@
} else {
initCreateFrustum(deviceInfo, viewDroneInfo)
}
- // console.log('2222', viewDroneInfo.longitude)
addFlyGltf(
viewDroneInfo.longitude,
viewDroneInfo.latitude,
@@ -66,7 +64,16 @@
dockInfo,
ssLinePath
)
- // console.log('3333', viewDroneInfo.longitude)
+ addFlyLaser(
+ viewDroneInfo.longitude,
+ viewDroneInfo.latitude,
+ deviceInfo.height,
+ deviceInfo.payloads[0],
+ deviceInfo.attitude_head,
+ deviceInfo,
+ dockInfo,
+ ssLinePath
+ )
setelCamera(
viewDroneInfo.longitude,
viewDroneInfo.latitude,
@@ -90,6 +97,16 @@
initCreateFrustum(deviceInfo, viewDroneInfo)
console.log('4444', viewDroneInfo.longitude)
addFlyGltf(
+ viewDroneInfo.longitude,
+ viewDroneInfo.latitude,
+ deviceInfo.height,
+ deviceInfo.payloads[0],
+ deviceInfo.attitude_head,
+ deviceInfo,
+ dockInfo,
+ ssLinePath
+ )
+ addFlyLaser(
viewDroneInfo.longitude,
viewDroneInfo.latitude,
deviceInfo.height,
@@ -169,6 +186,52 @@
}
}
+ const imgLaser = new URL('@/assets/images/laser.png', import.meta.url).href
+ // 增加激光扫射点
+ function addFlyLaser(lng:any, lat:any, alt:any, payloads:any, attitude_head:any, deviceInfo:any, dockInfo:any, ssLinePath:any) {
+ console.log('哒哒哒', payloads)
+ const position = globalCesium.Cartesian3.fromDegrees(
+ payloads.measure_target_longitude, payloads.measure_target_latitude, payloads.measure_target_altitude
+ )
+ if (laserEntity && laserEntity != null) {
+ laserEntity.position = new globalCesium.CallbackProperty(function () {
+ return position
+ }, false)
+ laserEntity.orientation = new globalCesium.CallbackProperty(function () {
+ return orientation
+ }, false)
+
+ laserEntity.show = true
+
+ window.cesiumViewer.scene.requestRender()
+ } else {
+ laserEntity = window.cesiumViewer.entities.add({
+ position,
+ id: 'laser_coordinate',
+ billboard: {
+ image: imgLaser,
+ outlineWidth: 0,
+ width: 36,
+ height: 36,
+ scale: 1.0,
+ }
+ })
+ }
+ // 增加激光扫射信息
+ laserEntity.label = new globalCesium.LabelGraphics({
+ text: `目标海拔:${Math.ceil(payloads.measure_target_altitude)}m\n测距距离:${Math.round(
+ Math.ceil(payloads.measure_target_distance),
+ )}m`,
+ font: '13px monospace',
+ showBackground: true,
+ horizontalOrigin: globalCesium.HorizontalOrigin.CENTER,
+ verticalOrigin: globalCesium.VerticalOrigin.BOTTOM,
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
+ pixelOffset: new globalCesium.Cartesian2(0, -40),
+ show: true,
+ })
+ }
+
function addFlyGltf (lng:any, lat:any, alt:any, payloads:any, attitude_head:any, deviceInfo:any, dockInfo:any, ssLinePath:any) {
const { gimbal_pitch, gimbal_yaw } = payloads
const position = globalCesium.Cartesian3.fromDegrees(
--
Gitblit v1.9.3