邵佳豪 3 years ago
parent
commit
d21056ab26
  1. 75
      src/app/babylon/controller/config-manager.ts
  2. 155
      src/app/babylon/controller/data-manager.ts
  3. 6
      src/app/babylon/controller/info-manager.ts
  4. 2
      src/app/babylon/controller/status/building-status.ts
  5. 2
      src/app/babylon/controller/status/indoor-status.ts
  6. 46
      src/app/babylon/model/data/institution/facility/all-facility-data.ts
  7. 22
      src/app/babylon/model/data/institution/facility/property-data/in/property-data-mhq.ts
  8. 31
      src/app/babylon/model/data/institution/facility/property-data/indoor/property-data-fhfq.ts
  9. 26
      src/app/babylon/model/data/institution/facility/property-data/indoor/property-data-sslt.ts
  10. 24
      src/app/babylon/model/data/institution/facility/property-data/indoor/property-data-xfdt.ts
  11. 42
      src/app/babylon/model/data/institution/facility/property-data/indoor/property-data-zdqy.ts
  12. 0
      src/app/babylon/model/data/institution/facility/property-data/out/property-data-dwbz.ts
  13. 0
      src/app/babylon/model/data/institution/facility/property-data/out/property-data-pl.ts
  14. 6
      src/app/babylon/model/data/institution/facility/property-data/out/property-data-q.ts
  15. 31
      src/app/babylon/model/data/institution/facility/property-data/outdoor/property-data-aqck.ts
  16. 26
      src/app/babylon/model/data/institution/facility/property-data/outdoor/property-data-gd.ts
  17. 195
      src/app/babylon/model/data/model-data/model-data-facility.ts
  18. 6
      src/app/babylon/model/data/model-data/model-edit-data.ts
  19. 1
      src/app/babylon/model/info/building/building-info.ts
  20. 8
      src/app/babylon/model/info/model/facilityinfo-tool/facility-area.ts
  21. 267
      src/app/babylon/model/info/model/facilityinfo-tool/facility-gd.ts
  22. 23
      src/app/babylon/model/info/model/model-info-facility.ts
  23. 40
      src/app/babylon/view/building-window/building-ui-item.ts
  24. 74
      src/app/babylon/view/building-window/building-window.ts
  25. 165
      src/app/babylon/view/facility-window/facility-window.ts
  26. 71
      src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts
  27. 14
      src/app/babylon/view/mark-window/mark-window.ts
  28. 23
      src/app/babylon/view/toolbar-window/toobar-window.ts
  29. 29
      src/app/pages/plan/plan.component.html
  30. 53
      src/app/pages/plan/plan.component.scss
  31. 81
      src/app/pages/plan/plan.component.ts
  32. BIN
      src/assets/images/adsorb.png
  33. BIN
      src/assets/images/facility/out/DWBZ.png
  34. BIN
      src/assets/images/facility/out/PL.png
  35. BIN
      src/assets/images/facility/out/QY.png
  36. BIN
      src/assets/images/facility/out/TPBZ.png
  37. BIN
      src/assets/images/revolveThree.png
  38. BIN
      src/assets/images/scaleThree.png
  39. BIN
      src/assets/images/translationThree.png
  40. BIN
      src/assets/images/verticalView.png
  41. BIN
      src/assets/mesh/facilities/dwbz/DWBZ.bin
  42. 174
      src/assets/mesh/facilities/dwbz/DWBZ.gltf
  43. 5
      src/assets/mesh/facilities/dwbz/DWBZ.gltf.manifest
  44. BIN
      src/assets/mesh/facilities/dwbz/DWBZ.jpg
  45. BIN
      src/assets/mesh/facilities/pl/PL.bin
  46. 174
      src/assets/mesh/facilities/pl/PL.gltf
  47. 5
      src/assets/mesh/facilities/pl/PL.gltf.manifest
  48. BIN
      src/assets/mesh/facilities/pl/PL.png
  49. BIN
      src/assets/mesh/facilities/tpbz/TPBZ.bin
  50. 174
      src/assets/mesh/facilities/tpbz/TPBZ.gltf
  51. 5
      src/assets/mesh/facilities/tpbz/TPBZ.gltf.manifest
  52. BIN
      src/assets/mesh/facilities/tpbz/TPBZ.jpg

75
src/app/babylon/controller/config-manager.ts

