diff --git a/src/app/babylon/controller/info-manager.ts b/src/app/babylon/controller/info-manager.ts index 17073ea..68a8624 100644 --- a/src/app/babylon/controller/info-manager.ts +++ b/src/app/babylon/controller/info-manager.ts @@ -178,6 +178,7 @@ export class InfoManager { } + FacilityWindow.instance.createFacility( modelEditData.facilities[i].facilities[j], false, diff --git a/src/app/babylon/controller/mode-manager.ts b/src/app/babylon/controller/mode-manager.ts index 8b28322..146f793 100644 --- a/src/app/babylon/controller/mode-manager.ts +++ b/src/app/babylon/controller/mode-manager.ts @@ -28,7 +28,7 @@ export class ModeManager { /** * 调试模式 */ - public static isDebug = false; + public static isDebug = true; diff --git a/src/app/babylon/model/info/model/model-info-building.ts b/src/app/babylon/model/info/model/model-info-building.ts index 4da9d68..3597855 100644 --- a/src/app/babylon/model/info/model/model-info-building.ts +++ b/src/app/babylon/model/info/model/model-info-building.ts @@ -189,6 +189,7 @@ export class ModelInfo_building extends ModelInfo { infos = []; } + //释放所有设备 disposeAllFacility() { ModeManager.log('释放室内设备' + this.facilityInfos.length); diff --git a/src/app/babylon/view/building-window/building-window.ts b/src/app/babylon/view/building-window/building-window.ts index ac5c905..0d2486b 100644 --- a/src/app/babylon/view/building-window/building-window.ts +++ b/src/app/babylon/view/building-window/building-window.ts @@ -15,7 +15,7 @@ import { ArcRotateCameraData } from "../../model/data/camera-data"; import { BuildingData, BuildingData_ChemicalPlant, BuildingData_Environment, BuildingData_Normal, BuildingType } from "../../model/data/institution/building/building-data"; import { JYZInfoMoudleType, JYZShowData } from "../../model/data/institution/jyz-show-data"; import { ModelType } from "../../model/data/model-data/model-data"; -import { FacilityPosType, FacilityType } from "../../model/data/model-data/model-data-facility"; +import { FacilityPosType, FacilityType, ModelData_facility } from "../../model/data/model-data/model-data-facility"; import { ModelEditData } from "../../model/data/model-data/model-edit-data"; import { BuildingInfo } from "../../model/info/building/building-info"; import { BuildingInfo_ChemicalPlant } from "../../model/info/building/building-info-chemicalplant"; @@ -688,7 +688,30 @@ export class BuildingWindow extends UIBase { public clearHomeLessFacilityData() { if (this.currentBuidngItem != null) { - this.currentBuidngItem.clearFacilityFromMesh(); + let allFacilities = this.currentBuidngItem.buildingInfo.buildingData.outdoorData.facilities; + let needClear: ModelData_facility[] = []; + for (let i = 0; i < allFacilities.length; i++) { + + let facilityByType = allFacilities[i]; + for (let j = 0; j < facilityByType.facilities.length; j++) { + let info = FacilityInfoInSceneWindow.instance.getFacilityInfo(facilityByType.facilities[j]); + if (info == null + || TsTool.stringContain(info._modelBox.id, "(Box)")) { + needClear.push(facilityByType.facilities[j]); + } + } + + } + + + for (let k = 0; k < needClear.length; k++) { + for (let i = 0; i < allFacilities.length; i++) { + let facilityByType = allFacilities[i]; + TsTool.arrayRemove(facilityByType.facilities, needClear[k]); + + } + } + } } @@ -708,7 +731,7 @@ export class BuildingWindow extends UIBase { */ public getModelAndCreateFacilityData() { - //this.clearHomeLessFacilityData(); + this.clearHomeLessFacilityData(); if (this.currentBuidngItem != null) { //获取所有transformNodes diff --git a/src/app/babylon/view/facility-window/facility-window.ts b/src/app/babylon/view/facility-window/facility-window.ts index 60c597a..c19f362 100644 --- a/src/app/babylon/view/facility-window/facility-window.ts +++ b/src/app/babylon/view/facility-window/facility-window.ts @@ -442,13 +442,14 @@ export class FacilityWindow extends UIBase { let defaultMesh: AbstractMesh = null; if (mesh == null) { - defaultMesh = MeshBuilder.CreateBox(facilityData.key, { size: 1 }); + defaultMesh = MeshBuilder.CreateBox(facilityData.key + "(Box)", { size: 1 }); defaultMesh.isVisible = false; } else { defaultMesh = mesh; } + let facilityInfo = InfoManager.newModelInfo_facility( facilityData.key, facilityData, diff --git a/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts b/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts index 9f5a6d8..9347015 100644 --- a/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts +++ b/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts @@ -687,6 +687,22 @@ export class FacilityInfoInSceneWindow extends UIBase { } + /** + * 是否有data对应的设备info + * @param facilityData + */ + getFacilityInfo(facilityData: ModelData_facility) { + let result: ModelInfo_facility = null; + for (let i = 0; i < this.facilityInfoUIItemes.length; i++) { + if (this.facilityInfoUIItemes[i].modelInfo.modelData == facilityData) { + result = this.facilityInfoUIItemes[i].modelInfo; + break; + } + } + return result; + + } + //根据info找到相应的item,然后模拟选中 selectFacilityInfo(facilityInfo: ModelInfo_facility) {