|
|
|
@ -58,6 +58,7 @@
|
|
|
|
|
import airPoint from './airPoint.vue';
|
|
|
|
|
import * as mars3d from 'mars3d';
|
|
|
|
|
import { EventBus } from '@/utils/eventBus';
|
|
|
|
|
import { airPortStore } from '@/store/modules/airport';
|
|
|
|
|
|
|
|
|
|
import 'mars3d-space';
|
|
|
|
|
|
|
|
|
@ -2472,17 +2473,123 @@ const setUAVPosition = () => {
|
|
|
|
|
flyTo: true,
|
|
|
|
|
});
|
|
|
|
|
graphicLayer.addGraphic(route);
|
|
|
|
|
// 是与route绑定的矢量对象,放在route构造时一起构造
|
|
|
|
|
addGroundLine(route, 'uav-route')
|
|
|
|
|
addRectSensor(route, 'uav-route')
|
|
|
|
|
}
|
|
|
|
|
if (props.uavTrack.longitude) {
|
|
|
|
|
const positionVal = Cesium.Cartesian3.fromDegrees(
|
|
|
|
|
props.uavTrack.longitude,
|
|
|
|
|
props.uavTrack.latitude,
|
|
|
|
|
props.uavTrack.height,
|
|
|
|
|
);
|
|
|
|
|
route.addTimePosition(positionVal,Cesium.JulianDate.fromDate(new Date()));
|
|
|
|
|
const positionVal = Cesium.Cartesian3.fromDegrees(
|
|
|
|
|
props.uavTrack.longitude,
|
|
|
|
|
props.uavTrack.latitude,
|
|
|
|
|
props.uavTrack.height,
|
|
|
|
|
);
|
|
|
|
|
route.addTimePosition(positionVal,Cesium.JulianDate.fromDate(new Date()));
|
|
|
|
|
const airPortStoreVal = airPortStore();
|
|
|
|
|
const uav = airPortStoreVal.getUAV;
|
|
|
|
|
const type_subtype_gimbalindex = props.uavTrack[uav.camera_index];
|
|
|
|
|
const rectSensor = graphicLayer.getGraphicById("uav-route-rectSensor")
|
|
|
|
|
rectSensor.heading = type_subtype_gimbalindex.gimbal_yaw //四周方向角,0至360度角度值
|
|
|
|
|
rectSensor.pitch = type_subtype_gimbalindex.gimbal_pitch //俯仰角,上下摇摆的角度,0至360度角度值
|
|
|
|
|
rectSensor.roll = type_subtype_gimbalindex.gimbal_roll + 90 //滚转角,左右摆动的角度,0至360度角度值
|
|
|
|
|
rectSensor.angle1 = 10 //夹角1,半场角度,取值范围 0.1-89.9
|
|
|
|
|
rectSensor.angle2 = 10 //夹角2,半场角度,取值范围 0.1-89.9
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
// 绘制连接地面线
|
|
|
|
|
function addGroundLine(route) {
|
|
|
|
|
const groundPoint = new mars3d.graphic.PointPrimitive({
|
|
|
|
|
id: route.id + "-groundPoint",
|
|
|
|
|
position: route.position,
|
|
|
|
|
style: {
|
|
|
|
|
color: "#ff0000",
|
|
|
|
|
pixelSize: 6
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
graphicLayer.addGraphic(groundPoint)
|
|
|
|
|
|
|
|
|
|
const linePositions = []
|
|
|
|
|
const groundLine = new mars3d.graphic.PolylineEntity({
|
|
|
|
|
id: route.id + "-groundLine",
|
|
|
|
|
positions: new Cesium.CallbackProperty(function (time) {
|
|
|
|
|
return linePositions
|
|
|
|
|
}, false),
|
|
|
|
|
style: {
|
|
|
|
|
width: 1,
|
|
|
|
|
materialType: mars3d.MaterialType.PolylineDash,
|
|
|
|
|
materialOptions: {
|
|
|
|
|
color: Cesium.Color.WHITE,
|
|
|
|
|
dashLength: 20
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
graphicLayer.addGraphic(groundLine)
|
|
|
|
|
|
|
|
|
|
route.on(mars3d.EventType.change, function (event) {
|
|
|
|
|
const wrjPt = route.position
|
|
|
|
|
const wrjCarto = Cesium.Cartographic.fromCartesian(wrjPt)
|
|
|
|
|
const dmHeight = mars3d.PointUtil.getHeight(map?.scene, wrjCarto, { max: wrjCarto.height })
|
|
|
|
|
const pt2 = Cesium.Cartesian3.fromRadians(wrjCarto.longitude, wrjCarto.latitude, dmHeight)
|
|
|
|
|
|
|
|
|
|
// 更新竖直线坐标
|
|
|
|
|
linePositions[0] = wrjPt
|
|
|
|
|
linePositions[1] = pt2
|
|
|
|
|
|
|
|
|
|
// 更新其他矢量对象
|
|
|
|
|
groundPoint.position = pt2
|
|
|
|
|
|
|
|
|
|
if (route.label) {
|
|
|
|
|
// const wrjHeight = wrjCarto.height - dmHeight // 相对地面高度(AGL): 飞行海拔-地面海拔
|
|
|
|
|
// fixedRoute.label.text = `火星无人机\nAGL:${mars3d.Util.formatNum(wrjHeight, 2)}m`
|
|
|
|
|
|
|
|
|
|
// 绝对高度(ASL): 飞行海拔
|
|
|
|
|
route.label.text = `火星无人机\nASL:${mars3d.Util.formatNum(wrjCarto.height, 2)}m`
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 绘制 相机视锥体
|
|
|
|
|
function addRectSensor(route) {
|
|
|
|
|
const rectSensor = new mars3d.graphic.RectSensor({
|
|
|
|
|
id: route.id + "-rectSensor",
|
|
|
|
|
position: route.property,
|
|
|
|
|
style: {
|
|
|
|
|
angle1: 10,
|
|
|
|
|
angle2: 10,
|
|
|
|
|
length: 50,
|
|
|
|
|
rayEllipsoid: true,
|
|
|
|
|
color: "rgba(0,255,255,0.3)",
|
|
|
|
|
outline: true,
|
|
|
|
|
topShow: true,
|
|
|
|
|
topSteps: 2,
|
|
|
|
|
flat: true,
|
|
|
|
|
cameraHpr: true,
|
|
|
|
|
heading: 0,
|
|
|
|
|
pitch: 0,
|
|
|
|
|
roll: 90
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
graphicLayer.addGraphic(rectSensor)
|
|
|
|
|
|
|
|
|
|
// 连接线
|
|
|
|
|
const rectLine = new mars3d.graphic.PolylineEntity({
|
|
|
|
|
id: route.id + "-rectLine",
|
|
|
|
|
positions: new Cesium.CallbackProperty(function (time) {
|
|
|
|
|
const localEnd = rectSensor?.rayPosition
|
|
|
|
|
if (!localEnd) {
|
|
|
|
|
return []
|
|
|
|
|
}
|
|
|
|
|
return [rectSensor.position, localEnd]
|
|
|
|
|
}, false),
|
|
|
|
|
style: {
|
|
|
|
|
arcType: Cesium.ArcType.NONE,
|
|
|
|
|
materialType: mars3d.MaterialType.PolylineDash,
|
|
|
|
|
materialOptions: {
|
|
|
|
|
color: "#ff0000"
|
|
|
|
|
},
|
|
|
|
|
width: 1
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
graphicLayer.addGraphic(rectLine)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////动作处理//////////////////////////////////////
|
|
|
|
|
const addAction = (action) => {
|
|
|
|
|