@ -16,6 +16,22 @@ export class ConfigManager {
static readonly c_time_longPress = 500;//长按时间(毫秒)
/**
* (assets子目录开始)
* @param facilityPosType
* @param type
*/
static getResPath_facility(facilityPosType: FacilityPosType, type: FacilityType): string {
let result = "mesh/facilities/";
// result += facilityPosType.toString() + "/";
result += (type).toLocaleLowerCase();
result += "/";
return result;
}
/**
* icon的url
* @param type
@ -23,7 +39,7 @@ export class ConfigManager {
*/
static getFacilityIconUrl(type: FacilityType, pos: FacilityPosType): string {
let result = ConfigManager.c_resPath_assetsRoot + "images/facility/" + pos + "/" + type + ".png";
let result = ConfigManager.c_resPath_assetsRoot + "images/facility/" + pos + '/' + type + ".png";
return result;
}
@ -34,40 +50,11 @@ export class ConfigManager {
static getFacilityTypeName(type: FacilityType): string {
let result = "未知";
switch (type) {
case FacilityType.AQCK: result = "安全出口"; break;
case FacilityType.DSXHS: result = "地上消火栓"; break;
case FacilityType.DXXHS: result = "地下消火栓"; break;
case FacilityType.SZDSXHS: result = "市政地上消火栓"; break;
case FacilityType.SZDXXHS: result = "市政地下消火栓"; break;
case FacilityType.DSSBJHQ: result = "地上水泵接合器"; break;
case FacilityType.DXSBJHQ: result = "地下水泵接合器"; break;
case FacilityType.QBSBJHQ: result = "墙壁式接合器"; break;
case FacilityType.DGNSBJHQ: result = "多功能接合器"; break;
case FacilityType.GD: result = "高度"; break;
case FacilityType.PL: result = "毗邻"; break;
case FacilityType.JTQ: result = "禁停区"; break;
case FacilityType.JJQ: result = "集结区"; break;
case FacilityType.QY: result = "区域"; break;
case FacilityType.TPBZ: result = "图片标注"; break;
case FacilityType.XKS: result = "消控室"; break;
case FacilityType.BF: result = "泵房"; break;
case FacilityType.SX: result = "水箱"; break;
case FacilityType.LSXFB: result = "立式消防泵"; break;
case FacilityType.WSXFB: result = "卧式消防泵"; break;
case FacilityType.CYXFB: result = "柴油消防泵"; break;
case FacilityType.FHFQ: result = "防火分区"; break;
case FacilityType.SNXHS: result = "室内消火栓"; break;
case FacilityType.FHM: result = "防火门"; break;
case FacilityType.FHJL: result = "防火卷帘"; break;
case FacilityType.SSLT: result = "疏散楼梯"; break;
case FacilityType.XFDT: result = "消防电梯"; break;
case FacilityType.PTDT: result = "普通电梯"; break;
case FacilityType.WXY: result = "危险源"; break;
case FacilityType.ZDQY: result = "重点区域"; break;
case FacilityType.DWBZ: result = "点位标注"; break;
case FacilityType.HT: result = "货梯"; break;
case FacilityType.BNC: result = "避难层"; break;//特殊
}
return result;
}
@ -77,26 +64,14 @@ export class ConfigManager {
* @param facilityType
*/
static getPosType(facilityType: FacilityType): FacilityPosType {
let result = FacilityPosType.Indoor;
let result = FacilityPosType.In;
switch (facilityType) {
case FacilityType.AQCK:
case FacilityType.DSXHS:
case FacilityType.DXXHS:
case FacilityType.SZDXXHS:
case FacilityType.SZDSXHS:
case FacilityType.DSSBJHQ:
case FacilityType.DXSBJHQ:
case FacilityType.QBSBJHQ:
case FacilityType.DGNSBJHQ:
case FacilityType.GD:
case FacilityType.PL:
case FacilityType.JTQ:
case FacilityType.JJQ:
case FacilityType.TPBZ: result = FacilityPosType.Outdoor; break;
case FacilityType.DWBZ:
case FacilityType.ZDQY:
case FacilityType.WXY: result = FacilityPosType.Public; break;
case FacilityType.QY:
case FacilityType.TPBZ:
case FacilityType.DWBZ: result = FacilityPosType.Out; break;
}
return result;
}
@ -177,7 +152,7 @@ export class ConfigManager {
[MarkType.JJX, "警戒线"],
[MarkType.SD, "水带"],
[MarkType.JGLX, "进攻路线"],
[MarkType.CT, "撤退"],
[MarkType.CT, "撤退"],
[MarkType.ZHB, "指挥部"],
[MarkType.LT6, "6米拉梯"],
[MarkType.LT15, "15米拉梯"],

155
src/app/babylon/controller/data-manager.ts

@ -1,58 +1,44 @@
import { HttpErrorResponse } from '@angular/common/http';
import { Quaternion, Vector3 } from '@babylonjs/core';
import { plainToClass } from 'class-transformer';
import {
BuildingData,
BuildingData_ChemicalPlant,
BuildingData_Environment,
BuildingData_Normal,
BuildingType,
BuildingType
} from '../model/data/institution/building/building-data';
import {
FacilityPosType,
FacilityType,
ModelData_facility,
} from '../model/data/model-data/model-data-facility';
import { AllFacilityData } from '../model/data/institution/facility/all-facility-data';
import { PropertyData_Base_IMG } from '../model/data/institution/facility/property-data/base/property-data-base-img';
import { PropertyData_MHQ } from '../model/data/institution/facility/property-data/in/property-data-mhq';
import { PropertyData_DWBZ } from '../model/data/institution/facility/property-data/out/property-data-dwbz';
import { PropertyData_PL } from '../model/data/institution/facility/property-data/out/property-data-pl';
import { PropertyData_Q } from '../model/data/institution/facility/property-data/out/property-data-q';
import { PropertyData_Base } from '../model/data/institution/facility/property-data/property-data-base';
import { PropertyData_public } from '../model/data/institution/facility/property-data/property-data-public';
import {
InstitutionData,
NormalData,
NormalData
} from '../model/data/institution/institution-data';
import { InsitutionDataSimple } from '../model/data/institution/institution-data-simple';
import { AllMarkData } from '../model/data/mark/all-mark-data';
import { AllMarkPlanData } from '../model/data/mark/mark-plan-data';
import {
BuildingPosType,
ModelData,
ModelData
} from '../model/data/model-data/model-data';
import { ModelData_building } from '../model/data/model-data/model-data-building';
import {
FacilityPosType,
FacilityType
} from '../model/data/model-data/model-data-facility';
import { ModelEditData } from '../model/data/model-data/model-edit-data';
import { TransformData } from '../model/data/transform-data';
import { BabylonTool } from '../tool/babylon-tool';
import { AllFacilityData } from '../model/data/institution/facility/all-facility-data';
import { plainToClass } from 'class-transformer';
import { TsTool } from '../tool/ts-tool';
import { ConfigManager } from './config-manager';
import { ModelEditData } from '../model/data/model-data/model-edit-data';
import { ModeManager } from './mode-manager';
import { ServeManager } from './serve-manager';
import { InsitutionDataSimple } from '../model/data/institution/institution-data-simple';
import { PropertyData_Base } from '../model/data/institution/facility/property-data/property-data-base';
import { PropertyData_AQCK } from '../model/data/institution/facility/property-data/outdoor/property-data-aqck';
import { PropertyData_public } from '../model/data/institution/facility/property-data/property-data-public';
import { TsTool } from '../tool/ts-tool';
import { PropertyData_Base_XHS } from '../model/data/institution/facility/property-data/base/property-data-base-xhs';
import { PropertyData_Base_SBJHQ } from '../model/data/institution/facility/property-data/base/property-data-base-sbjhq';
import { PropertyData_PL } from '../model/data/institution/facility/property-data/outdoor/property-data-pl';
import { PropertyData_Base_IMG } from '../model/data/institution/facility/property-data/base/property-data-base-img';
import { PropertyData_Base_XFB } from '../model/data/institution/facility/property-data/base/property-data-base-xfb';
import { PropertyData_FHFQ } from '../model/data/institution/facility/property-data/indoor/property-data-fhfq';
import { PropertyData_SSLT } from '../model/data/institution/facility/property-data/indoor/property-data-sslt';
import { PropertyData_XFDT } from '../model/data/institution/facility/property-data/indoor/property-data-xfdt';
import { PropertyData_ZDQY } from '../model/data/institution/facility/property-data/indoor/property-data-zdqy';
import { PropertyData_DWBZ } from '../model/data/institution/facility/property-data/indoor/property-data-dwbz';
import { PropertyData_GD } from '../model/data/institution/facility/property-data/outdoor/property-data-gd';
import { ModeManager, ModeType } from './mode-manager';
import { AllMarkData } from '../model/data/mark/all-mark-data';
import { AllMarkPlanData } from '../model/data/mark/mark-plan-data';
import { HttpErrorResponse } from '@angular/common/http';
import { PropertyData_Q } from '../model/data/institution/facility/property-data/outdoor/property-data-q';
class Test {
id: string;
}
//数据管理器
export class DataManager {
@ -76,9 +62,9 @@ export class DataManager {
//本地捏造消防设备列表信息
DataManager.initDebugData_facility();
if (ModeManager.currentMode == ModeType.Look) {
DataManager.initDebugData_mark();
}
//if (ModeManager.currentMode == ModeType.Look) {
DataManager.initDebugData_mark();
// }
let dataFromServe = true;//true-表示数据来自服务器,false-表示来自本地捏造
@ -313,35 +299,18 @@ export class DataManager {
return result;
}
//获取设备资源完整路径
static getResPath_facility(facilityPosType: FacilityPosType, type: FacilityType): string {
let result = "facilities/";
// //获取设备资源完整路径
// static getResPath_facility(facilityPosType: FacilityPosType, type: FacilityType): string {
// let result = "mesh/facilities/";
result += facilityPosType.toString() + "/";
// result += facilityPosType.toString() + "/";
result += DataManager.getResName_facility(type).toLocaleLowerCase();
result += "/";
return result;
}
// result += (type).toLocaleLowerCase();
// result += "/";
// return result;
// }
//获取设备的资源名(有些是公用的)
static getResName_facility(type: FacilityType): string {
let result = type.toString();
switch (type) {
case FacilityType.XKS:
case FacilityType.BF:
case FacilityType.SX:
case FacilityType.FHM:
case FacilityType.FHJL:
case FacilityType.SSLT:
case FacilityType.XFDT:
case FacilityType.PTDT:
case FacilityType.HT:
case FacilityType.WXY: result = "Location"; break;
}
return result;
}
//初始化设备信息
static initDebugData_facility() {
@ -456,33 +425,20 @@ export class DataManager {
static createPropertyData(key: string, facilityType: FacilityType): PropertyData_Base {
let result: PropertyData_Base = null;
switch (facilityType) {
case FacilityType.AQCK: result = new PropertyData_AQCK(key, "", false, "安全出口", ""); break; //安全出口
case FacilityType.DSXHS:
case FacilityType.DXXHS:
case FacilityType.SZDSXHS:
case FacilityType.SZDXXHS: result = new PropertyData_Base_XHS(key, "", false, "", "", "", facilityType); break;
case FacilityType.DSSBJHQ:
case FacilityType.DXSBJHQ:
case FacilityType.QBSBJHQ:
case FacilityType.DGNSBJHQ: result = new PropertyData_Base_SBJHQ(key, "", "", "", "", facilityType); break;
case FacilityType.GD: result = new PropertyData_GD(key, "-"); break;
//自定义放置
case FacilityType.PL: result = new PropertyData_PL(key, 0, "", []); break;
case FacilityType.JTQ:
case FacilityType.JJQ: result = new PropertyData_Q(key, "", "", "", null, facilityType); break;
case FacilityType.TPBZ:
case FacilityType.XKS:
case FacilityType.BF:
case FacilityType.SX: result = new PropertyData_Base_IMG(key, "", "", "", facilityType); break;
case FacilityType.LSXFB:
case FacilityType.WSXFB:
case FacilityType.CYXFB: result = new PropertyData_Base_XFB(key, "", "", "", "", "", "", facilityType); break;
case FacilityType.FHFQ: result = new PropertyData_FHFQ(key, "", ""); break;
case FacilityType.SSLT: result = new PropertyData_SSLT(key, "", "", ""); break;
case FacilityType.XFDT: result = new PropertyData_XFDT(key, "", "", ""); break;
case FacilityType.WXY: result = new PropertyData_Base_IMG(key, "", "", "", facilityType); break;
case FacilityType.ZDQY: result = new PropertyData_ZDQY(key, "", "", "", "", "", []); break;
case FacilityType.QY: result = new PropertyData_Q(key, "", "", "", null, facilityType); break;
case FacilityType.TPBZ: result = new PropertyData_Base_IMG(key, "", "", "", facilityType); break;
case FacilityType.DWBZ: result = new PropertyData_DWBZ(key, "", ""); break;
//其他在表格中显示无
//建筑模型内内置的
case FacilityType.XF_MHQ_PT_4:
case FacilityType.XF_MHQ_PT_8:
case FacilityType.XF_MHQ_PT_35:
case FacilityType.XF_MHQ_GF_4:
case FacilityType.XF_MHQ_GF_8:
case FacilityType.XF_MHQ_GF_35: result = new PropertyData_MHQ(key, facilityType); break;
}
if (result == null) {
@ -491,25 +447,6 @@ export class DataManager {
return result;
}
/**
*
* @param name
*/
static createMarkPlane(name: string) {
if (DataManager.allMarkPlanData == null) {
console.error("当前单位没有标绘方案,无法新建");
return;
}
let index = 0;
}

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

@ -2,7 +2,7 @@
import { AbstractMesh } from "@babylonjs/core";
import { MarkData } from "../model/data/mark/mark-data";
import { ModelData } from "../model/data/model-data/model-data";
import { FacilityType, ModelData_facility } from "../model/data/model-data/model-data-facility";
import { FacilityInBuildingType, FacilityType, ModelData_facility } from "../model/data/model-data/model-data-facility";
import { ModelEditData } from "../model/data/model-data/model-edit-data";
import { TransformData } from "../model/data/transform-data";
import { BuildingInfo } from "../model/info/building/building-info";
@ -117,6 +117,8 @@ export class InfoManager {
}
/**
* info
* @param key
@ -174,6 +176,7 @@ export class InfoManager {
buildingInfo,
true,
false,
null,//要根据类型,是不是从场景中查找
(modelInfo: ModelInfo_facility) => {
if (ModeManager.currentMode == ModeType.Look) {
modelInfo.setIconEnable(false);//查看模式下隐藏所有设备ui
@ -199,6 +202,7 @@ export class InfoManager {
facilityInfoByType.facilityInfo.push(facilityInfo);
}
//将某设备info,从相应的列表中移除
static removeFacilityInfoToTypeList(facilityInfo: ModelInfo_facility, facilityInfosByType: FacilityInfoByType[]) {
let facilityType = (facilityInfo.modelData as ModelData_facility).facilityType;

2
src/app/babylon/controller/status/building-status.ts

@ -95,7 +95,7 @@ export class BuildingStatus extends StatusBase {
}
}
SceneManager.s_facilityWindow.updateAllFacilities(FacilityPosType.Outdoor);
SceneManager.s_facilityWindow.updateAllFacilities(FacilityPosType.Out);
let instance = this;
this.onChangeFacilityObserver = EventManager.addListener<Event_ChangeFacility>(Event_ChangeFacility, ((eventInfo) => {

2
src/app/babylon/controller/status/indoor-status.ts

@ -51,7 +51,7 @@ export class IndoorStatus extends StatusBase {
GizmoTool.onPickMeshInfoObservable.notifyObservers(null);//取消之前的选中
SceneManager.s_facilityInfoInSceneWindow.clearFacilityInfoUIItemes();//先清空
SceneManager.s_facilityWindow.updateAllFacilities(FacilityPosType.Indoor);
SceneManager.s_facilityWindow.updateAllFacilities(FacilityPosType.In);
SceneManager.Instance.sunLight.intensity = 1;
}
//退出状态

46
src/app/babylon/model/data/institution/facility/all-facility-data.ts

@ -17,56 +17,24 @@ export class AllFacilityData {
static CreateAllFacilityData(): AllFacilityData {
let result = new AllFacilityData();
AllFacilityData.newFacilityData(FacilityType.AQCK, FacilityPosType.Outdoor, result);
AllFacilityData.newFacilityData(FacilityType.DSXHS, FacilityPosType.Outdoor, result);
AllFacilityData.newFacilityData(FacilityType.DXXHS, FacilityPosType.Outdoor, result);
AllFacilityData.newFacilityData(FacilityType.SZDSXHS, FacilityPosType.Outdoor, result);
AllFacilityData.newFacilityData(FacilityType.SZDXXHS, FacilityPosType.Outdoor, result);
AllFacilityData.newFacilityData(FacilityType.DSSBJHQ, FacilityPosType.Outdoor, result);
AllFacilityData.newFacilityData(FacilityType.DXSBJHQ, FacilityPosType.Outdoor, result);
AllFacilityData.newFacilityData(FacilityType.QBSBJHQ, FacilityPosType.Outdoor, result);
AllFacilityData.newFacilityData(FacilityType.DGNSBJHQ, FacilityPosType.Outdoor, result);
AllFacilityData.newFacilityData(FacilityType.GD, FacilityPosType.Outdoor, result, false);
AllFacilityData.newFacilityData(FacilityType.PL, FacilityPosType.Outdoor, result);
AllFacilityData.newFacilityData(FacilityType.JTQ, FacilityPosType.Outdoor, result, false);
AllFacilityData.newFacilityData(FacilityType.JJQ, FacilityPosType.Outdoor, result, false);
AllFacilityData.newFacilityData(FacilityType.TPBZ, FacilityPosType.Outdoor, result, true);
AllFacilityData.newFacilityData(FacilityType.PL, FacilityPosType.Out, result);
AllFacilityData.newFacilityData(FacilityType.QY, FacilityPosType.Out, result, false);
AllFacilityData.newFacilityData(FacilityType.TPBZ, FacilityPosType.Out, result, true);
AllFacilityData.newFacilityData(FacilityType.DWBZ, FacilityPosType.Out, result);
AllFacilityData.newFacilityData(FacilityType.XKS, FacilityPosType.Indoor, result, false);
AllFacilityData.newFacilityData(FacilityType.BF, FacilityPosType.Indoor, result, false);
AllFacilityData.newFacilityData(FacilityType.SX, FacilityPosType.Indoor, result, false);
AllFacilityData.newFacilityData(FacilityType.LSXFB, FacilityPosType.Indoor, result);
AllFacilityData.newFacilityData(FacilityType.WSXFB, FacilityPosType.Indoor, result);
AllFacilityData.newFacilityData(FacilityType.CYXFB, FacilityPosType.Indoor, result);
AllFacilityData.newFacilityData(FacilityType.FHFQ, FacilityPosType.Indoor, result, false);
AllFacilityData.newFacilityData(FacilityType.SNXHS, FacilityPosType.Indoor, result);
AllFacilityData.newFacilityData(FacilityType.FHM, FacilityPosType.Indoor, result, false);
AllFacilityData.newFacilityData(FacilityType.FHJL, FacilityPosType.Indoor, result, false);
AllFacilityData.newFacilityData(FacilityType.SSLT, FacilityPosType.Indoor, result, false);
AllFacilityData.newFacilityData(FacilityType.XFDT, FacilityPosType.Indoor, result, false);
AllFacilityData.newFacilityData(FacilityType.PTDT, FacilityPosType.Indoor, result, false);
AllFacilityData.newFacilityData(FacilityType.HT, FacilityPosType.Indoor, result, false);
AllFacilityData.newFacilityData(FacilityType.WXY, FacilityPosType.Public, result);
AllFacilityData.newFacilityData(FacilityType.ZDQY, FacilityPosType.Public, result);
AllFacilityData.newFacilityData(FacilityType.DWBZ, FacilityPosType.Public, result);
return result;
}
//新建设备信息
static newFacilityData(type: FacilityType, posType: FacilityPosType, allFacilityData: AllFacilityData, isModel: boolean = true): ModelData_facility {
return;
let name = ConfigManager.getFacilityTypeName(type);
let result = new ModelData_facility(type.toString(), type, name, DataManager.getResName_facility(type) + ".gltf", new TransformData(), posType, isModel);
let result = new ModelData_facility(type.toString(), type, name, type + ".gltf", new TransformData(), posType, isModel);
switch (posType) {
case FacilityPosType.Outdoor:
case FacilityPosType.Out:
allFacilityData.outdoor.push(result);
break;
case FacilityPosType.Indoor:
allFacilityData.indoor.push(result);
break;
case FacilityPosType.Public:
allFacilityData.outdoor.push(result);
case FacilityPosType.In:
allFacilityData.indoor.push(result);
break;
}

22
src/app/babylon/model/data/institution/facility/property-data/in/property-data-mhq.ts

@ -0,0 +1,22 @@
import { FacilityType } from "../../../../model-data/model-data-facility";
import { PropertyData_Base } from "../property-data-base";
/**
*
*/
export class PropertyData_MHQ extends PropertyData_Base {
constructor(key: string, facilityType: FacilityType) {
super(key, facilityType);
}
clone(key: string) {
let result = new PropertyData_MHQ(key, this.facilityType);
return result;
}
}

31
src/app/babylon/model/data/institution/facility/property-data/indoor/property-data-fhfq.ts

@ -1,31 +0,0 @@
import { Color3, Color4 } from "@babylonjs/core";
import { Type } from "class-transformer";
import { FacilityType } from "../../../../model-data/model-data-facility";
import { PropertyData_Base } from "../property-data-base";
/**
*
*/
export class PropertyData_FHFQ extends PropertyData_Base {
name: string = "";//名称
area: string = "";//面积
@Type(() => Color3)
color: Color3 = Color3.Red();//颜色
constructor(key: string, name: string, area: string, color: Color3 = Color3.Red()) {
super(key, FacilityType.FHFQ);
this.name = name;
this.area = area;
this.color = color;
}
clone(key: string) {
let result = new PropertyData_FHFQ(key, this.name, this.area, this.color);
return result;
}
}

26
src/app/babylon/model/data/institution/facility/property-data/indoor/property-data-sslt.ts

@ -1,26 +0,0 @@
import { FacilityType } from "../../../../model-data/model-data-facility";
import { PropertyData_Base_LT } from "../base/property-data-base-lt";
import { PropertyData_Base } from "../property-data-base";
/**
*
*/
export class PropertyData_SSLT extends PropertyData_Base_LT {
width: string = "";//宽度
constructor(key: string, number: string, channel: string, width: string) {
super(key, number, channel, FacilityType.SSLT);
this.width = width;
}
clone(key: string) {
let result = new PropertyData_SSLT(key, this.number, this.channel, this.width);
return result;
}
}

24
src/app/babylon/model/data/institution/facility/property-data/indoor/property-data-xfdt.ts

@ -1,24 +0,0 @@
import { FacilityType } from "../../../../model-data/model-data-facility";
import { PropertyData_Base_LT } from "../base/property-data-base-lt";
import { PropertyData_Base } from "../property-data-base";
/**
*
*/
export class PropertyData_XFDT extends PropertyData_Base_LT {
weight: string = "";//载重
constructor(key: string, number: string, channel: string, weight: string) {
super(key, number, channel, FacilityType.XFDT);
this.weight = weight;
}
clone(key: string) {
let result = new PropertyData_XFDT(key, this.number, this.channel, this.weight);
return result;
}
}

42
src/app/babylon/model/data/institution/facility/property-data/indoor/property-data-zdqy.ts

@ -1,42 +0,0 @@
import { FacilityType } from "../../../../model-data/model-data-facility";
import { PropertyData_Base } from "../property-data-base";
/**
*
*/
export class PropertyData_ZDQY extends PropertyData_Base {
name: string = "";//名称
pos: string = "";//所在位置
construction: string = "";//建筑结构
character: string = "";//使用性质
danger: string = "";//主要危险性
imgs: string[] = [];//图片
constructor(key: string, name: string, pos: string, construction: string, character: string, danger: string, imgs: string[]) {
super(key, FacilityType.ZDQY);
this.name = name;
this.pos = pos;
this.construction = construction;
this.character = character;
this.danger = danger;
this.imgs = imgs;
}
clone(key: string) {
let newImgs: string[] = [];
for (let i = 0; i < this.imgs.length; i++) {
newImgs.push(this.imgs[i]);
}
let result = new PropertyData_ZDQY(key, this.name, this.pos, this.construction, this.character, this.danger, newImgs);
return result;
}
}

0
src/app/babylon/model/data/institution/facility/property-data/indoor/property-data-dwbz.ts → src/app/babylon/model/data/institution/facility/property-data/out/property-data-dwbz.ts

0
src/app/babylon/model/data/institution/facility/property-data/outdoor/property-data-pl.ts → src/app/babylon/model/data/institution/facility/property-data/out/property-data-pl.ts

6
src/app/babylon/model/data/institution/facility/property-data/outdoor/property-data-q.ts → src/app/babylon/model/data/institution/facility/property-data/out/property-data-q.ts

@ -17,10 +17,8 @@ export class PropertyData_Q extends PropertyData_Base_IMG {
this.color = color;
if (color == null) {
switch (type) {
case FacilityType.JTQ:
this.color = Color3.Yellow();
break;
case FacilityType.JJQ:
case FacilityType.QY:
this.color = Color3.Green();
break;
}

31
src/app/babylon/model/data/institution/facility/property-data/outdoor/property-data-aqck.ts

@ -1,31 +0,0 @@
import { FacilityType } from "../../../../model-data/model-data-facility";
import { PropertyData_Base } from "../property-data-base";
/**
*
*/
export class PropertyData_AQCK extends PropertyData_Base {
img: string = "";
is360: boolean;//全景图片
name: string = "安全出口";
width: string = "";
constructor(key: string, img: string, is360: boolean, name: string, width: string) {
super(key, FacilityType.AQCK);
this.img = img;
this.is360 = is360;
this.name = name;
this.width = width;
}
clone(key: string) {
let result = new PropertyData_AQCK(key, this.img, this.is360, "安全出口", "1");
return result;
}
}

26
src/app/babylon/model/data/institution/facility/property-data/outdoor/property-data-gd.ts

@ -1,26 +0,0 @@
import { FacilityType } from "../../../../model-data/model-data-facility";
import { PropertyData_Base } from "../property-data-base";
/**
*
*/
export class PropertyData_GD extends PropertyData_Base {
info: string = "";
constructor(key: string, info: string) {
super(key, FacilityType.GD);
this.info = info;
}
clone(key: string) {
let result = new PropertyData_GD(key, this.info);
return result;
}
}

195
src/app/babylon/model/data/model-data/model-data-facility.ts

@ -5,13 +5,14 @@ import { PropertyData_Base } from "../institution/facility/property-data/propert
import { classToClass, Type } from "class-transformer";
import { Vector3 } from "@babylonjs/core";
import { DataManager } from "src/app/babylon/controller/data-manager";
import { ConfigManager } from "src/app/babylon/controller/config-manager";
//设备数据
export class ModelData_facility extends ModelData {
posType: FacilityPosType = FacilityPosType.Outdoor;//位置类型
posType: FacilityPosType = FacilityPosType.Out;//位置类型
facilityType: FacilityType = FacilityType.AQCK;//具体设备类别
facilityType: FacilityType = FacilityType.PL;//具体设备类别
@Type(() => PropertyData_Base)
propertyData: PropertyData_Base = null;//属性信息
@Type(() => Vector3)
@ -30,7 +31,7 @@ export class ModelData_facility extends ModelData {
switch (showType) {
case FacilityShowType.ModelAndTag:
this.resName = resName;
this.resPath = DataManager.getResPath_facility(this.posType, type);
this.resPath = ConfigManager.getResPath_facility(this.posType, type);
break;
case FacilityShowType.AreaAndTag:
this.areaPoints = this.newAreapPoints();
@ -81,37 +82,13 @@ export class ModelData_facility extends ModelData {
static getShowType(facilityType: FacilityType): FacilityShowType {
let result = FacilityShowType.ModelAndTag;
switch (facilityType) {
case FacilityType.AQCK:
case FacilityType.DSXHS:
case FacilityType.DXXHS:
case FacilityType.SZDXXHS:
case FacilityType.SZDSXHS:
case FacilityType.DSSBJHQ:
case FacilityType.DXSBJHQ:
case FacilityType.QBSBJHQ:
case FacilityType.DGNSBJHQ:
case FacilityType.PL:
case FacilityType.TPBZ:
case FacilityType.XKS:
case FacilityType.BF:
case FacilityType.SX:
case FacilityType.LSXFB:
case FacilityType.WSXFB:
case FacilityType.CYXFB:
case FacilityType.SNXHS:
case FacilityType.FHM:
case FacilityType.HT:
case FacilityType.PTDT:
case FacilityType.XFDT:
case FacilityType.SSLT:
case FacilityType.FHJL: result = FacilityShowType.ModelAndTag; break;//展示模型和标签
case FacilityType.JTQ:
case FacilityType.JJQ:
case FacilityType.FHFQ: result = FacilityShowType.AreaAndTag; break;//展示可编辑多边形
case FacilityType.GD: result = FacilityShowType.GdAndTag; break;//展示高度和标签
case FacilityType.DWBZ:
case FacilityType.TPBZ: result = FacilityShowType.ModelAndTag; break;//展示模型和标签
case FacilityType.QY: result = FacilityShowType.AreaAndTag; break;//展示可编辑多边形
}
return result;
@ -125,9 +102,8 @@ export class ModelData_facility extends ModelData {
//设备位置类型(室内还是室外)
export enum FacilityPosType {
Indoor = "indoor", //室内
Outdoor = "outdoor", //室外
Public = "public",//共有
In = "in", //内置在建筑模型中
Out = "out", //在编辑时单独放置
}
//设备展示类型
@ -143,138 +119,125 @@ export enum FacilityShowType {
*
*/
export enum FacilityType {
//室外
/**
*
*/
AQCK = "AQCK",
/**
*
*/
DSXHS = "DSXHS",
/**
*
*/
DXXHS = "DXXHS",
/**
*
*/
SZDSXHS = "SZDSXHS",
/**
*
*/
SZDXXHS = "SZDXXHS",
//外部自定义
/**
*
*
*/
DSSBJHQ = "DSSBJHQ",
PL = "PL",
/**
*
*
*/
DXSBJHQ = "DXSBJHQ",
QY = "QY",
/**
*
*
*/
QBSBJHQ = "QBSBJHQ",
TPBZ = "TPBZ",
/**
*
*
*/
DGNSBJHQ = "DGNSBJHQ",
DWBZ = "DWBZ",
//模型内置
/**
*
* - 4kg
*/
GD = "GD",
XF_MHQ_PT_4 = "XF_MHQ_PT_4",
/**
*
* - 8kg
*/
PL = "PL",
XF_MHQ_PT_8 = "XF_MHQ_PT_8",
/**
*
* - 35kg ()
*/
JTQ = "JTQ",
XF_MHQ_PT_35 = "XF_MHQ_PT_35",
/**
*
* - 4kg
*/
JJQ = "JJQ",
XF_MHQ_GF_4 = "XF_MHQ_GF_4",
/**
*
* - 8kg
*/
TPBZ = "TPBZ",//
//室内
XF_MHQ_GF_8 = "XF_MHQ_GF_8",
/**
*
* - 36kg
*/
XKS = "XKS",
XF_MHQ_GF_35 = "XF_MHQ_GF_35",
/**
*
*
*/
BF = "BF",
XF_MHT = "XF_MHT",
/**
*
*
*/
SX = "SX",
XF_XFQ = "XF_XFQ",
/**
*
*
*/
LSXFB = "LSXFB",
XF_XFT = "XF_XFT",
/**
*
*
*/
WSXFB = "WSXFB",
XF_XFCM = "XF_XFCM",
/**
*
*
*/
CYXFB = "CYXFB",
XF_XFF = "XF_XFF",
/**
*
*
*/
SNXHS = "SNXHS",
XF_XFS = "XF_XFS",
/**
*
*
*/
FHM = "FHM",
JY_JYJ = "JY_JYJ",
/**
*
*
*/
FHJL = "FHJL",
JY_YG = "JY_YG",
/**
*
*
*/
SSLT = "SSLT",
/**
*
*/
XFDT = "XFDT",
ZD_YG = "ZD_YG",
/**
*
* 线
*/
PTDT = "PTDT",
JY_SYGX = "JY_SYGX",
/**
*
* 线
*/
HT = "HT",
JY_YQHSGX = "JY_YQHSGX",
/**
*
* 线
*/
BNC = "BNC",
XF_TSLX = "XF_TSLX",
/**
*
*
*/
WXY = "WXY",
XF_SSD = "XF_SSD"
}
/**
*
*/
export enum FacilityInBuildingType {
/**
*
*
*/
ZDQY = "ZDQY",
Facility,
/**
*
*
*/
DWBZ = "DWBZ",
Oilling,
/**
*
*
*/
FHFQ = "FHFQ",
}
Stop,
}

6
src/app/babylon/model/data/model-data/model-edit-data.ts

@ -12,7 +12,7 @@ export class ModelEditData {
@Type(() => ModelData)
modelData: ModelData; //模型信息
@Type(() => FacilityDatasByType)
facilities: FacilityDatasByType[] = []; //含有哪些设备
facilities: FacilityDatasByType[] = []; //含有哪些设备(手动放置)
constructor() {
// this.belongToBuilding = belongToBuilding;
@ -59,6 +59,10 @@ export class ModelEditData {
return result;
}
}
/**

1
src/app/babylon/model/info/building/building-info.ts

@ -115,4 +115,5 @@ export class BuildingInfo {
SceneManager.destroyModel(this.modelInfo);
}
}
}

8
src/app/babylon/model/info/model/facilityinfo-tool/facility-area.ts

@ -42,13 +42,7 @@ export class AreaInfo {
static getAreaColor(facilityType: FacilityType): Color3 {
let result = Color3.Red();
switch (facilityType) {
case FacilityType.FHFQ:
result = Color3.Red();
break;
case FacilityType.JTQ:
result = Color3.Yellow();
break;
case FacilityType.JJQ:
case FacilityType.QY:
result = Color3.Green();
break;
}

267
src/app/babylon/model/info/model/facilityinfo-tool/facility-gd.ts

@ -1,267 +0,0 @@
//#region 高度
import { AbstractMesh, MeshBuilder, Color3, Vector3, Mesh, Observer, Scene, Vector2 } from "@babylonjs/core";
import { Control, Button } from "@babylonjs/gui";
import { GridMaterial } from "@babylonjs/materials";
import { ModeManager, ModeType } from "src/app/babylon/controller/mode-manager";
import { SceneManager } from "src/app/babylon/controller/scene-manager";
import { UIManager } from "src/app/babylon/controller/ui-manager";
import { BabylonUIStyleTool, UI_LineInfo } from "src/app/babylon/tool/babylon-ui-style-tool";
import { GizmoTool, TransformUIType } from "src/app/babylon/tool/gizmo-tool";
import { PropertyData_GD } from "../../../data/institution/facility/property-data/outdoor/property-data-gd";
import { ModelData_facility } from "../../../data/model-data/model-data-facility";
import { ModelInfo_facility } from "../model-info-facility";
/**
*
*/
export class GdInfo {
pointData_start: Vector3;//起位
pointData_end: Vector3;//终点
material: GridMaterial;
belongToFacility: ModelInfo_facility;
myPath: Vector3[] = [];
myTube: Mesh;
gdMeshPoints: GdMeshPoint[] = [];
isShow: boolean;
onGizmoAimMeshObserver: Observer<AbstractMesh>;
updateObserver: Observer<Scene>;
constructor(startPoint: Vector3, endPoint: Vector3, belongToFacility: ModelInfo_facility) {
let instance = this;
this.belongToFacility = belongToFacility;
this.pointData_start = startPoint;
let point_start = new GdMeshPoint(this, this.pointData_start, false);
this.gdMeshPoints.push(point_start);
this.pointData_end = endPoint;
let point_end = new GdMeshPoint(this, this.pointData_end, true);
this.gdMeshPoints.push(point_end);
this.myPath.push(point_start.pos);
this.myPath.push(point_end.pos);
this.updateObserver = SceneManager.Instance.scene.onBeforeRenderObservable.add(() => {
instance.update();
});
this.onGizmoAimMeshObserver = GizmoTool.onGizmoAimMeshObservable.add((mesh) => {
instance.onChangeGizmo(mesh);
})
this.createMesh();
}
createMesh() {
this.myTube = MeshBuilder.CreateTube("tube", { path: this.myPath, radius: 2, sideOrientation: Mesh.DOUBLESIDE, updatable: true }, SceneManager.Instance.scene);
this.myTube.parent = this.belongToFacility.modelBox;
this.myTube.position = Vector3.Zero();
this.material = new GridMaterial("mat_myTube", SceneManager.Instance.scene);
this.material.mainColor = Color3.FromHexString(BabylonUIStyleTool.c_color_3d_blue); // new Color3(0, 0.5, 1)
this.material.lineColor = new Color3(0, 0, 0);
this.myTube.material = this.material;
}
update() {
this.gdMeshPoints[1].mesh.position.x = 0;
this.gdMeshPoints[1].mesh.position.z = 0;
this.myPath[1] = this.gdMeshPoints[1].mesh.position;
this.myTube = MeshBuilder.CreateTube("tube", { path: this.myPath, radius: 2, sideOrientation: Mesh.DOUBLESIDE, updatable: true, instance: this.myTube }, SceneManager.Instance.scene);
let facilityData = this.belongToFacility.modelData as ModelData_facility;
let property = facilityData.propertyData as PropertyData_GD;
this.gdMeshPoints[1].updateInfo(property.info);
}
//释放
dispose() {
SceneManager.Instance.scene.onBeforeRenderObservable.remove(this.updateObserver);
GizmoTool.onGizmoAimMeshObservable.remove(this.onGizmoAimMeshObserver);
this.updateObserver = null;
for (let i = 0; i < this.gdMeshPoints.length; i++) {
this.gdMeshPoints[i].dispose();
}
this.material.dispose();
this.myTube.dispose();
}
onChangeGizmo(mesh: AbstractMesh) {
// if (mesh != null) {
// this.isShow = mesh == this.belongToFacility.modelBox || this.isPosPointMesh(mesh);
// this.setEnable(this.isShow);
// }
// else {
// this.setEnable(false);
// }
}
//是否是位点mesh
isPosPointMesh(mesh: AbstractMesh): boolean {
if (mesh == null) {
return false;
}
for (let i = 0; i < this.gdMeshPoints.length; i++) {
if (mesh == this.gdMeshPoints[i].mesh) {
return true;
}
}
return false;
}
setEnable(show: boolean) {
for (let i = 0; i < this.gdMeshPoints.length; i++) {
this.gdMeshPoints[i].setEnable(show);
}
}
setUIEnable(show: boolean) {
for (let i = 0; i < this.gdMeshPoints.length; i++) {
this.gdMeshPoints[i].showEditUI(show);
}
}
}
/**
* mesh
*/
export class GdMeshPoint {
pos: Vector3;
canSet: boolean;
gdInfo: GdInfo;
uiRoot: Button;
lineInfo: UI_LineInfo;
mesh: Mesh;
constructor(gdInfo: GdInfo, pos: Vector3, canSet: boolean) {
this.pos = pos;
this.canSet = canSet;
if (canSet) {
this.gdInfo = gdInfo;
this.mesh = MeshBuilder.CreateBox(gdInfo.belongToFacility.modelBox.name + "_point", { size: 1 });
this.mesh.setParent(gdInfo.belongToFacility.modelBox);
this.mesh.position = pos;
this.mesh.isVisible = false;
this.initEditUI();
this.lineInfo = BabylonUIStyleTool.createLineInfo(gdInfo.belongToFacility.modelBox.name, this.mesh);
this.showEditUI(false);
}
}
//初始化 编辑UI
initEditUI() {
if (ModeManager.currentMode == ModeType.Edit) {
let instance = this;
this.uiRoot = Button.CreateImageButton("ui_editPoint_" + this.gdInfo.belongToFacility.modelBox.name, "", "assets/images/ui/edit.png");
UIManager.Instance.uiRoot.addControl(this.uiRoot);
this.uiRoot.linkWithMesh(this.mesh);
this.uiRoot.linkOffsetYInPixels = 20;
this.uiRoot.linkOffsetXInPixels = -40;
BabylonUIStyleTool.setStyle_size(this.uiRoot, "20px", "20px");
this.uiRoot.image.width = 0.8;
this.uiRoot.image.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;
this.uiRoot.image.verticalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;
// this.uiRoot.thickness = 0;
this.uiRoot.background = BabylonUIStyleTool.c_color_3d_blueBg;
this.uiRoot.color = BabylonUIStyleTool.c_color_3d_blue;
// this.uiRoot.alpha = 0.7;
this.uiRoot.onPointerClickObservable.add(() => {
instance.changeAim();
});
}
}
//显示或隐藏 编辑UI
showEditUI(show: boolean) {
if (this.uiRoot != null) {
this.uiRoot.isVisible = show && this.canSet;
}
}
//显示、隐藏标识UI
setEnable(show: boolean) {
if (this.lineInfo != null) {
this.lineInfo.setEnable(show);
}
this.showEditUI(show && ModeManager.currentMode == ModeType.Edit);
}
//改变选中的目标
changeAim() {
let instance = this;
GizmoTool.onTransformUITypeChange(TransformUIType.Position);//强行变为position
GizmoTool.changeGizmoAim(instance.mesh, false, true, false);
// PosPointTool.attachMesh(instance.mesh as Mesh, instance.pos,
// () => {
// instance.addPoint();
// },
// () => {
// instance.reducePoint();
// }
// );
//如果需要增加节点,在此拓展
}
dispose() {
if (this.canSet) {
if (this.uiRoot != null) {
this.uiRoot.dispose();
}
GizmoTool.leaveTheGizmoAimMesh(this.mesh);
this.mesh.dispose();
this.lineInfo.dispose();
}
}
/**
*
* @param text
*/
updateInfo(text: string) {
if (this.lineInfo.info != null) {
this.lineInfo.info.text = "高度:" + text;
this.lineInfo.info.resizeToFit = true;
this.lineInfo.infoBg.height = (this.lineInfo.info.heightInPixels + 5) + "px";
}
}
}
//#endregion

23
src/app/babylon/model/info/model/model-info-facility.ts

@ -10,7 +10,7 @@ import { ModelData } from "../../data/model-data/model-data";
import { FacilityShowType, FacilityType, ModelData_facility } from "../../data/model-data/model-data-facility";
import { BuildingInfo } from "../building/building-info";
import { AreaInfo } from "./facilityinfo-tool/facility-area";
import { GdInfo } from "./facilityinfo-tool/facility-gd";
import { ModelInfo } from "./model-info";
//设施数据
@ -20,7 +20,6 @@ export class ModelInfo_facility extends ModelInfo {
facilityShowType: FacilityShowType;//设备展示状态
ui_select: Ellipse | Rectangle;
areaInfo: AreaInfo;//区域信息
gdInfo: GdInfo;//高度信息
isNew: boolean;//是否是新建
@ -47,12 +46,9 @@ export class ModelInfo_facility extends ModelInfo {
BabylonUIStyleTool.setStyle_size(this.uiFollowRoot, ConfigManager.c_size_facilityIconSize + "px", ConfigManager.c_size_facilityIconSize + "px");
this.uiFollowRoot.thickness = 0;
if (modelData.facilityType == FacilityType.AQCK) {
this.ui_select = new Rectangle("select");
}
else {
this.ui_select = new Ellipse("select");
}
this.ui_select = new Ellipse("select");
this.uiFollowRoot.addControl(this.ui_select);
this.ui_select.background = BabylonUIStyleTool.c_color_3d_blue;
@ -131,9 +127,7 @@ export class ModelInfo_facility extends ModelInfo {
this.areaInfo.setEnable(enable);
}
if (this.gdInfo != null) {
this.gdInfo.setEnable(enable);
}
}
/**
@ -150,9 +144,7 @@ export class ModelInfo_facility extends ModelInfo {
*/
setIconEnable(enable: boolean) {
this.showFollowUI(enable);
if (this.gdInfo != null) {
this.gdInfo.setUIEnable(enable);
}
if (!enable)//还原选中状态
{
@ -165,9 +157,6 @@ export class ModelInfo_facility extends ModelInfo {
this.areaInfo.dispose();
}
if (this.gdInfo != null) {
this.gdInfo.dispose();
}
super.dispose();
}
}

40
src/app/babylon/view/building-window/building-ui-item.ts

@ -1,14 +1,21 @@
import { AbstractMesh, Mesh, TransformNode } from "@babylonjs/core";
import { ConfigManager } from "../../controller/config-manager";
import { InfoManager } from "../../controller/info-manager";
import { SceneManager } from "../../controller/scene-manager";
import { IndoorStatus } from "../../controller/status/indoor-status";
import { StatusManager } from "../../controller/status/status-manager";
import { BuildingType, BuildingData_Normal } from "../../model/data/institution/building/building-data";
import { FacilityPosType, FacilityType, ModelData_facility } from "../../model/data/model-data/model-data-facility";
import { ModelEditData } from "../../model/data/model-data/model-edit-data";
import { TransformData } from "../../model/data/transform-data";
import { BuildingInfo } from "../../model/info/building/building-info";
import { ModelInfo_building } from "../../model/info/model/model-info-building";
import { BabylonTool } from "../../tool/babylon-tool";
import { GizmoTool } from "../../tool/gizmo-tool";
import { TsTool } from "../../tool/ts-tool";
import { FacilityWindow } from "../facility-window/facility-window";
import { MarkWindow } from "../mark-window/mark-window";
// import { BuildingCreateWindow } from "./building-create-window";
import { BuildingWindow } from "./building-window";
@ -196,6 +203,39 @@ export class BuildingUIItem {
}
/**
*
* @param mesh
*/
createFacilityByMesh(mesh: AbstractMesh) {
FacilityWindow.instance.createFacilityByMesh(mesh, this.buildingInfo);
}
/**
*
* @param mesh
*/
createOilingByMesh(mesh: AbstractMesh) {
FacilityWindow.instance.createOilingByMesh(mesh, this.buildingInfo);
}
/**
*
* @param mesh
*/
createStopByMesh(mesh: AbstractMesh) {
FacilityWindow.instance.createStopByMesh(mesh, this.buildingInfo);
}
/**
* mesh中寻找的设备信息
*/
clearFacilityFromMesh() {
}
//#endregion
//#region 内部私有

74
src/app/babylon/view/building-window/building-window.ts

@ -21,6 +21,9 @@ import { BuildingUIItem } from "./building-ui-item";
//建筑界面
export class BuildingWindow extends UIBase {
static instance: BuildingWindow;
buldingStatus: BuildingStatus;
buildingUIItems: BuildingUIItem[] = [];//所有建筑UI
@ -207,13 +210,12 @@ export class BuildingWindow extends UIBase {
this.buldingStatus = StatusManager.getStatus<BuildingStatus>(BuildingStatus);
this.initBuildings();//创建每一个建筑buildingItem
BuildingWindow.instance = this;
this.three = PlanComponent.instance;
// this.three.getAllBuilding(this);
this.three.buildingUIItems = this.buildingUIItems
this.buildingUIItems.length ? this.three.beforeOneBuildingID = this.three.buildingUIItems[0].getBuildingID() : null
}
@ -348,6 +350,8 @@ export class BuildingWindow extends UIBase {
}
});
}
//#endregion
@ -495,5 +499,67 @@ export class BuildingWindow extends UIBase {
}
//#endregion
//#region 寻找建筑内已有设备相关
/**
*
*/
readonly c_xiaoFang = "XF_";
/**
*
*/
readonly c_jiaYou = "JY_";
/**
*
*/
readonly c_zheDang = "ZD";
/**
*
*/
public clearHomeLessFacilityData() {
if (this.currentBuidngItem != null) {
let allNode = this.currentBuidngItem.clearFacilityFromMesh();
}
}
/**
* ()
*/
public getModelAndCreateFacilityData() {
this.clearHomeLessFacilityData();
if (this.currentBuidngItem != null) {
//获取所有transformNodes
let allNode = this.currentBuidngItem.buildingInfo.ModelInfo.modelBox.getChildMeshes(false);
for (let i = 0; i < allNode.length; i++) {
let nodeName = allNode[i].name;
if (TsTool.stringContain(nodeName, this.c_xiaoFang)) //消防
{
this.currentBuidngItem.createFacilityByMesh(allNode[i]);
}
else if (TsTool.stringContain(nodeName, this.c_xiaoFang))//加油站
{
this.currentBuidngItem.createOilingByMesh(allNode[i]);
}
else if (TsTool.stringContain(nodeName, this.c_zheDang))//遮挡
{
this.currentBuidngItem.createStopByMesh(allNode[i]);
}
}
}
}
//#endregion
}

165
src/app/babylon/view/facility-window/facility-window.ts

@ -1,4 +1,5 @@
import {
AbstractMesh,
EventState,
Mesh,
MeshBuilder,
@ -11,6 +12,7 @@ import {
Image,
Rectangle,
} from '@babylonjs/gui';
import { PlanComponent } from 'src/app/pages/plan/plan.component';
import { ConfigManager } from '../../controller/config-manager';
import { DataManager, ModelChangeType } from '../../controller/data-manager';
import { Event_ChangeFacility } from '../../controller/event-manager/events/event-change-facility';
@ -21,15 +23,15 @@ import { BuildingStatus } from '../../controller/status/building-status';
import { IndoorStatus } from '../../controller/status/indoor-status';
import { StatusManager } from '../../controller/status/status-manager';
import { UIManager } from '../../controller/ui-manager';
import { FacilityPosType, ModelData_facility, FacilityShowType } from '../../model/data/model-data/model-data-facility';
import { FacilityPosType, ModelData_facility, FacilityShowType, FacilityType } from '../../model/data/model-data/model-data-facility';
import { TransformData } from '../../model/data/transform-data';
import { BuildingInfo } from '../../model/info/building/building-info';
import { AreaInfo } from '../../model/info/model/facilityinfo-tool/facility-area';
import { GdInfo } from '../../model/info/model/facilityinfo-tool/facility-gd';
import { ModelInfo_facility } from '../../model/info/model/model-info-facility';
import { BabylonTool } from '../../tool/babylon-tool';
import { BabylonUIStyleTool } from '../../tool/babylon-ui-style-tool';
import { GizmoTool } from '../../tool/gizmo-tool';
import { TsTool } from '../../tool/ts-tool';
import { CopyFacilityInfo, FacilityInfoInSceneWindow } from '../facilityinfoinscene-window/facilityinfoinscene-window';
import { ToolbarWindow } from '../toolbar-window/toobar-window';
import { UIBase } from '../window-base/ui-base';
@ -39,7 +41,7 @@ import { FacilityUIItem } from './facility-ui-item';
export class FacilityWindow extends UIBase {
// three: ThreeDimensionalHomeComponent;//前端组件
three: PlanComponent;//前端组件
allFacilityUIItemes: FacilityUIItem[] = [];
@ -145,7 +147,7 @@ export class FacilityWindow extends UIBase {
let facilities: ModelData_facility[];
if (facilityPosType == FacilityPosType.Indoor) {
if (facilityPosType == FacilityPosType.In) {
facilities = DataManager.allFacilityData.indoor;
} else {
// console.log("=====updateAllFacilities=====");
@ -169,11 +171,13 @@ export class FacilityWindow extends UIBase {
instance.allFacilityUIItemes.push(facilityUIItem);
}
console.log("所有可用的设备", instance.allFacilityUIItemes);
// ThreeDimensionalHomeComponent.instance.getAllIcons(instance)
PlanComponent.instance.getAllIcons(instance)
})
// instance.three = ThreeDimensionalHomeComponent.instance
instance.three = PlanComponent.instance
}
@ -234,7 +238,7 @@ export class FacilityWindow extends UIBase {
if (eventData.event.button == 0) { //左键正常
if (eventData.pickInfo.hit && !SceneManager.s_isPointerDrag) {
if (FacilityWindow.s_currentFacilityItem != null) {
instance.createNewFacility(eventData.pickInfo.pickedPoint);
instance.createNewFacilityByPos(eventData.pickInfo.pickedPoint);
return;
}
}
@ -243,7 +247,7 @@ export class FacilityWindow extends UIBase {
}
}
else { //右键取消
// instance.three.unSelectBottomIcon();
instance.three.unSelectBottomIcon();
}
break;
@ -293,13 +297,36 @@ export class FacilityWindow extends UIBase {
//创建新的设施(用世界坐标)
createNewFacility(worldPosition: Vector3) {
createNewFacilityByPos(worldPosition: Vector3) {
let facilityData = FacilityWindow.s_currentFacilityItem.facilityData.clone(
this.createIndex.toString()
);
facilityData.transformData.position = worldPosition.clone();
this.createNewFacility(facilityData);
}
/**
* mesh创建设备
* @param mesh
* @param type
*/
createNewFacilityByMesh(mesh: AbstractMesh, type: FacilityType) {
let facilityData = this.createFacilityDataFromMesh(mesh, type);
//let facilityInfo = this.createFacilityInfoFromMesh(facilityData, mesh, buildingInfo);
this.createNewFacility(facilityData, mesh);
}
/**
* (data)
* @param facilityData
* @param mesh null表示利用根据数据加载模型null表示已经准备好了
*/
createNewFacility(facilityData: ModelData_facility, mesh: AbstractMesh = null) {
let currentBuidngItem = StatusManager.getStatus<BuildingStatus>(BuildingStatus)
.buildingWindow.currentBuidngItem;
if (currentBuidngItem == null) {
@ -310,11 +337,10 @@ export class FacilityWindow extends UIBase {
Event_ChangeFacility.dispatch(facilityData, ModelChangeType.Add, null);
this.createFacility(facilityData, true, undefined, false, true, (modelInfo) => {
this.createFacility(facilityData, true, undefined, false, true, mesh, (modelInfo) => {
GizmoTool.onPickMeshInfoObservable.notifyObservers(modelInfo);
});
}
/**
@ -347,7 +373,7 @@ export class FacilityWindow extends UIBase {
}
Event_ChangeFacility.dispatch(facilityData, ModelChangeType.Add, null);
this.createFacility(facilityData, false, undefined, true, true, (modelInfo) => {
this.createFacility(facilityData, false, undefined, true, true, null, (modelInfo) => {
//GizmoTool.onPickMeshInfoObservable.notifyObservers(modelInfo);
modelInfo.onStopLongPress(null, null);
@ -374,6 +400,7 @@ export class FacilityWindow extends UIBase {
buildingInfo: BuildingInfo = null,
isLocalPos = false,
select = false,
mesh: AbstractMesh = null, //null 表示利用根据数据加载模型,不是null表示已经准备好了
onSuccess?: (modelInfo: ModelInfo_facility) => void
): ModelInfo_facility {
@ -434,17 +461,6 @@ export class FacilityWindow extends UIBase {
}
}
else if (facilityInfo.facilityShowType == FacilityShowType.GdAndTag) {
if (facilityData.areaPoints.length == 0) {
facilityData.areaPoints = [];
facilityData.areaPoints.push(new Vector3(0, 0, 0));
facilityData.areaPoints.push(new Vector3(0, 10, 0));
}
facilityInfo.gdInfo = new GdInfo(facilityData.areaPoints[0], facilityData.areaPoints[1], facilityInfo);
if (onSuccess) {
onSuccess(facilityInfo);
}
}
// if (select) {
// GizmoTool.onPickMeshInfoObservable.notifyObservers(facilityInfo);
@ -518,4 +534,105 @@ export class FacilityWindow extends UIBase {
return buildingInfo;
}
//#region 从已有模型创建设备
/**
*
* @param mesh
*/
createFacilityByMesh(mesh: AbstractMesh, buildingInfo: BuildingInfo) {
if (TsTool.stringContain(mesh.name, FacilityType.XF_MHQ_GF_4)) {
this.createNewFacilityByMesh(mesh, FacilityType.XF_MHQ_GF_4);
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_MHQ_GF_8)) {
this.createNewFacilityByMesh(mesh, FacilityType.XF_MHQ_GF_8);
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_MHQ_GF_35)) {
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_MHQ_PT_4)) {
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_MHQ_PT_8)) {
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_MHQ_PT_35)) {
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_MHT)) {
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_SSD)) {
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_TSLX)) {
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_XFCM)) {
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_XFF)) {
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_XFQ)) {
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_XFS)) {
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_XFT)) {
}
else if (TsTool.stringContain(mesh.name, FacilityType.ZD_YG)) {
}
}
/**
*
* @param mesh
*/
createOilingByMesh(mesh: AbstractMesh, buildingInfo: BuildingInfo) {
}
/**
*
* @param mesh
*/
createStopByMesh(mesh: AbstractMesh, buildingInfo: BuildingInfo) {
}
createFacilityDataFromMesh(mesh: AbstractMesh, type: FacilityType) {
let name = ConfigManager.getFacilityTypeName(type);
let result = new ModelData_facility(mesh.name, type, name, mesh.name, new TransformData(), FacilityPosType.In);
return result;
}
/**
* mesh和设备data创建设备Info()
* @param facilityData
* @param mesh
* @param buildingInfo
*/
createFacilityInfoFromMesh(facilityData: ModelData_facility, mesh: AbstractMesh, buildingInfo: BuildingInfo) {
let facilityInfo = InfoManager.newModelInfo_facility(
facilityData.key,
facilityData,
null,
mesh,
buildingInfo,
true
);
return facilityInfo;
}
//#endregion
}

71
src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts

@ -1,18 +1,5 @@
import { SceneManager } from "../../controller/scene-manager";
import { PropertyData_Base_IMG } from "../../model/data/institution/facility/property-data/base/property-data-base-img";
import { PropertyData_Base_SBJHQ } from "../../model/data/institution/facility/property-data/base/property-data-base-sbjhq";
import { PropertyData_Base_XFB } from "../../model/data/institution/facility/property-data/base/property-data-base-xfb";
import { PropertyData_Base_XHS } from "../../model/data/institution/facility/property-data/base/property-data-base-xhs";
import { PropertyData_DWBZ } from "../../model/data/institution/facility/property-data/indoor/property-data-dwbz";
import { PropertyData_FHFQ } from "../../model/data/institution/facility/property-data/indoor/property-data-fhfq";
import { PropertyData_SSLT } from "../../model/data/institution/facility/property-data/indoor/property-data-sslt";
import { PropertyData_XFDT } from "../../model/data/institution/facility/property-data/indoor/property-data-xfdt";
import { PropertyData_ZDQY } from "../../model/data/institution/facility/property-data/indoor/property-data-zdqy";
import { PropertyData_AQCK } from "../../model/data/institution/facility/property-data/outdoor/property-data-aqck";
import { PropertyData_GD } from "../../model/data/institution/facility/property-data/outdoor/property-data-gd";
import { PropertyData_PL } from "../../model/data/institution/facility/property-data/outdoor/property-data-pl";
import { PropertyData_Q } from "../../model/data/institution/facility/property-data/outdoor/property-data-q";
import { PropertyData_Base } from "../../model/data/institution/facility/property-data/property-data-base";
import { FacilityType, ModelData_facility } from "../../model/data/model-data/model-data-facility";
import { ModelInfo_facility } from "../../model/info/model/model-info-facility";
@ -63,59 +50,8 @@ export class FacilityInfoUIItem {
*
*/
getPropertyData() {
let facilityData
// = (this.modelInfo.modelData as ModelData_facility).propertyData as any;
if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.AQCK) {
//安全出口
facilityData = (this.modelInfo.modelData as ModelData_facility).propertyData as PropertyData_AQCK;
} else if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.DSXHS || (this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.DXXHS || (this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.SZDSXHS || (this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.SZDXXHS) {
//消火栓
facilityData = (this.modelInfo.modelData as ModelData_facility).propertyData as PropertyData_Base_XHS;
} else if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.DSSBJHQ || (this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.DXSBJHQ || (this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.QBSBJHQ || (this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.DGNSBJHQ) {
//水泵接合器
facilityData = (this.modelInfo.modelData as ModelData_facility).propertyData as PropertyData_Base_SBJHQ;
} else if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.GD) {
//高度
facilityData = (this.modelInfo.modelData as ModelData_facility).propertyData as PropertyData_GD;
} else if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.PL) {
//毗邻
facilityData = (this.modelInfo.modelData as ModelData_facility).propertyData as PropertyData_PL;
} else if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.TPBZ || (this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.XKS || (this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.BF || (this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.SX) {
//图片标注,消控室,泵房,水箱
facilityData = (this.modelInfo.modelData as ModelData_facility).propertyData as PropertyData_Base_IMG;
} else if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.JJQ || (this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.JTQ) {
//集结区,禁停区
facilityData = (this.modelInfo.modelData as ModelData_facility).propertyData as PropertyData_Q;
}
else if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.LSXFB || (this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.WSXFB || (this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.CYXFB) {
//消防泵
facilityData = (this.modelInfo.modelData as ModelData_facility).propertyData as PropertyData_Base_XFB;
} else if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.FHFQ) {
//防火分区
facilityData = (this.modelInfo.modelData as ModelData_facility).propertyData as PropertyData_FHFQ;
} else if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.FHM) {
//防火门
} else if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.FHJL) {
//防火卷帘
} else if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.SSLT) {
//疏散楼梯
facilityData = (this.modelInfo.modelData as ModelData_facility).propertyData as PropertyData_SSLT;
} else if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.XFDT) {
//消防电梯
facilityData = (this.modelInfo.modelData as ModelData_facility).propertyData as PropertyData_XFDT;
} else if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.PTDT) {
//普通电梯
facilityData = null
} else if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.ZDQY) {
//重点区域
facilityData = (this.modelInfo.modelData as ModelData_facility).propertyData as PropertyData_ZDQY;
} else if ((this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.WXY || (this.modelInfo.modelData as ModelData_facility).facilityType == FacilityType.DWBZ) {
//危险源,点位标注
facilityData = (this.modelInfo.modelData as ModelData_facility).propertyData as PropertyData_DWBZ;
} else {
//未匹配到的
facilityData = null
}
let facilityData = (this.modelInfo.modelData as ModelData_facility).propertyData as any;
return facilityData
}
@ -177,9 +113,6 @@ export class FacilityInfoUIItem {
}
let size = null;
if (this.modelInfo.gdInfo != null) {
size = this.modelInfo.gdInfo.myPath[1].y * 3;
}
if (this.modelInfo.areaInfo != null) {
//计算多边形size

14
src/app/babylon/view/mark-window/mark-window.ts

@ -1356,19 +1356,7 @@ export class MarkWindow extends UIBase {
*/
isWaterSouce(type: FacilityType) {
let result = false;
switch (type) {
case FacilityType.DXXHS:
case FacilityType.DSXHS:
case FacilityType.SZDSXHS:
case FacilityType.SZDXXHS:
case FacilityType.DSSBJHQ:
case FacilityType.DXSBJHQ:
case FacilityType.DGNSBJHQ:
case FacilityType.QBSBJHQ:
case FacilityType.SNXHS:
result = true;
break;
}
return result;
}

23
src/app/babylon/view/toolbar-window/toobar-window.ts

@ -3,6 +3,7 @@ import { PointerEventTypes } from "@babylonjs/core/Events/pointerEvents";
import { PointerInfo } from "@babylonjs/core/Events/pointerEvents";
import { EventState } from "@babylonjs/core/Misc/observable";
import { Button, Control, Rectangle } from "@babylonjs/gui";
import { PlanComponent } from "src/app/pages/plan/plan.component";
import { DataManager } from "../../controller/data-manager";
import { ModeManager } from "../../controller/mode-manager";
import { SceneManager } from "../../controller/scene-manager";
@ -11,10 +12,9 @@ import { UIManager } from "../../controller/ui-manager";
import { BabylonUIStyleTool } from "../../tool/babylon-ui-style-tool";
import { GizmoTool, TransformUIType } from "../../tool/gizmo-tool";
import { MeasureTool, MeasureType } from "../../tool/measure-tool";
import { BuildingWindow } from "../building-window/building-window";
import { FacilityWindow } from "../facility-window/facility-window";
import { CopyFacilityInfo, FacilityInfoInSceneWindow } from "../facilityinfoinscene-window/facilityinfoinscene-window";
import { UIBase } from "../window-base/ui-base";
/**
@ -32,7 +32,7 @@ export class ToolbarWindow extends UIBase {
//#region 前端对接
// three: ThreeDimensionalHomeComponent;//前端组件
three: PlanComponent;//前端组件
compassAlpha: number;//指南针旋转 0-2π
/**
@ -89,6 +89,21 @@ export class ToolbarWindow extends UIBase {
//#endregion
/**
*
*/
clearHomeLessFacilityData() {
BuildingWindow.instance.clearHomeLessFacilityData();
}
/**
*
*/
getModelAndCreateFacilityData() {
BuildingWindow.instance.getModelAndCreateFacilityData();
}
onInit() {
super.onInit();
ToolbarWindow.instance = this;
@ -204,7 +219,7 @@ export class ToolbarWindow extends UIBase {
//改变拾取状态
changeMeshAdsorbY() {
this.isMeshAdsorb = !this.isMeshAdsorb;
// this.three.updateSelectAdsorb();
PlanComponent.instance.updateSelectAdsorb();
}
//#endregion

29
src/app/pages/plan/plan.component.html

@ -1,7 +1,7 @@
<div class="content">
<canvas id="center"></canvas>
<!-- 左侧建筑 -->
<!-- 左侧建筑 -->
<div class="showLeftBuilding" title="显示" *ngIf="!isShowLeftBuilding" (click)="toggleLeftBuilding(true)"><i nz-icon nzType="right" nzTheme="outline"></i></div>
<div class="leftBuilding" [ngClass]="{'isShowLeftBuilding': isShowLeftBuilding === false}">
<div class="hideLeft"><i nz-icon nzType="close" nzTheme="outline" title="隐藏" (click)="toggleLeftBuilding(false)"></i></div>
@ -12,17 +12,38 @@
<div class="leftCenter">
<div class="everyBuilding" *ngFor="let item of buildingUIItems" (click)='selectLeftBuilding(item)' [ngClass]="{'selectLeftBuilding': beforeOneBuildingID == item.getBuildingID()}">
<label style="flex: 1;" class="overflowText modelTitle">{{item.getBuildingName()}}</label>
<label style="width: 50px; overflow: hidden;">
<i nz-icon nzType="edit" nzTheme="outline" title="编辑" (click)="editModelBuilding($event,item)"></i>
<label style="width: 65px; overflow: hidden;">
<i nz-icon nzType="plus-circle" nzTheme="outline" title="聚焦" (click)="positionModelBuilding($event,item)"></i>
<i nz-icon nzType="edit" nzTheme="outline" title="编辑" (click)="editModelBuilding($event,item)" style="margin: 0 5px;"></i>
<i nz-icon nzType="delete" nzTheme="outline" title="删除" (click)="deleteModelBuilding($event,item)"></i>
</label>
</div>
</div>
</div>
<!-- 左侧建筑 -->
<!-- 左侧建筑栏 -->
<!-- 底部图标栏 -->
<div class="bottomIcons">
<div class="autoScroll"><i nz-icon nzType="left" nzTheme="outline" (click)="bottomScroll(0)"></i></div>
<div class="bottomCenter" id="bottomCenter">
<div class="everyIcon" (click)='selectBottomIcon(item)' *ngFor="let item of allFacilityUIItemes" [ngClass]="{'selectLeftIcon': beforeOneIcon == item.getIconID()}">
<img [src]="item.getIconURL()">
<p>{{item.getIconName()}}</p>
</div>
</div>
<div class="autoScroll"><i nz-icon nzType="right" nzTheme="outline" (click)="bottomScroll(1)"></i></div>
</div>
<!-- 底部图标栏 -->
<!-- 右上角快捷栏 -->
<div class="rightTopFast">
<div class="publicFast leftFast">
<button title="平移" (click)="translation()" [ngClass]="{'selectRightTopFast': selectRightTopFast == 0}"></button>
<button title="旋转" (click)="revolve()" [ngClass]="{'selectRightTopFast': selectRightTopFast == 1}"></button>
<button title="缩放" (click)="scale()" [ngClass]="{'selectRightTopFast': selectRightTopFast == 2}"></button>
<button title="吸附" (click)="adsorb()" [ngClass]="{'leftFastIsTure': selectAdsorb }"></button>
<button title="切换至顶视图" (click)="toggleTopLevelView()" [ngClass]="{'leftFastIsTure': topLevelView }"></button>
</div>
<div style="margin: 0 10px; background-color: #0080FF;" title="保存"><button (click)="preserve()"><i nz-icon nzType="save" nzTheme="outline" style="font-size: 20px;"></i></button></div>
</div>
<!-- 右上角快捷栏 -->

53
src/app/pages/plan/plan.component.scss

@ -5,7 +5,7 @@
position: relative;
canvas{ width: 100%; height: 100%; border: none; outline: none; }
}
.anticon { font-size: 16px; cursor: pointer; } //字体图标
.anticon{ font-size: 16px; cursor: pointer; } //字体图标
//文本溢出
.overflowText{
overflow: hidden;
@ -65,7 +65,6 @@
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
.modelTitle { font-size: 14px; }
label { display: block; }
.anticon { margin: 0 3px; } //字体图标
}
.selectLeftBuilding { background-color: #2196f3; } //选中样式
}
@ -75,9 +74,43 @@
transition: margin-left 0.5s;
}
//底部图标栏
.bottomIcons{
width: 80%;
height: 60px;
line-height: 60px;
position: absolute;
left: 0;
right: 0;
bottom: 1px;
margin: auto;/*这行代码是关键*/
color: #fff;
background: rgba(0,17,33,0.7);
border-radius: 10px 10px 0px 0px;
display: flex;
box-sizing: border-box;
padding: 1px;
.autoScroll{ width: 30px; text-align: center; }
.bottomCenter{
flex: 1;
overflow: hidden;
.everyIcon {
width: 100px;
height: 58px;
line-height: normal;
text-align: center;
display: inline-block;
overflow: hidden;
img { width: 40px; height: 40px; margin-top: 3px; cursor: pointer; }
p { height: 18px; line-height: 18px; margin-top: -3px; font-size: 12px; }
}
}
.selectLeftIcon { background: rgb(0,128,255,0.5); } //选中样式
}
//右上角快捷栏
.rightTopFast{
width: 60px;
width: 250px;
height: 38px;
position: absolute;
right: 1px;
@ -95,4 +128,18 @@
color: #fff;
cursor: pointer;
}
.publicFast {
box-sizing: border-box;
padding: 1px 5px;
background-color: rgba(0,0,0,0.5);
}
.leftFast {
:first-child{ background: url(../../../assets/images/translationThree.png) no-repeat center; }
:nth-child(2){ background: url(../../../assets/images/revolveThree.png) no-repeat center; }
:nth-child(3){ background: url(../../../assets/images/scaleThree.png) no-repeat center; }
:nth-child(4){ background: url(../../../assets/images/adsorb.png) no-repeat center; }
:nth-child(5){ background: url(../../../assets/images/verticalView.png) no-repeat center; }
.leftFastIsTure { border: 1px solid #fff; } //吸附样式
}
.selectRightTopFast { border: 1px solid #fff; } //选种样式
}

81
src/app/pages/plan/plan.component.ts

@ -12,6 +12,8 @@ import { BuildingStatus } from 'src/app/babylon/controller/status/building-statu
import { BuildingUIItem } from 'src/app/babylon/view/building-window/building-ui-item';
import { BuildingType } from 'src/app/babylon/model/data/institution/building/building-data';
import { BuildingWindow } from 'src/app/babylon/view/building-window/building-window';
import { FacilityUIItem } from 'src/app/babylon/view/facility-window/facility-ui-item';
import { FacilityWindow } from 'src/app/babylon/view/facility-window/facility-window';
@ -124,6 +126,12 @@ export class PlanComponent implements OnInit {
this.editBuildingPop = e; //打开弹窗
}
//聚焦 建筑
positionModelBuilding(event, e: BuildingUIItem) {
event.stopPropagation()
e.lookAt()
}
//删除建筑
deleteModelBuilding(event, e: BuildingUIItem) {
event.stopPropagation()
@ -136,6 +144,79 @@ export class PlanComponent implements OnInit {
}
}
allFacilityUIItemes: FacilityUIItem[] = []; //底部所有 图标
beforeOneIcon: string = null; //当前选择 图标
// 获取 底部图标栏list
getAllIcons(e: FacilityWindow) {
this.allFacilityUIItemes = e.allFacilityUIItemes
this.beforeOneIcon = null
}
//选择底部图标
selectBottomIcon(e: FacilityUIItem) {
if (this.beforeOneIcon != e.getIconID()) {
this.beforeOneIcon = e.getIconID()
e.select()
} else {
this.beforeOneIcon = null
e.unSelect()
}
}
//取消选择 底部图标
unSelectBottomIcon() {
if (this.beforeOneIcon) {
let e: FacilityUIItem = this.allFacilityUIItemes.find(item => { return item.getIconID() === this.beforeOneIcon })
e ? e.unSelect() : null
this.beforeOneIcon = null
}
}
//底部图标栏 滚动条
bottomScroll(e) {
let bootomDiv = this.element.nativeElement.querySelector('#bottomCenter')
e == 0 ? bootomDiv.scrollLeft = bootomDiv.scrollLeft + 50 : bootomDiv.scrollLeft = bootomDiv.scrollLeft - 50
}
selectRightTopFast: number = 0; //当前选择功能 快捷栏
selectAdsorb: boolean = false; //吸附状态
topLevelView: boolean = false; //顶视图状态
//平移
translation() {
this.selectRightTopFast = 0
ToolbarWindow.instance.changeGizmoType_position();
}
//旋转
revolve() {
this.selectRightTopFast = 1
ToolbarWindow.instance.changeGizmoType_Rotation();
}
//缩放
scale() {
this.selectRightTopFast = 2
ToolbarWindow.instance.changeGizmoType_Scale();
}
//吸附
adsorb() {
ToolbarWindow.instance.changeMeshAdsorbY();
}
//获取吸附的状态
updateSelectAdsorb() {
this.selectAdsorb = ToolbarWindow.instance.isMeshAdsorb;
}
//切换至顶视图
toggleTopLevelView() {
this.topLevelView = !this.topLevelView
ToolbarWindow.instance.changeTopView(this.topLevelView)
}
//保存
preserve() {
ToolbarWindow.instance.onBtnSave();

BIN
src/assets/images/adsorb.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
src/assets/images/facility/out/DWBZ.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
src/assets/images/facility/out/PL.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
src/assets/images/facility/out/QY.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
src/assets/images/facility/out/TPBZ.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
src/assets/images/revolveThree.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

BIN
src/assets/images/scaleThree.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

BIN
src/assets/images/translationThree.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

BIN
src/assets/images/verticalView.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
src/assets/mesh/facilities/dwbz/DWBZ.bin

Binary file not shown.

174
src/assets/mesh/facilities/dwbz/DWBZ.gltf

@ -0,0 +1,174 @@
{
"asset": {
"version": "2.0",
"generator": "babylon.js glTF exporter for 3dsmax 2020 v20201214.2"
},
"scene": 0,
"scenes": [
{
"nodes": [
0
]
}
],
"nodes": [
{
"mesh": 0,
"rotation": [
0.7071068,
0,
0,
0.7071067
],
"name": "DWBZ",
"translation": [
0,
0,
0
],
"scale": [
1,
1,
1
]
}
],
"meshes": [
{
"primitives": [
{
"attributes": {
"POSITION": 1,
"TANGENT": 2,
"NORMAL": 3,
"TEXCOORD_0": 4
},
"indices": 0,
"material": 0,
"mode": 4,
"extensions": {
"KHR_draco_mesh_compression": {
"bufferView": 0,
"attributes": {
"POSITION": 0,
"TANGENT": 1,
"NORMAL": 2,
"TEXCOORD_0": 3
}
}
}
}
],
"name": "DWBZ"
}
],
"accessors": [
{
"componentType": 5123,
"count": 1068,
"type": "SCALAR",
"name": "accessorIndices"
},
{
"componentType": 5126,
"count": 1068,
"max": [
0.2237389352940401,
0.23126999538265758,
0.0024346969171470945
],
"min": [
-0.04925561481714704,
-0.044022137017147044,
-0.4255422221171471
],
"type": "VEC3",
"name": "accessorPositions"
},
{
"componentType": 5126,
"count": 1068,
"type": "VEC4",
"name": "accessorTangents"
},
{
"componentType": 5126,
"count": 1068,
"type": "VEC3",
"name": "accessorNormals"
},
{
"componentType": 5126,
"count": 1068,
"type": "VEC2",
"name": "accessorUVs"
}
],
"bufferViews": [
{
"buffer": 0,
"byteOffset": 0,
"byteLength": 18614
}
],
"buffers": [
{
"name": "DWBZ",
"byteLength": 18616,
"uri": "DWBZ.bin"
}
],
"materials": [
{
"pbrMetallicRoughness": {
"baseColorTexture": {
"index": 0,
"texCoord": 0
},
"metallicFactor": 0,
"roughnessFactor": 0.450053632,
"baseColorFactor": [
1,
1,
1,
1
]
},
"name": "DWBZ",
"emissiveFactor": [
0,
0,
0
],
"alphaMode": "OPAQUE",
"doubleSided": false
}
],
"textures": [
{
"sampler": 0,
"source": 0,
"name": "DWBZ.jpg"
}
],
"images": [
{
"name": "DWBZ",
"uri": "DWBZ.jpg"
}
],
"samplers": [
{
"magFilter": 9729,
"minFilter": 9987,
"wrapS": 10497,
"wrapT": 10497
}
],
"extensionsRequired": [
"KHR_draco_mesh_compression"
],
"extensionsUsed": [
"KHR_draco_mesh_compression"
]
}

5
src/assets/mesh/facilities/dwbz/DWBZ.gltf.manifest

@ -0,0 +1,5 @@
{
"version" : 1,
"enableSceneOffline" : true,
"enableTexturesOffline" : true
}

BIN
src/assets/mesh/facilities/dwbz/DWBZ.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
src/assets/mesh/facilities/pl/PL.bin

Binary file not shown.

174
src/assets/mesh/facilities/pl/PL.gltf

@ -0,0 +1,174 @@
{
"asset": {
"version": "2.0",
"generator": "babylon.js glTF exporter for 3dsmax 2020 v20201214.2"
},
"scene": 0,
"scenes": [
{
"nodes": [
0
]
}
],
"nodes": [
{
"mesh": 0,
"translation": [
0,
0,
6.10351549e-7
],
"rotation": [
0.7071068,
0,
0,
0.7071067
],
"name": "PL",
"scale": [
1,
1,
1
]
}
],
"meshes": [
{
"primitives": [
{
"attributes": {
"POSITION": 1,
"TANGENT": 2,
"NORMAL": 3,
"TEXCOORD_0": 4
},
"indices": 0,
"material": 0,
"mode": 4,
"extensions": {
"KHR_draco_mesh_compression": {
"bufferView": 0,
"attributes": {
"POSITION": 0,
"TANGENT": 1,
"NORMAL": 2,
"TEXCOORD_0": 3
}
}
}
}
],
"name": "PL"
}
],
"accessors": [
{
"componentType": 5123,
"count": 1446,
"type": "SCALAR",
"name": "accessorIndices"
},
{
"componentType": 5126,
"count": 1302,
"max": [
9.994759744015631,
9.942144559843674,
0.01258431331265264
],
"min": [
-9.994759744015633,
-9.940061744015633,
-0.19228631101563265
],
"type": "VEC3",
"name": "accessorPositions"
},
{
"componentType": 5126,
"count": 1302,
"type": "VEC4",
"name": "accessorTangents"
},
{
"componentType": 5126,
"count": 1302,
"type": "VEC3",
"name": "accessorNormals"
},
{
"componentType": 5126,
"count": 1302,
"type": "VEC2",
"name": "accessorUVs"
}
],
"bufferViews": [
{
"buffer": 0,
"byteOffset": 0,
"byteLength": 23001
}
],
"buffers": [
{
"name": "PL",
"byteLength": 23004,
"uri": "PL.bin"
}
],
"materials": [
{
"pbrMetallicRoughness": {
"baseColorTexture": {
"index": 0,
"texCoord": 0
},
"metallicFactor": 0,
"roughnessFactor": 0.450053632,
"baseColorFactor": [
1,
1,
1,
1
]
},
"alphaMode": "BLEND",
"name": "PL",
"emissiveFactor": [
0,
0,
0
],
"doubleSided": false
}
],
"textures": [
{
"sampler": 0,
"source": 0,
"name": "PL.png"
}
],
"images": [
{
"name": "PL",
"uri": "PL.png"
}
],
"samplers": [
{
"magFilter": 9729,
"minFilter": 9987,
"wrapS": 10497,
"wrapT": 10497
}
],
"extensionsRequired": [
"KHR_draco_mesh_compression"
],
"extensionsUsed": [
"KHR_draco_mesh_compression"
]
}

5
src/assets/mesh/facilities/pl/PL.gltf.manifest

@ -0,0 +1,5 @@
{
"version" : 1,
"enableSceneOffline" : true,
"enableTexturesOffline" : true
}

BIN
src/assets/mesh/facilities/pl/PL.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

BIN
src/assets/mesh/facilities/tpbz/TPBZ.bin

Binary file not shown.

174
src/assets/mesh/facilities/tpbz/TPBZ.gltf

@ -0,0 +1,174 @@
{
"asset": {
"version": "2.0",
"generator": "babylon.js glTF exporter for 3dsmax 2020 v20201214.2"
},
"scene": 0,
"scenes": [
{
"nodes": [
0
]
}
],
"nodes": [
{
"mesh": 0,
"rotation": [
0.7071068,
0,
0,
0.7071067
],
"name": "TPBZ",
"translation": [
0,
0,
0
],
"scale": [
1,
1,
1
]
}
],
"meshes": [
{
"primitives": [
{
"attributes": {
"POSITION": 1,
"TANGENT": 2,
"NORMAL": 3,
"TEXCOORD_0": 4
},
"indices": 0,
"material": 0,
"mode": 4,
"extensions": {
"KHR_draco_mesh_compression": {
"bufferView": 0,
"attributes": {
"POSITION": 0,
"TANGENT": 1,
"NORMAL": 2,
"TEXCOORD_0": 3
}
}
}
}
],
"name": "TPBZ"
}
],
"accessors": [
{
"componentType": 5123,
"count": 4908,
"type": "SCALAR",
"name": "accessorIndices"
},
{
"componentType": 5126,
"count": 4908,
"max": [
0.17296450471910108,
0.17046235425842693,
0.00027006055056177924
],
"min": [
-0.1729830605505618,
-0.17035406055056182,
-0.5530840075505618
],
"type": "VEC3",
"name": "accessorPositions"
},
{
"componentType": 5126,
"count": 4908,
"type": "VEC4",
"name": "accessorTangents"
},
{
"componentType": 5126,
"count": 4908,
"type": "VEC3",
"name": "accessorNormals"
},
{
"componentType": 5126,
"count": 4908,
"type": "VEC2",
"name": "accessorUVs"
}
],
"bufferViews": [
{
"buffer": 0,
"byteOffset": 0,
"byteLength": 82936
}
],
"buffers": [
{
"name": "TPBZ",
"byteLength": 82936,
"uri": "TPBZ.bin"
}
],
"materials": [
{
"pbrMetallicRoughness": {
"baseColorTexture": {
"index": 0,
"texCoord": 0
},
"metallicFactor": 0,
"roughnessFactor": 0.450053632,
"baseColorFactor": [
1,
1,
1,
1
]
},
"name": "TPBZ",
"emissiveFactor": [
0,
0,
0
],
"alphaMode": "OPAQUE",
"doubleSided": false
}
],
"textures": [
{
"sampler": 0,
"source": 0,
"name": "TPBZ.jpg"
}
],
"images": [
{
"name": "TPBZ",
"uri": "TPBZ.jpg"
}
],
"samplers": [
{
"magFilter": 9729,
"minFilter": 9987,
"wrapS": 10497,
"wrapT": 10497
}
],
"extensionsRequired": [
"KHR_draco_mesh_compression"
],
"extensionsUsed": [
"KHR_draco_mesh_compression"
]
}

5
src/assets/mesh/facilities/tpbz/TPBZ.gltf.manifest

@ -0,0 +1,5 @@
{
"version" : 1,
"enableSceneOffline" : true,
"enableTexturesOffline" : true
}

BIN
src/assets/mesh/facilities/tpbz/TPBZ.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Loading…
Cancel
Save