Browse Source

增加清除游离设备功能

dev
刘向辉 3 years ago
parent
commit
ea4a7a7830
  1. 1
      src/app/babylon/controller/info-manager.ts
  2. 2
      src/app/babylon/controller/mode-manager.ts
  3. 1
      src/app/babylon/model/info/model/model-info-building.ts
  4. 29
      src/app/babylon/view/building-window/building-window.ts
  5. 3
      src/app/babylon/view/facility-window/facility-window.ts
  6. 16
      src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts

1
src/app/babylon/controller/info-manager.ts

@ -178,6 +178,7 @@ export class InfoManager {
}
FacilityWindow.instance.createFacility(
modelEditData.facilities[i].facilities[j],
false,

2
src/app/babylon/controller/mode-manager.ts

@ -28,7 +28,7 @@ export class ModeManager {
/**
*
*/
public static isDebug = false;
public static isDebug = true;

1
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);

29
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

3
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,

16
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) {

Loading…
Cancel
Save