添加name记录
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 加载点
|
// 加载点
|
||||||
const ids: string[] = pointsHandle.addPoints(
|
const result: { ids: string[]; names: string[] } = pointsHandle.addPoints(
|
||||||
props.basePoints,
|
props.basePoints,
|
||||||
props.getDisasterIcon,
|
props.getDisasterIcon,
|
||||||
props.prefix,
|
props.prefix,
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
// 记录id
|
// 记录id
|
||||||
useLoadingResourceStore().addLoadingResource(
|
useLoadingResourceStore().addLoadingResource(
|
||||||
props.loadingResourceField!,
|
props.loadingResourceField!,
|
||||||
ids
|
result
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
// 记录行政区划id
|
// 记录行政区划id
|
||||||
useLoadingResourceStore().addLoadingResource(
|
useLoadingResourceStore().addLoadingResource(
|
||||||
LoadingResource.ADMINISTRATIVE_DIVISION,
|
LoadingResource.ADMINISTRATIVE_DIVISION,
|
||||||
areasId
|
{ ids: areasId, names: [] } // 此处name不进行记录
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -108,14 +108,14 @@
|
|||||||
CesiumUtilsSingleton.batchShowPrimitives(
|
CesiumUtilsSingleton.batchShowPrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(
|
useLoadingResourceStore().getLoadingResource(
|
||||||
LoadingResource.HIDDEN_DANGER_POINT
|
LoadingResource.HIDDEN_DANGER_POINT
|
||||||
)
|
).ids
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 隐藏隐患点
|
// 隐藏隐患点
|
||||||
CesiumUtilsSingleton.batchHidePrimitives(
|
CesiumUtilsSingleton.batchHidePrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(
|
useLoadingResourceStore().getLoadingResource(
|
||||||
LoadingResource.HIDDEN_DANGER_POINT
|
LoadingResource.HIDDEN_DANGER_POINT
|
||||||
)
|
).ids
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,13 +98,13 @@
|
|||||||
CesiumUtilsSingleton.batchShowPrimitives(
|
CesiumUtilsSingleton.batchShowPrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(
|
useLoadingResourceStore().getLoadingResource(
|
||||||
LoadingResource.RISK_POINT
|
LoadingResource.RISK_POINT
|
||||||
)
|
).ids
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
CesiumUtilsSingleton.batchHidePrimitives(
|
CesiumUtilsSingleton.batchHidePrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(
|
useLoadingResourceStore().getLoadingResource(
|
||||||
LoadingResource.RISK_POINT
|
LoadingResource.RISK_POINT
|
||||||
)
|
).ids
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<!-- 加载桥梁点 -->
|
<!-- 加载桥梁点 -->
|
||||||
<LoadingPoints
|
<LoadingPoints
|
||||||
v-if="
|
v-if="useStatusStore().appLoadingCompleted && bridgeList.length > 0"
|
||||||
useStatusStore().appLoadingCompleted && bridgeList.length > 0
|
|
||||||
"
|
|
||||||
:base-points="bridgeList"
|
:base-points="bridgeList"
|
||||||
:get-disaster-icon="getDisasterIcon"
|
:get-disaster-icon="getDisasterIcon"
|
||||||
:prefix="config.prefix.bridgePointId"
|
:prefix="config.prefix.bridgePointId"
|
||||||
@@ -101,16 +99,14 @@
|
|||||||
if (newValue) {
|
if (newValue) {
|
||||||
// 显示桥梁点
|
// 显示桥梁点
|
||||||
CesiumUtilsSingleton.batchShowPrimitives(
|
CesiumUtilsSingleton.batchShowPrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(
|
useLoadingResourceStore().getLoadingResource(LoadingResource.BRIDGE)
|
||||||
LoadingResource.BRIDGE
|
.ids
|
||||||
)
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 隐藏桥梁点
|
// 隐藏桥梁点
|
||||||
CesiumUtilsSingleton.batchHidePrimitives(
|
CesiumUtilsSingleton.batchHidePrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(
|
useLoadingResourceStore().getLoadingResource(LoadingResource.BRIDGE)
|
||||||
LoadingResource.BRIDGE
|
.ids
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,14 +103,14 @@
|
|||||||
CesiumUtilsSingleton.batchShowPrimitives(
|
CesiumUtilsSingleton.batchShowPrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(
|
useLoadingResourceStore().getLoadingResource(
|
||||||
LoadingResource.DANGEROUS_SOURCE
|
LoadingResource.DANGEROUS_SOURCE
|
||||||
)
|
).ids
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 隐藏危险源
|
// 隐藏危险源
|
||||||
CesiumUtilsSingleton.batchHidePrimitives(
|
CesiumUtilsSingleton.batchHidePrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(
|
useLoadingResourceStore().getLoadingResource(
|
||||||
LoadingResource.DANGEROUS_SOURCE
|
LoadingResource.DANGEROUS_SOURCE
|
||||||
)
|
).ids
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,14 +104,14 @@
|
|||||||
CesiumUtilsSingleton.batchShowPrimitives(
|
CesiumUtilsSingleton.batchShowPrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(
|
useLoadingResourceStore().getLoadingResource(
|
||||||
LoadingResource.EMERGENCY_SHELTER
|
LoadingResource.EMERGENCY_SHELTER
|
||||||
)
|
).ids
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 隐藏避难所
|
// 隐藏避难所
|
||||||
CesiumUtilsSingleton.batchHidePrimitives(
|
CesiumUtilsSingleton.batchHidePrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(
|
useLoadingResourceStore().getLoadingResource(
|
||||||
LoadingResource.EMERGENCY_SHELTER
|
LoadingResource.EMERGENCY_SHELTER
|
||||||
)
|
).ids
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,14 +103,14 @@
|
|||||||
CesiumUtilsSingleton.batchShowPrimitives(
|
CesiumUtilsSingleton.batchShowPrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(
|
useLoadingResourceStore().getLoadingResource(
|
||||||
LoadingResource.FIRE_STATION
|
LoadingResource.FIRE_STATION
|
||||||
)
|
).ids
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 隐藏消防站
|
// 隐藏消防站
|
||||||
CesiumUtilsSingleton.batchHidePrimitives(
|
CesiumUtilsSingleton.batchHidePrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(
|
useLoadingResourceStore().getLoadingResource(
|
||||||
LoadingResource.FIRE_STATION
|
LoadingResource.FIRE_STATION
|
||||||
)
|
).ids
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,11 +100,13 @@
|
|||||||
// 显示医院
|
// 显示医院
|
||||||
CesiumUtilsSingleton.batchShowPrimitives(
|
CesiumUtilsSingleton.batchShowPrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(LoadingResource.HOSPITAL)
|
useLoadingResourceStore().getLoadingResource(LoadingResource.HOSPITAL)
|
||||||
|
.ids
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 隐藏医院
|
// 隐藏医院
|
||||||
CesiumUtilsSingleton.batchHidePrimitives(
|
CesiumUtilsSingleton.batchHidePrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(LoadingResource.HOSPITAL)
|
useLoadingResourceStore().getLoadingResource(LoadingResource.HOSPITAL)
|
||||||
|
.ids
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,12 +99,16 @@
|
|||||||
if (newValue) {
|
if (newValue) {
|
||||||
// 显示水库
|
// 显示水库
|
||||||
CesiumUtilsSingleton.batchShowPrimitives(
|
CesiumUtilsSingleton.batchShowPrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(LoadingResource.RESERVOIR)
|
useLoadingResourceStore().getLoadingResource(
|
||||||
|
LoadingResource.RESERVOIR
|
||||||
|
).ids
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 隐藏水库
|
// 隐藏水库
|
||||||
CesiumUtilsSingleton.batchHidePrimitives(
|
CesiumUtilsSingleton.batchHidePrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(LoadingResource.RESERVOIR)
|
useLoadingResourceStore().getLoadingResource(
|
||||||
|
LoadingResource.RESERVOIR
|
||||||
|
).ids
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,11 +100,13 @@
|
|||||||
// 显示学校
|
// 显示学校
|
||||||
CesiumUtilsSingleton.batchShowPrimitives(
|
CesiumUtilsSingleton.batchShowPrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(LoadingResource.SCHOOL)
|
useLoadingResourceStore().getLoadingResource(LoadingResource.SCHOOL)
|
||||||
|
.ids
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 隐藏学校
|
// 隐藏学校
|
||||||
CesiumUtilsSingleton.batchHidePrimitives(
|
CesiumUtilsSingleton.batchHidePrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(LoadingResource.SCHOOL)
|
useLoadingResourceStore().getLoadingResource(LoadingResource.SCHOOL)
|
||||||
|
.ids
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<!-- 加载物资储备点 -->
|
<!-- 加载物资储备点 -->
|
||||||
<LoadingPoints
|
<LoadingPoints
|
||||||
v-if="
|
v-if="useStatusStore().appLoadingCompleted && storePointsList.length > 0"
|
||||||
useStatusStore().appLoadingCompleted && storePointsList.length > 0
|
|
||||||
"
|
|
||||||
:base-points="storePointsList"
|
:base-points="storePointsList"
|
||||||
:get-disaster-icon="getDisasterIcon"
|
:get-disaster-icon="getDisasterIcon"
|
||||||
:prefix="config.prefix.storePointsPointId"
|
:prefix="config.prefix.storePointsPointId"
|
||||||
@@ -103,14 +101,14 @@
|
|||||||
CesiumUtilsSingleton.batchShowPrimitives(
|
CesiumUtilsSingleton.batchShowPrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(
|
useLoadingResourceStore().getLoadingResource(
|
||||||
LoadingResource.STORE_POINTS
|
LoadingResource.STORE_POINTS
|
||||||
)
|
).ids
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 隐藏物资储备点
|
// 隐藏物资储备点
|
||||||
CesiumUtilsSingleton.batchHidePrimitives(
|
CesiumUtilsSingleton.batchHidePrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(
|
useLoadingResourceStore().getLoadingResource(
|
||||||
LoadingResource.STORE_POINTS
|
LoadingResource.STORE_POINTS
|
||||||
)
|
).ids
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
<div>
|
<div>
|
||||||
<!-- 加载地铁站点点位 -->
|
<!-- 加载地铁站点点位 -->
|
||||||
<LoadingPoints
|
<LoadingPoints
|
||||||
v-if="useStatusStore().appLoadingCompleted && subwayStationList.length > 0"
|
v-if="
|
||||||
|
useStatusStore().appLoadingCompleted && subwayStationList.length > 0
|
||||||
|
"
|
||||||
:base-points="subwayStationList"
|
:base-points="subwayStationList"
|
||||||
:get-disaster-icon="getDisasterIcon"
|
:get-disaster-icon="getDisasterIcon"
|
||||||
:prefix="config.prefix.subwayStationPointId"
|
:prefix="config.prefix.subwayStationPointId"
|
||||||
@@ -99,12 +101,16 @@
|
|||||||
if (newValue) {
|
if (newValue) {
|
||||||
// 显示地铁站点
|
// 显示地铁站点
|
||||||
CesiumUtilsSingleton.batchShowPrimitives(
|
CesiumUtilsSingleton.batchShowPrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(LoadingResource.SUBWAY_STATION)
|
useLoadingResourceStore().getLoadingResource(
|
||||||
|
LoadingResource.SUBWAY_STATION
|
||||||
|
).ids
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 隐藏地铁站点
|
// 隐藏地铁站点
|
||||||
CesiumUtilsSingleton.batchHidePrimitives(
|
CesiumUtilsSingleton.batchHidePrimitives(
|
||||||
useLoadingResourceStore().getLoadingResource(LoadingResource.SUBWAY_STATION)
|
useLoadingResourceStore().getLoadingResource(
|
||||||
|
LoadingResource.SUBWAY_STATION
|
||||||
|
).ids
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,12 +26,13 @@ export const usePointsHandle = () => {
|
|||||||
getDisasterIcon: (disasterType?: string) => string,
|
getDisasterIcon: (disasterType?: string) => string,
|
||||||
prefix: string,
|
prefix: string,
|
||||||
isDefault: boolean = false
|
isDefault: boolean = false
|
||||||
): string[] {
|
): { ids: string[]; names: string[] } {
|
||||||
// 设置加载配置
|
// 设置加载配置
|
||||||
const options: PrimitiveOptions[] = [];
|
const options: PrimitiveOptions[] = [];
|
||||||
|
|
||||||
// 存放id
|
// 存放id、name
|
||||||
const ids: string[] = [];
|
const ids: string[] = [];
|
||||||
|
const names: string[] = [];
|
||||||
|
|
||||||
points.forEach((point) => {
|
points.forEach((point) => {
|
||||||
try {
|
try {
|
||||||
@@ -42,7 +43,10 @@ export const usePointsHandle = () => {
|
|||||||
const position = Cartesian3.fromDegrees(point.lon, point.lat, 10);
|
const position = Cartesian3.fromDegrees(point.lon, point.lat, 10);
|
||||||
|
|
||||||
const id = `${prefix}${point.id}`;
|
const id = `${prefix}${point.id}`;
|
||||||
|
const name = point.name!;
|
||||||
ids.push(id);
|
ids.push(id);
|
||||||
|
names.push(name);
|
||||||
|
|
||||||
options.push({
|
options.push({
|
||||||
id: id,
|
id: id,
|
||||||
type: 'billboard',
|
type: 'billboard',
|
||||||
@@ -65,7 +69,7 @@ export const usePointsHandle = () => {
|
|||||||
// 批量创建图层
|
// 批量创建图层
|
||||||
CesiumUtilsSingleton.addPrimitivesBatch(options);
|
CesiumUtilsSingleton.addPrimitivesBatch(options);
|
||||||
|
|
||||||
return ids;
|
return { ids, names };
|
||||||
}
|
}
|
||||||
|
|
||||||
return { addPoints };
|
return { addPoints };
|
||||||
|
|||||||
@@ -4,12 +4,15 @@ import { ref, type Ref } from 'vue';
|
|||||||
|
|
||||||
// 存储按需加载的数据
|
// 存储按需加载的数据
|
||||||
export const useLoadingResourceStore = defineStore('loadingResource', () => {
|
export const useLoadingResourceStore = defineStore('loadingResource', () => {
|
||||||
const loadingResource: Ref<Partial<Record<LoadingResource, string[]>>> = ref(
|
const loadingResource: Ref<
|
||||||
{}
|
Partial<Record<LoadingResource, { ids: string[]; names: string[] }>>
|
||||||
);
|
> = ref({});
|
||||||
|
|
||||||
// 添加数据
|
// 添加数据
|
||||||
const addLoadingResource = (key: LoadingResource, value: string[]) => {
|
const addLoadingResource = (
|
||||||
|
key: LoadingResource,
|
||||||
|
value: { ids: string[]; names: string[] }
|
||||||
|
) => {
|
||||||
loadingResource.value[key] = value;
|
loadingResource.value[key] = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -24,7 +27,7 @@ export const useLoadingResourceStore = defineStore('loadingResource', () => {
|
|||||||
* 获取数据
|
* 获取数据
|
||||||
*/
|
*/
|
||||||
const getLoadingResource = (key: LoadingResource) => {
|
const getLoadingResource = (key: LoadingResource) => {
|
||||||
return loadingResource.value[key] || [];
|
return loadingResource.value[key] || { ids: [], names: [] };
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -12,4 +12,6 @@ export interface Point {
|
|||||||
geom?: string;
|
geom?: string;
|
||||||
/** 灾害类型 */
|
/** 灾害类型 */
|
||||||
disasterType?: string;
|
disasterType?: string;
|
||||||
|
/** 名称 */
|
||||||
|
name?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user