wangjuncheng
2025-04-20 d8a0684a057df926c788525575eecdddde977133
src/views/mnfz.vue
@@ -49,7 +49,8 @@
  waterSimulateParams.value = form;
}
function endSimulate() {
  // showDebuffDetail.value = true
  showDebuffDetail.value = false
  clearTrailLine();
  removeDataSources();
  setTimeout(() => {
    showWaterSimulate.value = false;
@@ -59,15 +60,19 @@
const MaxInfluenceAreaList = ref([]);
const dataSources = [];
function getTimeMarkers() {
  // 将改 list数据的 gemo EPSG:4548 坐标 转为 wgs84 坐标系的 geojson 数据
  // 将 list 数据的 geom EPSG:4548 坐标转换为 WGS84 坐标系的 GeoJSON 数据
  const list = MaxInfluenceAreaList.value;
  list.forEach((item, index) => {
    const geosjon = geomToGeoJSON(item.geom);
    Cesium.GeoJsonDataSource.load(geosjon, {
      stroke: Cesium.Color.RED, // 边框颜色
      strokeWidth: 2, // 边框宽度
      fill: Cesium.Color.RED.withAlpha(0.5), // 填充颜色(带透明度)
    }).then((dataSource) => {
    const geojson = geomToGeoJSON(item.geom);
    Cesium.GeoJsonDataSource.load(geojson).then((dataSource) => {
      // 设置样式,将颜色改为红色
      dataSource.entities.values.forEach((entity) => {
        entity.polygon.material = new Cesium.Color(1.0, 0.0, 0.0, 0.6); // 红色,80% 不透明度
        entity.polygon.outlineColor = Cesium.Color.YELLOW;
        entity.polygon.outline = true;
      });
      // 添加数据源到 viewer
      viewer.dataSources.add(dataSource);
      dataSources.push(dataSource);
    });
@@ -152,6 +157,19 @@
  );
  TrailLine.push(_TrailLine);
}
// 清除轨迹线对象
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 showLine() {
//   earthCtrl.factory.createSimpleGraphic(
//     "polyline",