修复图片显示问题
This commit is contained in:
parent
4ded7b26c9
commit
50a860fdf7
@ -1329,51 +1329,59 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
addJobLine(info, isFinish) {
|
addJobLine(info, isFinish) {
|
||||||
console.log('任务信息', info)
|
// 参数和数据校验
|
||||||
let load = renderTaskInfo[`${info.id}-${info.uavList[0].uavId}`]
|
console.log(info, info.uavList, 777777777777);
|
||||||
|
|
||||||
|
if (!info || !Array.isArray(info.uavList) || info.uavList.length === 0) return;
|
||||||
|
const uav = info.uavList[0];
|
||||||
|
if (!Array.isArray(uav.airlineList) || uav.airlineList.length === 0) return;
|
||||||
|
const key = `${info.id}-${uav.uavId}`;
|
||||||
|
let load = renderTaskInfo[key];
|
||||||
|
console.log(load, key, 3333333);
|
||||||
|
|
||||||
if (load) {
|
if (load) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
let routes = []
|
let routes = [];
|
||||||
let startHeight = 0
|
let startHeight = 0;
|
||||||
let endHeight = 0
|
let endHeight = 0;
|
||||||
info.uavList[0].airlineList.forEach((item, index) => {
|
uav.airlineList.forEach((item, index) => {
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
startHeight = item.flightStartHeight
|
startHeight = item.startHeight;
|
||||||
}
|
}
|
||||||
if (index === info.uavList[0].airlineList.length - 1) {
|
if (index === uav.airlineList.length - 1) {
|
||||||
endHeight = item.flightEndHeight
|
endHeight = item.endHeight;
|
||||||
}
|
}
|
||||||
routes.push([item.flightStartLon, item.flightStartLat, item.flightStartHeight])
|
routes.push([item.startLon, item.startLat, item.startHeight]);
|
||||||
routes.push([item.flightEndLon, item.flightEndLat, item.flightEndHeight])
|
routes.push([item.endLon, item.endLat, item.endHeight]);
|
||||||
})
|
});
|
||||||
routes.unshift([info.uavList[0].startLon, info.uavList[0].startLat, startHeight])
|
routes.unshift([uav.startLon, uav.startLat, startHeight]);
|
||||||
routes.push([info.uavList[0].endLon, info.uavList[0].endLat, endHeight])
|
routes.push([uav.endLon, uav.endLat, endHeight]);
|
||||||
let positions = []
|
let positions = [];
|
||||||
let minLon, maxLon, minLat, maxLat
|
let minLon, maxLon, minLat, maxLat;
|
||||||
routes.forEach((item, index) => {
|
routes.forEach((item, index) => {
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
minLon = item[0]
|
minLon = item[0];
|
||||||
maxLon = item[0]
|
maxLon = item[0];
|
||||||
minLat = item[1]
|
minLat = item[1];
|
||||||
maxLat = item[1]
|
maxLat = item[1];
|
||||||
} else {
|
} else {
|
||||||
minLon = Math.min(minLon, item[0])
|
minLon = Math.min(minLon, item[0]);
|
||||||
maxLon = Math.max(maxLon, item[0])
|
maxLon = Math.max(maxLon, item[0]);
|
||||||
minLat = Math.min(minLat, item[1])
|
minLat = Math.min(minLat, item[1]);
|
||||||
maxLat = Math.max(maxLat, item[1])
|
maxLat = Math.max(maxLat, item[1]);
|
||||||
}
|
}
|
||||||
positions.push(DT.Cesium.Cartesian3.fromDegrees(item[0], item[1], item[2]))
|
positions.push(DT.Cesium.Cartesian3.fromDegrees(item[0], item[1], item[2]));
|
||||||
})
|
});
|
||||||
let currentIndex = 0
|
if (positions.length === 0) return;
|
||||||
let currentPosition = positions[0].clone()
|
let currentIndex = 0;
|
||||||
|
let currentPosition = positions[0].clone();
|
||||||
if (isFinish) {
|
if (isFinish) {
|
||||||
currentIndex = positions.length - 1
|
currentIndex = positions.length - 1;
|
||||||
currentPosition = positions[currentIndex].clone()
|
currentPosition = positions[currentIndex].clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
let pathEntity = new DT.DirectionPath({
|
let pathEntity = new DT.DirectionPath({
|
||||||
id: `${info.id}-${info.uavList[0].uavId}~baseline`,
|
id: `${key}~baseline`,
|
||||||
positions: positions,
|
positions: positions,
|
||||||
dataFit: false,
|
dataFit: false,
|
||||||
currentPosition: currentPosition,
|
currentPosition: currentPosition,
|
||||||
@ -1401,19 +1409,18 @@ export default {
|
|||||||
scale: 0.5,
|
scale: 0.5,
|
||||||
show: true,
|
show: true,
|
||||||
style: DT.Cesium.LabelStyle.FILL_AND_OUTLINE,
|
style: DT.Cesium.LabelStyle.FILL_AND_OUTLINE,
|
||||||
text: info.uavList[0].uavName,
|
text: uav.uavName,
|
||||||
verticalOrigin: DT.Cesium.VerticalOrigin.CENTER,
|
verticalOrigin: DT.Cesium.VerticalOrigin.CENTER,
|
||||||
disableDepthTestDistance: 10000
|
disableDepthTestDistance: 10000
|
||||||
},
|
},
|
||||||
billboardConfig: {
|
billboardConfig: {
|
||||||
image: process.env.BASE_URL + 'static/img/icon_wrj.png',
|
image: process.env.BASE_URL + 'static/img/icon_wrj.png',
|
||||||
disableDepthTestDistance: 10000
|
disableDepthTestDistance: 10000
|
||||||
// enableRotation: true
|
|
||||||
},
|
},
|
||||||
enableRepeatAdjust: false,
|
enableRepeatAdjust: false,
|
||||||
})
|
});
|
||||||
let pathEntity2 = new DT.DirectionPath({
|
let pathEntity2 = new DT.DirectionPath({
|
||||||
id: `${info.id}-${info.uavList[0].uavId}~baseline`,
|
id: `${key}~baseline-radar`,
|
||||||
positions: positions,
|
positions: positions,
|
||||||
dataFit: false,
|
dataFit: false,
|
||||||
currentPosition: currentPosition,
|
currentPosition: currentPosition,
|
||||||
@ -1441,53 +1448,48 @@ export default {
|
|||||||
scale: 0.5,
|
scale: 0.5,
|
||||||
show: true,
|
show: true,
|
||||||
style: DT.Cesium.LabelStyle.FILL_AND_OUTLINE,
|
style: DT.Cesium.LabelStyle.FILL_AND_OUTLINE,
|
||||||
text: info.uavList[0].uavName,
|
text: uav.uavName,
|
||||||
verticalOrigin: DT.Cesium.VerticalOrigin.CENTER,
|
verticalOrigin: DT.Cesium.VerticalOrigin.CENTER,
|
||||||
disableDepthTestDistance: 10000
|
disableDepthTestDistance: 10000
|
||||||
},
|
},
|
||||||
billboardConfig: {
|
billboardConfig: {
|
||||||
image: process.env.BASE_URL + 'static/img/icon_wrj.png',
|
image: process.env.BASE_URL + 'static/img/icon_wrj.png',
|
||||||
disableDepthTestDistance: 10000
|
disableDepthTestDistance: 10000
|
||||||
// enableRotation: true
|
|
||||||
},
|
},
|
||||||
enableRepeatAdjust: false,
|
enableRepeatAdjust: false,
|
||||||
})
|
});
|
||||||
console.log('调用添加方法了吗')
|
lodLayer.add(pathEntity);
|
||||||
lodLayer.add(pathEntity)
|
radarLayer.add(pathEntity2);
|
||||||
radarLayer.add(pathEntity2)
|
renderTaskInfo[key] = {
|
||||||
|
|
||||||
// 添加图片
|
|
||||||
|
|
||||||
|
|
||||||
renderTaskInfo[`${info.id}-${info.uavList[0].uavId}`] = {
|
|
||||||
entity: pathEntity,
|
entity: pathEntity,
|
||||||
entity2: pathEntity2,
|
entity2: pathEntity2,
|
||||||
picture: {}
|
picture: {}
|
||||||
}
|
};
|
||||||
|
info.uavList.forEach(uavItem => {
|
||||||
info.uavList.forEach(uav => {
|
if (uavItem.payloadList && Array.isArray(uavItem.payloadList)) {
|
||||||
uav.payloadList.forEach(payload => {
|
uavItem.payloadList.forEach(payload => {
|
||||||
payload.imageList.forEach(image => {
|
if (payload.imageList && Array.isArray(payload.imageList)) {
|
||||||
this.addMarkPicture2(image)
|
payload.imageList.forEach(image => {
|
||||||
})
|
this.addMarkPicture2(image);
|
||||||
})
|
});
|
||||||
})
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
// 适当扩大视角范围
|
// 适当扩大视角范围
|
||||||
let lonDiff = (maxLon - minLon) / 2
|
let lonDiff = (maxLon - minLon) / 2;
|
||||||
let latDiff = (maxLat - minLat) / 2
|
let latDiff = (maxLat - minLat) / 2;
|
||||||
minLon -= lonDiff
|
minLon -= lonDiff;
|
||||||
maxLon += lonDiff
|
maxLon += lonDiff;
|
||||||
minLat -= latDiff
|
minLat -= latDiff;
|
||||||
maxLat += latDiff
|
maxLat += latDiff;
|
||||||
|
|
||||||
let boundingPosition = [
|
let boundingPosition = [
|
||||||
DT.Cesium.Cartesian3.fromDegrees(minLon, minLat),
|
DT.Cesium.Cartesian3.fromDegrees(minLon, minLat),
|
||||||
DT.Cesium.Cartesian3.fromDegrees(minLon, maxLat),
|
|
||||||
DT.Cesium.Cartesian3.fromDegrees(maxLon, minLat),
|
DT.Cesium.Cartesian3.fromDegrees(maxLon, minLat),
|
||||||
|
DT.Cesium.Cartesian3.fromDegrees(minLon, maxLat),
|
||||||
DT.Cesium.Cartesian3.fromDegrees(maxLon, maxLat),
|
DT.Cesium.Cartesian3.fromDegrees(maxLon, maxLat),
|
||||||
]
|
];
|
||||||
// console.log('最小最大', minLon, maxLon, minLat, maxLat)
|
viewer.cesiumViewer.camera.flyToBoundingSphere(DT.Cesium.BoundingSphere.fromPoints(boundingPosition), { duration: 0.1 });
|
||||||
viewer.cesiumViewer.camera.flyToBoundingSphere(DT.Cesium.BoundingSphere.fromPoints(boundingPosition), { duration: 0.1 })
|
|
||||||
},
|
},
|
||||||
removeJobLine(jobId, uavId) {
|
removeJobLine(jobId, uavId) {
|
||||||
let load = renderTaskInfo[`${jobId}-${uavId}`]
|
let load = renderTaskInfo[`${jobId}-${uavId}`]
|
||||||
@ -2853,76 +2855,75 @@ export default {
|
|||||||
// }));
|
// }));
|
||||||
// if (this.tempAdd) return
|
// if (this.tempAdd) return
|
||||||
// this.tempAdd = true
|
// this.tempAdd = true
|
||||||
|
console.log(data, renderTaskInfo, 'tupiantupian');
|
||||||
|
|
||||||
let id = `${data.jobId}-${data.uavId}`
|
let id = `${data.jobId}-${data.uavId}`
|
||||||
let target = renderTaskInfo[id]
|
// let target = renderTaskInfo[id]
|
||||||
if (target) {
|
// if (target) {
|
||||||
let cby_bg_data = [
|
let cby_bg_data = [
|
||||||
data.left1Lon, data.left1Lat,
|
data.left1Lon, data.left1Lat,
|
||||||
data.left2Lon, data.left2Lat,
|
data.left2Lon, data.left2Lat,
|
||||||
data.right2Lon, data.right2Lat,
|
data.right2Lon, data.right2Lat,
|
||||||
data.right1Lon, data.right1Lat,
|
data.right1Lon, data.right1Lat,
|
||||||
]
|
]
|
||||||
let entity = viewer.entities.add({
|
let entity = viewer.entities.add({
|
||||||
id: `${data.jobId}-${data.uavId}~${data.fileId}-picture`,
|
id: `${data.jobId}-${data.uavId}~${data.fileId}-picture`,
|
||||||
name: '背景',
|
name: '背景',
|
||||||
polygon: {
|
polygon: {
|
||||||
// hierarchy: DT.Cesium.Cartesian3.fromDegreesArrayHeights(cby_bg_data),
|
hierarchy: DT.Cesium.Cartesian3.fromDegreesArray(cby_bg_data),
|
||||||
hierarchy: DT.Cesium.Cartesian3.fromDegreesArray(cby_bg_data),
|
perPositionHeight: true,
|
||||||
perPositionHeight: true,
|
material: new DT.Cesium.ImageMaterialProperty({
|
||||||
material: new DT.Cesium.ImageMaterialProperty({
|
image: window.config.imagePath + data.relativePath,
|
||||||
image: window.config.imagePath + data.relativePath,
|
}),
|
||||||
// image: process.env.BASE_URL + 'static/img/ttt.tif',
|
outline: true,
|
||||||
// image: process.env.BASE_URL + 'static/img/pic.png',
|
outlineColor: DT.Cesium.Color.WHITE,
|
||||||
}),//new Cesium.Color(0.29, 0.85, 0.89, 0.5), //Cesium.Color.PALETURQUOISE.withAlpha(0.5),
|
outlineWidth: 2, //很多电脑当宽度>1时,没用
|
||||||
outline: true,
|
}
|
||||||
outlineColor: DT.Cesium.Color.WHITE,
|
})
|
||||||
outlineWidth: 2, //很多电脑当宽度>1时,没用
|
let markLineArr = []
|
||||||
}
|
if (data.itemList) {
|
||||||
})
|
data.itemList.forEach((item) => {
|
||||||
let markLineArr = []
|
let markId = `${data.jobId}-${data.uavId}-${data.fileId}-${item.id}~mark`
|
||||||
if (data.itemList) {
|
let markPosition = DT.Cesium.Cartesian3.fromDegrees(item.left1Lon, item.left1Lat, 1)
|
||||||
data.itemList.forEach((item) => {
|
let markArr = [
|
||||||
let markId = `${data.jobId}-${data.uavId}-${data.fileId}-${item.id}~mark`
|
item.left1Lon, item.left1Lat, 1,
|
||||||
let markPosition = DT.Cesium.Cartesian3.fromDegrees(item.left1Lon, item.left1Lat, 1)
|
item.left2Lon, item.left2Lat, 1,
|
||||||
let markArr = [
|
item.right2Lon, item.right2Lat, 1,
|
||||||
item.left1Lon, item.left1Lat, 1,
|
item.right1Lon, item.right1Lat, 1,
|
||||||
item.left2Lon, item.left2Lat, 1,
|
item.left1Lon, item.left1Lat, 1,
|
||||||
item.right2Lon, item.right2Lat, 1,
|
]
|
||||||
item.right1Lon, item.right1Lat, 1,
|
let markLine = viewer.entities.add({
|
||||||
item.left1Lon, item.left1Lat, 1,
|
id: markId,
|
||||||
]
|
show: false,
|
||||||
let markLine = viewer.entities.add({
|
position: markPosition,
|
||||||
id: markId,
|
label: {
|
||||||
show: false,
|
text: this.detectType[item.type],
|
||||||
position: markPosition,
|
font: '12px sans-serif',
|
||||||
label: {
|
fillColor: DT.Cesium.Color.RED,
|
||||||
text: this.detectType[item.type],
|
horizontalOrigin: DT.Cesium.HorizontalOrigin.LEFT,
|
||||||
font: '12px sans-serif',
|
verticalOrigin: DT.Cesium.VerticalOrigin.TOP,
|
||||||
fillColor: DT.Cesium.Color.RED,
|
disableDepthTestDistance: 10000,
|
||||||
horizontalOrigin: DT.Cesium.HorizontalOrigin.LEFT,
|
showBackground: false,
|
||||||
verticalOrigin: DT.Cesium.VerticalOrigin.TOP,
|
backgroundColor: DT.Cesium.Color.BLACK,
|
||||||
disableDepthTestDistance: 10000,
|
style: DT.Cesium.LabelStyle.FILL_AND_OUTLINE,
|
||||||
showBackground: false,
|
},
|
||||||
backgroundColor: DT.Cesium.Color.BLACK,
|
polyline: {
|
||||||
style: DT.Cesium.LabelStyle.FILL_AND_OUTLINE,
|
positions: DT.Cesium.Cartesian3.fromDegreesArrayHeights(markArr),
|
||||||
},
|
// positions: DT.Cesium.Cartesian3.fromDegreesArray(markArr),
|
||||||
polyline: {
|
width: 1,
|
||||||
positions: DT.Cesium.Cartesian3.fromDegreesArrayHeights(markArr),
|
material: DT.Cesium.Color.RED,
|
||||||
// positions: DT.Cesium.Cartesian3.fromDegreesArray(markArr),
|
depthFailMaterial: DT.Cesium.Color.RED,
|
||||||
width: 1,
|
zIndex: 3,
|
||||||
material: DT.Cesium.Color.RED,
|
}
|
||||||
depthFailMaterial: DT.Cesium.Color.RED,
|
|
||||||
zIndex: 3,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
markLineArr.push(markLine)
|
|
||||||
})
|
})
|
||||||
}
|
markLineArr.push(markLine)
|
||||||
target.picture[`${data.fileId}-picture`] = {
|
})
|
||||||
pictureEntity: entity,
|
|
||||||
markArr: markLineArr
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// target.picture[`${data.fileId}-picture`] = {
|
||||||
|
// pictureEntity: entity,
|
||||||
|
// markArr: markLineArr
|
||||||
|
// }
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
addPictureHandle() {
|
addPictureHandle() {
|
||||||
console.log('双击事件执行了吗', new Date().getTime())
|
console.log('双击事件执行了吗', new Date().getTime())
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user