wangjuncheng
2025-04-20 1a452b6708a442915899d2ddf8288e28fd63bfbc
src/views/mnfz.vue
@@ -25,10 +25,10 @@
import DebuffDetail from "@/components/tools/DebuffDetail.vue";
import DebuffTable from "@/components/tools/DebuffTable.vue";
import { getMaxInfluenceArea } from "@/api/index";
import { createPoint, geomToGeoJSON } from "@/utils/map.js";
import colors from "@/assets/img/left/colors3.png";
import danger from "@/assets/img/left/danger.png";
import { checkedKeys } from "@/store/index";
const waterSimulateParams = ref({});
const showWaterSimulate = ref(false);
@@ -49,6 +49,7 @@
  waterSimulateParams.value = form;
}
function endSimulate() {
  showDebuffDetail.value = false
  clearTrailLine();
  removeDataSources();
@@ -60,16 +61,35 @@
const MaxInfluenceAreaList = ref([]);
const dataSources = [];
function getTimeMarkers() {
  // 将 list 数据的 geom EPSG:4548 坐标转换为 WGS84 坐标系的 GeoJSON 数据
  // 将 list 数据的 geom EPSG:4326 坐标转换为 WGS84 坐标系的 GeoJSON 数据
  const list = MaxInfluenceAreaList.value;
  list.forEach((item, index) => {
    const geojson = geomToGeoJSON(item.geom);
    const geojson = JSON.parse(item.geom); // 解析 geom 字段为 GeoJSON 对象
    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.material = new Cesium.Color(1.0, 0.0, 0.0, 0.6); // 红色,80% 不透明度
        // entity.polygon.material = new Cesium.Color.YELLOW; // 红色,80% 不透明度
        entity.polygon.outlineColor = Cesium.Color.YELLOW;
        entity.polygon.outline = true;
        // 使用提供的 X, Y, Z 坐标作为图标位置
        const position = Cesium.Cartesian3.fromDegrees(item.X, item.Y, item.Z);
        // 在中心点上方添加一个图标实体
        const billboardEntity = viewer.entities.add({
          position: position,
          billboard: {
            image: danger, // 图标的路径
            scale: 1.0, // 图标缩放比例
            verticalOrigin: Cesium.VerticalOrigin.BOTTOM, // 图标底部对齐到中心点
            heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, // 图标贴地
            distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 1500), // 控制可见距离范围 (0米到1500米)
          },
        });
        // 将图标实体与当前数据源关联
        dataSource.entities.add(billboardEntity);
      });
      // 添加数据源到 viewer