关闭自动推演时候清除脉冲实体

This commit is contained in:
wzy-warehouse
2026-06-16 10:03:46 +08:00
parent 2e2cbcb18d
commit ec15cd194b
2 changed files with 18 additions and 15 deletions
@@ -34,6 +34,9 @@ export const useRightHandle = () => {
// 隐藏步骤条
statusStore.uiComponents.stepBar.show = false;
// 删除脉冲
CesiumUtilsSingleton.removeAllPulses();
}
};
+15 -15
View File
@@ -552,7 +552,7 @@ export class CesiumUtils {
this.clearAllPrimitives(clearType);
this.clearAllLayers(clearType);
this.clearAllGeoJsonLayers(clearType);
this.#removeAllPulses();
this.removeAllPulses();
}
// ===================== getter 和 setter函数 =====================
@@ -637,7 +637,7 @@ export class CesiumUtils {
if (!viewer) return;
// 移除已有脉冲
this.#removeAllPulses();
this.removeAllPulses();
// 生成圆形贴图
if (!this.#pulseCircleImage) {
@@ -665,6 +665,15 @@ export class CesiumUtils {
}
}
/**
* 移除所有脉冲实体
*/
removeAllPulses(): void {
for (const key of Object.keys(this.#pulseMap)) {
this.#deletePulseEntity(key);
}
}
// ===================== 私有方法 =====================
/**
@@ -720,24 +729,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);
@@ -751,15 +760,6 @@ export class CesiumUtils {
});
}
/**
* 移除所有脉冲实体
*/
#removeAllPulses(): void {
for (const key of Object.keys(this.#pulseMap)) {
this.#deletePulseEntity(key);
}
}
/**
* 删除单个脉冲实体
* @param key - 脉冲映射 key