获取机场位置,地图上展示

main
刘妍 2 months ago
parent ecaf734628
commit e125e0079c

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@ -55,3 +55,6 @@ export const eventsTopicSubscribe = () => {
// 发送消息
clientSubscribe('thing/product/8UUXN5400A079H/events');
};
export const drcUpTopic = () => {
clientSubscribe('thing/product/8UUXN5400A079H/drc/up');
};

@ -1,7 +1,7 @@
<template>
<div>
<div style="width: 100%; height: 100vh">
<Map :airRoute="airRoute" @flyToThere="flyToThere" :airPort="airPort" />
<Map :airRoute="airRoute" @flyToThere="flyToThere" :airPort="airPort" :uavTrack="uavTrack" />
</div>
<SelectComponent @selectChange="changeSelect" />
<AirportInformation
@ -73,6 +73,7 @@
import { buildGUID } from '@/utils/uuid';
import { vDrag } from '@/utils/drag';
import { EventBus } from '@/utils/eventBus';
import { drcUpTopic } from '@/utils/debugging/remote';
const { createMessage } = useMessage();
const airRoute = ref({
@ -92,6 +93,7 @@
latitude: null,
longitude: null,
});
const uavTrack = ref({});
onMounted(() => {
destroyConnection();
createConnection();
@ -158,6 +160,7 @@
const topicUrl = 'thing/product/8UUXN5400A079H/osd';
//
clientSubscribe(topicUrl, { qos: 0 });
//
getClient().on('message', (topic, message) => {
const rs = JSON.parse(message);
@ -170,6 +173,11 @@
airPort.value.latitude = rs.data.latitude;
airPort.value.longitude = rs.data.longitude;
}
if (rs.method == 'osd_info_push') {
if (rs.data.latitude && rs.data.longitude) {
uavTrack.value = rs.data;
}
}
}
});
};

@ -77,6 +77,7 @@
services_replyTopic,
drcDownTopic,
eventsTopicSubscribe,
drcUpTopic,
} from '@/utils/debugging/remote';
import { buildGUID } from '@/utils/uuid';
import { useMessage } from '@/hooks/web/useMessage';
@ -139,6 +140,7 @@
createMessage.success('当前有用户正在操作,请稍后再试');
return;
}
emits('clickTakeOff');
changeRedisUser(true);
};
@ -245,6 +247,7 @@
};
servicesTopic(querys);
drc_eart_beat();
drcUpTopic();
};
let timer;
const drc_eart_beat = () => {
@ -335,11 +338,13 @@
}
}
if (rs.method === 'drc_status_notify' && monitorDRC.value) {
console.log('drc_status_notify', rs.data);
if (rs.data.result == 0) {
if (rs.data.drc_state == 0) {
drc_eart_beat();
}
} else {
drc_eart_beat();
createMessage.error('DRC连接失败状态码' + rs.data.result);
}
}

@ -51,7 +51,15 @@
'waylineInfo',
'workPlanFormShow',
'airPort',
'uavTrack',
]);
watch(
() => props.uavTrack,
(val) => {
setUAVPosition();
},
{ deep: true },
);
watch(
() => props.airPort,
@ -528,6 +536,7 @@
if (props.airPort) {
setAirportPosition();
}
setUAVPosition();
});
};
@ -1532,26 +1541,20 @@
const setAirportPosition = async () => {
let point = graphicLayer.getGraphicById('set-airport');
// //
let position = [props.airPort.latitude, props.airPort.longitude, 70];
let position = [props.airPort.longitude, props.airPort.latitude, 70];
//
if (point) {
point.setOptions({
id: 'set-airport',
name: '航点',
name: '机场位置',
position: position,
style: {
image: '/map/AchievementManage.png',
image: '/projecthome/airport.png',
width: 35,
height: 59,
scale: 1,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
label: {
text: '航点',
font_size: 14,
color: '#ffffff',
outline: true,
outlineColor: '#000000',
pixelOffsetY: -35,
},
},
});
} else {
@ -1559,23 +1562,70 @@
id: 'set-airport',
position: position,
style: {
image: '/map/AchievementManage.png',
image: '/projecthome/airport.png',
width: 35,
height: 59,
scale: 1,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
label: {
text: '机场位置',
font_size: 14,
color: '#ffffff',
outline: true,
outlineColor: '#000000',
pixelOffsetY: -35,
},
},
});
graphicLayer.addGraphic(startGraphic);
}
};
const uavList = ref([
// [118.29665332645175, 35.13459536363883, 81.6864700317383],
// [118.29665332645185, 35.13459536363883, 81.6894700317393],
]);
//
const setUAVPosition = () => {
const position = [props.uavTrack.longitude, props.uavTrack.latitude, props.uavTrack.height];
let flag1 = uavList.value.findIndex((item) => {
return item == position;
});
if (flag1 == -1) {
uavList.value.push(position);
}
// const fixedRoute = new mars3d.graphic.FixedRoute({
// name: '线',
// position: {
// type: 'time', //
// speed: 700,
// pauseTime: 0.5,
// list: uavList.value,
// },
// frameRate: 1,
// showStop: true,
// model: {
// // url: '/projecthome/walk.gltf',
// url: 'https://data.mars3d.cn/gltf/mars/man/walk.gltf',
// scale: 5,
// minimumPixelSize: 50,
// },
// polyline: {
// color: '#ffff00',
// width: 2,
// },
// });
// graphicLayer.addGraphic(fixedRoute);
const graphic = new mars3d.graphic.BillboardPrimitive({
position: {
type: 'time', //
speed: 600,
list: uavList.value,
},
style: {
image: '/projecthome/flightOperation.png',
width: 117,
height: 105,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
},
attr: { remark: '点状数据time类型position' },
});
graphicLayer.addGraphic(graphic);
};
</script>
<style scoped>

Loading…
Cancel
Save