|
|
|
@ -9,22 +9,29 @@ import {RulerAlt} from '@vicons/carbon'
|
|
|
|
|
import {TerrainSharp} from '@vicons/material'
|
|
|
|
|
import {DrawPolygon} from '@vicons/fa'
|
|
|
|
|
import {useMessage} from 'naive-ui'
|
|
|
|
|
import {ref} from "vue";
|
|
|
|
|
import {nextTick, ref} from "vue";
|
|
|
|
|
import {useStaticStore} from "@/store/staticOptions.js";
|
|
|
|
|
import {requestAirline} from "@/assets/js/request.js";
|
|
|
|
|
import {dataProcess_fromQT, getAirline} from "@/assets/js/websocketProtocol.ts";
|
|
|
|
|
import {dataProcess_fromQT, dataProcess_fromQT_route} from "@/assets/js/websocketProtocol.ts";
|
|
|
|
|
import SpatialAnalysis from "@/components/SpatialAnalysis.vue";
|
|
|
|
|
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";
|
|
|
|
|
|
|
|
|
|
const message = useMessage();
|
|
|
|
|
let SceneValue;
|
|
|
|
|
let showModal = ref(false);
|
|
|
|
|
let showDetection = ref(false);
|
|
|
|
|
let hasPlane = ref(false);
|
|
|
|
|
let store = useStaticStore();
|
|
|
|
|
let lStore = useLayerStore();
|
|
|
|
|
|
|
|
|
|
const spatialAnalyse = ref(null)
|
|
|
|
|
const layerManager = ref(null)
|
|
|
|
|
const collisionDetection = ref(null)
|
|
|
|
|
SceneValue = ref('untrace');
|
|
|
|
|
let frameCount = 0
|
|
|
|
|
|
|
|
|
|
function handleSceneSelect(key){
|
|
|
|
|
if(!hasPlane.value) return;
|
|
|
|
@ -32,7 +39,7 @@ function handleSceneSelect(key){
|
|
|
|
|
if(key === 'untrace') {
|
|
|
|
|
window.measureViewer.setNoTrack()
|
|
|
|
|
}else if(key === 'fallow') {
|
|
|
|
|
window.viewer.trackedEntity = window.viewer.entities.getById('websocket-flying-plane');
|
|
|
|
|
window.viewer.trackedEntity = window.viewer.entities.getById(store.uav.ModelIDinMap);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let layerValue = ref('layer1');
|
|
|
|
@ -40,7 +47,7 @@ let barIsOpen = ref(true);
|
|
|
|
|
|
|
|
|
|
function handleEditSelect(key) {
|
|
|
|
|
if(key === 'requestLine') {
|
|
|
|
|
getUavAirline()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
// 航线管理页面
|
|
|
|
@ -151,16 +158,53 @@ async function connectWebSocket() {
|
|
|
|
|
|
|
|
|
|
store.webskt.ws.onmessage = (event) => {
|
|
|
|
|
//收到消息后的处理流程....
|
|
|
|
|
let data = dataProcess_fromQT(JSON.parse(event.data))
|
|
|
|
|
console.log(data);
|
|
|
|
|
let sktData = JSON.parse(event.data)
|
|
|
|
|
// console.log(sktData);
|
|
|
|
|
frameCount++
|
|
|
|
|
if(sktData.type === 0){
|
|
|
|
|
let ycData = dataProcess_fromQT(sktData)
|
|
|
|
|
if (ycData != null) {
|
|
|
|
|
// 更新遥测数据(飞机位置)
|
|
|
|
|
window.measureViewer.updateDynamicData(ycData)
|
|
|
|
|
// 添加飞机三维图标
|
|
|
|
|
if (!hasPlane.value && data != null) {
|
|
|
|
|
window.measureViewer.addAirplaneEntity(store.models.defaultAirPlane, data.uavId + data.uavType)
|
|
|
|
|
if(!hasPlane.value){
|
|
|
|
|
window.measureViewer.addAirplaneEntity(store.models.defaultAirPlane, ycData.uavId + ycData.uavType)
|
|
|
|
|
SceneValue.value = 'fallow'
|
|
|
|
|
hasPlane.value = true;
|
|
|
|
|
}
|
|
|
|
|
if (data != null) {
|
|
|
|
|
window.measureViewer.updateDynamicData(data)
|
|
|
|
|
/************************测试代码(以下)******************/
|
|
|
|
|
// 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){
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(sktData.type === 1){
|
|
|
|
|
let routeData = dataProcess_fromQT_route(sktData)
|
|
|
|
|
lStore.navi.airlines.push(routeData)
|
|
|
|
|
console.log(routeData)
|
|
|
|
|
if(routeData != null){
|
|
|
|
|
window.measureViewer.showAirLine(routeData)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
@ -174,20 +218,6 @@ function closeWS(){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 请求航线接口
|
|
|
|
|
*/
|
|
|
|
|
function getUavAirline() {
|
|
|
|
|
if(sessionStorage.getItem('uavId')){
|
|
|
|
|
requestAirline(sessionStorage.getItem('uavId')).then(rsp => {
|
|
|
|
|
console.log(rsp.data)
|
|
|
|
|
window.measureViewer.showAirLine(getAirline(rsp.data))
|
|
|
|
|
})
|
|
|
|
|
}else {
|
|
|
|
|
message.warning('当前未连接飞机')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function manageLayer(){
|
|
|
|
|
layerManager.value?.open_closeSidebar()
|
|
|
|
|
}
|
|
|
|
@ -273,6 +303,9 @@ function manageLayer(){
|
|
|
|
|
</n-button>
|
|
|
|
|
</n-row>
|
|
|
|
|
</n-space>
|
|
|
|
|
<n-space id="detectionGraph" v-show="showDetection">
|
|
|
|
|
<CollisionDetection ref="collisionDetection"></CollisionDetection>
|
|
|
|
|
</n-space>
|
|
|
|
|
|
|
|
|
|
<n-modal v-model:show="showModal"
|
|
|
|
|
style="width: 30%"
|
|
|
|
@ -316,4 +349,13 @@ function manageLayer(){
|
|
|
|
|
border-radius: 7px;
|
|
|
|
|
background: rgba(21, 21, 21, 0.94);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#detectionGraph{
|
|
|
|
|
position: absolute;
|
|
|
|
|
bottom: 2rem;
|
|
|
|
|
width: 100rem;
|
|
|
|
|
height: 15rem;
|
|
|
|
|
border-radius: 7px;
|
|
|
|
|
background: rgba(21, 21, 21, 0.94);
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|