diff --git a/src/app/babylon/controller/config-manager.ts b/src/app/babylon/controller/config-manager.ts index b932819..d676a0e 100644 --- a/src/app/babylon/controller/config-manager.ts +++ b/src/app/babylon/controller/config-manager.ts @@ -43,7 +43,10 @@ export class ConfigManager { case FacilityType.QY: case FacilityType.TPBZ: case FacilityType.DWBZ: + case FacilityType.JY_JYJ://临时 + case FacilityType.JY_YG://临时 result = true; + break; } @@ -73,11 +76,28 @@ export class ConfigManager { static getFacilityTypeName(type: FacilityType): string { let result = "未知"; switch (type) { - + //自定义放置 case FacilityType.PL: result = "毗邻"; break; case FacilityType.QY: result = "区域"; break; - case FacilityType.TPBZ: result = "图片标注"; break; - case FacilityType.DWBZ: result = "点位标注"; break; + case FacilityType.TPBZ: result = "图片"; break; + case FacilityType.DWBZ: result = "点位"; break; + //内建 + case FacilityType.XF_MHQ_PT_4: result = "4kg普通灭火器"; break; + case FacilityType.XF_MHQ_PT_8: result = "8kg普通灭火器"; break; + case FacilityType.XF_MHQ_PT_35: result = "35kg普通灭火器"; break; + case FacilityType.XF_MHQ_GF_4: result = "4kg干粉灭火器"; break; + case FacilityType.XF_MHQ_GF_8: result = "8kg干粉灭火器"; break; + case FacilityType.XF_MHQ_GF_35: result = "35kg干粉灭火器"; break; + case FacilityType.XF_MHT: result = "灭火毯"; break; + case FacilityType.XF_XFQ: result = "消防锹"; break; + case FacilityType.XF_XFT: result = "消防桶"; break; + case FacilityType.XF_XFCM: result = "消防长矛"; break; + case FacilityType.XF_XFF: result = "消防斧"; break; + case FacilityType.XF_XFS: result = "消防沙"; break; + case FacilityType.JY_JYJ: result = "加油机"; break; + case FacilityType.JY_YG: result = "油罐"; break; + case FacilityType.JY_SYGX: result = "输油管线"; break; + case FacilityType.JY_YQHSGX: result = "油气回收管线"; break; } return result; } diff --git a/src/app/babylon/controller/data-manager.ts b/src/app/babylon/controller/data-manager.ts index 4b8f0c6..de28f8a 100644 --- a/src/app/babylon/controller/data-manager.ts +++ b/src/app/babylon/controller/data-manager.ts @@ -11,7 +11,11 @@ import { } from '../model/data/institution/building/building-data'; 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_JYJ } from '../model/data/institution/facility/property-data/in/property-data-jyj'; import { PropertyData_MHQ } from '../model/data/institution/facility/property-data/in/property-data-mhq'; +import { PropertyData_SYGX } from '../model/data/institution/facility/property-data/in/property-data-sygx'; +import { PropertyData_YG } from '../model/data/institution/facility/property-data/in/property-data-yg'; +import { PropertyData_YQHSGX } from '../model/data/institution/facility/property-data/in/property-data-yqhsgx'; 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'; @@ -439,7 +443,10 @@ export class DataManager { 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; - + case FacilityType.JY_JYJ: result = new PropertyData_JYJ(key,"", "","", "","",); break; + case FacilityType.JY_YG: result = new PropertyData_YG(key,"", "","", "","",""); break; + case FacilityType.JY_SYGX: result = new PropertyData_SYGX(key); break; + case FacilityType.JY_YQHSGX: result = new PropertyData_YQHSGX(key); break; } diff --git a/src/app/babylon/controller/mode-manager.ts b/src/app/babylon/controller/mode-manager.ts index 5bf14b6..4f3c9fd 100644 --- a/src/app/babylon/controller/mode-manager.ts +++ b/src/app/babylon/controller/mode-manager.ts @@ -15,15 +15,15 @@ export enum ModeType { export class ModeManager { /** - * 当前模式的类型(编辑模式代表内部编辑人员,可新增单位、上传模型,查看模式代表交付的模式) + * 当前模式的类型 * 外部使用 currentMode 属性访问和修改 */ private static s_currentMode: ModeType = ModeType.Edit; /** - * 高级权限,表示某些高级功能的开放 + * 制作模式代表内部编辑人员,可新增单位、上传模型,查看模式代表交付的模式 */ - public static highPower = true; + public static s_isMakeMode = true; /** * 调试模式 @@ -52,7 +52,7 @@ export class ModeManager { //#endregion /** - * 获取当前模式的类型 + * 获取当前模式的类型(查看或编辑,用户权限有关) */ static get currentMode(): ModeType { return ModeManager.s_currentMode; diff --git a/src/app/babylon/controller/scene-manager.ts b/src/app/babylon/controller/scene-manager.ts index fed7287..cb7899e 100644 --- a/src/app/babylon/controller/scene-manager.ts +++ b/src/app/babylon/controller/scene-manager.ts @@ -138,6 +138,7 @@ export class SceneManager { // camera.upperBetaLimit = 1.5; //beta方向上的旋转限制(防止看到模型底面) camera.lowerRadiusLimit = 1; //相机距离拍摄目标的最小距离(防止穿插) camera.setTarget(Vector3.Zero()); //设置拍摄目标 + camera.radius = 100; camera.attachControl(this.canvas, true); //把相机连接到画布 this.defaultCamera = camera; @@ -475,7 +476,7 @@ export class SceneManager { ) { // console.log("准备加载"); - let defaultMesh = MeshBuilder.CreateBox(modelData.key, { size: 0.01 }); + let defaultMesh = MeshBuilder.CreateBox(modelData.key + "Box", { size: 0.01 }); defaultMesh.scaling.y = 0.01; defaultMesh.visibility = 0; diff --git a/src/app/babylon/controller/serve-manager.ts b/src/app/babylon/controller/serve-manager.ts index dc50523..0ac613a 100644 --- a/src/app/babylon/controller/serve-manager.ts +++ b/src/app/babylon/controller/serve-manager.ts @@ -5,7 +5,7 @@ import { BuildingBasicInfosService } from "src/app/service/babylon/building-basi import { ObjectsService } from "src/app/service/objects.service"; import { InsitutionDataSimple } from "../model/data/institution/institution-data-simple"; import { AllMarkPlanData } from "../model/data/mark/mark-plan-data"; -import { ModeManager } from "./mode-manager"; +import { ModeManager, ModeType } from "./mode-manager"; //服务器通信 export class ServeManager { @@ -95,7 +95,7 @@ export class ServeManager { this.buildingBISrv.getMarkData(institutionID) .subscribe(data => { - ModeManager.log(data); + // ModeManager.log(data); if (onSuccess) { onSuccess(institutionID, JSON.parse((data as any).result)); } @@ -103,7 +103,13 @@ export class ServeManager { if (error instanceof HttpErrorResponse) { if (error.status === 404) { ModeManager.log("没有标绘数据,新建:" + error.error); - onSuccess(institutionID, null); //data 为null ,表示新建 + if (ModeManager.currentMode == ModeType.Edit) { + onSuccess(institutionID, null); //data 为null ,表示新建 + } + else { + PlanComponent.instance.openSnackBar("暂无数据"); + } + } else { if (onError) { @@ -138,6 +144,7 @@ export class ServeManager { } //PlanComponent.instance.openSnackBar("保存标绘信息成功"); // alert("保存标绘信息成功"); + PlanComponent.instance.openSnackBar("保存成功"); //暂时没有失败的回调 onError }) diff --git a/src/app/babylon/model/data/camera-data.ts b/src/app/babylon/model/data/camera-data.ts index 8ab6ed5..16c1bf5 100644 --- a/src/app/babylon/model/data/camera-data.ts +++ b/src/app/babylon/model/data/camera-data.ts @@ -12,13 +12,18 @@ export class ArcRotateCameraData { alpha: number; beta: number; + + constructor() { + this.target = new Vector3(); + } + /** * 将数据设置到相机上 * @param camera */ setDataToCamera(camera: ArcRotateCamera) { camera._scene.stopAnimation(camera); - camera.target = this.target; + camera.target = this.target.clone(); camera.radius = this.radius; camera.alpha = this.alpha; camera.beta = this.beta; @@ -29,7 +34,7 @@ export class ArcRotateCameraData { * @param camera */ getDataFromCamera(camera: ArcRotateCamera) { - this.target = camera.target; + this.target = camera.target.clone(); this.radius = camera.radius; this.alpha = camera.alpha; this.beta = camera.beta; diff --git a/src/app/babylon/model/data/institution/facility/property-data/in/property-data-jyj.ts b/src/app/babylon/model/data/institution/facility/property-data/in/property-data-jyj.ts new file mode 100644 index 0000000..e06fede --- /dev/null +++ b/src/app/babylon/model/data/institution/facility/property-data/in/property-data-jyj.ts @@ -0,0 +1,32 @@ + +import { FacilityType } from "../../../../model-data/model-data-facility"; +import { PropertyData_Base } from "../property-data-base"; + +/** + * 加油机 + */ +export class PropertyData_JYJ extends PropertyData_Base { + + brand: string = ""; //品牌 + superBrand: string = ""; //超大牌 + oilGunNum: string = ""; //油枪数量 + oilProductNo: string = ""; //油品品号 + oilPumpType: string = ""; //油泵类型 + + constructor(key: string, brand: string, superBrand: string, oilGunNum: string, oilProductNo: string, oilPumpType: string) { + super(key, FacilityType.JY_JYJ); + this.name = "未命名"; + this.brand = brand + this.superBrand = superBrand + this.oilGunNum = oilGunNum + this.oilProductNo = oilProductNo + this.oilPumpType = oilPumpType + } + + clone(key: string) { + let result = new PropertyData_JYJ(key, this.brand, this.superBrand, this.oilGunNum, this.oilProductNo, this.oilPumpType); + result.name = this.name; + return result; + } + +} \ No newline at end of file diff --git a/src/app/babylon/model/data/institution/facility/property-data/in/property-data-sygx.ts b/src/app/babylon/model/data/institution/facility/property-data/in/property-data-sygx.ts new file mode 100644 index 0000000..a396beb --- /dev/null +++ b/src/app/babylon/model/data/institution/facility/property-data/in/property-data-sygx.ts @@ -0,0 +1,25 @@ + +import { FacilityType } from "../../../../model-data/model-data-facility"; +import { PropertyData_Base_IMG } from "../base/property-data-base-img"; +import { PropertyData_Base } from "../property-data-base"; + +/** + * 输油管 + */ +export class PropertyData_SYGX extends PropertyData_Base_IMG { + + constructor(key: string) { + super(key, "", "", "", FacilityType.JY_SYGX); + + } + + clone(key: string) { + let result = new PropertyData_SYGX(key); + result.img = this.img; + result.pos = this.pos; + result.info = this.info, + result.is360 = this.is360; + return result; + } + +} \ No newline at end of file diff --git a/src/app/babylon/model/data/institution/facility/property-data/in/property-data-yg.ts b/src/app/babylon/model/data/institution/facility/property-data/in/property-data-yg.ts new file mode 100644 index 0000000..41892e3 --- /dev/null +++ b/src/app/babylon/model/data/institution/facility/property-data/in/property-data-yg.ts @@ -0,0 +1,34 @@ + +import { FacilityType } from "../../../../model-data/model-data-facility"; +import { PropertyData_Base } from "../property-data-base"; + +/** + * 油罐 + */ +export class PropertyData_YG extends PropertyData_Base { + + oilProductNo: string = ""; //油品品号 + oilTankVolume: string = ""; //油罐容积 + safeVolume: string = ""; //安全容积 + quantity: string = ""; //数量 + tankFarm: string = ""; //罐区 + oilTankType: string = ""; //油罐类型 + + constructor(key: string,oilProductNo: string,oilTankVolume: string,safeVolume: string,quantity: string,tankFarm: string,oilTankType: string) { + super(key, FacilityType.JY_YG); + this.name = "未命名"; + this.oilProductNo = oilProductNo + this.oilTankVolume = oilTankVolume + this.safeVolume = safeVolume + this.quantity = quantity + this.tankFarm = tankFarm + this.oilTankType = oilTankType + } + + clone(key: string) { + let result = new PropertyData_YG(key,this.oilProductNo,this.oilTankVolume,this.safeVolume,this.quantity,this.tankFarm,this.oilTankType); + result.name = this.name; + return result; + } + +} \ No newline at end of file diff --git a/src/app/babylon/model/data/institution/facility/property-data/in/property-data-yqhsgx.ts b/src/app/babylon/model/data/institution/facility/property-data/in/property-data-yqhsgx.ts new file mode 100644 index 0000000..22bdab0 --- /dev/null +++ b/src/app/babylon/model/data/institution/facility/property-data/in/property-data-yqhsgx.ts @@ -0,0 +1,25 @@ + +import { FacilityType } from "../../../../model-data/model-data-facility"; +import { PropertyData_Base_IMG } from "../base/property-data-base-img"; +import { PropertyData_Base } from "../property-data-base"; + +/** + * 输油管 + */ +export class PropertyData_YQHSGX extends PropertyData_Base_IMG { + + constructor(key: string) { + super(key, "", "", "", FacilityType.JY_YQHSGX); + + } + + clone(key: string) { + let result = new PropertyData_YQHSGX(key); + result.img = this.img; + result.pos = this.pos; + result.info = this.info, + result.is360 = this.is360; + return result; + } + +} \ No newline at end of file diff --git a/src/app/babylon/model/data/institution/facility/property-data/out/property-data-q.ts b/src/app/babylon/model/data/institution/facility/property-data/out/property-data-q.ts index dbb01b2..67b507b 100644 --- a/src/app/babylon/model/data/institution/facility/property-data/out/property-data-q.ts +++ b/src/app/babylon/model/data/institution/facility/property-data/out/property-data-q.ts @@ -6,7 +6,7 @@ import { PropertyData_Base_IMG } from "../base/property-data-base-img"; import { PropertyData_Base } from "../property-data-base"; /** - * 集结区和禁停区 + * 区域类 */ export class PropertyData_Q extends PropertyData_Base_IMG { diff --git a/src/app/babylon/model/data/institution/jyz-show-data.ts b/src/app/babylon/model/data/institution/jyz-show-data.ts index 68ec178..23e717f 100644 --- a/src/app/babylon/model/data/institution/jyz-show-data.ts +++ b/src/app/babylon/model/data/institution/jyz-show-data.ts @@ -16,7 +16,7 @@ export class JYZShowData { * 摄像机数据 */ @Type(() => ArcRotateCameraData) - cameraData: ArcRotateCameraData; + cameraData: ArcRotateCameraData = new ArcRotateCameraData(); /** * 展示罩棚 @@ -26,7 +26,10 @@ export class JYZShowData { constructor(moudleType: JYZInfoMoudleType, camera: ArcRotateCamera, showZP: boolean) { this.moudleType = moudleType; this.cameraData = new ArcRotateCameraData(); - this.cameraData.getDataFromCamera(camera); + if (camera != null) { + this.cameraData.getDataFromCamera(camera); + } + } } diff --git a/src/app/babylon/model/data/mark/mark-plan-data.ts b/src/app/babylon/model/data/mark/mark-plan-data.ts index 68fb3f9..1e4e751 100644 --- a/src/app/babylon/model/data/mark/mark-plan-data.ts +++ b/src/app/babylon/model/data/mark/mark-plan-data.ts @@ -225,6 +225,16 @@ export class MarkNodeData { @Type(() => NatureData) natureData: NatureData; + /** + * 描述 + */ + describe: string; + + /** + * 图片(或视频?) + */ + texture: string; + constructor(id: number, name: string) { this.id = id; 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 5fe89f2..aa080af 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 @@ -67,7 +67,7 @@ export class ModelData_facility extends ModelData { //新建区域位点 newAreapPoints(): Vector3[] { - let size = 10; + let size = 3; let x = 0.75 * size; let z = 0.5 * size; let result: Vector3[] = []; diff --git a/src/app/babylon/model/info/mark/mark-plan-info.ts b/src/app/babylon/model/info/mark/mark-plan-info.ts index 7ef67bf..16e0a6d 100644 --- a/src/app/babylon/model/info/mark/mark-plan-info.ts +++ b/src/app/babylon/model/info/mark/mark-plan-info.ts @@ -83,7 +83,7 @@ export class MarkNodeInfo { } /** - * 获取下一个标绘物的id + * 获取下一个新建标绘物的id(用于新建) */ getNextMarkDataId() { //console.log(this.currentMarkDataIndex, 1); diff --git a/src/app/babylon/model/info/model/facilityinfo-tool/facility-area.ts b/src/app/babylon/model/info/model/facilityinfo-tool/facility-area.ts index 8531844..6c96074 100644 --- a/src/app/babylon/model/info/model/facilityinfo-tool/facility-area.ts +++ b/src/app/babylon/model/info/model/facilityinfo-tool/facility-area.ts @@ -1,6 +1,6 @@ //#region 区域 -import { AbstractMesh, Color3, Mesh, MeshBuilder, Observer, PolygonMeshBuilder, Quaternion, Scene, StandardMaterial, Vector2, Vector3 } from "@babylonjs/core"; +import { AbstractMesh, Color3, Mesh, MeshBuilder, Observer, PointerDragBehavior, PolygonMeshBuilder, Quaternion, Scene, StandardMaterial, Vector2, Vector3 } from "@babylonjs/core"; import { Button, Vector2WithInfo } from "@babylonjs/gui"; import { ModelInfo_facility } from "../model-info-facility"; @@ -197,9 +197,9 @@ export class AreaInfo { //更新顶点 updateMeshPoint(index = -1) { this.clearMeshPoint(); - let select = null; + let select: PolygonMeshPoint = null; for (let i = 0; i < this.pointData.length; i++) { - let l_meshPoint = new PolygonMeshPoint(PosPointTool.c_key + "_" + i, i, 0.2, this.root, this.pointData[i], this); + let l_meshPoint = new PolygonMeshPoint(PosPointTool.c_key + "_" + i, i, 0.5, this.root, this.pointData[i], this); this.pointMesh.push(l_meshPoint); if (i == index) { @@ -266,6 +266,7 @@ export class PolygonMeshPoint { area: AreaInfo mesh: Mesh; pos: Vector3; + pointMat: StandardMaterial; //顶点材质 index: number; @@ -273,6 +274,7 @@ export class PolygonMeshPoint { onGizmoAimMeshObservor: Observer; onPointerClickObservor: Observer; + pointerDragBehavior: PointerDragBehavior;//拖拽事件 constructor(name: string, index: number, size: number, parent: Mesh, pos: Vector3, area: AreaInfo) { @@ -289,23 +291,37 @@ export class PolygonMeshPoint { //初始化编辑UI initEditUI(name: string, size: number, parent: Mesh, pos: Vector3) { if (ModeManager.currentMode == ModeType.Edit) { - this.mesh = MeshBuilder.CreateBox(name, { size: size }); + let instance = this; + + this.mesh = MeshBuilder.CreateSphere(name, { diameter: size }); this.mesh.setParent(parent); this.mesh.position = pos; - this.mesh.isVisible = false; + this.mesh.isVisible = true; - let instance = this; - this.uiRoot = Button.CreateSimpleButton("ui_" + name, this.index.toString()); - UIManager.Instance.uiRoot.addControl(this.uiRoot); - this.uiRoot.linkWithMesh(this.mesh); - BabylonUIStyleTool.setStyle_size(this.uiRoot, "20px", "20px"); - this.uiRoot.background = BabylonUIStyleTool.c_color_blue; - this.uiRoot.color = BabylonUIStyleTool.c_color_white; - this.uiRoot.onPointerClickObservable.add(() => { + this.pointMat = new StandardMaterial("mat_areaPoint", SceneManager.Instance.scene); + this.pointMat.emissiveColor = Color3.FromHexString("#A9FF00"); + this.pointMat.disableLighting = true; + this.pointMat.alpha = 0.87; + this.mesh.material = this.pointMat; + + this.pointerDragBehavior = new PointerDragBehavior({ dragPlaneNormal: Vector3.Up() }); //平面内移动 + this.mesh.addBehavior(this.pointerDragBehavior); + this.pointerDragBehavior.onDragEndObservable.add(() => { instance.changeAim(); }); - this.showUI(false); + + // this.uiRoot = Button.CreateSimpleButton("ui_" + name, this.index.toString()); + // UIManager.Instance.uiRoot.addControl(this.uiRoot); + // this.uiRoot.linkWithMesh(this.mesh); + // BabylonUIStyleTool.setStyle_size(this.uiRoot, "20px", "20px"); + // this.uiRoot.background = BabylonUIStyleTool.c_color_blue; + // this.uiRoot.color = BabylonUIStyleTool.c_color_white; + // this.uiRoot.onPointerClickObservable.add(() => { + // instance.changeAim(); + // }); + + // this.showUI(false); } } @@ -318,7 +334,7 @@ export class PolygonMeshPoint { //改变选中的目标 changeAim() { let instance = this; - GizmoTool.changeGizmoAim(instance.mesh); + //GizmoTool.changeGizmoAim(instance.mesh); PosPointTool.attachMesh(instance.mesh as Mesh, instance.pos, () => { instance.addPoint(); @@ -337,6 +353,10 @@ export class PolygonMeshPoint { this.mesh.dispose(); this.uiRoot.dispose(); } + if (this.pointMat != null) { + this.pointMat.dispose(); + this.pointMat = null; + } } 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 337a043..68345d8 100644 --- a/src/app/babylon/model/info/model/model-info-building.ts +++ b/src/app/babylon/model/info/model/model-info-building.ts @@ -50,7 +50,7 @@ export class ModelInfo_building extends ModelInfo { for (let i = 0; i < allTransformNode.length; i++) { if (TsTool.stringContain(allTransformNode[i].name, "WAI")) { this.neiRoot = allTransformNode[i]; - console.log("找到关键节点wai"); + break; } } @@ -58,6 +58,10 @@ export class ModelInfo_building extends ModelInfo { if (this.neiRoot == null) { + if (!TsTool.stringContain(this.modelBox.name, "Box")) { + console.error("没有关键节点", this.modelBox.name); + } + this.neiRoot = this.modelBox; } @@ -156,6 +160,9 @@ export class ModelInfo_building extends ModelInfo { //更新跟随UI的名称 updateName(name: string) { this.uiIconBtn.textBlock.text = name; + if (!ModeManager.s_isMakeMode) { + this.showFollowUI(false); + } } diff --git a/src/app/babylon/model/info/model/model-info-facility.ts b/src/app/babylon/model/info/model/model-info-facility.ts index 1725414..29e5b8d 100644 --- a/src/app/babylon/model/info/model/model-info-facility.ts +++ b/src/app/babylon/model/info/model/model-info-facility.ts @@ -3,12 +3,13 @@ import { Button, Control, Ellipse, Rectangle, Vector2WithInfo } from "@babylonjs import { ConfigManager } from "src/app/babylon/controller/config-manager"; import { SceneManager } from "src/app/babylon/controller/scene-manager"; import { BabylonUIStyleTool } from "src/app/babylon/tool/babylon-ui-style-tool"; +import { SpeakingTool } from "src/app/babylon/tool/speaking-tool"; import { TsTool } from "src/app/babylon/tool/ts-tool"; import { FacilityWindow } from "src/app/babylon/view/facility-window/facility-window"; import { FacilityInfoInSceneWindow } from "src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window"; import { PropertyBaseWindow } from "src/app/babylon/view/property-window/property-base-window"; import { ModelData } from "../../data/model-data/model-data"; -import { FacilityShowType, FacilityType, ModelData_facility } from "../../data/model-data/model-data-facility"; +import { FacilityPosType, FacilityShowType, FacilityType, ModelData_facility } from "../../data/model-data/model-data-facility"; import { BuildingInfo } from "../building/building-info"; import { AreaInfo } from "./facilityinfo-tool/facility-area"; @@ -16,6 +17,9 @@ import { ModelInfo } from "./model-info"; //设施数据 export class ModelInfo_facility extends ModelInfo { + + static readonly c_hightLightColor = Color3.Yellow(); + belongToBuilding: BuildingInfo;//属于哪个建筑 pickDown: boolean;//按下 facilityShowType: FacilityShowType;//设备展示状态 @@ -39,15 +43,15 @@ export class ModelInfo_facility extends ModelInfo { } onCreateFollowUI() { - let modelData = this.modelData as ModelData_facility; - if (!ConfigManager.getFacilityNeedIcon(modelData.facilityType)) { + let facilityData = this.modelData as ModelData_facility; + if (!ConfigManager.getFacilityNeedIcon(facilityData.facilityType)) { return; } super.onCreateFollowUI(); let instance = this; - let posType = ConfigManager.getPosType(modelData.facilityType); - let iconPath = ConfigManager.getFacilityIconUrl(modelData.facilityType, posType); + let posType = ConfigManager.getPosType(facilityData.facilityType); + let iconPath = ConfigManager.getFacilityIconUrl(facilityData.facilityType, posType); BabylonUIStyleTool.setStyle_size(this.uiFollowRoot, ConfigManager.c_size_facilityIconSize + "px", ConfigManager.c_size_facilityIconSize + "px"); this.uiFollowRoot.thickness = 0; @@ -93,7 +97,13 @@ export class ModelInfo_facility extends ModelInfo { }); this.uiFollowRoot.zIndex = BabylonUIStyleTool.c_zIndex_facilityIcon; - this.showFollowUI(false); + + if (facilityData.posType == FacilityPosType.In) { + this.showFollowUI(false); //内置设备,默认隐藏 + } + + + } @@ -115,6 +125,7 @@ export class ModelInfo_facility extends ModelInfo { // this.onClickMeshIconBtn(eventData,eventState); FacilityInfoInSceneWindow.instance.selectFacilityInfo(this); + // SpeakingTool.Instance.speak("你好世界"); } //展示属性 @@ -141,7 +152,10 @@ export class ModelInfo_facility extends ModelInfo { * @param enable */ setSelectEnable(enable: boolean) { - this.ui_select.isVisible = enable; + if (this.ui_select != null) { + this.ui_select.isVisible = enable; + } + } /** @@ -159,14 +173,14 @@ export class ModelInfo_facility extends ModelInfo { } /** - * 播放展示动画(高亮) - * @param play false表示停止,并恢复正常 - */ + * 播放展示动画(高亮) + * @param play false表示停止,并恢复正常 + */ playShowAnim(play: boolean) { this.showFollowUI(play); if (this.modelBox != null) { if (play) { - SceneManager.Instance.addToHighLight(this.modelBox as Mesh, Color3.Yellow()); + SceneManager.Instance.addToHighLight(this.modelBox as Mesh, ModelInfo_facility.c_hightLightColor); } else { SceneManager.Instance.removeFromHighLight(this.modelBox as Mesh); diff --git a/src/app/babylon/model/info/model/model-info.ts b/src/app/babylon/model/info/model/model-info.ts index 9a28a13..2a31504 100644 --- a/src/app/babylon/model/info/model/model-info.ts +++ b/src/app/babylon/model/info/model/model-info.ts @@ -5,15 +5,15 @@ import { EventState, Mesh, PointerDragBehavior, + Vector2, Vector3, } from '@babylonjs/core'; import { Button, Rectangle, Vector2WithInfo } from '@babylonjs/gui'; import { classToClass } from 'class-transformer'; -import { SceneManager } from 'src/app/babylon/controller/scene-manager'; import { UIManager } from 'src/app/babylon/controller/ui-manager'; import { BabylonTool } from 'src/app/babylon/tool/babylon-tool'; -import { BabylonUIStyleTool } from 'src/app/babylon/tool/babylon-ui-style-tool'; import { GizmoTool } from 'src/app/babylon/tool/gizmo-tool'; +import { TsTool } from 'src/app/babylon/tool/ts-tool'; import { ModelData } from '../../data/model-data/model-data'; @@ -25,7 +25,12 @@ export class ModelInfo { /** * 所有子节点 */ - models: AbstractMesh[]; + _models: AbstractMesh[]; + + /** + * 头部所在位置(并不是都有) + */ + head: AbstractMesh; /** * 包装盒、根节点 ,请使用modelBox 属性进行访问 */ @@ -121,6 +126,20 @@ export class ModelInfo { } } + /** + * 模型的子节点们 + */ + get models(): AbstractMesh[] { + if (this._models == null) { + this._models = this.modelBox.getChildMeshes(); + } + return this._models; + } + + set models(value: AbstractMesh[]) { + this._models = value; + } + //创建跟随UI onCreateFollowUI() { @@ -237,8 +256,23 @@ export class ModelInfo { if (this.uiFollowRoot != null) { - this.uiFollowRoot.linkWithMesh(this.modelBox); - this.uiFollowRoot.linkOffsetY = '-50px'; + + for (let i = 0; i < this.models.length; i++) { + let l_mesh = this.models[i]; + if (TsTool.stringContain(l_mesh.name, "Head")) { + this.head = l_mesh; + break; + } + } + + if (this.head == null) { + this.uiFollowRoot.linkWithMesh(this.modelBox); + this.uiFollowRoot.linkOffsetY = '-50px'; + } + else { + this.uiFollowRoot.linkWithMesh(this.head); + } + } } @@ -271,6 +305,22 @@ export class ModelInfo { } + + + /** + * 获取头部跟随的ui所在的位置 + */ + getHeadUIPos() { + let result: Vector2 = null; + if (this.uiFollowRoot != null) { + result = new Vector2(); + result.x = this.uiFollowRoot.leftInPixels; + result.y = this.uiFollowRoot.topInPixels; + } + + return result; + } + } diff --git a/src/app/babylon/tool/babylon-tool.ts b/src/app/babylon/tool/babylon-tool.ts index 8369ff6..9b04c7f 100644 --- a/src/app/babylon/tool/babylon-tool.ts +++ b/src/app/babylon/tool/babylon-tool.ts @@ -288,6 +288,9 @@ export class BabylonTool { } + /** + * 动画移动摄像机target、半径、alpha、beta + */ public static AnimMoveCameraTargetAB( camera: ArcRotateCamera, allFrame: number, diff --git a/src/app/babylon/tool/gizmo-tool.ts b/src/app/babylon/tool/gizmo-tool.ts index 199d4e2..632c872 100644 --- a/src/app/babylon/tool/gizmo-tool.ts +++ b/src/app/babylon/tool/gizmo-tool.ts @@ -425,7 +425,7 @@ export class GizmoTool { : UIBase.color_null; GizmoTool.s_gizmoManager.scaleGizmoEnabled = isScaling; - if (uiType == TransformUIType.Hide) { //隐藏选中框 + if (uiType == TransformUIType.Hide || !ModeManager.s_isMakeMode) { //隐藏选中框 GizmoTool.s_boundingBoxGizmo.attachedMesh = null; } diff --git a/src/app/babylon/tool/pos-point-tool.ts b/src/app/babylon/tool/pos-point-tool.ts index 058f5da..eb75013 100644 --- a/src/app/babylon/tool/pos-point-tool.ts +++ b/src/app/babylon/tool/pos-point-tool.ts @@ -19,14 +19,19 @@ export class PosPointTool { initUI() { let instance = this; this.uiRoot = new Rectangle("PosPointTooUI"); + this.uiRoot.color = BabylonUIStyleTool.c_color_3d_blueLight; + this.uiRoot.shadowBlur = 5; UIManager.Instance.uiRoot.addControl(this.uiRoot); BabylonUIStyleTool.setStyle_size(this.uiRoot, "40px", "20px"); let stack = new StackPanel("stack"); this.uiRoot.addControl(stack); + stack.width = 1; + stack.height = 1; stack.isVertical = false; + let btn_add = Button.CreateSimpleButton("add", "+"); stack.addControl(btn_add); btn_add.background = BabylonUIStyleTool.c_color_blue; @@ -52,7 +57,7 @@ export class PosPointTool { showUI(show: boolean) { this.uiRoot.isVisible = show; this.uiRoot.linkWithMesh(this.mesh); - this.uiRoot.linkOffsetY = "-50px"; + this.uiRoot.linkOffsetY = "-30px"; } //#endregion diff --git a/src/app/babylon/tool/speaking-tool.ts b/src/app/babylon/tool/speaking-tool.ts new file mode 100644 index 0000000..5fb710b --- /dev/null +++ b/src/app/babylon/tool/speaking-tool.ts @@ -0,0 +1,64 @@ + +/** + * 语音工具 + */ +export class SpeakingTool { + + private static instance: SpeakingTool; + + static get Instance() { + if (SpeakingTool.instance == null) { + SpeakingTool.instance = new SpeakingTool(); + } + return SpeakingTool.instance; + } + + + /** + * 阅读一段文字 + * @param msg + */ + speak(msg: string) { + if (this.isIE()) { + + } + else { + let speakMsg = new SpeechSynthesisUtterance(msg); + speakMsg.lang = "zh-CN"; + speakMsg.rate = 1; + speakMsg.pitch = 1.5; + window.speechSynthesis.speak(speakMsg); + + return speakMsg; + } + } + + /** + * 暂停正在进行的阅读 + * @param speakMsg + */ + pause() { + window.speechSynthesis.pause(); + } + /** + * 继续之前暂停的阅读 + */ + resume() { + window.speechSynthesis.resume(); + } + + /** + * IE浏览器 + */ + private isIE() { + // if ("ActiveXObject" in window) { + // console.log("IE 浏览器") + // return true; + // } + // else { + // return false; + // } + return false; + } + +} \ No newline at end of file diff --git a/src/app/babylon/view/building-window/building-window.ts b/src/app/babylon/view/building-window/building-window.ts index 9478575..41f09df 100644 --- a/src/app/babylon/view/building-window/building-window.ts +++ b/src/app/babylon/view/building-window/building-window.ts @@ -1,8 +1,10 @@ import { AbstractMesh, Material, Mesh, PBRMaterial, Texture } from "@babylonjs/core"; import { PlanComponent } from "src/app/pages/plan/plan.component"; +import { ConfigManager } from "../../controller/config-manager"; import { DataManager } from "../../controller/data-manager"; import { InfoManager } from "../../controller/info-manager"; +import { ModeManager, ModeType } from "../../controller/mode-manager"; import { SceneManager } from "../../controller/scene-manager"; import { ServeManager } from "../../controller/serve-manager"; import { BuildingStatus } from "../../controller/status/building-status"; @@ -10,7 +12,7 @@ import { StatusManager } from "../../controller/status/status-manager"; 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 { FacilityType } from "../../model/data/model-data/model-data-facility"; +import { FacilityPosType, FacilityType } 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"; @@ -20,6 +22,7 @@ import { ModelInfo_building } from "../../model/info/model/model-info-building"; import { FacilityInfoByType } from "../../model/info/model/model-info-facility"; import { BabylonTool } from "../../tool/babylon-tool"; import { TsTool } from "../../tool/ts-tool"; +import { FacilityInfoInSceneWindow } from "../facilityinfoinscene-window/facilityinfoinscene-window"; import { UIBase } from "../window-base/ui-base"; import { BuildingUIItem } from "./building-ui-item"; @@ -217,8 +220,6 @@ export class BuildingWindow extends UIBase { * @param show true表示显示 */ showJYZInfoModel(type: JYZInfoMoudleType, show: boolean) { - console.log("showJYZInfoModel", type, show); - if (this.currentJYZInfoMoudleType == type) { if (show) { return; //与上次显示的模块相同 @@ -239,15 +240,7 @@ export class BuildingWindow extends UIBase { //进入应急处置 } else {//恢复查看状态 - let showData = DataManager.institutionData.getMoudleShowData(type); - if (showData != null) { - let camera = SceneManager.Instance.defaultCamera; - //showData.cameraData.setDataToCamera(camera); - let cameraData = showData.cameraData; - BabylonTool.AnimMoveCameraTargetAB(camera, 60, cameraData.target, cameraData.radius, cameraData.alpha, cameraData.beta); - this.showZP(showData.showZP); - PlanComponent.instance.isOpenAwning = showData.showZP; - } + this.recoverMoudleShow(type); } } else { @@ -259,6 +252,23 @@ export class BuildingWindow extends UIBase { } + /** + * 恢复展示模块状态(视角、罩棚) + * @param type + */ + recoverMoudleShow(type: JYZInfoMoudleType) { + let showData = DataManager.institutionData.getMoudleShowData(type); + if (showData != null) { + let camera = SceneManager.Instance.defaultCamera; + //showData.cameraData.setDataToCamera(camera); + let cameraData = showData.cameraData; + BabylonTool.AnimMoveCameraTargetAB(camera, 60, cameraData.target, cameraData.radius, cameraData.alpha, cameraData.beta); + this.showZP(showData.showZP); + PlanComponent.instance.isOpenAwning = showData.showZP; + } + + } + //#endregion @@ -345,6 +355,7 @@ export class BuildingWindow extends UIBase { this.showJYZModules(JYZInfoMoudleType.AQSS, false); this.showJYZModules(JYZInfoMoudleType.YQHSGX, false); this.showJYZModules(JYZInfoMoudleType.YQHSGX, false); + this.recoverMoudleShow(null); //this.onChangeCurrentBuildingItem(item); @@ -503,7 +514,7 @@ export class BuildingWindow extends UIBase { instance.addBuildings(BuildingType.Normal, 0, (uiItem, index) => { if (index == 0 && uiItem.buildingInfo.isEnable) { instance.onChangeCurrentBuildingItem(uiItem, false); - uiItem.lookAt(false); + //uiItem.lookAt(false); // console.log("默认选中" + uiItem.buildingInfo.buildingData.normalData.key); } }); @@ -708,6 +719,8 @@ export class BuildingWindow extends UIBase { } this.initFacilityTypeByMoudleType(type, this.currentBuidngItem.buildingInfo); + FacilityInfoInSceneWindow.instance.selectJYJFrom3D(null); + //设备: 显示UI let facilityByType: FacilityInfoByType[] = []; if (this.facilitysByMoudle.has(type)) { @@ -763,6 +776,31 @@ export class BuildingWindow extends UIBase { let moudleTypeKey = moudleType; //当前模块物体的特殊字段 let zdKey = "ZD_" + moudleType; //阻挡类物体特殊字段 + //编辑模式下,基本信息下的设备会随时变化 + if (ModeManager.currentMode == ModeType.Edit) { + let jbxxMoudle = JYZInfoMoudleType.JBXX; + if (this.facilitysByMoudle.has(jbxxMoudle)) { + this.facilitysByMoudle.get(jbxxMoudle).length = 0; + } + else { + this.facilitysByMoudle.set(jbxxMoudle, []); + } + + + let allFacilityByType = buildingInfo.ModelInfo.facilityInfos; + if (allFacilityByType == null) { + return; //没有设备 + } + + for (let i = 0; i < allFacilityByType.length; i++) { + let l_facilityByType = allFacilityByType[i]; + if (ConfigManager.getPosType(l_facilityByType.type) == FacilityPosType.Out) { + this.facilitysByMoudle.get(jbxxMoudle).push(l_facilityByType); + } + } + + + } if (this.facilitysByMoudle.has(moudleType)) { //已经初始化过了 return; @@ -779,17 +817,7 @@ export class BuildingWindow extends UIBase { for (let i = 0; i < allFacilityByType.length; i++) { let l_facilityByType = allFacilityByType[i]; - // if (moudleType == JYZInfoMoudleType.XF) //消防-逃生 - // { - // if (TsTool.stringContain(l_facilityByType.type, FacilityType.XF_TSLX)) { - // continue; - // } - // if (TsTool.stringContain(l_facilityByType.type, FacilityType.XF_SSD)) { - // continue; - // } - - // } - if (TsTool.stringContain(l_facilityByType.type, zdKey)) { + if (TsTool.stringContain(l_facilityByType.type, zdKey)) { //遮挡物 if (!this.zdByMoudle.has(moudleType)) { this.zdByMoudle.set(moudleType, []); } @@ -798,6 +826,7 @@ export class BuildingWindow extends UIBase { else if (TsTool.stringContain(l_facilityByType.type, "_" + moudleTypeKey) || TsTool.stringContain(l_facilityByType.type, moudleTypeKey + "_")) { this.facilitysByMoudle.get(moudleType).push(l_facilityByType); } + } } @@ -862,7 +891,6 @@ export class BuildingWindow extends UIBase { if (!isRepeat)//不重复,就添加进去 { this.mat_UV.get(moudleType).push(l_mat); - console.log("找到uv", l_mat); } } } @@ -936,10 +964,12 @@ export class BuildingWindow extends UIBase { } if (jyzShowData == null) { jyzShowData = new JYZShowData(moudleType, camera, showZP); + DataManager.institutionData.JYZShowDatas.push(jyzShowData); } jyzShowData.moudleType = moudleType; jyzShowData.cameraData.getDataFromCamera(camera); jyzShowData.showZP = showZP; + console.log("保存展示数据", DataManager.institutionData.JYZShowDatas); } diff --git a/src/app/babylon/view/facility-window/facility-window.ts b/src/app/babylon/view/facility-window/facility-window.ts index d511de0..a430a89 100644 --- a/src/app/babylon/view/facility-window/facility-window.ts +++ b/src/app/babylon/view/facility-window/facility-window.ts @@ -1,8 +1,10 @@ import { AbstractMesh, + Color3, EventState, Mesh, MeshBuilder, + PickingInfo, PointerEventTypes, PointerInfo, Vector3, @@ -23,6 +25,8 @@ 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 { BuildingType } from '../../model/data/institution/building/building-data'; +import { JYZInfoMoudleType } from '../../model/data/institution/jyz-show-data'; 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'; @@ -33,6 +37,7 @@ import { BabylonUIStyleTool } from '../../tool/babylon-ui-style-tool'; import { GizmoTool } from '../../tool/gizmo-tool'; import { TsTool } from '../../tool/ts-tool'; import { BuildingWindow } from '../building-window/building-window'; +import { FacilityInfoUIItem } from '../facilityinfoinscene-window/facilityinfo-ui-item'; import { CopyFacilityInfo, FacilityInfoInSceneWindow } from '../facilityinfoinscene-window/facilityinfoinscene-window'; import { ToolbarWindow } from '../toolbar-window/toobar-window'; import { UIBase } from '../window-base/ui-base'; @@ -49,6 +54,8 @@ export class FacilityWindow extends UIBase { static s_currentFacilityItem: FacilityUIItem; static instance: FacilityWindow; + + createIconRoot: Rectangle;//创建状态的跟随icon createIcon: Image; static readonly c_createIcon_width = 40; @@ -237,7 +244,11 @@ export class FacilityWindow extends UIBase { case PointerEventTypes.POINTERUP: if (eventData.event.button == 0) { //左键正常 + + if (eventData.pickInfo.hit && !SceneManager.s_isPointerDrag) { + + if (FacilityWindow.s_currentFacilityItem != null) { instance.createNewFacilityByPos(eventData.pickInfo.pickedPoint); return; @@ -258,6 +269,7 @@ export class FacilityWindow extends UIBase { } } + //寻找设备预设 getFacilityPrefab(resName: string): Mesh { let result = null; @@ -309,24 +321,8 @@ export class FacilityWindow extends UIBase { } - /** - * 根据mesh创建设备 - * @param mesh - * @param type - */ - createNewFacilityByMesh(mesh: AbstractMesh, type: FacilityType) { - let facilityData = this.createFacilityDataFromMesh(mesh, type); - //let facilityInfo = this.createFacilityInfoFromMesh(facilityData, mesh, buildingInfo); - if (!this.isRepeatFacilityFromMesh(type, mesh.id)) //不重复 - { - console.log("获取到设备" + type, mesh); - this.createNewFacility(facilityData, mesh); - } - - - } /** @@ -342,6 +338,10 @@ export class FacilityWindow extends UIBase { // ThreeDimensionalHomeComponent.instance.openSnackBar("请先选中目标建筑"); return } + else if (currentBuidngItem.getBuildingType() == BuildingType.Environment) { + alert("请选中主体建筑后,再进行标注") + return + } Event_ChangeFacility.dispatch(facilityData, ModelChangeType.Add, null); @@ -728,6 +728,36 @@ export class FacilityWindow extends UIBase { } + //#endregion + + + //#region 加油机特殊表现 + + + + + /** + * 根据mesh创建设备 + * @param mesh + * @param type + */ + createNewFacilityByMesh(mesh: AbstractMesh, type: FacilityType) { + let facilityData = this.createFacilityDataFromMesh(mesh, type); + //let facilityInfo = this.createFacilityInfoFromMesh(facilityData, mesh, buildingInfo); + + + if (!this.isRepeatFacilityFromMesh(type, mesh.id)) //不重复 + { + console.log("获取到设备" + type, mesh); + this.createNewFacility(facilityData, mesh); + } + + + } + + + + //#endregion } diff --git a/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts b/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts index 7a278ee..f9126ba 100644 --- a/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts +++ b/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts @@ -1,4 +1,5 @@ +import { Vector2 } from "@babylonjs/core"; import { SceneManager } from "../../controller/scene-manager"; 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"; @@ -93,12 +94,15 @@ export class FacilityInfoUIItem { GizmoTool.onPickMeshInfoObservable.notifyObservers(this.modelInfo); this.facilityInfoInSceneWindow.selectFacilityItemToThree([this], true); this.modelInfo.setIconEnable(select); + this.facilityInfoInSceneWindow.playJYJSelectEffect(select, this.modelInfo) } else { this.facilityInfoInSceneWindow.selectFacilityItemToThree([this], false); if (!this.facilityInfoInSceneWindow.getFacilityUIShowType(this.getType())) { this.modelInfo.setIconEnable(select); + } + this.facilityInfoInSceneWindow.playJYJSelectEffect(select, this.modelInfo) } } @@ -131,5 +135,17 @@ export class FacilityInfoUIItem { } + /** + * 获取头部UI的位置(像素) + */ + getHeadUIPos(): Vector2 { + if (this.modelInfo != null) { + return this.modelInfo.getHeadUIPos(); + } + else { + return null; + } + } + } \ No newline at end of file diff --git a/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts b/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts index d3cf2ed..4e715ea 100644 --- a/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts +++ b/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts @@ -1,15 +1,17 @@ import { EventManager } from "@angular/platform-browser"; -import { AbstractMesh, Ray, RayHelper, Vector3 } from "@babylonjs/core"; +import { AbstractMesh, Color3, EventState, Mesh, PickingInfo, PointerEventTypes, PointerInfo, Ray, RayHelper, Vector3 } from "@babylonjs/core"; import { classToClass } from "class-transformer"; import { PlanComponent } from "src/app/pages/plan/plan.component"; import { ModelChangeType } from "../../controller/data-manager"; import { Event_KeyboardInput } from "../../controller/event-manager/events/event-keyboard-input"; import { Event_ModelInfoChange } from "../../controller/event-manager/events/event-modelinfo-change"; import { ModeManager, ModeType } from "../../controller/mode-manager"; +import { SceneManager } from "../../controller/scene-manager"; import { BuildingStatus } from "../../controller/status/building-status"; import { IndoorStatus } from "../../controller/status/indoor-status"; import { StatusManager } from "../../controller/status/status-manager"; import { Game } from "../../game"; +import { JYZInfoMoudleType } from "../../model/data/institution/jyz-show-data"; import { ModelData_facility, FacilityType } from "../../model/data/model-data/model-data-facility"; import { BuildingInfo } from "../../model/info/building/building-info"; import { ModelInfo } from "../../model/info/model/model-info"; @@ -18,6 +20,7 @@ import { GizmoTool } from "../../tool/gizmo-tool"; import { TsTool } from "../../tool/ts-tool"; import { BuildingWindow } from "../building-window/building-window"; +import { FacilityWindow } from "../facility-window/facility-window"; import { UIBase } from "../window-base/ui-base"; import { FacilityInfoUIItem } from "./facilityinfo-ui-item"; @@ -42,6 +45,7 @@ export class FacilityInfoInSceneWindow extends UIBase { isMultiselect: boolean = false;//多选状态 + //#region 前端对接 @@ -94,6 +98,7 @@ export class FacilityInfoInSceneWindow extends UIBase { { if (this.currentFacility != null) { for (let i = 0; i < this.currentFacility.length; i++) { + console.log("取消选中", facilityInfoUIItem.getName()); this.currentFacility[i].onSelect(false); } this.currentFacility = []; @@ -159,12 +164,11 @@ export class FacilityInfoInSceneWindow extends UIBase { } } else { // 单选 if (isChecked) { //选中 - this.three.beforeOnefacilityInfo = facilityInfoUIItem[0].getID(); - this.three.getPropertyData(facilityInfoUIItem[0]) + this.three.selectProperty(facilityInfoUIItem[0]) } else { //取消选中 - // this.three.isShowRightNature = false - this.three.beforeOnefacilityInfo = null + } + } } @@ -175,21 +179,21 @@ export class FacilityInfoInSceneWindow extends UIBase { showFacilityByType(facilityType: FacilityType, show: boolean) { if (ModeManager.currentMode == ModeType.Look) { - // for (let i = 0; i < this.facilityInfoUIItemes.length; i++) { - // let l_facilityData = (this.facilityInfoUIItemes[i].modelInfo.modelData) as ModelData_facility; - // if (facilityType == null || facilityType == l_facilityData.facilityType) { - // this.facilityInfoUIItemes[i].modelInfo.setEnable(show); - // } - // else if (show) { - // this.facilityInfoUIItemes[i].modelInfo.setEnable(false); - // } - // } for (let i = 0; i < this.facilityInfoUIItemes.length; i++) { let l_facilityData = (this.facilityInfoUIItemes[i].modelInfo.modelData) as ModelData_facility; if (facilityType == null || facilityType == l_facilityData.facilityType) { - this.facilityInfoUIItemes[i].modelInfo.setIconEnable(show); + this.facilityInfoUIItemes[i].modelInfo.setEnable(show); + } + else if (show) { + this.facilityInfoUIItemes[i].modelInfo.setEnable(false); } } + // for (let i = 0; i < this.facilityInfoUIItemes.length; i++) { + // let l_facilityData = (this.facilityInfoUIItemes[i].modelInfo.modelData) as ModelData_facility; + // if (facilityType == null || facilityType == l_facilityData.facilityType) { + // this.facilityInfoUIItemes[i].modelInfo.setIconEnable(show); + // } + // } } else { for (let i = 0; i < this.facilityInfoUIItemes.length; i++) { @@ -207,13 +211,27 @@ export class FacilityInfoInSceneWindow extends UIBase { * @param facilityType */ getFacilityUIShowType(facilityType: FacilityType): boolean { - // for (let i = 0; i < this.three.allFacilityInfoUIItemes.length; i++) { - // let item = this.three.allFacilityInfoUIItemes[i]; - // if (item.type == facilityType) { - // return item.isShow; - // } - // } - return true; + + //没开弹框 + if (!this.three.isShowChildComponent || this.three.leftDomain == null) { + + return false; + } + + //没有要显示的设备 + if (this.three.leftDomain.FacilityList == null) { + return false; + } + + for (let i = 0; i < this.three.leftDomain.FacilityList.length; i++) { + let item: FacilityInfoUIItem = this.three.leftDomain.FacilityList[i]; + if (item.getType() == facilityType) { + console.log("显示", facilityType); + return true; + } + } + console.log("不显示", facilityType); + return false; } @@ -242,14 +260,15 @@ export class FacilityInfoInSceneWindow extends UIBase { super.onInit(); FacilityInfoInSceneWindow.instance = this; - // this.three = ThreeDimensionalHomeComponent.instance; + this.three = PlanComponent.instance; + // EventManager.addListener(Event_ModelInfoChange, this.onModelInfoChange); GizmoTool.onPickMeshInfoObservable.add(this.onClickModel); this.currentFacility = []; this.initKeyboardInput(); this.initDragInput(); - + this.initPickEvent(); } @@ -261,6 +280,7 @@ export class FacilityInfoInSceneWindow extends UIBase { GizmoTool.onPickMeshInfoObservable.removeCallback(this.onClickModel); } + //#endregion //#region 键盘输入 /** @@ -280,14 +300,7 @@ export class FacilityInfoInSceneWindow extends UIBase { onKeyboardInput(eventData: Event_KeyboardInput) { if (eventData.data.key == "Delete") // 删除。 后期看是否加入 Backspace 退格 { - //改由前端完成快捷键删除 - // if (this.currentFacility != null) { - // for (let i = 0; i < this.currentFacility.length; i++) { - // this.currentFacility[i].askDelete(false); - // } - // this.currentFacility = []; - // this.three.getAllCensusList(this.facilityInfoUIItemes || []); - // } + } else if (eventData.data.key == "X") //室内消火栓吸附墙 { @@ -417,6 +430,154 @@ export class FacilityInfoInSceneWindow extends UIBase { //#endregion + //#region 鼠标输入 + //初始化pick事件 + initPickEvent() { + + SceneManager.Instance.scene.onPointerObservable.add( + + this.onPointerObservable + ); + } + + //鼠标交互监听 + onPointerObservable(eventData: PointerInfo, eventState: EventState) { + + let instance = FacilityInfoInSceneWindow.instance; + + switch (eventData.type) { + case PointerEventTypes.POINTERUP: + if (eventData.event.button == 0) { //左键正常 + if (eventData.pickInfo.hit && !SceneManager.s_isPointerDrag) { + + instance.selectJYJFrom3D(eventData.pickInfo); + } + } + else { //右键 + + } + break; + case PointerEventTypes.POINTERPICK: + // console.log(eventData.event); + break; + } + } + + + /** + * 选中加油机时,高亮颜色 + */ + static readonly c_selectJYJColor = Color3.Green(); + + /** + * 当前选中的加油机 + */ + currentSelectJYJInfo: ModelInfo_facility; + + /** + * 三维中通过点击模型获取加油机(或油罐) + * @param pickInfo null 表示取消选中 + */ + selectJYJFrom3D(pickInfo: PickingInfo) { + + if (this.currentSelectJYJInfo != null) { + let facilityItem: FacilityInfoUIItem = FacilityInfoInSceneWindow.instance.getFacilityItem(this.currentSelectJYJInfo); + facilityItem.onSelect(false); + // this.playJYJSelectEffect(false, this.currentSelectJYJInfo); + this.currentSelectJYJInfo = null; + } + + if (pickInfo == null) { + return; + } + + let allJYJInfo: ModelInfo_facility[] = []; + + try { + let facilityInfosByType = BuildingWindow.instance.currentBuidngItem.buildingInfo.ModelInfo.facilityInfos; + + let currentMoudle = BuildingWindow.instance.currentJYZInfoMoudleType; + + for (let i = 0; i < facilityInfosByType.length; i++) { + if ((currentMoudle == null || currentMoudle == JYZInfoMoudleType.JYJ) && facilityInfosByType[i].type == FacilityType.JY_JYJ || + (currentMoudle == null || currentMoudle == JYZInfoMoudleType.YG) && facilityInfosByType[i].type == FacilityType.JY_YG) { + allJYJInfo = allJYJInfo.concat(facilityInfosByType[i].facilityInfo); + } + } + + + } catch (error) { + console.log("点击没找到", error); + } + + let result: ModelInfo_facility = null; + + + for (let i = 0; i < allJYJInfo.length; i++) { + let childMesh = allJYJInfo[i].models; + childMesh.push(allJYJInfo[i].modelBox); + for (let j = 0; j < childMesh.length; j++) { + if (pickInfo.pickedMesh == childMesh[j]) { + result = allJYJInfo[i]; + console.log("通过点击,找到加油机了"); + break; + } + } + } + + + if (result != null) { + + //this.playJYJSelectEffect(true, result); + let facilityItem: FacilityInfoUIItem = FacilityInfoInSceneWindow.instance.getFacilityItem(result); + console.log("场景中选中设备", facilityItem); //通知前端 + this.selectFacilityItem(facilityItem); + // facilityItem.onSelect(true); + //FacilityInfoInSceneWindow.instance.selectFacilityItemToThree([facilityItem], true); + //console.log(facilityItem.getHeadUIPos()); + } + } + + /** + * 展示加油机(或油罐)选中的效果 + * @param play false,表示还原 + */ + playJYJSelectEffect(play: boolean, facilityInfo: ModelInfo_facility) { + + //if (play) { + let facilityData = facilityInfo.modelData as ModelData_facility; + if (facilityData.facilityType != FacilityType.JY_JYJ && + facilityData.facilityType != FacilityType.JY_YG) { + //只有加油机和油罐有高亮显示和取消 + return; + } + //} + + + if (play) { + this.currentSelectJYJInfo = facilityInfo; + //正在展示加油机或油罐 + if (BuildingWindow.instance.currentJYZInfoMoudleType == JYZInfoMoudleType.JYJ + || BuildingWindow.instance.currentJYZInfoMoudleType == JYZInfoMoudleType.YG) { + SceneManager.Instance.removeFromHighLight(facilityInfo.modelBox as Mesh); + } + SceneManager.Instance.addToHighLight(facilityInfo.modelBox as Mesh, FacilityInfoInSceneWindow.c_selectJYJColor); + + } + else { + SceneManager.Instance.removeFromHighLight(facilityInfo.modelBox as Mesh); + //正在展示加油机或油罐 + if (BuildingWindow.instance.currentJYZInfoMoudleType == JYZInfoMoudleType.JYJ + || BuildingWindow.instance.currentJYZInfoMoudleType == JYZInfoMoudleType.YG) { + SceneManager.Instance.addToHighLight(facilityInfo.modelBox as Mesh, ModelInfo_facility.c_hightLightColor); + } + + } + + + } + //#endregion + //创建所有设备UI createAllFacilities(facilityByType: FacilityInfoByType[]) { this.clearFacilityInfoUIItemes(); diff --git a/src/app/babylon/view/mark-window/mark-window.ts b/src/app/babylon/view/mark-window/mark-window.ts index 7e7f6ad..5fc0bcb 100644 --- a/src/app/babylon/view/mark-window/mark-window.ts +++ b/src/app/babylon/view/mark-window/mark-window.ts @@ -117,8 +117,8 @@ export class MarkWindow extends UIBase { isShowProperty3d: boolean = true; /** - * 是否显示水源 - */ + * 是否显示水源 + */ isShowWaterSource = false; //#region 生命周期 @@ -145,7 +145,9 @@ export class MarkWindow extends UIBase { this.weatherTool = new WeatherTool(SceneManager.Instance.defaultCamera, SceneManager.Instance.scene); - + SceneManager.Instance.scene.onBeforeRenderObservable.add(() => { + instance.onUpdateShow(); + }) } @@ -623,9 +625,9 @@ export class MarkWindow extends UIBase { } /** - * 改变风向 - * @param temperature - */ + * 改变风向 + * @param temperature + */ changeNature_windDirection(windDirection: WindDirectionType) { if (this.currentMarkNodeInfo == null) { return; @@ -635,9 +637,9 @@ export class MarkWindow extends UIBase { } /** -* 改变风速 -* @param temperature -*/ + * 改变风速 + * @param temperature + */ changeNature_windPower(windPower: number) { if (this.currentMarkNodeInfo == null) { return; @@ -646,7 +648,77 @@ export class MarkWindow extends UIBase { } + /** + * 播放或暂停演出系统 + * @param play false 表示暂停 + */ + playOrPauseShow(play: boolean) { + + + } + + /** + * 调至某一节点 + */ + skipToNode(nodeID: string) { + + } + + + + //#endregion + + + //#region 演出系统 + + + + /** + * 当前演出剩余时间 + */ + currentShowTime: number; + /** + * 当前节点的完整演出时间 + */ + totalShowTime: number; + + + /** + * 是否正在演出 + */ + isPlayingShow: boolean = false; + + + /** + * 播放 + * @param id + */ + playMarkNode(id: number) { + + + + //通知前端 + } + + /** + * 每帧更新 + */ + onUpdateShow() { + + if (this.isPlayingShow) { + if (this.currentShowTime > 0) { + this.currentShowTime -= SceneManager.Instance.scene.deltaTime * 0.001; + + if (this.currentShowTime <= 0) { + let l_currentMarkNodeData: MarkNodeData = this.currentMarkNodeInfo.nodeData; + //播放下一个节点 + this.getNextNode(l_currentMarkNodeData.id); + } + } + } + + } //#endregion @@ -904,6 +976,13 @@ export class MarkWindow extends UIBase { return result; } + /** + * 获取当前方案下,下一个节点,null表示没有了 + */ + getNextNode(id: number) { + let result: MarkNodeInfo = null; + return result; + } //#endregion diff --git a/src/app/pages/left-domain/left-domain.component.html b/src/app/pages/left-domain/left-domain.component.html index 73e12e9..d0782a8 100644 --- a/src/app/pages/left-domain/left-domain.component.html +++ b/src/app/pages/left-domain/left-domain.component.html @@ -18,8 +18,12 @@
-
-

1类加油机

+
+ +
+
+ +

品牌

@@ -29,11 +33,16 @@

油泵类型

-

超大牌

-

2

-

4

-

92#

-

自吸泵

+

+

+

+

+

+ + + + +

@@ -41,8 +50,12 @@
-
-

1号油罐

+
+ +
+
+ +

油品品号

@@ -53,12 +66,18 @@

油罐类型

-

92#

-

200L

-

180L

-

1

-

独立罐区

-

防渗罐池

+

+

+

+

+

+

+ + + + + +

@@ -66,7 +85,10 @@
- + + +

{{node.title}}

{{getFacilityNum(node.key)}}

+
diff --git a/src/app/pages/left-domain/left-domain.component.scss b/src/app/pages/left-domain/left-domain.component.scss index fe01a1e..5f39ec6 100644 --- a/src/app/pages/left-domain/left-domain.component.scss +++ b/src/app/pages/left-domain/left-domain.component.scss @@ -33,8 +33,11 @@ } } -.title{ font-size: 16px; height: 20px; line-height: 20px; margin-bottom: 20px; } //头部header .publicBox{ width: 100%; height: 100%; overflow-y: auto; padding: 0 20px; } +.title{ font-size: 16px; height: 20px; line-height: 20px; margin-bottom: 20px; .anticon{ margin-left: 5px; font-size: 16px; } } //头部header +.tableInput{ border: none; outline: none; background-color: transparent; width: 100%; height: 100%; } +.tableSelect{ width: 100%; height: 100%; color: #fff; } + .baseInfo{ //基本信息 .interval{ margin-top: 10px; border-bottom: 1px solid rgb(197, 226, 245); } //分隔div p{ height: 20px; line-height: 20px; } @@ -44,7 +47,11 @@ .textImage{ margin-bottom: 15px; height: auto; line-height: normal; img{ width: auto; height: 130px; } } } .refueller{ //加油机 - .interval{ margin-top: 10px; } //分隔div + .interval{ margin-top: 10px; position: relative; cursor: pointer; } //分隔div + .positionLeftTop { position: absolute; width: 10px; height: 10px; left: -5px; top: -5px; border-left: 1px solid #fff; border-top: 1px solid #fff; } //左上角 + .positionLeftBottom { position: absolute; width: 10px; height: 10px; left: -5px; bottom: -5px; border-left: 1px solid #fff; border-bottom: 1px solid #fff; } //左下角 + .positionRightTop { position: absolute; width: 10px; height: 10px; right: -5px; top: -5px; border-right: 1px solid #fff; border-top: 1px solid #fff; } //右上角 + .positionRightBottom { position: absolute; width: 10px; height: 10px; right: -5px; bottom: -5px; border-right: 1px solid #fff; border-bottom: 1px solid #fff; } //右下角 .table{ width: 100%; border: 1px solid #91CCFF; @@ -64,14 +71,9 @@ } } } -.oilTank{ //油管设备 +// .oilTank{ //油管设备 -} +// } .fireFacilities{ //消防设施 - .ant-tree{ - height: 32px; - line-height: 32px; - background-color: transparent; - color: #C4E2FC; - } + .treeRow{ width: 100%; display: flex; height: 30px; line-height: 30px; p:first-child{ flex: 1; }; p{ margin: 0; padding: 0; .anticon{ margin-right: 5px; font-size: 16px; } } } } \ No newline at end of file diff --git a/src/app/pages/left-domain/left-domain.component.ts b/src/app/pages/left-domain/left-domain.component.ts index 80e56ad..e6dd912 100644 --- a/src/app/pages/left-domain/left-domain.component.ts +++ b/src/app/pages/left-domain/left-domain.component.ts @@ -1,6 +1,10 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree'; +import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree'; +import { FacilityInfoInSceneWindow } from 'src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window'; import { PlanComponent } from '../plan/plan.component'; +import { FacilityInfoUIItem } from "../../babylon/view/facilityinfoinscene-window/facilityinfo-ui-item"; +import { ConfigManager } from 'src/app/babylon/controller/config-manager'; +import { FacilityType } from 'src/app/babylon/model/data/model-data/model-data-facility'; @Component({ selector: 'app-left-domain', @@ -15,16 +19,121 @@ export class LeftDomainComponent implements OnInit { this.initComponent() } + editModel: boolean = true; //编辑/查看模式 beforeFence: number; //当前选中功能栏 + FacilityList: FacilityInfoUIItem[] = []; //统计设备 list + selectFacilityId: string = null; //选中设备 ID @ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent; - treeData: NzTreeNodeOptions[] = treeData.nodes; //tree data + treeData: NzTreeNodeOptions[] = []; //tree data //初始化组件 initComponent(type?: number) { if (type != undefined && type != null) { this.beforeFence = type + this.handleFacility() } else { this.beforeFence = PlanComponent.instance.selectFence + this.handleFacility() + } + } + + //处理 设备data + handleFacility() { + let list: FacilityInfoUIItem[] = [] + FacilityInfoInSceneWindow.instance.facilityInfoUIItemes.forEach(item=>{ + if (this.beforeFence === 1) { //加油机 + item.getType() === "JY_JYJ"? list.push(item) : null + } else if (this.beforeFence === 2) { //油罐设备 + item.getType() === "JY_YG"? list.push(item) : null + } else if (this.beforeFence === 3) { //消防设施 + (item.getType()).slice(0,3) === "XF_"? list.push(item) : null + } + }) + this.FacilityList = list + this.selectFacilityId = null + if (this.beforeFence === 3) { //消防设施 + this.handleTreeData(this.FacilityList) + } + } + + //选中 设备 + selectFacility(item: FacilityInfoUIItem) { + if (this.selectFacilityId != item.getID()) { + this.selectFacilityId = item.getID() + FacilityInfoInSceneWindow.instance.selectFacilityItem(item); + } else { + this.selectFacilityId = null + item.onSelect(false) + } + } + + //处理 treeData + handleTreeData(list: FacilityInfoUIItem[]) { + this.treeData = [] + list.forEach(item=>{ + let isFind = this.treeData.find(element=>{ return (item.getType()).includes(element.key) }) + if (!isFind) { //不存在 + if (item.getType().includes('XF_MHQ')) { //灭火器 + let primaryNode = { title: '灭火器', key: 'XF_MHQ', selectable: false, expanded: true, children: [], } + let treeNode = { title: ConfigManager.getFacilityTypeName(item.getType()), key: item.getType(), selectable: false, } + primaryNode.children.push(treeNode) + this.treeData.push(primaryNode) + } else { + let primaryNode = { title: ConfigManager.getFacilityTypeName(item.getType()), key: item.getType(), selectable: false, } + this.treeData.push(primaryNode) + } + } else { //存在 + if (item.getType().includes('XF_MHQ') && !isFind.children.find(elements=>{ return elements.key === item.getType() })) { //灭火器 + let treeNode = { title: ConfigManager.getFacilityTypeName(item.getType()), key: item.getType(), selectable: false, } + isFind.children.push(treeNode) + } + } + }) + //编辑模式 + if (this.editModel) { + let isFind = this.treeData.find(item=>{ return item.key === 'XF_MHQ' }) + if (!isFind) { + let primaryNode = { title: '灭火器', key: 'XF_MHQ', selectable: false, } + this.treeData.push(primaryNode) + } + for (let facility in FacilityType) { + if (facility.slice(0,3) === "XF_" && !facility.includes('XF_MHQ')) { + let isFind = this.treeData.find(item=>{ return item.key === facility }) + if (!isFind) { + let primaryNode = { title: ConfigManager.getFacilityTypeName(FacilityType[facility]), key: facility, selectable: false, } + this.treeData.push(primaryNode) + } + } + } + } + //编辑模式 + } + + //获取设备 数量 + getFacilityNum(type: string): number { + let num = 0 + this.FacilityList.forEach(item=>{ + item.getType().includes(type)? num = num + 1 : null + }) + return num + } + + //点击tree节点 + nzClick(event: NzFormatEmitEvent) { + if (event.node.key != 'XF_MHQ') { + event.node.isSelected = !event.node.isSelected + if (event.node.isSelected) { //显示当前, 隐藏所有 + FacilityInfoInSceneWindow.instance.showFacilityByType(null, false) + FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[event.node.key], event.node.isSelected) + } else { //显示所有 + this.treeData.forEach(item=>{ + if (item.key != 'XF_MHQ') { + FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[item.key], true) + } else { + item.children.forEach(element=>{ FacilityInfoInSceneWindow.instance.showFacilityByType(FacilityType[element.key], true) }) + } + }) + } } } @@ -43,29 +152,5 @@ export class LeftDomainComponent implements OnInit { } export class treeData { - static nodes: NzTreeNodeOptions[] = [ - { - title: '灭火器', - key: '1', - selectable: false, - children: [ - { title: '4KG手提干粉灭火器', key: '1', selectable: false, }, - { title: '4KG手提泡沫灭火器', key: '2', selectable: false, }, - { title: '4KG手提二氧化碳灭火器', key: '3', selectable: false, }, - { title: '35KG手推灭火器', key: '4', selectable: false, }, - ] - }, - { - title: '灭火毯', - key: '2', - selectable: false, - children: [] - }, - { - title: '消防锹', - key: '3', - selectable: false, - children: [] - }, - ]; + static nodes: NzTreeNodeOptions[] = [] } diff --git a/src/app/pages/login/login.component.ts b/src/app/pages/login/login.component.ts index 19abd0d..d379c6a 100644 --- a/src/app/pages/login/login.component.ts +++ b/src/app/pages/login/login.component.ts @@ -3,9 +3,9 @@ import { HttpClient } from '@angular/common/http' import { Router, ActivatedRoute } from '@angular/router' import { CacheTokenService } from '../../service/cache-token.service'//引入服务 import { CookieService } from 'ngx-cookie-service';//cookie插件 - import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { NzMessageService } from 'ng-zorro-antd/message'; + @Component({ selector: 'app-login', templateUrl: './login.component.html', @@ -28,6 +28,7 @@ export class LoginComponent implements OnInit { errmsg: string = ''; //错误信息 + //跳转注册页面 toRegister() { this.router.navigate(['/register']) diff --git a/src/app/pages/pages.module.ts b/src/app/pages/pages.module.ts index 470eb6a..73c0fc2 100644 --- a/src/app/pages/pages.module.ts +++ b/src/app/pages/pages.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { CommonModule } from '@angular/common'; import { A11yModule } from '@angular/cdk/a11y'; import { DragDropModule } from '@angular/cdk/drag-drop'; @@ -37,6 +37,8 @@ import { OilStationInfoComponent } from './oil-station-info/oil-station-info.com import { LeftDomainComponent } from './left-domain/left-domain.component'; import { AddequipmentComponent } from './equipment-info/addequipment/addequipment.component'; import { EditequipmentComponent } from './equipment-info/editequipment/editequipment.component'; + + @NgModule({ declarations: [LoginComponent, RegisterComponent, HomeComponent, PlanComponent, TodayWarningComponent, CriminalRecordsComponent, TodayWarningAdminComponent, CriminalRecordsAdminComponent, LeftDomainComponent, EquipmentInfoComponent, OilStationInfoComponent, AddequipmentComponent, EditequipmentComponent], imports: [ @@ -67,6 +69,8 @@ import { EditequipmentComponent } from './equipment-info/editequipment/editequip NzSpinModule, NzTreeModule ], - entryComponents :[AddequipmentComponent,EditequipmentComponent] + entryComponents: [AddequipmentComponent, EditequipmentComponent], + schemas: [CUSTOM_ELEMENTS_SCHEMA] + }) export class PagesModule { } diff --git a/src/app/pages/plan/plan.component.html b/src/app/pages/plan/plan.component.html index d872530..1716fe8 100644 --- a/src/app/pages/plan/plan.component.html +++ b/src/app/pages/plan/plan.component.html @@ -1,5 +1,5 @@
-
+
diff --git a/src/app/pages/plan/plan.component.ts b/src/app/pages/plan/plan.component.ts index 01bb492..be42d05 100644 --- a/src/app/pages/plan/plan.component.ts +++ b/src/app/pages/plan/plan.component.ts @@ -269,11 +269,13 @@ export class PlanComponent implements OnInit { } beforeOnePropertyData: FacilityInfoUIItem = null; //当前选择 设备 - beforeOnefacilityInfo: string = null; //当前选择 设备ID - //获取选择设备 属性 - getPropertyData(e: FacilityInfoUIItem) { + //选中 设备 + selectProperty(e: FacilityInfoUIItem) { this.beforeOnePropertyData = e + if (this.isShowChildComponent && this.leftDomain) { + this.leftDomain.selectFacilityId = e.getID() + } } selectRightTopFast: number = 0; //当前选择功能 快捷栏 diff --git a/src/assets/images/facility/in/JY_JYJ.png b/src/assets/images/facility/in/JY_JYJ.png new file mode 100644 index 0000000..199063a Binary files /dev/null and b/src/assets/images/facility/in/JY_JYJ.png differ diff --git a/src/assets/images/facility/in/JY_YG.png b/src/assets/images/facility/in/JY_YG.png new file mode 100644 index 0000000..f377b06 Binary files /dev/null and b/src/assets/images/facility/in/JY_YG.png differ diff --git a/src/assets/images/facility/out/DWBZ.png b/src/assets/images/facility/out/DWBZ.png index 8424018..bbc7d50 100644 Binary files a/src/assets/images/facility/out/DWBZ.png and b/src/assets/images/facility/out/DWBZ.png differ diff --git a/src/assets/images/facility/out/PL.png b/src/assets/images/facility/out/PL.png index 96be52e..9e82a04 100644 Binary files a/src/assets/images/facility/out/PL.png and b/src/assets/images/facility/out/PL.png differ diff --git a/src/assets/images/facility/out/QY.png b/src/assets/images/facility/out/QY.png index 20c9871..81b25dc 100644 Binary files a/src/assets/images/facility/out/QY.png and b/src/assets/images/facility/out/QY.png differ diff --git a/src/assets/images/facility/out/TPBZ.png b/src/assets/images/facility/out/TPBZ.png index 48a05d6..7494541 100644 Binary files a/src/assets/images/facility/out/TPBZ.png and b/src/assets/images/facility/out/TPBZ.png differ diff --git a/src/styles.scss b/src/styles.scss index 49a6cce..88c4e22 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -102,16 +102,22 @@ h1 { font-size: 16px; } - -//滚动条样式 -::-webkit-scrollbar { - width: 5px; -} -::-webkit-scrollbar-thumb { - background-image: linear-gradient(#2495f8,#1c73c2,#02233f,); -} -::-webkit-scrollbar-track { - background-color: #0d4070; +//三维场景 +#threeDimensional { + .ant-tree{ color: #C4E2FC; } + .ant-tree,.ant-tree-node-content-wrapper:hover,.ant-tree-node-content-wrapper.ant-tree-node-selected { background-color: transparent; } + .ant-tree-node-content-wrapper { width: 100%; } + .ant-select-single:not(.ant-select-customize-input) .ant-select-selector { border: none; border-radius: 0px; } + //滚动条样式 + ::-webkit-scrollbar { + width: 5px; + } + ::-webkit-scrollbar-thumb { + background-image: linear-gradient(#2495f8,#1c73c2,#02233f,); + } + ::-webkit-scrollbar-track { + background-color: #0d4070; + } } diff --git a/yarn.lock b/yarn.lock index e2d741a..20611a6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -122,7 +122,7 @@ resolved "https://registry.npmmirror.com/@angular/animations/download/@angular/animations-9.1.13.tgz?cache=0&sync_timestamp=1634753072212&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2F%40angular%2Fanimations%2Fdownload%2F%40angular%2Fanimations-9.1.13.tgz#561305f7bf4a7a5ea3ff172d6fac31615667acb0" integrity sha1-VhMF979Kel6j/xctb6wxYVZnrLA= -"@angular/cdk@^9.0.0": +"@angular/cdk@^9.0.0", "@angular/cdk@^9.2.4": version "9.2.4" resolved "https://registry.npmmirror.com/@angular/cdk/download/@angular/cdk-9.2.4.tgz#8413958bd275e4c34be3b96f56444671dd30ba93" integrity sha1-hBOVi9J15MNL47lvVkRGcd0wupM= @@ -4976,9 +4976,9 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" -echarts@^4.6.0: +echarts@^4.9.0: version "4.9.0" - resolved "https://registry.nlark.com/echarts/download/echarts-4.9.0.tgz?cache=0&sync_timestamp=1632191355993&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fecharts%2Fdownload%2Fecharts-4.9.0.tgz#a9b9baa03f03a2a731e6340c55befb57a9e1347d" + resolved "https://registry.npmmirror.com/echarts/download/echarts-4.9.0.tgz?cache=0&sync_timestamp=1635741929711&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fecharts%2Fdownload%2Fecharts-4.9.0.tgz#a9b9baa03f03a2a731e6340c55befb57a9e1347d" integrity sha1-qbm6oD8Doqcx5jQMVb77V6nhNH0= dependencies: zrender "4.3.2"