diff --git a/src/App.vue b/src/App.vue
index da0ff03..0571eb9 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -6,7 +6,7 @@
import { RouterView } from 'vue-router';
import { ElLoading } from 'element-plus';
import { watch } from 'vue';
- import { useViewerStore } from './stores/useViewerStore';
+ import { useStatusStore } from './stores/useStatusStore';
const loadingOption = {
fullscreen: true,
@@ -16,7 +16,7 @@
let loadingInstanve = ElLoading.service(loadingOption);
watch(
- () => useViewerStore().getViewerLoadingCompleted(),
+ () => useStatusStore().getAppLoadingCompleted(),
(val) => {
if (val) {
loadingInstanve.close();
diff --git a/src/component/map/AdministrativeDivision.vue b/src/component/map/AdministrativeDivision.vue
index 03b9a75..84e05cd 100644
--- a/src/component/map/AdministrativeDivision.vue
+++ b/src/component/map/AdministrativeDivision.vue
@@ -5,6 +5,7 @@
diff --git a/src/component/map/MapComponent.vue b/src/component/map/MapComponent.vue
index b15b71d..85e86ac 100644
--- a/src/component/map/MapComponent.vue
+++ b/src/component/map/MapComponent.vue
@@ -2,14 +2,14 @@
-
+
diff --git a/src/component/rain-earthquake/RiskPointComponent.vue b/src/component/rain-earthquake/RiskPointComponent.vue
index 18911c7..dde45ce 100644
--- a/src/component/rain-earthquake/RiskPointComponent.vue
+++ b/src/component/rain-earthquake/RiskPointComponent.vue
@@ -3,12 +3,11 @@
@@ -31,7 +30,7 @@
import LoadingPoints from '@/component/rain-earthquake/LoadingPoints.vue';
import config from '@/config/config.json';
import InformationBox from '@/component/common/InformationBox.vue';
- import { useViewerStore } from '@/stores/useViewerStore';
+ import { useStatusStore } from '@/stores/useStatusStore';
import { useLoadingInformationStore } from '@/stores/useLoadingInformation';
import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils';
import { useRiskPoint } from '@/hooks/rain-earthquake/useRiskPoint';
diff --git a/src/stores/useStatusStore.ts b/src/stores/useStatusStore.ts
new file mode 100644
index 0000000..f89570a
--- /dev/null
+++ b/src/stores/useStatusStore.ts
@@ -0,0 +1,131 @@
+import { defineStore } from 'pinia';
+import { type Ref, ref } from 'vue';
+
+/**
+ * 全局状态管理
+ * @returns 应用状态及相关方法
+ */
+export const useStatusStore = defineStore('status', () => {
+ /**
+ * 应用加载完成状态
+ */
+ const appLoadingCompleted: Ref
= ref(false);
+
+ /**
+ * 显示行政区划
+ */
+ const showAdministrativeDivision = ref(true);
+
+ /**
+ * 灾情链影响点表格显示状态
+ */
+ const disasterChainPointShow = ref(false);
+
+ /**
+ * 图例显示状态
+ */
+ const legendShow = ref(true);
+
+ /**
+ * 隐患点显示状态
+ */
+ const hiddenDangerPointShow = ref(true);
+
+ /**
+ * 风险点显示状态
+ */
+ const riskPointShow = ref(true);
+
+ /**
+ * 获取应用加载完成状态
+ * @returns 加载完成状态
+ */
+ const getAppLoadingCompleted = () => appLoadingCompleted.value;
+ /**
+ * 设置应用加载完成状态
+ * @param value - 加载完成状态
+ */
+ const setAppLoadingCompleted = (value: boolean) => {
+ appLoadingCompleted.value = value;
+ };
+
+ /**
+ * 获取显示行政区划
+ * @returns 显示行政区划
+ */
+ const getShowAdministrativeDivision = () => showAdministrativeDivision.value;
+ /**
+ * 设置显示行政区划
+ * @param value - 显示行政区划
+ */
+ const setShowAdministrativeDivision = (value: boolean) => {
+ showAdministrativeDivision.value = value;
+ };
+
+ /**
+ * 获取灾情链影响点表格显示状态
+ * @returns 灾情链影像点表格显示状态
+ */
+ const getDisasterChainPointShow = () => disasterChainPointShow.value;
+ /**
+ * 设置灾情链影响点表格显示状态
+ * @param value - 灾情链影像点表格显示状态
+ */
+ const setDisasterChainPointShow = (value: boolean) => {
+ disasterChainPointShow.value = value;
+ };
+
+ /**
+ * 获取图例显示状态
+ * @returns 图例显示状态
+ */
+ const getLegendShow = () => legendShow.value;
+ /**
+ * 设置图例显示状态
+ * @param value - 图例显示状态
+ */
+ const setLegendShow = (value: boolean) => {
+ legendShow.value = value;
+ };
+
+ /**
+ * 获取隐患点显示状态
+ * @returns 隐患点显示状态
+ */
+ const getHiddenDangerPointShow = () => hiddenDangerPointShow.value;
+ /**
+ * 设置隐患点显示状态
+ * @param value - 隐患点显示状态
+ */
+ const setHiddenDangerPointShow = (value: boolean) => {
+ hiddenDangerPointShow.value = value;
+ };
+
+ /**
+ * 获取风险点显示状态
+ * @returns 风险点显示状态
+ */
+ const getRiskPointShow = () => riskPointShow.value;
+ /**
+ * 设置风险点显示状态
+ * @param value - 风险点显示状态
+ */
+ const setRiskPointShow = (value: boolean) => {
+ riskPointShow.value = value;
+ };
+
+ return {
+ getAppLoadingCompleted,
+ setAppLoadingCompleted,
+ getShowAdministrativeDivision,
+ setShowAdministrativeDivision,
+ getDisasterChainPointShow,
+ setDisasterChainPointShow,
+ getLegendShow,
+ setLegendShow,
+ getHiddenDangerPointShow,
+ setHiddenDangerPointShow,
+ getRiskPointShow,
+ setRiskPointShow,
+ };
+});
diff --git a/src/stores/useViewerStore.ts b/src/stores/useViewerStore.ts
deleted file mode 100644
index 09a639a..0000000
--- a/src/stores/useViewerStore.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { defineStore } from 'pinia';
-import { type Ref, ref } from 'vue';
-
-/**
- * Viewer加载状态管理
- * @returns Viewer加载完成状态及相关方法
- */
-export const useViewerStore = defineStore('viewer', () => {
- /**
- * Viewer加载完成状态
- */
- const viewerLoadingCompleted: Ref = ref(false);
-
- /**
- * 获取Viewer加载完成状态
- * @returns 加载完成状态
- */
- const getViewerLoadingCompleted = () => viewerLoadingCompleted.value;
- /**
- * 设置Viewer加载完成状态
- * @param value - 加载完成状态
- */
- const setViewerLoadingCompleted = (value: boolean) => {
- viewerLoadingCompleted.value = value;
- };
-
- return { getViewerLoadingCompleted, setViewerLoadingCompleted };
-});
diff --git a/src/utils/cesium/CesiumUtils.ts b/src/utils/cesium/CesiumUtils.ts
index 670c486..78d82b0 100644
--- a/src/utils/cesium/CesiumUtils.ts
+++ b/src/utils/cesium/CesiumUtils.ts
@@ -246,6 +246,34 @@ export class CesiumUtils {
return this.#primitiveManager!.getPrimitiveIds(clearType);
}
+ /**
+ * 批量切换Primitives可见性
+ * @param ids - Primitive ID 数组
+ * @param visible - 是否可见
+ */
+ batchTogglePrimitives(ids: string[], visible: boolean): void {
+ this.#checkManager(this.#primitiveManager, 'PrimitiveManager');
+ this.#primitiveManager!.batchTogglePrimitives(ids, visible);
+ }
+
+ /**
+ * 批量显示Primitives
+ * @param ids - Primitive ID 数组
+ */
+ batchShowPrimitives(ids: string[]): void {
+ this.#checkManager(this.#primitiveManager, 'PrimitiveManager');
+ this.#primitiveManager!.batchShowPrimitives(ids);
+ }
+
+ /**
+ * 批量隐藏Primitives
+ * @param ids - Primitive ID 数组
+ */
+ batchHidePrimitives(ids: string[]): void {
+ this.#checkManager(this.#primitiveManager, 'PrimitiveManager');
+ this.#primitiveManager!.batchHidePrimitives(ids);
+ }
+
// ===================== 图层管理 =====================
/**
diff --git a/src/utils/cesium/PrimitiveManager.ts b/src/utils/cesium/PrimitiveManager.ts
index 6fe41e1..0eaa1be 100644
--- a/src/utils/cesium/PrimitiveManager.ts
+++ b/src/utils/cesium/PrimitiveManager.ts
@@ -122,6 +122,44 @@ export class PrimitiveManager {
return this.#getTargetIdsByType(clearType);
}
+ /**
+ * 批量显示或隐藏Primitive
+ * @param ids - Primitive ID 数组
+ * @param visible - 是否显示
+ */
+ batchTogglePrimitives(ids: string[], visible: boolean): void {
+ const uniquePrimitives = new Set();
+
+ for (const id of ids) {
+ const primitive = this.getPrimitiveById(id);
+ if (primitive) {
+ uniquePrimitives.add(primitive);
+ } else {
+ console.warn(`Primitive ID "${id}" 不存在,无法设置显示`);
+ }
+ }
+
+ for (const primitive of uniquePrimitives) {
+ primitive.show = visible;
+ }
+ }
+
+ /**
+ * 批量显示Primitive
+ * @param ids - Primitive ID 数组
+ */
+ batchShowPrimitives(ids: string[]): void {
+ this.batchTogglePrimitives(ids, true);
+ }
+
+ /**
+ * 批量隐藏Primitive
+ * @param ids - Primitive ID 数组
+ */
+ batchHidePrimitives(ids: string[]): void {
+ this.batchTogglePrimitives(ids, false);
+ }
+
// ===================== 私有方法 =====================
#groupPrimitivesByType(primitives: PrimitiveOptions[]) {
diff --git a/src/views/IndexView.vue b/src/views/IndexView.vue
index 0c5b5d3..eef6415 100644
--- a/src/views/IndexView.vue
+++ b/src/views/IndexView.vue
@@ -10,7 +10,7 @@