| | |
| | | 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 isFinish = ref(true); |
| | | |
| | | const treeMap = new Map(); |
| | | |
| | | |
| | | |
| | | |
| | | // 提供方法给所有子组件 |
| | | provide("simulateActions", { |
| | |
| | | } |
| | | // 定义全局变量存储当前正在闪动的面片 |
| | | let flashingPolygon = null; |
| | | |
| | | // 添加事件监听器,接收来自表格组件的事件 |
| | | function setupRowClickListener(dataSources) { |
| | | if (!Array.isArray(dataSources) || dataSources.length === 0) { |
| | | console.error("Data sources array is undefined or empty!"); |
| | | return; |
| | | } |
| | | |
| | | EventBus.on("row-clicked", (id) => { |
| | | const clickedEntity = findEntityById(id, dataSources); |
| | | if (clickedEntity) { |
| | | // 如果点击的是同一个实体,则停止闪动并清空选择 |
| | | if (flashingPolygon && flashingPolygon === clickedEntity) { |
| | | stopFlashing(flashingPolygon); |
| | | flashingPolygon = null; // 清空当前选中的实体 |
| | | return; |
| | | } |
| | | // 如果有其他实体正在闪动,先停止它的闪动 |
| | | if (flashingPolygon && flashingPolygon !== clickedEntity) { |
| | | stopFlashing(flashingPolygon); |
| | | } |
| | | |
| | | // 开始新的闪动 |
| | | startFlashing(clickedEntity); |
| | | flashingPolygon = clickedEntity; |
| | | } else { |
| | | console.warn(`No entity found with ID: ${id}`); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 根据ID查找实体 |
| | | function findEntityById(id, dataSources) { |
| | | if (!Array.isArray(dataSources) || dataSources.length === 0) { |
| | | console.error("Data sources array is undefined or empty!"); |
| | | return null; |
| | | } |
| | | |
| | | console.log("Searching for ID:", id); |
| | | for (const dataSource of dataSources) { |
| | | const entities = dataSource.entities.values; |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | // 开始闪动效果 |
| | | function startFlashing(polygonEntity) { |
| | | // 存储原始颜色 |
| | | const originalColor = polygonEntity.polygon.material.color.getValue(); |
| | | polygonEntity._originalColor = originalColor; // 将原始颜色保存到实体中 |
| | | |
| | | // 创建颜色变化的回调函数 |
| | | let isFlashing = true; // 标记是否正在闪动 |
| | | polygonEntity.polygon.material = new Cesium.ColorMaterialProperty( |
| | |
| | | : originalColor; |
| | | }, false) |
| | | ); |
| | | |
| | | // 将闪动状态保存到实体上,便于后续控制 |
| | | polygonEntity._isFlashing = isFlashing; |
| | | } |
| | |
| | | polygonEntity.polygon.material = new Cesium.ColorMaterialProperty( |
| | | originalColor |
| | | ); |
| | | |
| | | // 清空闪动状态 |
| | | polygonEntity._isFlashing = false; |
| | | polygonEntity._originalColor = null; // 清除保存的原始颜色 |