显示隐藏脉冲
This commit is contained in:
@@ -53,8 +53,7 @@
|
|||||||
// 进行模型计算
|
// 进行模型计算
|
||||||
$api.rainfall
|
$api.rainfall
|
||||||
.modelDeduction({
|
.modelDeduction({
|
||||||
disaster_name: `${Utils.formatDate('YYYYMMDDHHmmss', new Date('2025-09-16 20:00:00'))}暴雨自动推演`,
|
disaster_name: `${Utils.formatDate('YYYYMMDDHHmmss')}暴雨自动推演`,
|
||||||
occurred_time: '2025-09-16 20:00:00',
|
|
||||||
operation_type: '暴雨灾害链自动推演',
|
operation_type: '暴雨灾害链自动推演',
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ export const useRightHandle = () => {
|
|||||||
|
|
||||||
// 添加图例
|
// 添加图例
|
||||||
rainstormDeduction.addLegend();
|
rainstormDeduction.addLegend();
|
||||||
|
|
||||||
|
// 如果有脉冲,显示脉冲
|
||||||
|
CesiumUtilsSingleton.showPulseEffects();
|
||||||
} else {
|
} else {
|
||||||
// 关闭暴雨模拟:隐藏降雨栅格图层
|
// 关闭暴雨模拟:隐藏降雨栅格图层
|
||||||
statusStore.weatherLayers.showRainfallGrid.show = false;
|
statusStore.weatherLayers.showRainfallGrid.show = false;
|
||||||
@@ -35,8 +38,8 @@ export const useRightHandle = () => {
|
|||||||
// 隐藏步骤条
|
// 隐藏步骤条
|
||||||
statusStore.uiComponents.stepBar.show = false;
|
statusStore.uiComponents.stepBar.show = false;
|
||||||
|
|
||||||
// 删除脉冲
|
// 隐藏脉冲
|
||||||
CesiumUtilsSingleton.removeAllPulses();
|
CesiumUtilsSingleton.hidePulseEffects();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import {
|
|||||||
Color,
|
Color,
|
||||||
JulianDate,
|
JulianDate,
|
||||||
CallbackProperty,
|
CallbackProperty,
|
||||||
|
ConstantProperty,
|
||||||
HeightReference,
|
HeightReference,
|
||||||
VerticalOrigin,
|
VerticalOrigin,
|
||||||
HorizontalOrigin,
|
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({
|
viewer.entities.add({
|
||||||
id: pulseId,
|
id: pulseId,
|
||||||
position: Cartesian3.fromDegrees(lon, lat),
|
position: Cartesian3.fromDegrees(lon, lat),
|
||||||
properties: {pulseKey: key},
|
properties: { pulseKey: key },
|
||||||
billboard: {
|
billboard: {
|
||||||
image: this.#pulseCircleImage,
|
image: this.#pulseCircleImage,
|
||||||
width: new CallbackProperty((time) => {
|
width: new CallbackProperty((time) => {
|
||||||
const elapsed =
|
const elapsed =
|
||||||
JulianDate.secondsDifference(time, startTime) % duration;
|
JulianDate.secondsDifference(time, startTime) % duration;
|
||||||
const progress = elapsed / duration;
|
const progress = elapsed / duration;
|
||||||
return maxRadius * 2 * Math.abs(Math.sin(progress * Math.PI));
|
return maxRadius * 2 * Math.abs(Math.sin(progress * Math.PI));
|
||||||
}, false),
|
}, false),
|
||||||
height: new CallbackProperty((time) => {
|
height: new CallbackProperty((time) => {
|
||||||
const elapsed =
|
const elapsed =
|
||||||
JulianDate.secondsDifference(time, startTime) % duration;
|
JulianDate.secondsDifference(time, startTime) % duration;
|
||||||
const progress = elapsed / duration;
|
const progress = elapsed / duration;
|
||||||
return maxRadius * 2 * Math.abs(Math.sin(progress * Math.PI));
|
return maxRadius * 2 * Math.abs(Math.sin(progress * Math.PI));
|
||||||
}, false),
|
}, false),
|
||||||
color: new CallbackProperty((time) => {
|
color: new CallbackProperty((time) => {
|
||||||
const elapsed =
|
const elapsed =
|
||||||
JulianDate.secondsDifference(time, startTime) % duration;
|
JulianDate.secondsDifference(time, startTime) % duration;
|
||||||
const progress = elapsed / duration;
|
const progress = elapsed / duration;
|
||||||
const alpha = 0.7 * (1 - progress);
|
const alpha = 0.7 * (1 - progress);
|
||||||
return color.withAlpha(alpha);
|
return color.withAlpha(alpha);
|
||||||
|
|||||||
Reference in New Issue
Block a user