diff --git a/src/component/rain-earthquake/detail-panels/RainfallGridComponent.vue b/src/component/rain-earthquake/detail-panels/RainfallGridComponent.vue index bc62b7e..7f025d3 100644 --- a/src/component/rain-earthquake/detail-panels/RainfallGridComponent.vue +++ b/src/component/rain-earthquake/detail-panels/RainfallGridComponent.vue @@ -53,8 +53,7 @@ // 进行模型计算 $api.rainfall .modelDeduction({ - disaster_name: `${Utils.formatDate('YYYYMMDDHHmmss', new Date('2025-09-16 20:00:00'))}暴雨自动推演`, - occurred_time: '2025-09-16 20:00:00', + disaster_name: `${Utils.formatDate('YYYYMMDDHHmmss')}暴雨自动推演`, operation_type: '暴雨灾害链自动推演', }) .then((res) => { diff --git a/src/hooks/rain-earthquake/useRightHandle.ts b/src/hooks/rain-earthquake/useRightHandle.ts index 5b6b90a..f208e07 100644 --- a/src/hooks/rain-earthquake/useRightHandle.ts +++ b/src/hooks/rain-earthquake/useRightHandle.ts @@ -25,6 +25,9 @@ export const useRightHandle = () => { // 添加图例 rainstormDeduction.addLegend(); + + // 如果有脉冲,显示脉冲 + CesiumUtilsSingleton.showPulseEffects(); } else { // 关闭暴雨模拟:隐藏降雨栅格图层 statusStore.weatherLayers.showRainfallGrid.show = false; @@ -35,8 +38,8 @@ export const useRightHandle = () => { // 隐藏步骤条 statusStore.uiComponents.stepBar.show = false; - // 删除脉冲 - CesiumUtilsSingleton.removeAllPulses(); + // 隐藏脉冲 + CesiumUtilsSingleton.hidePulseEffects(); } }; diff --git a/src/utils/cesium/CesiumUtils.ts b/src/utils/cesium/CesiumUtils.ts index 851959b..a7f6ce7 100644 --- a/src/utils/cesium/CesiumUtils.ts +++ b/src/utils/cesium/CesiumUtils.ts @@ -22,6 +22,7 @@ import { Color, JulianDate, CallbackProperty, + ConstantProperty, HeightReference, VerticalOrigin, HorizontalOrigin, @@ -674,6 +675,38 @@ export class CesiumUtils { } } + /** + * 隐藏所有脉冲效果 + */ + hidePulseEffects(): void { + const viewer = this.getViewer(); + if (!viewer) return; + + for (const key of Object.keys(this.#pulseMap)) { + const entry = this.#pulseMap[key]; + const entity = viewer.entities.getById(entry.pulseId); + if (entity && entity.billboard) { + entity.billboard.show = new ConstantProperty(false); + } + } + } + + /** + * 显示所有脉冲效果 + */ + showPulseEffects(): void { + const viewer = this.getViewer(); + if (!viewer) return; + + for (const key of Object.keys(this.#pulseMap)) { + const entry = this.#pulseMap[key]; + const entity = viewer.entities.getById(entry.pulseId); + if (entity && entity.billboard) { + entity.billboard.show = new ConstantProperty(true); + } + } + } + // ===================== 私有方法 ===================== /** @@ -729,24 +762,24 @@ export class CesiumUtils { viewer.entities.add({ id: pulseId, position: Cartesian3.fromDegrees(lon, lat), - properties: {pulseKey: key}, + properties: { pulseKey: key }, billboard: { image: this.#pulseCircleImage, width: new CallbackProperty((time) => { const elapsed = - JulianDate.secondsDifference(time, startTime) % duration; + JulianDate.secondsDifference(time, startTime) % duration; const progress = elapsed / duration; return maxRadius * 2 * Math.abs(Math.sin(progress * Math.PI)); }, false), height: new CallbackProperty((time) => { const elapsed = - JulianDate.secondsDifference(time, startTime) % duration; + JulianDate.secondsDifference(time, startTime) % duration; const progress = elapsed / duration; return maxRadius * 2 * Math.abs(Math.sin(progress * Math.PI)); }, false), color: new CallbackProperty((time) => { const elapsed = - JulianDate.secondsDifference(time, startTime) % duration; + JulianDate.secondsDifference(time, startTime) % duration; const progress = elapsed / duration; const alpha = 0.7 * (1 - progress); return color.withAlpha(alpha);