| | |
| | | import { useSimStore } from "@/store/simulation"; |
| | | import { storeToRefs } from "pinia"; |
| | | const simStore = useSimStore(); |
| | | const { selectedScheme, frameNum, layerDate,schemWaterInfo } = storeToRefs(simStore); |
| | | const { selectedScheme, frameNum, layerDate, schemWaterInfo } = |
| | | storeToRefs(simStore); |
| | | import { clearAllPoints } from "@/utils/map"; |
| | | |
| | | const emit = defineEmits([ |
| | | "timeUpdate", |
| | |
| | | // 降雨数据相关变量 |
| | | let rainFallValues = ref([]); // 存储原始降雨量数据 |
| | | let minRainValue = ref(Infinity); |
| | | let averageRainIntensity = ref(); |
| | | let maxRainValue = ref(-Infinity); |
| | | // 获取降雨数据 |
| | | function getRainfallData() { |
| | |
| | | |
| | | // 提取 intensity 值 |
| | | rainFallValues.value = hourlyRainfallList.map((r) => r.intensity); |
| | | // 计算平均雨强 |
| | | if (rainFallValues.value.length > 0) { |
| | | const sumIntensity = rainFallValues.value.reduce( |
| | | (sum, val) => sum + val, |
| | | 0 |
| | | ); |
| | | averageRainIntensity.value = sumIntensity / rainFallValues.value.length; |
| | | } else { |
| | | averageRainIntensity.value = 0; // 或者 null 表示无数据 |
| | | } |
| | | |
| | | console.log("平均雨强为:", averageRainIntensity.value); |
| | | |
| | | minRainValue.value = Math.min(...rainFallValues.value); |
| | | maxRainValue.value = Math.max(...rainFallValues.value); |
| | | |
| | |
| | | watersMaxHeight, |
| | | watersMinHeight |
| | | ); |
| | | const waterInfoArr = [watersMaxHeight] |
| | | schemWaterInfo.value = waterInfoArr |
| | | const waterInfoArr = [ |
| | | watersMaxHeight, |
| | | maxRainValue.value, |
| | | averageRainIntensity.value, |
| | | ]; |
| | | schemWaterInfo.value = waterInfoArr; |
| | | // 更新时间轴相关数据 |
| | | if (timestamps) { |
| | | frameNum.value = timestamps.length; |
| | |
| | | } |
| | | |
| | | async function endSimulation() { |
| | | clearAllPoints(); |
| | | simStore.openDia = true; |
| | | // 结束模拟之后清除layer列表 |
| | | simStore.rePlayList = []; |
| | | console.log(simStore.rePlayList, "结束模拟清除rePlayListrePlayList列表"); |