wangjuncheng
2025-04-21 39d03876dbcf35623d3498f3914c036163da33cd
Merge branch 'master' of http://103.135.160.14:9034/r/NslWeb
已添加1个文件
已修改2个文件
254 ■■■■■ 文件已修改
public/json/line.json 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/simulation.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mnfz.vue 202 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/json/line.json
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,50 @@
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [116.59760983462722, 40.55718061951575, 598.7727601629845],
          [116.59760983462722, 40.55718061951575, 598.7727601629845],
          [116.59644965700153, 40.559317401763465, 569.8277901304249],
          [116.59740375239096, 40.560148143453276, 565.7157141156055],
          [116.59870671532008, 40.56066772033189, 559.9818134466861],
          [116.5989382913525, 40.561279499654816, 560.6004363337727],
          [116.59861851530843, 40.56191986528282, 556.7244657770593],
          [116.59863937279577, 40.562540361696044, 549.989046117256],
          [116.59798186828961, 40.563844128117175, 542.9938582259548],
          [116.59754420154454, 40.564258234641095, 540.1763729232823],
          [116.5971651744301, 40.56431251805267, 542.1265936059641],
          [116.59531329047178, 40.56704193949793, 523.9216605197581],
          [116.59466519689155, 40.56774819682324, 520.854586137509],
          [116.59371048844169, 40.568490515866735, 515.9891637325094],
          [116.59357695557298, 40.56837940750097, 515.9897252144557],
          [116.5936486797175, 40.56834910348064, 515.9898053186113]
        ]
      },
      "properties": {}
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [116.58968486232361, 40.57741443362995, 470.43196808102977],
          [116.58979068033705, 40.5769004556742, 477.24145981798205],
          [116.59043681293315, 40.576324193581456, 477.780635468482],
          [116.59156016224689, 40.57434225036743, 486.1814940411667],
          [116.59134241985157, 40.57310686967558, 485.9949599924823],
          [116.5904829230302, 40.5725751143292, 488.97277966815074],
          [116.59164316145382, 40.5706964031903, 497.0488991194549],
          [116.59227985803987, 40.569716082751754, 504.36840726535365],
          [116.59374203955004, 40.5684339509514, 515.9963172883579],
          [116.59361619860711, 40.56835405566704, 515.9929502933207],
          [116.59361619860711, 40.56835405566704, 515.9929502933207]
        ]
      },
      "properties": {}
    }
  ]
}
src/store/simulation.js
@@ -123,7 +123,7 @@
    const startMNFZ = () => {
        init()
        leftShow.value = true
        rightRiverShow.value = true
        // rightRiverShow.value = true
    }
    const startMNPG = () => {
src/views/mnfz.vue
@@ -1,9 +1,23 @@
<template>
  <Left @start="startSimulate" @end="endSimulate" />
  <echartInfo :isDynamicMode="isDynamicMode" :isFinish="isFinish" v-if="loadingSim" />
  <TimeLine v-if="showWaterSimulate" @time-update="timeUpdate" @is-playing="isPlaying"
    :waterSimulateParams="waterSimulateParams" @playbackFinished="playbackFinished" @end="endSimulate" />
  <DebuffDetail v-if="showDebuffDetail" @open="openDetail" @close="showDebuffDetail = false" />
  <echartInfo
    :isDynamicMode="isDynamicMode"
    :isFinish="isFinish"
    v-if="rightRiverShow"
  />
  <TimeLine
    v-if="showWaterSimulate"
    @time-update="timeUpdate"
    @is-playing="isPlaying"
    :waterSimulateParams="waterSimulateParams"
    @playbackFinished="playbackFinished"
    @end="endSimulate"
  />
  <DebuffDetail
    v-if="showDebuffDetail"
    @open="openDetail"
    @close="showDebuffDetail = false"
  />
  <DebuffTable v-if="showDebuffTable" @close="closeDebuffTable" />
</template>
@@ -19,18 +33,27 @@
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";
import { useSimStore } from "@/store/simulation";
import { storeToRefs } from "pinia";
const simStore = useSimStore();
const { rightRiverShow } = storeToRefs(simStore);
const waterSimulateParams = ref({});
const showWaterSimulate = ref(false);
const showDebuffDetail = ref(false);
const showDebuffTable = ref(false);
const isDynamicMode = ref(false);
const isFinish = ref(true);
const loadingSim = ref(false);
const treeMap = new Map();
// æä¾›æ–¹æ³•给所有子组件
provide("simulateActions", {
@@ -41,14 +64,14 @@
function startSimulate(form) {
  // console.log("form", form);
  showWaterSimulate.value = true;
  loadingSim.value = true
  rightRiverShow.value = true;
  waterSimulateParams.value = form;
}
function endSimulate() {
  loadingSim.value = false
  showDebuffDetail.value = false
  rightRiverShow.value = false;
  showDebuffDetail.value = false;
  clearTrailLine();
  removeEmergencyPoints()
  removeEmergencyPoints();
  removeDataSources();
  setTimeout(() => {
    showWaterSimulate.value = false;
@@ -85,7 +108,10 @@
            scale: 1.0,
            verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
            heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
            distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 1500),
            distanceDisplayCondition: new Cesium.DistanceDisplayCondition(
              0,
              1500
            ),
          },
        });
        dataSource.entities.add(billboardEntity);
@@ -95,8 +121,7 @@
    });
    await Promise.all(loadPromises);
    setupRowClickListener(dataSources);
  } catch (error) {
  }
  } catch (error) {}
}
// æ¸…除隐患点
function removeDataSources() {
@@ -143,11 +168,17 @@
  ];
  // è¿™é‡Œæ˜¯æ·»åŠ é¿é™©ç‚¹å¯Œæ–‡æœ¬é«˜äº®æ˜¾ç¤º
  list.forEach((item) => {
    let point = earthCtrl.factory.createRichTextPoint("避险点", [item.longitude, item.latitude, item.altitude - 10], {
      distanceDisplayCondition: new SmartEarth.Cesium.DistanceDisplayCondition(0, 2000),
      fontColor: "#ffffff",
      fontSize: 20
    }, "0");
    let point = earthCtrl.factory.createRichTextPoint(
      "避险点",
      [item.longitude, item.latitude, item.altitude - 10],
      {
        distanceDisplayCondition:
          new SmartEarth.Cesium.DistanceDisplayCondition(0, 2000),
        fontColor: "#ffffff",
        fontSize: 20,
      },
      "0"
    );
    console.log("point", point);
    emergencyAreaList.push(point);
  });
