2026-04-21 19:50:57 +08:00
|
|
|
import { useStatusStore } from '@/stores/useStatusStore.ts';
|
|
|
|
|
import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils.ts';
|
2026-04-18 17:34:46 +08:00
|
|
|
import config from '@/config/config.json';
|
2026-05-06 17:44:30 +08:00
|
|
|
import { useLeftLegendStore } from '@/stores/useLeftLegendStore';
|
2026-05-06 18:17:54 +08:00
|
|
|
import { useScene } from '../useScene';
|
2026-05-07 10:39:34 +08:00
|
|
|
import { useRainstormDeduction } from '../rainstorm/useRainstormDeduction';
|
2026-04-18 17:34:46 +08:00
|
|
|
|
|
|
|
|
export const useRightHandle = () => {
|
2026-05-07 13:08:30 +08:00
|
|
|
const statusStore = useStatusStore();
|
|
|
|
|
const leftLegendStore = useLeftLegendStore();
|
|
|
|
|
const scene = useScene();
|
|
|
|
|
const rainstormDeduction = useRainstormDeduction();
|
2026-05-05 17:09:32 +08:00
|
|
|
/**
|
|
|
|
|
* 暴雨模拟
|
|
|
|
|
* @param status - 状态
|
|
|
|
|
*/
|
|
|
|
|
const rainstormSimulation = (status: unknown) => {
|
|
|
|
|
if (status as boolean) {
|
2026-05-07 10:39:34 +08:00
|
|
|
// 显示步骤
|
2026-05-07 13:08:30 +08:00
|
|
|
rainstormDeduction.showStep();
|
2026-05-07 10:39:34 +08:00
|
|
|
|
2026-05-05 19:17:58 +08:00
|
|
|
// 开启暴雨模拟:显示降雨栅格图层
|
2026-05-07 13:08:30 +08:00
|
|
|
statusStore.weatherLayers.showRainfallGrid.loading = true;
|
|
|
|
|
statusStore.weatherLayers.showRainfallGrid.show = true;
|
2026-05-06 17:44:30 +08:00
|
|
|
|
2026-05-06 18:02:56 +08:00
|
|
|
// 添加图例
|
2026-05-07 13:08:30 +08:00
|
|
|
rainstormDeduction.addLegend();
|
2026-05-05 19:17:58 +08:00
|
|
|
} else {
|
|
|
|
|
// 关闭暴雨模拟:隐藏降雨栅格图层
|
2026-05-07 13:08:30 +08:00
|
|
|
statusStore.weatherLayers.showRainfallGrid.show = false;
|
2026-05-06 17:44:30 +08:00
|
|
|
|
2026-05-06 18:02:56 +08:00
|
|
|
// 删除图例
|
2026-05-07 13:08:30 +08:00
|
|
|
delete leftLegendStore.legendListInfo.precipitation;
|
2026-05-07 10:39:34 +08:00
|
|
|
|
|
|
|
|
// 隐藏步骤条
|
2026-05-07 13:08:30 +08:00
|
|
|
statusStore.uiComponents.stepBar.show = false;
|
2026-06-16 10:03:46 +08:00
|
|
|
|
|
|
|
|
// 删除脉冲
|
|
|
|
|
CesiumUtilsSingleton.removeAllPulses();
|
2026-05-05 17:09:32 +08:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-04-18 17:34:46 +08:00
|
|
|
/**
|
|
|
|
|
* 重置场景
|
|
|
|
|
*/
|
|
|
|
|
const resetScene = () => {
|
|
|
|
|
CesiumUtilsSingleton.clearAllResources('custom');
|
2026-05-07 13:08:30 +08:00
|
|
|
scene.resetScene();
|
2026-05-06 18:17:54 +08:00
|
|
|
// 隐藏加载
|
2026-05-07 13:08:30 +08:00
|
|
|
statusStore.appLoadingCompleted = true;
|
2026-04-18 17:34:46 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 重置视角
|
|
|
|
|
*/
|
|
|
|
|
const resetView = () => {
|
|
|
|
|
CesiumUtilsSingleton.flyToTarget(
|
|
|
|
|
config.defaultPosition as [number, number, number]
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2026-05-05 17:09:32 +08:00
|
|
|
return { rainstormSimulation, resetScene, resetView };
|
2026-04-18 17:34:46 +08:00
|
|
|
};
|