src/views/mnfz.vue
@@ -33,6 +33,8 @@
import { createPoint, geomToGeoJSON } from "@/utils/map.js";
import { loadAreaPolygon, clearAreaPolygon } from "@/utils/area";
import colors from "@/assets/img/left/colors3.png";
import danger from "@/assets/img/left/danger.png";
import { checkedKeys } from "@/store/index";
@@ -191,6 +193,8 @@
        // 如果有 clear 方法,调用 clear
        entity.clear();
      } else if (entity && earthCtrl && earthCtrl.coreMap) {
        // 清除避险点绿色面片
        clearAreaPolygon();
        // 如果是 Cesium 实体,使用 coreMap.entities.remove 移除
        earthCtrl.coreMap.entities.remove(entity);
      }
@@ -199,14 +203,14 @@
  }
}
// 避险路线
///////////////////////////// 流光线避险路线/////////////////////////////
let pathLayer = null; // 存储创建的图层
function showLine() {
  // 创建新图层
  pathLayer = earthCtrl.factory.createPathLayer({
    url: "/json/line.json",
    color: "#0033FF",
    width: 15.0,
    color: "#008500",
    width: 12.0,
    pointColor: "#FFFFFF",
    speed: 2,
    far: 50000,
@@ -226,10 +230,201 @@
  //   earthCtrl.coreMap.entities.remove(item);
  // }
  // });
  // pathLayer = [];
  pathLayer = null;
}
///////////////////////////// 流光线避险路线/////////////////////////////
///////////////////////////// 箭头版避险路线/////////////////////////////
// let TrailLine = [];
// async function showLine() {
//   const position1 = [
//     {
//       x: -2172867.1941179745,
//       y: 4339567.67446477,
//       z: 4125575.4386990573,
//     },
//     {
//       x: -2172867.1941179745,
//       y: 4339567.67446477,
//       z: 4125575.4386990573,
//     },
//     {
//       x: -2172700.396781143,
//       y: 4339454.037139385,
//       z: 4125736.906847591,
//     },
//     {
//       x: -2172744.4001612393,
//       y: 4339361.421455601,
//       z: 4125804.324253885,
//     },
//     {
//       x: -2172824.3311673277,
//       y: 4339274.56533081,
//       z: 4125844.432999503,
//     },
//     {
//       x: -2172822.298957661,
//       y: 4339226.700024104,
//       z: 4125896.451233209,
//     },
//     {
//       x: -2172776.0573917977,
//       y: 4339194.843872361,
//       z: 4125947.9581145854,
//     },
//     {
//       x: -2172755.2828807314,
//       y: 4339149.410126468,
//       z: 4125995.9286539108,
//     },
//     {
//       x: -2172660.9533022284,
//       y: 4339085.401362197,
//       z: 4126101.3750262205,
//     },
//     {
//       x: -2172613.460204307,
//       y: 4339073.342332504,
//       z: 4126134.479399525,
//     },
//     {
//       x: -2172583.664140033,
//       y: 4339085.533980615,
//       z: 4126140.3272964833,
//     },
//     {
//       x: -2172348.977405535,
//       y: 4338967.122025027,
//       z: 4126358.7532469626,
//     },
//     {
//       x: -2172276.019363938,
//       y: 4338943.999121099,
//       z: 4126416.339696519,
//     },
//     {
//       x: -2172178.064812976,
//       y: 4338928.9482959965,
//       z: 4126475.798078439,
//     },
//     {
//       x: -2172171.5451145098,
//       y: 4338941.186930828,
//       z: 4126466.425301899,
//     },
//     {
//       x: -2172177.9565195283,
//       y: 4338940.424956708,
//       z: 4126463.8688932694,
//     },
//   ];
//   const position2 = [
//     {
//       x: -2171569.1995107993,
//       y: 4338474.198855222,
//       z: 4127198.938949332,
//     },
//     {
//       x: -2171596.1458028457,
//       y: 4338508.014766663,
//       z: 4127160.0148374927,
//     },
//     {
//       x: -2171663.8877153755,
//       y: 4338521.115613981,
//       z: 4127111.758040112,
//     },
//     {
//       x: -2171815.8899659193,
//       y: 4338612.264105235,
//       z: 4126950.0428421027,
//     },
//     {
//       x: -2171839.2819730053,
//       y: 4338700.186548507,
//       z: 4126845.712987762,
//     },
//     {
//       x: -2171792.4015423204,
//       y: 4338769.135301243,
//       z: 4126802.7938519563,
//     },
//     {
//       x: -2171943.7495626938,
//       y: 4338851.9854133595,
//       z: 4126649.5658632508,
//     },
//     {
//       x: -2172026.1490882114,
//       y: 4338896.137127666,
//       z: 4126571.6284971433,
//     },
//     {
//       x: -2172182.2854437083,
//       y: 4338931.410179759,
//       z: 4126471.0308961133,
//     },
//     {
//       x: -2172175.3377184337,
//       y: 4338941.338674108,
//       z: 4126464.288707359,
//     },
//     {
//       x: -2172175.3377184337,
//       y: 4338941.338674108,
//       z: 4126464.288707359,
//     },
//   ];
//   // 定义一个函数来创建轨迹线
//   function createTrailLine(positions, color = "#ffffff") {
//     let LineInterpolation = earthCtrl.core.LineInterpolation(
//       earthCtrl.coreMap,
//       {
//         positions: positions,
//         num: 50,
//         getHeight: true,
//       }
//     );
//     let min = LineInterpolation.height;
//     let max = min.map((item) => item + 35);
//     console.log(min, max);
//     let _TrailLine = earthCtrl.factory.createTrailLineWall(
//       LineInterpolation.positions,
//       {
//         maximumHeights: max,
//         minimumHeights: min,
//         color: color, // 线颜色
//         url: colors, // 如果没有设置 colors,请用纯色或删除此行
//       }
//     );
//     TrailLine.push(_TrailLine);
//   }
//   // 分别创建两条轨迹线
//   createTrailLine(position1, "#ff0000"); // 红色轨迹
//   createTrailLine(position2, "#0000ff"); // 蓝色轨迹
// }
// // 清除轨迹线对象
// function clearTrailLine() {
//   TrailLine.forEach((item, index) => {
//     if (item && typeof item.deleteObject === "function") {
//       item.deleteObject();
//     } else if (item && typeof item.clear === "function") {
//       item.clear();
//     } else if (item && earthCtrl && earthCtrl.coreMap) {
//       earthCtrl.coreMap.entities.remove(item);
//     }
//   });
//   TrailLine = [];
// }
///////////////////////////// 箭头版避险路线/////////////////////////////
function timeUpdate(percentage) {
  if (percentage > 99) {
  console.log(percentage, "ppppppppppp");
  if (percentage > 99.9) {
    if (showDebuffDetail.value) {
      return;
    }