修改添加gsojson的isdefault,方便重置场景

This commit is contained in:
wzy-warehouse
2026-04-14 17:05:27 +08:00
parent d6f488bb3e
commit df1fb2aea3
8 changed files with 12 additions and 9 deletions
+1 -1
View File
@@ -19,9 +19,9 @@
const layerConfigs = areasId.map((id, index) => ({
layerId: id,
geojsonData: areas[index],
isDefault: true,
options: {
showName: true,
isDefault: true,
labelStyle: {
labelText: areas[index].features[0].properties.name,
center: [
@@ -10,6 +10,7 @@
:get-disaster-icon="getDisasterIcon"
:prefix="config.prefix.hiddenDangerPointId"
:show-points="useStatusStore().getHiddenDangerPointShow()"
:is-default="true"
/>
<!-- 显示信息框 -->
@@ -15,6 +15,7 @@
getDisasterIcon: (disasterType?: string) => string;
prefix: string;
showPoints: boolean;
isDefault?: boolean;
}>();
// 点处理钩子
@@ -25,7 +26,8 @@
const ids: string[] = pointsHandle.addPoints(
props.basePoints,
props.getDisasterIcon,
props.prefix
props.prefix,
props.isDefault
);
// 显示隐藏点
@@ -8,6 +8,7 @@
:get-disaster-icon="getDisasterIcon"
:prefix="config.prefix.riskPointId"
:show-points="useStatusStore().getRiskPointShow()"
:is-default="true"
/>
<!-- 显示信息框 -->
+4 -2
View File
@@ -18,12 +18,14 @@ export const usePointsHandle = () => {
* @param points - 点数据数组
* @param getDisasterIcon - 获取灾害图标的函数
* @param prefix - 前缀
* @param isDefault - 是否为默认图元,默认false
* @returns 点的ID列表
*/
function addPoints(
points: Point[],
getDisasterIcon: (disasterType?: string) => string,
prefix: string
prefix: string,
isDefault: boolean = false
): string[] {
// 设置加载配置
const options: PrimitiveOptions[] = [];
@@ -48,7 +50,7 @@ export const usePointsHandle = () => {
image: getDisasterIcon(point.disasterType),
scale: 0.8,
width: 40,
isDefault: false,
isDefault: isDefault,
scaleByDistance: new NearFarScalar(500, 1, 5e5, 0.3),
customProperties: {
verticalOrigin: VerticalOrigin.BOTTOM,
+2 -3
View File
@@ -197,7 +197,7 @@ export class CesiumUtils {
}
/**
* 批量添加 Primitive(优化版本)
* 批量添加 Primitive
* - 按类型分组后批量创建,减少 scene.primitives.add 调用次数
* - 同类型的多个实例合并到一个 Primitive 或 BillboardCollection 中
* @param primitives - Primitive 配置选项数组
@@ -384,13 +384,12 @@ export class CesiumUtils {
/**
* 批量添加GeoJSON图层
* @param layerConfigs - 图层配置数组,每个元素包含 layerId、geojsonData、isDefault 和 options
* @param layerConfigs - 图层配置数组,每个元素包含 layerId、geojsonData 和 options
*/
async batchAddGeoJsonLayers(
layerConfigs: Array<{
layerId: string;
geojsonData: CustomizeGeoJsonDataSource;
isDefault?: boolean;
options?: GeoJsonOptions;
}>
): Promise<void> {
-1
View File
@@ -136,7 +136,6 @@ export class EntityManager {
*/
clearAllEntities(clearType: 'default' | 'custom' | 'all' = 'custom'): void {
const targetIds = this.#getTargetIdsByType(clearType);
targetIds.forEach((id) => {
const entity = this.#viewer.entities.getById(id);
if (entity) this.#viewer.entities.remove(entity);
-1
View File
@@ -103,7 +103,6 @@ export class PrimitiveManager {
*/
clearAllPrimitives(clearType: 'default' | 'custom' | 'all' = 'custom'): void {
const targetMap = this.#getTargetMapByType(clearType);
targetMap.forEach((primitive) => {
this.#viewer.scene.primitives.remove(primitive);
});