|
|
|
@ -350,12 +350,12 @@
|
|
|
|
|
imageGraphicData = [];
|
|
|
|
|
|
|
|
|
|
// 飞行方向标
|
|
|
|
|
let flightRotation = 0;
|
|
|
|
|
let flightMapRotation = 0;
|
|
|
|
|
const flightimage = new Image();
|
|
|
|
|
flightimage.crossOrigin = 'Anonymous';
|
|
|
|
|
flightimage.src = '/src/assets/images/flightoperation/mediaLibraryFlight.png';
|
|
|
|
|
flightimage.onload = () => {
|
|
|
|
|
let flightRotation = 0;
|
|
|
|
|
let flightMapRotation = 0;
|
|
|
|
|
// 地图照片-遍历
|
|
|
|
|
props.allImageDataList.forEach((item, index) => {
|
|
|
|
|
if (item.lng && item.lat && item.absoluteAltitude) {
|
|
|
|
@ -368,58 +368,6 @@
|
|
|
|
|
'https://m.tuniucdn.com/fb2/t1/G5/M00/44/52/Cii-s1soezyIF2UxABn76u-yKl8AAIwBgB34jAAGfwC3020871';
|
|
|
|
|
}
|
|
|
|
|
image.onload = () => {
|
|
|
|
|
// 创建Canvas元素
|
|
|
|
|
const canvas = document.createElement('canvas');
|
|
|
|
|
canvas.width = 34;
|
|
|
|
|
canvas.height = 29;
|
|
|
|
|
// 获取Canvas绘图上下文
|
|
|
|
|
const ctx = canvas.getContext('2d');
|
|
|
|
|
ctx.fillStyle = '#ffffff00';
|
|
|
|
|
ctx?.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
|
|
|
|
|
|
|
// 图片
|
|
|
|
|
ctx.save();
|
|
|
|
|
const centerX = canvas.width / 2;
|
|
|
|
|
const centerY = canvas.height / 2;
|
|
|
|
|
ctx.translate(centerX, centerY);
|
|
|
|
|
const angleInRadians = (Math.PI / 180) * (parseFloat(item.gimbalYawDegree) + 180); // 将角度转换为弧度
|
|
|
|
|
ctx.rotate(angleInRadians);
|
|
|
|
|
ctx.drawImage(image, 2 - centerX, 2 - centerY, 30, 25);
|
|
|
|
|
ctx.restore();
|
|
|
|
|
|
|
|
|
|
// 飞行标识-右上角
|
|
|
|
|
if (index + 1 < props.allImageDataList.length) {
|
|
|
|
|
const afterItem = props.allImageDataList[index + 1];
|
|
|
|
|
let dLng = afterItem.lng - item.lng;
|
|
|
|
|
let dLat = afterItem.lat - item.lat;
|
|
|
|
|
// 使用 atan2 自动处理象限和除零
|
|
|
|
|
let angleRad = Math.atan2(dLat, dLng);
|
|
|
|
|
let angleDeg = Cesium.Math.toDegrees(angleRad);
|
|
|
|
|
let angleA = ((Math.PI / 180) * (90 - angleDeg + 360)) % 360;
|
|
|
|
|
flightRotation = angleA;
|
|
|
|
|
flightMapRotation = angleDeg;
|
|
|
|
|
}
|
|
|
|
|
ctx.save();
|
|
|
|
|
const imgWAndH = 15;
|
|
|
|
|
ctx.translate(18 + imgWAndH / 2, imgWAndH / 2);
|
|
|
|
|
ctx.rotate(flightRotation);
|
|
|
|
|
ctx.drawImage(flightimage, -imgWAndH / 2, -imgWAndH / 2, imgWAndH, imgWAndH);
|
|
|
|
|
ctx.restore();
|
|
|
|
|
|
|
|
|
|
// 设置图片1的边框颜色和宽度
|
|
|
|
|
ctx.save();
|
|
|
|
|
ctx.strokeStyle = '#ffffff';
|
|
|
|
|
ctx.lineWidth = 1;
|
|
|
|
|
ctx.strokeRect(1, 1, canvas.width - 2, canvas.height - 2);
|
|
|
|
|
const dataURL1 = canvas.toDataURL('image/png');
|
|
|
|
|
ctx.restore();
|
|
|
|
|
|
|
|
|
|
// 设置图片2的边框颜色和宽度
|
|
|
|
|
ctx.strokeStyle = '#2d8cef';
|
|
|
|
|
ctx.lineWidth = 1;
|
|
|
|
|
ctx.strokeRect(1, 1, canvas.width - 2, canvas.height - 2);
|
|
|
|
|
const dataURL2 = canvas.toDataURL('image/png');
|
|
|
|
|
|
|
|
|
|
// 位置
|
|
|
|
|
let position = [
|
|
|
|
|
parseFloat(item.lng),
|
|
|
|
@ -431,6 +379,57 @@
|
|
|
|
|
map.scene,
|
|
|
|
|
Cesium.Cartesian3.fromDegrees(position[0], position[1]),
|
|
|
|
|
).then((point) => {
|
|
|
|
|
// 创建Canvas元素
|
|
|
|
|
const canvas = document.createElement('canvas');
|
|
|
|
|
canvas.width = 34;
|
|
|
|
|
canvas.height = 29;
|
|
|
|
|
// 获取Canvas绘图上下文
|
|
|
|
|
const ctx = canvas.getContext('2d');
|
|
|
|
|
ctx.fillStyle = '#ffffff00';
|
|
|
|
|
ctx?.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
|
|
|
|
|
|
|
// 图片
|
|
|
|
|
ctx.save();
|
|
|
|
|
const centerX = canvas.width / 2;
|
|
|
|
|
const centerY = canvas.height / 2;
|
|
|
|
|
ctx.translate(centerX, centerY);
|
|
|
|
|
const angleInRadians = (Math.PI / 180) * (parseFloat(item.gimbalYawDegree) + 180); // 将角度转换为弧度
|
|
|
|
|
ctx.rotate(angleInRadians);
|
|
|
|
|
ctx.drawImage(image, 2 - centerX, 2 - centerY, 30, 25);
|
|
|
|
|
ctx.restore();
|
|
|
|
|
|
|
|
|
|
// 飞行标识-右上角
|
|
|
|
|
if (index + 1 < props.allImageDataList.length) {
|
|
|
|
|
const afterItem = props.allImageDataList[index + 1];
|
|
|
|
|
let dLng = afterItem.lng - item.lng;
|
|
|
|
|
let dLat = afterItem.lat - item.lat;
|
|
|
|
|
// 使用 atan2 自动处理象限和除零
|
|
|
|
|
let angleRad = Math.atan2(dLat, dLng);
|
|
|
|
|
let angleDeg = Cesium.Math.toDegrees(angleRad);
|
|
|
|
|
flightRotation = ((Math.PI / 180) * (90 - angleDeg + 360)) % 360;
|
|
|
|
|
flightMapRotation = ((Math.PI / 180) * (angleDeg + 270)) % 360;
|
|
|
|
|
}
|
|
|
|
|
ctx.save();
|
|
|
|
|
const imgWAndH = 15;
|
|
|
|
|
ctx.translate(18 + imgWAndH / 2, imgWAndH / 2);
|
|
|
|
|
ctx.rotate(flightRotation);
|
|
|
|
|
ctx.drawImage(flightimage, -imgWAndH / 2, -imgWAndH / 2, imgWAndH, imgWAndH);
|
|
|
|
|
ctx.restore();
|
|
|
|
|
|
|
|
|
|
// 设置图片1的边框颜色和宽度
|
|
|
|
|
ctx.save();
|
|
|
|
|
ctx.strokeStyle = '#ffffff';
|
|
|
|
|
ctx.lineWidth = 1;
|
|
|
|
|
ctx.strokeRect(1, 1, canvas.width - 2, canvas.height - 2);
|
|
|
|
|
const dataURL1 = canvas.toDataURL('image/png');
|
|
|
|
|
ctx.restore();
|
|
|
|
|
|
|
|
|
|
// 设置图片2的边框颜色和宽度
|
|
|
|
|
ctx.strokeStyle = '#2d8cef';
|
|
|
|
|
ctx.lineWidth = 1;
|
|
|
|
|
ctx.strokeRect(1, 1, canvas.width - 2, canvas.height - 2);
|
|
|
|
|
const dataURL2 = canvas.toDataURL('image/png');
|
|
|
|
|
|
|
|
|
|
// 飞行点
|
|
|
|
|
let flightointGraphic = new mars3d.graphic.BillboardEntity({
|
|
|
|
|
id: item.id + '_flight',
|
|
|
|
@ -439,7 +438,7 @@
|
|
|
|
|
image: '/src/assets/images/flightoperation/mediaLibraryFlight.png',
|
|
|
|
|
clampToGround: false,
|
|
|
|
|
verticalOrigin: Cesium.VerticalOrigin.CENTER,
|
|
|
|
|
rotation: ((Math.PI / 180) * (flightMapRotation + 270)) % 360,
|
|
|
|
|
rotation: flightMapRotation,
|
|
|
|
|
},
|
|
|
|
|
hasEdit: false,
|
|
|
|
|
show: false,
|
|
|
|
|