@@ -158,10 +189,10 @@
  const emergencyAreaList = treeMap.get("避险点"); // èŽ·å–å­˜å‚¨çš„é¿é™©ç‚¹å®žä½“åˆ—è¡¨
  if (emergencyAreaList && emergencyAreaList.length > 0) {
    emergencyAreaList.forEach((entity) => {
      if (entity && typeof entity.deleteObject === 'function') {
      if (entity && typeof entity.deleteObject === "function") {
        // å¦‚果有 deleteObject æ–¹æ³•,优先调用
        entity.deleteObject();
      } else if (entity && typeof entity.clear === 'function') {
      } else if (entity && typeof entity.clear === "function") {
        // å¦‚果有 clear æ–¹æ³•,调用 clear
        entity.clear();
      } else if (entity && earthCtrl && earthCtrl.coreMap) {
@@ -173,92 +204,34 @@
  }
}
let TrailLine = [];
async function showLine() {
  const position = [
    {
      x: -2172540.8322597803,
      y: 4339064.62665997,
      z: 4126183.3895281963,
    },
    {
      x: -2172480.18394144,
      y: 4339033.15167176,
      z: 4126240.9529584926,
    },
    {
      x: -2172454.114348403,
      y: 4339020.0398392705,
      z: 4126261.946960697,
    },
    {
      x: -2172377.9670952093,
      y: 4338976.609385458,
      z: 4126333.862357211,
    },
    {
      x: -2172299.4142002705,
      y: 4338951.971578909,
      z: 4126397.5205803993,
    },
    {
      x: -2172245.1703274297,
      y: 4338940.86037857,
      z: 4126436.276389208,
    },
    {
      x: -2172176.7332184147,
      y: 4338930.525741544,
      z: 4126477.629952572,
    },
    {
      x: -2172173.8151051304,
      y: 4338939.043883864,
      z: 4126469.336927342,
    },
    {
      x: -2172173.7151194704,
      y: 4338939.023235937,
      z: 4126469.4107743693,
    },
  ];
  let LineInterpolation = earthCtrl.core.LineInterpolation(earthCtrl.coreMap, {
    positions: position,
    num: 50,
    getHeight: true,
// é¿é™©è·¯çº¿
let pathLayer = null; // å­˜å‚¨åˆ›å»ºçš„图层
function showLine() {
  // åˆ›å»ºæ–°å›¾å±‚
  pathLayer = earthCtrl.factory.createPathLayer({
    url: "/json/line.json",
    color: "#0033FF",
    width: 15.0,
    pointColor: "#FFFFFF",
    speed: 2,
    far: 50000,
  });
  // console.log(LineInterpolation.height, "A");
  let min = LineInterpolation.height;
  let max = min.map((item) => {
    return item + 35;
  });
  console.log(min, max);
  let _TrailLine = earthCtrl.factory.createTrailLineWall(
    LineInterpolation.positions,
    {
      maximumHeights: max,
      minimumHeights: min,
      color: "#ffffff", //线颜色(可选)
      url: colors,
    }
  );
  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 = [];
  if (pathLayer) {
    pathLayer.clear();
  }
  // 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);
  // }
  // });
  // pathLayer = [];
}
function timeUpdate(percentage) {
  if (percentage > 99) {
@@ -345,7 +318,9 @@
      // åˆ‡æ¢é¢œè‰²ï¼ˆä¾‹å¦‚红色和原始颜色交替)
      const currentTime = Date.now();
      const flashColor = Cesium.Color.RED.withAlpha(1); // é—ªåŠ¨é¢œè‰²
      return Math.floor(currentTime / 500) % 2 === 0 ? flashColor : originalColor;
      return Math.floor(currentTime / 500) % 2 === 0
        ? flashColor
        : originalColor;
    }, false)
  );
  // å°†é—ªåŠ¨çŠ¶æ€ä¿å­˜åˆ°å®žä½“ä¸Šï¼Œä¾¿äºŽåŽç»­æŽ§åˆ¶
@@ -356,18 +331,33 @@
function stopFlashing(polygonEntity) {
  // æ¢å¤åŽŸå§‹é¢œè‰²
  const originalColor = polygonEntity._originalColor || Cesium.Color.WHITE; // å¦‚果没有原始颜色,默认使用白色
  polygonEntity.polygon.material = new Cesium.ColorMaterialProperty(originalColor);
  polygonEntity.polygon.material = new Cesium.ColorMaterialProperty(
    originalColor
  );
  // æ¸…空闪动状态
  polygonEntity._isFlashing = false;
  polygonEntity._originalColor = null; // æ¸…除保存的原始颜色
}
onMounted(() => {
  setupRowClickListener()
  setupRowClickListener();
  getMaxInfluenceAreaData();
});
onUnmounted(() => {
  endSimulate();
});
// // è½¬æ¢åæ ‡ç³»ï¼Œç¬›å¡å°”坐标转为WGS48
// const positions = [[-2171569.1995107993, 4338474.198855222, 4127198.938949332]];
// const wgs84Positions = positions.map((xyz) => {
//   const cartesian = Cesium.Cartesian3.fromArray(xyz);
//   const cartographic = Cesium.Cartographic.fromCartesian(cartesian);
//   // å¼§åº¦è½¬è§’度
//   const lon = Cesium.Math.toDegrees(cartographic.longitude);
//   const lat = Cesium.Math.toDegrees(cartographic.latitude);
//   const height = cartographic.height; // å•位:米
//   return [lon, lat, height];
// });
</script>
<style lang="less" scoped>
@import url("../assets/css/home.css");