From c930943c38bb2f5850578f5eb1399e9f0102fca0 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Sat, 19 Apr 2025 19:03:28 +0800
Subject: [PATCH] feat:hook删除
---
/dev/null | 90 ---------------------------------------------
1 files changed, 0 insertions(+), 90 deletions(-)
diff --git a/src/hooks/useTaskViewInfo/useTaskViewInfo.js b/src/hooks/useTaskViewInfo/useTaskViewInfo.js
deleted file mode 100644
index 0b18f1f..0000000
--- a/src/hooks/useTaskViewInfo/useTaskViewInfo.js
+++ /dev/null
@@ -1,90 +0,0 @@
-import * as Cesium from 'cesium'
-import aircraftGltf from '@/assets/gltf/aircraft.gltf'
-import CreateFrustum from '@/utils/cesium/frustum/CreateFrustum'
-
-export function useTaskViewInfo (viewer, wsInfo) {
- const newViewer = isRef(viewer) ? viewer : ref(viewer)
-
- let viewInfoFrustum
- // 设置视椎
- const setCreateFrustum = (host) => {
- if (!host) return
- viewInfoFrustum?.clear()
-
- const attitude_head = 180 + host.attitude_head
- const gimbal_pitch = 90 - Number(host?.payloads[0]?.gimbal_pitch) || 0
-
- viewInfoFrustum = new CreateFrustum(newViewer.value, {
- position: {
- longitude: host.longitude,
- latitude: host.latitude,
- altitude: host.height,
- },
- width: 30,
- height: 30,
- fov: 20.0,
- near: 3.0,
- far: 250.0,
- roll: gimbal_pitch,
- pitch: 0,
- heading: attitude_head,
- })
- }
-
- function setAircraftGltf () {
- const host = deviceOsdInfo.value?.data?.host
- const aircraftEntity = newViewer.value?.entities.getById('aircraftGltf')
- const position = Cesium.Cartesian3.fromDegrees(host.longitude, host.latitude, host.height)
- if (aircraftEntity) {
- aircraftEntity.position = new Cesium.ConstantPositionProperty(position)
- return
- }
-
- newViewer.value?.entities.add({
- id: 'aircraftGltf',
- position,
- model: {
- uri: aircraftGltf, // 或 .glb
- scale: 1.0, // 缩放比例
- minimumPixelSize: 64, // 最小像素尺寸(保证模型远处可见)
- maximumScale: 128, // 最大缩放(可选)
- },
- })
- }
-
- // 视椎加载处理
- const deviceOsdInfo = computed(() => wsInfo.value?.device_osd)
-
-
- watch(
- [
- () => deviceOsdInfo.value,
- () => newViewer.value
- ],
- (
- [curDeviceOsdInfo, curViewer],
- ) => {
- const host = deviceOsdInfo.value?.data?.host
-
- if (!curViewer) return
-
- if ([14, 0].includes(host.mode_code)) {
- mapEntityRemove()
- return
- }
-
- setCreateFrustum(host)
- setAircraftGltf()
- }
- )
-
- const mapEntityRemove = () => {
- viewInfoFrustum?.clear()
-
- newViewer.value?.entities.removeById('aircraftGltf')
- }
-
- onUnmounted(() => {
- mapEntityRemove()
- })
-}
\ No newline at end of file
--
Gitblit v1.9.3