From ea50fa9068ef72cddc9e5a695c24c2820220a627 Mon Sep 17 00:00:00 2001 From: liuxianghui <519646741@qq.com> Date: Fri, 5 Nov 2021 16:26:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=B1=95=E7=A4=BA=E5=90=84?= =?UTF-8?q?=E4=B8=AA=E6=A8=A1=E5=9D=97=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/model-data/model-data-facility.ts | 7 ++- .../view/building-window/building-window.ts | 33 ++++++++++++- .../view/facility-window/facility-window.ts | 48 ++++++++++++++++++- .../view/toolbar-window/toobar-window.ts | 8 ++++ 4 files changed, 91 insertions(+), 5 deletions(-) diff --git a/src/app/babylon/model/data/model-data/model-data-facility.ts b/src/app/babylon/model/data/model-data/model-data-facility.ts index 18f62b6..d01fbfe 100644 --- a/src/app/babylon/model/data/model-data/model-data-facility.ts +++ b/src/app/babylon/model/data/model-data/model-data-facility.ts @@ -250,7 +250,12 @@ export enum FacilityType { /** * 疏散点 */ - XF_SSD = "XF_SSD" + XF_SSD = "XF_SSD", + + /** + * 罩棚 + */ + ZD_ZP = "ZD_ZP", } diff --git a/src/app/babylon/view/building-window/building-window.ts b/src/app/babylon/view/building-window/building-window.ts index 59a1d5a..91e0d2a 100644 --- a/src/app/babylon/view/building-window/building-window.ts +++ b/src/app/babylon/view/building-window/building-window.ts @@ -221,6 +221,8 @@ export class BuildingWindow extends UIBase { this.showJYZModules(type, show);//展示本次要展示的内容 } + + } @@ -566,7 +568,7 @@ export class BuildingWindow extends UIBase { */ public getModelAndCreateFacilityData() { - this.clearHomeLessFacilityData(); + //this.clearHomeLessFacilityData(); if (this.currentBuidngItem != null) { //获取所有transformNodes @@ -593,6 +595,8 @@ export class BuildingWindow extends UIBase { } + + //#endregion @@ -619,7 +623,7 @@ export class BuildingWindow extends UIBase { * @param show */ showJYZModules(type: JYZInfoMoudleType, show: boolean) { - + console.log("切换页签", type, show); if (this.currentBuidngItem == null) { return; } @@ -652,6 +656,9 @@ export class BuildingWindow extends UIBase { } } } + if (!show) { + this.currentJYZInfoMoudleType = null; + } } @@ -697,6 +704,23 @@ export class BuildingWindow extends UIBase { // } } + /** + * 显示罩棚 + * @param show false 表示隐藏罩棚 + */ + showZP(show: boolean) { + this.initFacilityTypeByMoudleType(JYZInfoMoudleType.ZP, this.currentBuidngItem.buildingInfo); + let zpInfoByTypes = this.facilitysByMoudle.get(JYZInfoMoudleType.ZP); + if (zpInfoByTypes != null) { + for (let i = 0; i < zpInfoByTypes.length; i++) { + let infos = zpInfoByTypes[i].facilityInfo; + for (let j = 0; j < infos.length; j++) { + infos[j].setEnable(show); + } + } + } + } + //#endregion @@ -732,4 +756,9 @@ export enum JYZInfoMoudleType { * 逃生路线 */ TSLX = "TSLX", + + /** + * 罩棚 + */ + ZP = "ZP", } \ No newline at end of file diff --git a/src/app/babylon/view/facility-window/facility-window.ts b/src/app/babylon/view/facility-window/facility-window.ts index 43fa2e2..feb8e24 100644 --- a/src/app/babylon/view/facility-window/facility-window.ts +++ b/src/app/babylon/view/facility-window/facility-window.ts @@ -316,8 +316,14 @@ export class FacilityWindow extends UIBase { createNewFacilityByMesh(mesh: AbstractMesh, type: FacilityType) { let facilityData = this.createFacilityDataFromMesh(mesh, type); //let facilityInfo = this.createFacilityInfoFromMesh(facilityData, mesh, buildingInfo); - console.log("获取到干粉灭火器", mesh); - this.createNewFacility(facilityData, mesh); + console.log("获取到设备" + type, mesh); + + if (!this.isRepeatFacilityFromMesh(type, mesh.id)) //不重复 + { + this.createNewFacility(facilityData, mesh); + } + + } @@ -637,6 +643,9 @@ export class FacilityWindow extends UIBase { else if (TsTool.stringContain(mesh.name, FacilityType.ZD_XF)) { this.createNewFacilityByMesh(mesh, FacilityType.ZD_XF); } + else if (TsTool.stringContain(mesh.name, FacilityType.ZD_ZP)) { + this.createNewFacilityByMesh(mesh, FacilityType.ZD_ZP); + } } @@ -664,6 +673,41 @@ export class FacilityWindow extends UIBase { return facilityInfo; } + /** + * 来自建筑中的设备 是否重复 + */ + isRepeatFacilityFromMesh(type: FacilityType, id: string) { + let currentBuidngItem = StatusManager.getStatus(BuildingStatus) + .buildingWindow.currentBuidngItem; + if (currentBuidngItem == null) { + alert("请先选中目标建筑"); + // ThreeDimensionalHomeComponent.instance.openSnackBar("请先选中目标建筑"); + return true; + } + let result = false; + + let facilityInfoByTypes = currentBuidngItem.buildingInfo.ModelInfo.facilityInfos; + if (facilityInfoByTypes != null) { + for (let i = 0; i < facilityInfoByTypes.length; i++) { + if (facilityInfoByTypes[i].type == type) { + let infos = facilityInfoByTypes[i].facilityInfo; + for (let j = 0; j < infos.length; j++) { + if (infos[j].modelData.resName == id) { + result = true; + console.log("重复的设备,不添加"); + break; + } + } + } + } + } + + + return result; + + + } + //#endregion } diff --git a/src/app/babylon/view/toolbar-window/toobar-window.ts b/src/app/babylon/view/toolbar-window/toobar-window.ts index 0f25a4b..19987bb 100644 --- a/src/app/babylon/view/toolbar-window/toobar-window.ts +++ b/src/app/babylon/view/toolbar-window/toobar-window.ts @@ -110,6 +110,14 @@ export class ToolbarWindow extends UIBase { BuildingWindow.instance.getModelAndCreateFacilityData(); } + /** + * 展示罩棚 + * @param show false表示隐藏罩棚 + */ + showZP(show: boolean) { + BuildingWindow.instance.showZP(show); + } + onInit() { super.onInit();