|  |  |  | @ -9,7 +9,7 @@ import {RulerAlt} from '@vicons/carbon' | 
		
	
		
			
				|  |  |  |  | import {TerrainSharp} from '@vicons/material' | 
		
	
		
			
				|  |  |  |  | import {DrawPolygon} from '@vicons/fa' | 
		
	
		
			
				|  |  |  |  | import {useMessage} from 'naive-ui' | 
		
	
		
			
				|  |  |  |  | import {nextTick, ref} from "vue"; | 
		
	
		
			
				|  |  |  |  | import {ref} from "vue"; | 
		
	
		
			
				|  |  |  |  | import {useStaticStore} from "@/store/staticOptions.js"; | 
		
	
		
			
				|  |  |  |  | import {dataProcess_fromQT, dataProcess_fromQT_route} from "@/assets/js/websocketProtocol.ts"; | 
		
	
		
			
				|  |  |  |  | import SpatialAnalysis from "@/components/SpatialAnalysis.vue"; | 
		
	
	
		
			
				
					|  |  |  | @ -17,7 +17,7 @@ import LayerManager from "@/components/map/LayerManager.vue"; | 
		
	
		
			
				|  |  |  |  | import CollisionDetection from "@/components/CollisionDetection.vue"; | 
		
	
		
			
				|  |  |  |  | import {useLayerStore} from "@/store/layerManagerStore.ts"; | 
		
	
		
			
				|  |  |  |  | import {Cartesian3} from "cesium"; | 
		
	
		
			
				|  |  |  |  | import * as echarts from "echarts"; | 
		
	
		
			
				|  |  |  |  | import {getDistance, getElevation} from "@/utils/map/geocomputation.ts"; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | const message = useMessage(); | 
		
	
		
			
				|  |  |  |  | let SceneValue; | 
		
	
	
		
			
				
					|  |  |  | @ -26,13 +26,13 @@ let showDetection = ref(false); | 
		
	
		
			
				|  |  |  |  | let hasPlane = ref(false); | 
		
	
		
			
				|  |  |  |  | let store = useStaticStore(); | 
		
	
		
			
				|  |  |  |  | let lStore = useLayerStore(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | let groundHeight = ref(-1) | 
		
	
		
			
				|  |  |  |  | const spatialAnalyse = ref(null) | 
		
	
		
			
				|  |  |  |  | const layerManager = ref(null) | 
		
	
		
			
				|  |  |  |  | const collisionDetection = ref(null) | 
		
	
		
			
				|  |  |  |  | SceneValue = ref('untrace'); | 
		
	
		
			
				|  |  |  |  | let frameCount = 0 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | let lastPos = undefined;  //飞机上一时点的坐标 | 
		
	
		
			
				|  |  |  |  | function handleSceneSelect(key){ | 
		
	
		
			
				|  |  |  |  |   if(!hasPlane.value)   return; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -168,43 +168,54 @@ async function connectWebSocket() { | 
		
	
		
			
				|  |  |  |  |         window.measureViewer.updateDynamicData(ycData) | 
		
	
		
			
				|  |  |  |  |         // 添加飞机三维图标 | 
		
	
		
			
				|  |  |  |  |         if(!hasPlane.value){ | 
		
	
		
			
				|  |  |  |  |           window.measureViewer.addAirplaneEntity(store.models.defaultAirPlane, ycData.uavId + ycData.uavType) | 
		
	
		
			
				|  |  |  |  |           window.measureViewer.addAirplaneEntity(store.models.fp98, ycData.uavId + ycData.uavType) | 
		
	
		
			
				|  |  |  |  |           SceneValue.value = 'fallow' | 
		
	
		
			
				|  |  |  |  |           hasPlane.value = true; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |         /************************测试代码(以下)******************/ | 
		
	
		
			
				|  |  |  |  |         // if(frameCount>50) {   //(50帧更新一次) | 
		
	
		
			
				|  |  |  |  |         //   frameCount = 0 | 
		
	
		
			
				|  |  |  |  |         //   //TODO: 调用子组件函数、测试 | 
		
	
		
			
				|  |  |  |  |         //   let cartesianTarget = Cartesian3.fromDegrees(114.6, 37.8) | 
		
	
		
			
				|  |  |  |  |         //   let cartesianCurr = Cartesian3.fromDegrees(ycData.lon, ycData.lat, ycData.alt) | 
		
	
		
			
				|  |  |  |  |         //   collisionDetection.value?.drawDetection(ycData.alt, cartesianCurr, cartesianTarget) | 
		
	
		
			
				|  |  |  |  |         // } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         /************************测试代码(以上)******************/ | 
		
	
		
			
				|  |  |  |  |         // 加载和更新碰撞检测图(20帧更新一次) | 
		
	
		
			
				|  |  |  |  |         if(lStore.navi.airlines.length>0 && frameCount>50){ | 
		
	
		
			
				|  |  |  |  |         console.log(frameCount) | 
		
	
		
			
				|  |  |  |  |         // 加载和更新碰撞检测图(50帧更新一次) | 
		
	
		
			
				|  |  |  |  |         if(frameCount>50){ | 
		
	
		
			
				|  |  |  |  |           showDetection.value = true | 
		
	
		
			
				|  |  |  |  |           frameCount = 0 | 
		
	
		
			
				|  |  |  |  |           lStore.navi.airlines.forEach(airline => { | 
		
	
		
			
				|  |  |  |  |             if(airline.code === lStore.navi.currentRouteID){ | 
		
	
		
			
				|  |  |  |  |               let targetPos = airline.points[lStore.navi.nextPoint] | 
		
	
		
			
				|  |  |  |  |               //TODO: 调用子组件函数、测试 | 
		
	
		
			
				|  |  |  |  |               let cartesianTarget = Cartesian3.fromDegrees(targetPos.lon, targetPos.lat,targetPos.alt) | 
		
	
		
			
				|  |  |  |  |               let cartesianCurr = Cartesian3.fromDegrees(ycData.lon, ycData.lat,ycData.alt) | 
		
	
		
			
				|  |  |  |  |               collisionDetection.value?.drawDetection(ycData.alt, cartesianCurr, cartesianTarget) | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |           let currentPos = Cartesian3.fromDegrees(ycData.lon, ycData.lat,ycData.alt) | 
		
	
		
			
				|  |  |  |  |           new Promise(resolve => { | 
		
	
		
			
				|  |  |  |  |             // 计算对地高度 m | 
		
	
		
			
				|  |  |  |  |             groundHeight.value = ycData.alt - getElevation(window.viewer, currentPos) | 
		
	
		
			
				|  |  |  |  |             // 计算当前点与上一点的距离 米 | 
		
	
		
			
				|  |  |  |  |             if(lastPos===undefined){ | 
		
	
		
			
				|  |  |  |  |               lastPos = currentPos; | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             let dis = getDistance(currentPos, lastPos) * 1000 | 
		
	
		
			
				|  |  |  |  |             lastPos = currentPos | 
		
	
		
			
				|  |  |  |  |             resolve(dis) | 
		
	
		
			
				|  |  |  |  |           }).then(res=>{ | 
		
	
		
			
				|  |  |  |  |             collisionDetection.value.drawDetection2(ycData.alt, res, ycData.alt-groundHeight.value) | 
		
	
		
			
				|  |  |  |  |           }) | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     if(sktData.type === 1){ | 
		
	
		
			
				|  |  |  |  |       let routeData = dataProcess_fromQT_route(sktData) | 
		
	
		
			
				|  |  |  |  |       lStore.navi.airlines.push(routeData) | 
		
	
		
			
				|  |  |  |  |       console.log(routeData) | 
		
	
		
			
				|  |  |  |  |       if(routeData != null){ | 
		
	
		
			
				|  |  |  |  |         lStore.navi.airlines.push(routeData) | 
		
	
		
			
				|  |  |  |  |         lStore.navi.currentRouteID = routeData.code | 
		
	
		
			
				|  |  |  |  |         console.log(routeData) | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         window.measureViewer.showAirLine(routeData) | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         //计算航线的地形剖面,并存储到store中 | 
		
	
		
			
				|  |  |  |  |         // FIXME: 当前逻辑有待更新 | 
		
	
		
			
				|  |  |  |  |         /* | 
		
	
		
			
				|  |  |  |  |         profileAnalyse_promise(window.viewer, routeData,100).then((result) => { | 
		
	
		
			
				|  |  |  |  |           let routeTerr = {} | 
		
	
		
			
				|  |  |  |  |           routeTerr.routeID = routeData.code | 
		
	
		
			
				|  |  |  |  |           routeTerr.distanceArray = result.distanceArray | 
		
	
		
			
				|  |  |  |  |           routeTerr.elevationArray = result.elevationArray | 
		
	
		
			
				|  |  |  |  |           lStore.routesTerrain.push(routeTerr) | 
		
	
		
			
				|  |  |  |  |         }) | 
		
	
		
			
				|  |  |  |  |         */ | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
	
		
			
				
					|  |  |  | @ -304,7 +315,7 @@ function manageLayer(){ | 
		
	
		
			
				|  |  |  |  |     </n-row> | 
		
	
		
			
				|  |  |  |  |   </n-space> | 
		
	
		
			
				|  |  |  |  |   <n-space id="detectionGraph" v-show="showDetection"> | 
		
	
		
			
				|  |  |  |  |     <CollisionDetection ref="collisionDetection"></CollisionDetection> | 
		
	
		
			
				|  |  |  |  |     <CollisionDetection ref="collisionDetection" :groundHeight="groundHeight"></CollisionDetection> | 
		
	
		
			
				|  |  |  |  |   </n-space> | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   <n-modal v-model:show="showModal" | 
		
	
	
		
			
				
					|  |  |  | @ -356,6 +367,6 @@ function manageLayer(){ | 
		
	
		
			
				|  |  |  |  |   width: 100rem; | 
		
	
		
			
				|  |  |  |  |   height: 15rem; | 
		
	
		
			
				|  |  |  |  |   border-radius: 7px; | 
		
	
		
			
				|  |  |  |  |   background: rgba(21, 21, 21, 0.94); | 
		
	
		
			
				|  |  |  |  |   background: rgba(255, 255, 255, 0.94); | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | </style> | 
		
	
	
		
			
				
					|  |  |  | 
 |