| | |
| | | // 无人机实体 |
| | | let droneEntity = null |
| | | |
| | | // 激光实体 |
| | | let laserEntity = null |
| | | export function droneFly () { |
| | | const store = useMyStore() |
| | | let deviceInfo = {} // 无人机信息 |
| | |
| | | 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 = { |
| | |
| | | } else { |
| | | initCreateFrustum(deviceInfo, viewDroneInfo) |
| | | } |
| | | // console.log('2222', viewDroneInfo.longitude) |
| | | addFlyGltf( |
| | | viewDroneInfo.longitude, |
| | | viewDroneInfo.latitude, |
| | |
| | | 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, |
| | |
| | | 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, |
| | |
| | | } |
| | | } |
| | | |
| | | 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( |