|
|
|
@ -7,7 +7,7 @@
|
|
|
|
|
<airPoint
|
|
|
|
|
:wayline="props.wayline"
|
|
|
|
|
:airPoints="airPoints"
|
|
|
|
|
@setFlyPoint="setFlyPoint"
|
|
|
|
|
@setTakeOffPoint="setTakeOffPoint"
|
|
|
|
|
@exitDraw="exitDraw"
|
|
|
|
|
:airInfo="lineInfo"
|
|
|
|
|
:airLineForm="props.airLineForm"
|
|
|
|
@ -20,7 +20,7 @@
|
|
|
|
|
<!-- 航面航线 -->
|
|
|
|
|
<div v-if="props.airLineForm.airLineType == 'mapping2d'" class="airpolygon-container">
|
|
|
|
|
<airPolygon
|
|
|
|
|
@setFlyPoint="setFlyPoint"
|
|
|
|
|
@setTakeOffPoint="setTakeOffPoint"
|
|
|
|
|
:airInfo="airInfo"
|
|
|
|
|
:editModel="props.editMode"
|
|
|
|
|
:polygonAirForm="polygonAirForm"
|
|
|
|
@ -285,10 +285,8 @@
|
|
|
|
|
// 航线预览:生成点
|
|
|
|
|
const generatePreviewPoint = (placemark)=>{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置默认起飞点
|
|
|
|
|
startPosition.value = [props.airLineForm?.taskOffLng, props.airLineForm?.taskOffLat, 70];
|
|
|
|
|
takeOffPointPosition.value = [props.airLineForm?.taskOffLng, props.airLineForm?.taskOffLat, 70];
|
|
|
|
|
|
|
|
|
|
// 先清空所有数据
|
|
|
|
|
clearAllLayer();
|
|
|
|
@ -371,11 +369,11 @@ const generatePreviewPoint = (placemark)=>{
|
|
|
|
|
|
|
|
|
|
let graphicLayer: mars3d.layer.GraphicLayer;
|
|
|
|
|
|
|
|
|
|
let uavGraphicLayer: mars3d.layer.GraphicLayer;
|
|
|
|
|
|
|
|
|
|
// 设置参考起飞点图层
|
|
|
|
|
let takeOffPointGraphicLayer:mars3d.layer.GraphicLayer;
|
|
|
|
|
|
|
|
|
|
let uavGraphicLayer: mars3d.layer.GraphicLayer;
|
|
|
|
|
|
|
|
|
|
// 测区面图层
|
|
|
|
|
let polygonGraphicLayer: mars3d.layer.GraphicLayer;
|
|
|
|
|
|
|
|
|
@ -648,7 +646,7 @@ const initMap = () => {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
takeOffPointGraphicLayer.on(mars3d.EventType.editMovePoint, function (event) {
|
|
|
|
|
flyPointMove(event);
|
|
|
|
|
takeOffPointMove(event);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
map.addLayer(takeOffPointGraphicLayer);
|
|
|
|
@ -683,14 +681,15 @@ const initMap = () => {
|
|
|
|
|
text: '删除测区',
|
|
|
|
|
icon: 'fa fa-camera-retro', // 支持 font-class 的字体方式图标
|
|
|
|
|
callback: (e) => {
|
|
|
|
|
handlerRemovePolygonArea(e);
|
|
|
|
|
handlerClearPolygonGraphicLayer(e);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
polygonGraphicLayer.on(mars3d.EventType.editMovePoint,(event)=>{
|
|
|
|
|
handlerPolygonEdit(event);
|
|
|
|
|
onPolygonGraphicLayerEdit(event);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
map.addLayer(polygonGraphicLayer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -734,7 +733,7 @@ const handlerBindMapMenus = () => {
|
|
|
|
|
text: '添加航点',
|
|
|
|
|
icon: 'fa fa-camera-retro', // 支持 font-class 的字体方式图标
|
|
|
|
|
callback: (e) => {
|
|
|
|
|
if (!startPosition.value) {
|
|
|
|
|
if (!takeOffPointPosition.value) {
|
|
|
|
|
message.warning('请先设置起飞点');
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
@ -758,7 +757,6 @@ const handlerBindMapMenus = () => {
|
|
|
|
|
|
|
|
|
|
///////////////////////////////图层和影像加载////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 加载长光卫星高分影像
|
|
|
|
|
const loadChangGuangLayer = ()=>{
|
|
|
|
|
var layer = new mars3d.layer.XyzLayer({
|
|
|
|
@ -776,14 +774,13 @@ const loadChangGuangLayer = ()=>{
|
|
|
|
|
map.addLayer(layer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////参考起飞点////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
// 全局参考起飞点 数据格式:[lng,lat,alt]
|
|
|
|
|
const startPosition = ref(null);
|
|
|
|
|
const takeOffPointPosition = ref(null);
|
|
|
|
|
|
|
|
|
|
// 设置起飞点
|
|
|
|
|
const setFlyPoint = async () => {
|
|
|
|
|
const setTakeOffPoint = async () => {
|
|
|
|
|
|
|
|
|
|
takeOffPointGraphicLayer ? takeOffPointGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
@ -801,29 +798,31 @@ const setFlyPoint = async () => {
|
|
|
|
|
outlineColor: '#000000',
|
|
|
|
|
pixelOffsetY: -50,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
startPosition.value = graphic.toJSON().position;
|
|
|
|
|
polygonAirForm.value.startingPoint = graphic.toJSON().position;
|
|
|
|
|
|
|
|
|
|
takeOffPointPosition.value = graphic.toJSON().position;
|
|
|
|
|
polygonAirForm.value.startingPoint = graphic.toJSON().position;
|
|
|
|
|
|
|
|
|
|
// 设置表单数据
|
|
|
|
|
props.airLineForm.taskOffLng = startPosition.value[0]
|
|
|
|
|
props.airLineForm.taskOffLat = startPosition.value[1]
|
|
|
|
|
props.airLineForm.taskOffLng = takeOffPointPosition.value[0]
|
|
|
|
|
props.airLineForm.taskOffLat = takeOffPointPosition.value[1]
|
|
|
|
|
|
|
|
|
|
// 更新航线
|
|
|
|
|
updatePolygonLineByParams();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 参考起飞点移动
|
|
|
|
|
const flyPointMove = (e) => {
|
|
|
|
|
const takeOffPointMove = (e) => {
|
|
|
|
|
|
|
|
|
|
let res = handlerGetLngLatHeight(e);
|
|
|
|
|
startPosition.value = [res.lng,res.lat,res.alt];
|
|
|
|
|
|
|
|
|
|
takeOffPointPosition.value = [res.lng,res.lat,res.alt];
|
|
|
|
|
polygonAirForm.value.startingPoint = [res.lng,res.lat,res.alt];
|
|
|
|
|
|
|
|
|
|
// 设置表单数据
|
|
|
|
|
props.airLineForm.taskOffLng = startPosition.value[0]
|
|
|
|
|
props.airLineForm.taskOffLat = startPosition.value[1]
|
|
|
|
|
props.airLineForm.taskOffLng = takeOffPointPosition.value[0]
|
|
|
|
|
props.airLineForm.taskOffLat = takeOffPointPosition.value[1]
|
|
|
|
|
|
|
|
|
|
// 更新航线
|
|
|
|
|
updatePolygonLineByParams();
|
|
|
|
@ -890,9 +889,6 @@ const handlerDrawPolygon = async () => {
|
|
|
|
|
|
|
|
|
|
props.airLineForm.flyToFirstPointMode = polygonWkt;
|
|
|
|
|
|
|
|
|
|
console.log("props.airLineForm",props.airLineForm);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let spceing = parseFloat(polygonCalculateParams.value?.spacing) / 10000;
|
|
|
|
|
let lines = generateScanLines(polygon,spceing, 0);
|
|
|
|
|
|
|
|
|
@ -905,7 +901,7 @@ const handlerDrawPolygon = async () => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 测区编辑后重新计算航线
|
|
|
|
|
const handlerPolygonEdit = (e)=>{
|
|
|
|
|
const onPolygonGraphicLayerEdit = (e)=>{
|
|
|
|
|
|
|
|
|
|
let coordinates = e.graphic.toJSON().positions;
|
|
|
|
|
|
|
|
|
@ -913,12 +909,13 @@ const handlerPolygonEdit = (e)=>{
|
|
|
|
|
coordinates.push(coordinates[0]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log("coordinates",coordinates);
|
|
|
|
|
|
|
|
|
|
polygonGeoJson.value = coordinates;
|
|
|
|
|
|
|
|
|
|
let polygon = turf.polygon([coordinates]);
|
|
|
|
|
|
|
|
|
|
let polygonWkt = GeojsonToWkt(polygon['geometry']);
|
|
|
|
|
props.airLineForm.flyToFirstPointMode = polygonWkt;
|
|
|
|
|
|
|
|
|
|
let spceing = parseFloat(polygonCalculateParams.value?.spacing) / 10000;
|
|
|
|
|
let lines = generateScanLines(polygon,spceing, 0);
|
|
|
|
|
|
|
|
|
@ -934,28 +931,12 @@ const handlerPolygonEdit = (e)=>{
|
|
|
|
|
// 绘制面航线
|
|
|
|
|
const handlerDrawPolygonLine = (lines) => {
|
|
|
|
|
|
|
|
|
|
let nodeGraphic = polygonGraphicLayer.getGraphicById("polygon-node-1");
|
|
|
|
|
|
|
|
|
|
if(nodeGraphic){
|
|
|
|
|
nodeGraphic.setOptions({
|
|
|
|
|
id: 'polygon-node-1',
|
|
|
|
|
name: '航点',
|
|
|
|
|
position: lines.geometry.coordinates[0],
|
|
|
|
|
style: {
|
|
|
|
|
image: '/map/node.png',
|
|
|
|
|
scale: 1,
|
|
|
|
|
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
|
|
|
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
|
|
|
|
label: {
|
|
|
|
|
text: '',
|
|
|
|
|
font_size: 14,
|
|
|
|
|
color: '#ffffff',
|
|
|
|
|
outline: true,
|
|
|
|
|
outlineColor: '#000000',
|
|
|
|
|
pixelOffsetY: -35,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
// 设置首航点
|
|
|
|
|
let firstAirLinePoint = polygonGraphicLayer.getGraphicById("polygon-node-1");
|
|
|
|
|
if(firstAirLinePoint){
|
|
|
|
|
firstAirLinePoint.setOptions({
|
|
|
|
|
position: lines.geometry.coordinates[0],
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
const graphic = new mars3d.graphic.BillboardEntity({
|
|
|
|
|
id: 'polygon-node-1',
|
|
|
|
@ -980,9 +961,7 @@ const handlerDrawPolygonLine = (lines) => {
|
|
|
|
|
polygonGraphicLayer.addGraphic(graphic);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 判断飞行模式
|
|
|
|
|
|
|
|
|
|
// 判断飞行模式 设置航点高度
|
|
|
|
|
lines.geometry.coordinates.unshift([
|
|
|
|
|
polygonAirForm.value.startingPoint[0],
|
|
|
|
|
polygonAirForm.value.startingPoint[1],
|
|
|
|
@ -1005,8 +984,6 @@ const handlerDrawPolygonLine = (lines) => {
|
|
|
|
|
arcType: Cesium.ArcType.GEODESIC, // 使用大地线
|
|
|
|
|
width: 2.0,
|
|
|
|
|
color: '#0aed8b',
|
|
|
|
|
// clampToGround: true,
|
|
|
|
|
extrudedHeight: 100, // 相对于地形的高度(米)
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
flyTo: true,
|
|
|
|
@ -1096,7 +1073,6 @@ function generateScanLines(polygon, spacing, angle = 0) {
|
|
|
|
|
airPoints.value?.push(point);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return connectedLine;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1113,7 +1089,7 @@ const connectLinesManual = (lines) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 相对起飞点高度
|
|
|
|
|
let relativeHeight = startPosition.value[2] + parseFloat(polygonCalculateParams.value.height);
|
|
|
|
|
let relativeHeight = takeOffPointPosition.value[2] + parseFloat(polygonCalculateParams.value.height);
|
|
|
|
|
|
|
|
|
|
line.geometry.coordinates?.forEach((item, idx) => {
|
|
|
|
|
line.geometry.coordinates[idx].push(relativeHeight);
|
|
|
|
@ -1180,13 +1156,11 @@ const CalculateAreaInfo = (polygon, lines) => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 删除面状测区 和 面状航线
|
|
|
|
|
const handlerRemovePolygonArea = () => {
|
|
|
|
|
if (polygonGraphicLayer) {
|
|
|
|
|
polygonGraphicLayer.clear();
|
|
|
|
|
}
|
|
|
|
|
if (polygonLineGraphicLayer) {
|
|
|
|
|
polygonLineGraphicLayer.clear();
|
|
|
|
|
}
|
|
|
|
|
const handlerClearPolygonGraphicLayer = () => {
|
|
|
|
|
|
|
|
|
|
polygonGraphicLayer ? polygonGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
polygonLineGraphicLayer ? polygonLineGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
textLabelGraphicLayer ? textLabelGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
@ -1198,6 +1172,7 @@ const handlerRemovePolygonArea = () => {
|
|
|
|
|
time: 0,
|
|
|
|
|
picture: '- -',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 面状航线测区、参数改变
|
|
|
|
@ -1237,7 +1212,6 @@ const updatePolygonLineByParams = ()=>{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 计算绘制的多边形每条线的长度和中心点
|
|
|
|
|
const polygonBorderInfo = ref([]);
|
|
|
|
|
|
|
|
|
@ -1307,10 +1281,14 @@ const handlerLoadtextLabelGraphicLayer = (info) => {
|
|
|
|
|
// 编辑回显航线
|
|
|
|
|
const handlerEditPolygonAirLine =async () => {
|
|
|
|
|
|
|
|
|
|
polygonAirForm.value.startingPoint = [props.airLineForm.taskOffLng,props.airLineForm.taskOffLat];
|
|
|
|
|
// 设置参考起飞点
|
|
|
|
|
|
|
|
|
|
takeOffPointPosition.value = [props.airLineForm.taskOffLng,props.airLineForm.taskOffLat,props.airLineForm?.taskOffAlt ? props.airLineForm?.taskOffAlt : 71]
|
|
|
|
|
|
|
|
|
|
polygonAirForm.value.startingPoint = [props.airLineForm.taskOffLng,props.airLineForm.taskOffLat,props.airLineForm?.taskOffAlt ? props.airLineForm?.taskOffAlt : 71];
|
|
|
|
|
|
|
|
|
|
// 起点
|
|
|
|
|
takeOffPointGraphicLayer ? takeOffPointGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
let startFlyGraphic = new mars3d.graphic.BillboardEntity({
|
|
|
|
|
position:[props.airLineForm.taskOffLng,props.airLineForm.taskOffLat],
|
|
|
|
|
style: {
|
|
|
|
@ -1328,16 +1306,13 @@ const handlerEditPolygonAirLine =async () => {
|
|
|
|
|
clampToGround: true,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
takeOffPointGraphicLayer.addGraphic(startFlyGraphic);
|
|
|
|
|
|
|
|
|
|
startPosition.value = [props.airLineForm.taskOffLng,props.airLineForm.taskOffLat,71]
|
|
|
|
|
takeOffPointGraphicLayer.addGraphic(startFlyGraphic);
|
|
|
|
|
|
|
|
|
|
// 测区
|
|
|
|
|
// 加载测区
|
|
|
|
|
let areaJson = WktToGeojson(props.airLineForm.flyToFirstPointMode)
|
|
|
|
|
|
|
|
|
|
polygonGeoJson.value = areaJson.coordinates[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let geojsonData = {
|
|
|
|
|
"type": "FeatureCollection",
|
|
|
|
|
"features": [
|
|
|
|
@ -1363,12 +1338,11 @@ const handlerEditPolygonAirLine =async () => {
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 文本标注
|
|
|
|
|
// 加载文本标注
|
|
|
|
|
handlerGetPolygonBorderInfo(areaJson.coordinates[0])
|
|
|
|
|
|
|
|
|
|
// 航线
|
|
|
|
|
// 加载航线
|
|
|
|
|
let placemark = props.waylineInfo?.Folder?.Placemark
|
|
|
|
|
|
|
|
|
|
placemark?.forEach((item, index) => {
|
|
|
|
|
let coordinate = item.Point.coordinates.split(',');
|
|
|
|
|
let airPointInfo = {
|
|
|
|
@ -1386,6 +1360,7 @@ const handlerEditPolygonAirLine =async () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let coordinates = [];
|
|
|
|
|
|
|
|
|
|
airPoints.value?.forEach((item, index) => {
|
|
|
|
|
coordinates.push([item.lng, item.lat]);
|
|
|
|
|
});
|
|
|
|
@ -1393,7 +1368,6 @@ const handlerEditPolygonAirLine =async () => {
|
|
|
|
|
let line = turf.lineString(coordinates);
|
|
|
|
|
|
|
|
|
|
handlerDrawPolygonLine(line);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////航点航线计算////////////////////////////////////////////
|
|
|
|
@ -1446,15 +1420,16 @@ const pointMove = (e, id) => {
|
|
|
|
|
|
|
|
|
|
// 绘制航线
|
|
|
|
|
const handlerDrawLine = () => {
|
|
|
|
|
|
|
|
|
|
let positions = [];
|
|
|
|
|
|
|
|
|
|
airPoints.value?.forEach((item, index) => {
|
|
|
|
|
positions.push([item.lng, item.lat, item.alt]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
positions.unshift([startPosition.value[0], startPosition.value[1], airPoints.value[0].alt]);
|
|
|
|
|
positions.unshift([takeOffPointPosition.value[0], takeOffPointPosition.value[1], airPoints.value[0].alt]);
|
|
|
|
|
|
|
|
|
|
positions.unshift([startPosition.value[0], startPosition.value[1], startPosition.value[2]]);
|
|
|
|
|
positions.unshift([takeOffPointPosition.value[0], takeOffPointPosition.value[1], takeOffPointPosition.value[2]]);
|
|
|
|
|
|
|
|
|
|
// 判断是否已经绘制
|
|
|
|
|
if (positions.length > 1) {
|
|
|
|
@ -2046,7 +2021,7 @@ const preViewPointWayLine = (position) => {
|
|
|
|
|
|
|
|
|
|
let startGraphic = new mars3d.graphic.BillboardEntity({
|
|
|
|
|
id: 'start-graphic',
|
|
|
|
|
position: startPosition.value,
|
|
|
|
|
position: takeOffPointPosition.value,
|
|
|
|
|
style: {
|
|
|
|
|
image: '/map/start.png',
|
|
|
|
|
scale: 1,
|
|
|
|
@ -2128,8 +2103,11 @@ const preViewPolygonWayLine = (lines) => {
|
|
|
|
|
|
|
|
|
|
// 清空所有图层
|
|
|
|
|
const clearAllLayer = () => {
|
|
|
|
|
|
|
|
|
|
graphicLayer ? graphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
stickGroundPointLayer ? stickGroundPointLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
lineGroundPointLayer ? lineGroundPointLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
polygonGraphicLayer ? polygonGraphicLayer.clear() : null;
|
|
|
|
@ -2293,6 +2271,7 @@ const setUAVPosition = () => {
|
|
|
|
|
},
|
|
|
|
|
frameRate: 1,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
const graphicModel = new mars3d.graphic.ModelPrimitive({
|
|
|
|
|
id: 'set-uav',
|
|
|
|
|