diff --git a/src/app/babylon/controller/config-manager.ts b/src/app/babylon/controller/config-manager.ts index 6a01cf6..b932819 100644 --- a/src/app/babylon/controller/config-manager.ts +++ b/src/app/babylon/controller/config-manager.ts @@ -1,5 +1,6 @@ import { MarkKindType, MarkType, MarkTagPos } from "../model/data/mark/mark-data"; import { FacilityPosType, FacilityType } from "../model/data/model-data/model-data-facility"; +import { TsTool } from "../tool/ts-tool"; //配置、常量管理器 export class ConfigManager { @@ -31,6 +32,28 @@ export class ConfigManager { return result; } + /** + * 查询设备是否需要展示图标 + * @param type + */ + static getFacilityNeedIcon(type: FacilityType) { + let result = false; + switch (type) { + case FacilityType.PL: + case FacilityType.QY: + case FacilityType.TPBZ: + case FacilityType.DWBZ: + result = true; + break; + + } + if (TsTool.stringContain(type, "XF_")) { + result = true; + } + + return result; + + } /** * 获取设备icon的url diff --git a/src/app/babylon/controller/info-manager.ts b/src/app/babylon/controller/info-manager.ts index e4c8436..7a8fc35 100644 --- a/src/app/babylon/controller/info-manager.ts +++ b/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 { FacilityInBuildingType, FacilityType, ModelData_facility } from "../model/data/model-data/model-data-facility"; +import { FacilityPosType, FacilityType, ModelData_facility } from "../model/data/model-data/model-data-facility"; import { ModelEditData } from "../model/data/model-data/model-edit-data"; import { TransformData } from "../model/data/transform-data"; import { BuildingInfo } from "../model/info/building/building-info"; @@ -164,19 +164,29 @@ export class InfoManager { modelEditData: ModelEditData, buildingInfo: BuildingInfo = null ) { + console.trace("创建设备", buildingInfo); let facilities = modelEditData.facilities; for (let i = 0; i < facilities.length; i++) { for (let j = 0; j < facilities[i].facilities.length; j++) { + + let mesh: AbstractMesh = null; + let facilityData = facilities[i].facilities[j] + if (facilityData.posType == FacilityPosType.In) { + mesh = SceneManager.Instance.scene.getMeshByID(facilityData.resName); + console.log("找到内置设备", mesh.uniqueId); + } + + FacilityWindow.instance.createFacility( modelEditData.facilities[i].facilities[j], false, buildingInfo, true, false, - null,//要根据类型,是不是从场景中查找 + mesh,//要根据类型,是不是从场景中查找 (modelInfo: ModelInfo_facility) => { if (ModeManager.currentMode == ModeType.Look) { modelInfo.setIconEnable(false);//查看模式下隐藏所有设备ui diff --git a/src/app/babylon/controller/scene-manager.ts b/src/app/babylon/controller/scene-manager.ts index 5332672..5e14706 100644 --- a/src/app/babylon/controller/scene-manager.ts +++ b/src/app/babylon/controller/scene-manager.ts @@ -57,6 +57,7 @@ import { ModelInfo_mark_multiLine } from '../model/info/mark/other/mark-plan-mul import { MarkData_multiArrow_CT, MarkData_multiArrow_JG } from '../model/data/mark/other/mark-data-multi-arrow'; import { ModelInfo_mark_multiArrow } from '../model/info/mark/other/mark-plan-multi-arrow'; import { ModelInfo_mark_particle } from '../model/info/mark/other/mark-plan-particle-info'; +import { FacilityPosType, ModelData_facility } from '../model/data/model-data/model-data-facility'; //场景管理器 export class SceneManager { @@ -258,16 +259,22 @@ export class SceneManager { let allMesh = mesh.getChildMeshes(); this.highLightLayer.addMesh(mesh, color); + allMesh.push(mesh); for (let i = 0; i < allMesh.length; i++) { let childMesh = allMesh[i]; if (childMesh instanceof Mesh) { this.highLightLayer.addMesh(childMesh, color); + this.highLightNum++; } } + + } + highLightNum = 0; + /** * 移除出高亮层 * @param mesh @@ -277,21 +284,23 @@ export class SceneManager { return; } let allMesh = mesh.getChildMeshes(); + allMesh.push(mesh); for (let i = 0; i < allMesh.length; i++) { let childMesh = allMesh[i]; if (childMesh instanceof Mesh) { this.highLightLayer.removeMesh(childMesh); + this.highLightNum--; } } } - /** - * 清空高亮层 - */ - clearHighLight() { - this.highLightLayer.removeAllMeshes(); - } + // /** + // * 清空高亮层 + // */ + // clearHighLight() { + // this.highLightLayer.removeAllMeshes(); + // } //#endregion @@ -784,8 +793,21 @@ export class SceneManager { if (modelInfo == null) { return; } else { - TsTool.arrayRemove(SceneManager.s_allModelInfo, modelInfo); - modelInfo.dispose(); + + console.log(modelInfo.modelData instanceof ModelData_facility, (modelInfo.modelData as ModelData_facility).posType); + + if (modelInfo.modelData instanceof ModelData_facility && modelInfo.modelData.posType == FacilityPosType.In) { + console.log("1111"); + //来自建筑模型中的设备 + modelInfo.dispose(false); + } + else { + console.log("222"); + TsTool.arrayRemove(SceneManager.s_allModelInfo, modelInfo); + modelInfo.dispose(); + } + + } } diff --git a/src/app/babylon/controller/serve-manager.ts b/src/app/babylon/controller/serve-manager.ts index 12c7167..92e0415 100644 --- a/src/app/babylon/controller/serve-manager.ts +++ b/src/app/babylon/controller/serve-manager.ts @@ -1,5 +1,6 @@ import { HttpErrorResponse } from "@angular/common/http"; import { classToPlain } from "class-transformer"; +import { PlanComponent } from "src/app/pages/plan/plan.component"; import { BuildingBasicInfosService } from "src/app/service/babylon/building-basic-infos.service"; import { ObjectsService } from "src/app/service/objects.service"; import { InsitutionDataSimple } from "../model/data/institution/institution-data-simple"; @@ -33,6 +34,7 @@ export class ServeManager { ) => void, onError?: (key: string, error: any) => void) { this.buildingBISrv.getBuildingBasicInfos(key) .subscribe(data => { + console.log("得到单位信息" + key, data); if (onSuccess) { onSuccess(key, JSON.parse((data as any).result)); } @@ -58,7 +60,7 @@ export class ServeManager { onSuccess(key, data.result); } if (key != "InsList") { - //ThreeDimensionalHomeComponent.instance.openSnackBar("保存单位成功"); + PlanComponent.instance.openSnackBar("保存单位成功"); // alert("保存单位成功"); } @@ -134,7 +136,7 @@ export class ServeManager { if (onSuccess) { onSuccess(allMarkPlanData.institutionID, data.result); } - // ThreeDimensionalHomeComponent.instance.openSnackBar("保存标绘信息成功"); + //PlanComponent.instance.openSnackBar("保存标绘信息成功"); // alert("保存标绘信息成功"); //暂时没有失败的回调 onError diff --git a/src/app/babylon/controller/status/login-status.ts b/src/app/babylon/controller/status/login-status.ts index e146489..50aae2d 100644 --- a/src/app/babylon/controller/status/login-status.ts +++ b/src/app/babylon/controller/status/login-status.ts @@ -71,12 +71,15 @@ export class LoginSatus extends StatusBase { console.error("获取单位列表失败"); console.log(error); if (error instanceof HttpErrorResponse && error.status === 404) { + let isAdd = confirm('数据库为空,是否进行初始化?') + if (isAdd) { //数据库没有数据,新建 this.institutionList = []; if (onSuccess) { onSuccess(this.institutionList, this.institutionList); } console.log("新建数据列表"); + } } else { console.log("单纯报错", error instanceof HttpErrorResponse, error.status === 404) 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 4965515..d01fbfe 100644 --- a/src/app/babylon/model/data/model-data/model-data-facility.ts +++ b/src/app/babylon/model/data/model-data/model-data-facility.ts @@ -10,9 +10,15 @@ import { ConfigManager } from "src/app/babylon/controller/config-manager"; //设备数据 export class ModelData_facility extends ModelData { - posType: FacilityPosType = FacilityPosType.Out;//位置类型 + /** + * 位置类型 + */ + posType: FacilityPosType = FacilityPosType.Out; - facilityType: FacilityType = FacilityType.PL;//具体设备类别 + /** + * 具体设备类别 + */ + facilityType: FacilityType = FacilityType.PL; @Type(() => PropertyData_Base) propertyData: PropertyData_Base = null;//属性信息 @Type(() => Vector3) @@ -96,14 +102,22 @@ export class ModelData_facility extends ModelData { + + } //设备位置类型(室内还是室外) export enum FacilityPosType { - In = "in", //内置在建筑模型中 - Out = "out", //在编辑时单独放置 + /** + * 内置在建筑模型中 + */ + In = "in", + /** + * 在编辑时单独放置 + */ + Out = "out", } //设备展示类型 @@ -191,6 +205,12 @@ export enum FacilityType { * 消防沙 */ XF_XFS = "XF_XFS", + + /** + * 消防的阻挡物 + */ + ZD_XF = "ZD_XF", + /** * 加油机 */ @@ -209,10 +229,20 @@ export enum FacilityType { * 输油管线 */ JY_SYGX = "JY_SYGX", + + /** + * 输油管线阻挡物 + */ + ZD_SYGX = "ZD_SYGX", /** * 油气回收管线 */ JY_YQHSGX = "JY_YQHSGX", + + /** + * 油气回收管线 阻挡物 + */ + ZD_YQHSGX = "ZD_YQHSGX", /** * 逃生路线 */ @@ -220,7 +250,12 @@ export enum FacilityType { /** * 疏散点 */ - XF_SSD = "XF_SSD" + XF_SSD = "XF_SSD", + + /** + * 罩棚 + */ + ZD_ZP = "ZD_ZP", } diff --git a/src/app/babylon/model/data/model-data/model-data.ts b/src/app/babylon/model/data/model-data/model-data.ts index 48df269..f0cd417 100644 --- a/src/app/babylon/model/data/model-data/model-data.ts +++ b/src/app/babylon/model/data/model-data/model-data.ts @@ -6,8 +6,14 @@ export class ModelData { key: string; //身份唯一标识 name: string; //用户定义的名称 - resName: string; //资源名称 - resPath: string; //资源路径(局部) 可使用 DataManager.getResPath进行构造 + /** + * 资源名称,如果是建筑内置设备,则代表了mesh的id(用于寻找mesh) + */ + resName: string; + /** + * 资源路径(局部) 可使用 DataManager.getResPath进行构造 + */ + resPath: string; @Type(() => TransformData) transformData: TransformData; //变换信息 version: number = 1;//版本号 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 c54124b..2d47b2a 100644 --- a/src/app/babylon/model/info/model/model-info-building.ts +++ b/src/app/babylon/model/info/model/model-info-building.ts @@ -150,9 +150,9 @@ export class ModelInfo_building extends ModelInfo { - dispose() { + dispose(disposeMesh?: boolean) { this.disposeAllFacility(); - super.dispose(); + super.dispose(disposeMesh); } /** @@ -218,9 +218,9 @@ export class ModelInfo_building extends ModelInfo { InfoManager.removeFacilityInfoToTypeList(modelInfo_facility, this.facilityInfos); } Event_ModelInfoChange.dispatch(modelInfo_facility, ModelChangeType.Remove); - if ((modelInfo_facility.modelData as ModelData_facility).posType == FacilityPosType.Out) { - SceneManager.destroyModel(modelInfo_facility); - } + + SceneManager.destroyModel(modelInfo_facility); + } 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 490d950..2057ec4 100644 --- a/src/app/babylon/model/info/model/model-info-facility.ts +++ b/src/app/babylon/model/info/model/model-info-facility.ts @@ -38,9 +38,13 @@ export class ModelInfo_facility extends ModelInfo { } onCreateFollowUI() { + let modelData = this.modelData as ModelData_facility; + if (!ConfigManager.getFacilityNeedIcon(modelData.facilityType)) { + return; + } super.onCreateFollowUI(); let instance = this; - let modelData = this.modelData as ModelData_facility; + let posType = ConfigManager.getPosType(modelData.facilityType); let iconPath = ConfigManager.getFacilityIconUrl(modelData.facilityType, posType); BabylonUIStyleTool.setStyle_size(this.uiFollowRoot, ConfigManager.c_size_facilityIconSize + "px", ConfigManager.c_size_facilityIconSize + "px"); @@ -152,12 +156,12 @@ export class ModelInfo_facility extends ModelInfo { } } - dispose() { + dispose(disposeMesh?: boolean) { if (this.areaInfo != null) { this.areaInfo.dispose(); } - super.dispose(); + super.dispose(disposeMesh); } } diff --git a/src/app/babylon/model/info/model/model-info.ts b/src/app/babylon/model/info/model/model-info.ts index 5f3ee40..066d77a 100644 --- a/src/app/babylon/model/info/model/model-info.ts +++ b/src/app/babylon/model/info/model/model-info.ts @@ -1,18 +1,18 @@ import { AbstractMesh, AnimationGroup, + Color3, EventState, - GizmoManager, Mesh, PointerDragBehavior, - TransformNode, - Node, 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'; @@ -137,6 +137,22 @@ export class ModelInfo { } } + /** + * 播放展示动画(高亮) + * @param play false表示停止,并恢复正常 + */ + playShowAnim(play: boolean) { + if (this.modelBox != null) { + if (play) { + SceneManager.Instance.addToHighLight(this.modelBox as Mesh, Color3.Red()); + + } + else { + SceneManager.Instance.removeFromHighLight(this.modelBox as Mesh); + + } + } + } /** * 克隆 @@ -201,18 +217,31 @@ export class ModelInfo { } } - dispose() { + /** + * 释放 + * @param disposeMesh 同时释放模型 + */ + dispose(disposeMesh: boolean = true) { this.isDisposed = true; - this.uiFollowRoot.dispose(); - // console.log("释放model" + this.key); - if (this.modelBox != null) { - this.modelBox.dispose(); - } else { - this.models[0].dispose(); + if (this.uiFollowRoot != null) { + this.uiFollowRoot.dispose(); + } + + console.log("释放model" + this.key, disposeMesh); + if (disposeMesh) { + if (this.modelBox != null) { + this.modelBox.dispose(); + } else { + this.models[0].dispose(); + } + } + else { + console.log("不释放mesh", this.modelBox.name); } } + //设置模型盒子时 onSetModelBox() { diff --git a/src/app/babylon/view/building-window/building-ui-item.ts b/src/app/babylon/view/building-window/building-ui-item.ts index a3b5c47..f38a4f1 100644 --- a/src/app/babylon/view/building-window/building-ui-item.ts +++ b/src/app/babylon/view/building-window/building-ui-item.ts @@ -208,7 +208,7 @@ export class BuildingUIItem { * @param mesh */ createFacilityByMesh(mesh: AbstractMesh) { - FacilityWindow.instance.createFacilityByMesh(mesh, this.buildingInfo); + FacilityWindow.instance.createFacilityByMesh(mesh); } @@ -217,7 +217,7 @@ export class BuildingUIItem { * @param mesh */ createOilingByMesh(mesh: AbstractMesh) { - FacilityWindow.instance.createOilingByMesh(mesh, this.buildingInfo); + FacilityWindow.instance.createOilingByMesh(mesh); } /** @@ -225,7 +225,7 @@ export class BuildingUIItem { * @param mesh */ createStopByMesh(mesh: AbstractMesh) { - FacilityWindow.instance.createStopByMesh(mesh, this.buildingInfo); + FacilityWindow.instance.createStopByMesh(mesh); } /** diff --git a/src/app/babylon/view/building-window/building-window.ts b/src/app/babylon/view/building-window/building-window.ts index 26062b7..298de6a 100644 --- a/src/app/babylon/view/building-window/building-window.ts +++ b/src/app/babylon/view/building-window/building-window.ts @@ -6,8 +6,8 @@ import { SceneManager } from "../../controller/scene-manager"; import { ServeManager } from "../../controller/serve-manager"; import { BuildingStatus } from "../../controller/status/building-status"; import { StatusManager } from "../../controller/status/status-manager"; -import { BuildingData_Normal, BuildingData_Environment, BuildingData_ChemicalPlant, BuildingType, BuildingData } from "../../model/data/institution/building/building-data"; -import { BuildingPosType, ModelType } from "../../model/data/model-data/model-data"; +import { BuildingData, BuildingData_ChemicalPlant, BuildingData_Environment, BuildingData_Normal, BuildingType } from "../../model/data/institution/building/building-data"; +import { ModelType } from "../../model/data/model-data/model-data"; import { 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"; @@ -15,6 +15,7 @@ import { BuildingInfo_ChemicalPlant } from "../../model/info/building/building-i import { BuildingInfo_Environment } from "../../model/info/building/building-info-environment"; import { BuildingInfo_Normal } from "../../model/info/building/building-info-normal"; import { ModelInfo_building } from "../../model/info/model/model-info-building"; +import { FacilityInfoByType } from "../../model/info/model/model-info-facility"; import { TsTool } from "../../tool/ts-tool"; import { UIBase } from "../window-base/ui-base"; import { BuildingUIItem } from "./building-ui-item"; @@ -61,8 +62,8 @@ export class BuildingWindow extends UIBase { let uiItem = this.addBuildingItem(buildingInfo); if (buildingData.outdoorData != null && buildingData.outdoorData.modelData != null && buildingData.outdoorData.modelData.resName != null) { - this.updateBuildingModel(buildingInfo, false, () => { - buildingInfo.initFacility(); + this.updateBuildingModel(buildingInfo, true, () => { + // buildingInfo.initFacility(); BuildingStatus.enterSuccessObservable.notifyObservers(uiItem); if (onSuccess) { onSuccess(uiItem, index); @@ -201,6 +202,34 @@ export class BuildingWindow extends UIBase { } + /** + * 加油站信息各个模块的显示、隐藏 + * @param type + * @param show true表示显示 + */ + showJYZInfoModel(type: JYZInfoMoudleType, show: boolean) { + console.log("showJYZInfoModel", type, show); + if (this.currentJYZInfoMoudleType == type) { + if (show) { + return; //与上次显示的模块相同 + } + else { + this.showJYZModules(type, show); + } + } + else { + if (this.currentJYZInfoMoudleType != null) { + this.showJYZModules(this.currentJYZInfoMoudleType, false); //先恢复之前隐藏的内容 + } + this.showJYZModules(type, show);//展示本次要展示的内容 + } + + + + } + + + //#endregion @@ -339,6 +368,7 @@ export class BuildingWindow extends UIBase { buildingInfo.ModelInfo = modelInfo as ModelInfo_building; buildingInfo.ModelInfo.updateName(buildingInfo.buildingData.normalData.name); if (updateFacility) { + InfoManager.createFacilityInfos(buildingInfo.buildingData.outdoorData, buildingInfo); } if (buildingInfo instanceof BuildingInfo_Environment) { @@ -542,7 +572,7 @@ export class BuildingWindow extends UIBase { */ public getModelAndCreateFacilityData() { - this.clearHomeLessFacilityData(); + //this.clearHomeLessFacilityData(); if (this.currentBuidngItem != null) { //获取所有transformNodes @@ -569,6 +599,176 @@ export class BuildingWindow extends UIBase { } + + //#endregion + + //#region 加油站基本信息模块的显隐表现 + + /** + * 当前查看的加油站信息模块类型 + */ + currentJYZInfoMoudleType: JYZInfoMoudleType = null; + + /** + * 当前模块需要显示的各类设备 + */ + facilitysByMoudle: Map = new Map(); + + /** + * 当前模块需要隐藏的设备 + */ + zdByMoudle: Map = new Map(); + + /** + * 展示加油站信息模块 + * @param type + * @param show + */ + showJYZModules(type: JYZInfoMoudleType, show: boolean) { + console.log("切换页签", type, show); + if (this.currentBuidngItem == null) { + return; + } + this.initFacilityTypeByMoudleType(type, this.currentBuidngItem.buildingInfo); + + //设备: 显示UI + let facilityByType: FacilityInfoByType[] = []; + if (this.facilitysByMoudle.has(type)) { + facilityByType = this.facilitysByMoudle.get(type); + } + for (let i = 0; i < facilityByType.length; i++) { + let infos = facilityByType[i].facilityInfo; + if (infos != null) { + for (let j = 0; j < infos.length; j++) { + infos[j].playShowAnim(show); + } + } + } + + //阻挡类物体 + let zdByType: FacilityInfoByType[] = []; + if (this.zdByMoudle.has(type)) { + zdByType = this.zdByMoudle.get(type); + } + for (let i = 0; i < zdByType.length; i++) { + let infos = zdByType[i].facilityInfo; + if (infos != null) { + for (let j = 0; j < infos.length; j++) { + infos[j].setEnable(!show); + } + } + } + if (show) { + this.currentJYZInfoMoudleType = type; + } + else { + console.log("隐藏", this.currentJYZInfoMoudleType); + this.currentJYZInfoMoudleType = null; + // SceneManager.Instance.highLightLayer.removeAllMeshes(); + + } + + } + + /** + * 根据功能模块,获取所需的设备类型 + * @param moudleType + */ + initFacilityTypeByMoudleType(moudleType: JYZInfoMoudleType, buildingInfo: BuildingInfo) { + + let moudleTypeKey = moudleType + "_"; //当前模块物体的特殊字段 + let zdKey = "ZD_" + moudleType; //阻挡类物体特殊字段 + + if (this.facilitysByMoudle.has(moudleType)) { + //已经初始化过了 + return; + } + else { + this.facilitysByMoudle.set(moudleType, []); + } + + let allFacilityByType = buildingInfo.ModelInfo.facilityInfos; + if (allFacilityByType == null) { + return; //没有设备 + } + + + + for (let i = 0; i < allFacilityByType.length; i++) { + let l_facilityByType = allFacilityByType[i]; + if (TsTool.stringContain(l_facilityByType.type, zdKey)) { + this.zdByMoudle.get(moudleType).push(l_facilityByType); + } + else if (TsTool.stringContain(l_facilityByType.type, moudleTypeKey)) { + this.facilitysByMoudle.get(moudleType).push(l_facilityByType); + } + } + + // for (var l_facility in FacilityType) { + + + + + // } + } + + /** + * 显示罩棚 + * @param show false 表示隐藏罩棚 + */ + showZP(show: boolean) { + this.initFacilityTypeByMoudleType(JYZInfoMoudleType.ZP, this.currentBuidngItem.buildingInfo); + let zpInfoByTypes = this.facilitysByMoudle.get(JYZInfoMoudleType.ZP); + if (zpInfoByTypes != null) { + for (let i = 0; i < zpInfoByTypes.length; i++) { + let infos = zpInfoByTypes[i].facilityInfo; + for (let j = 0; j < infos.length; j++) { + infos[j].setEnable(show); + } + } + } + } + + + + //#endregion + + +} + +/** + * 加油站信息模块类型 + */ +export enum JYZInfoMoudleType { + /** + * 消防 + */ + XF = "XF", + /** + * 加油机 + */ + JYJ = "JYJ", + /** + * 油罐 + */ + YG = "YG", + /** + * 输油管 + */ + SYG = "SYG", + /** + * 油气回收管线 + */ + YQHSGX = "YQHSGX", + /** + * 逃生路线 + */ + TSLX = "TSLX", + + /** + * 罩棚 + */ + ZP = "ZP", } \ No newline at end of file diff --git a/src/app/babylon/view/facility-window/facility-window.ts b/src/app/babylon/view/facility-window/facility-window.ts index 727d0c8..feb8e24 100644 --- a/src/app/babylon/view/facility-window/facility-window.ts +++ b/src/app/babylon/view/facility-window/facility-window.ts @@ -316,8 +316,14 @@ export class FacilityWindow extends UIBase { createNewFacilityByMesh(mesh: AbstractMesh, type: FacilityType) { let facilityData = this.createFacilityDataFromMesh(mesh, type); //let facilityInfo = this.createFacilityInfoFromMesh(facilityData, mesh, buildingInfo); + console.log("获取到设备" + type, mesh); + + if (!this.isRepeatFacilityFromMesh(type, mesh.id)) //不重复 + { + this.createNewFacility(facilityData, mesh); + } + - this.createNewFacility(facilityData, mesh); } @@ -330,7 +336,7 @@ export class FacilityWindow extends UIBase { let currentBuidngItem = StatusManager.getStatus(BuildingStatus) .buildingWindow.currentBuidngItem; if (currentBuidngItem == null) { - // alert("请先选中目标建筑"); + alert("请先选中目标建筑"); // ThreeDimensionalHomeComponent.instance.openSnackBar("请先选中目标建筑"); return } @@ -412,8 +418,16 @@ export class FacilityWindow extends UIBase { } - let defaultMesh = MeshBuilder.CreateBox(facilityData.key, { size: 1 }); - defaultMesh.isVisible = false; + let defaultMesh: AbstractMesh = null; + + if (mesh == null) { + defaultMesh = MeshBuilder.CreateBox(facilityData.key, { size: 1 }); + defaultMesh.isVisible = false; + } + else { + defaultMesh = mesh; + } + let facilityInfo = InfoManager.newModelInfo_facility( facilityData.key, facilityData, @@ -433,7 +447,7 @@ export class FacilityWindow extends UIBase { facilityInfo.belongToBuilding = buildingInfo; - if (facilityInfo.facilityShowType == FacilityShowType.ModelAndTag) { + if (facilityInfo.facilityShowType == FacilityShowType.ModelAndTag && mesh == null) { this.getFacilityPrefabSync(facilityData.resName).then((mesh) => { let prefab = mesh; @@ -480,7 +494,7 @@ export class FacilityWindow extends UIBase { } //设置设备transform信息 - setFacilityTransform(isLocalPos: boolean, isNew: boolean, facilityData: ModelData_facility, buildingInfo: BuildingInfo, newFacility: Mesh, facilityInfo?: ModelInfo_facility) { + setFacilityTransform(isLocalPos: boolean, isNew: boolean, facilityData: ModelData_facility, buildingInfo: BuildingInfo, newFacility: AbstractMesh, facilityInfo?: ModelInfo_facility) { //如果是局部坐标,要先设置父节点 if (isLocalPos) { buildingInfo.ModelInfo.setFacilityParent(facilityInfo); @@ -546,7 +560,7 @@ export class FacilityWindow extends UIBase { * 从模型中创建消防设备信息 * @param mesh */ - createFacilityByMesh(mesh: AbstractMesh, buildingInfo: BuildingInfo) { + createFacilityByMesh(mesh: AbstractMesh) { if (TsTool.stringContain(mesh.name, FacilityType.XF_MHQ_GF_4)) { this.createNewFacilityByMesh(mesh, FacilityType.XF_MHQ_GF_4); @@ -555,43 +569,40 @@ export class FacilityWindow extends UIBase { this.createNewFacilityByMesh(mesh, FacilityType.XF_MHQ_GF_8); } else if (TsTool.stringContain(mesh.name, FacilityType.XF_MHQ_GF_35)) { - + this.createNewFacilityByMesh(mesh, FacilityType.XF_MHQ_GF_35); } else if (TsTool.stringContain(mesh.name, FacilityType.XF_MHQ_PT_4)) { - + this.createNewFacilityByMesh(mesh, FacilityType.XF_MHQ_PT_4); } else if (TsTool.stringContain(mesh.name, FacilityType.XF_MHQ_PT_8)) { - + this.createNewFacilityByMesh(mesh, FacilityType.XF_MHQ_PT_8); } else if (TsTool.stringContain(mesh.name, FacilityType.XF_MHQ_PT_35)) { - + this.createNewFacilityByMesh(mesh, FacilityType.XF_MHQ_PT_35); } else if (TsTool.stringContain(mesh.name, FacilityType.XF_MHT)) { - + this.createNewFacilityByMesh(mesh, FacilityType.XF_MHT); } else if (TsTool.stringContain(mesh.name, FacilityType.XF_SSD)) { - + this.createNewFacilityByMesh(mesh, FacilityType.XF_SSD); } else if (TsTool.stringContain(mesh.name, FacilityType.XF_TSLX)) { - + this.createNewFacilityByMesh(mesh, FacilityType.XF_TSLX); } else if (TsTool.stringContain(mesh.name, FacilityType.XF_XFCM)) { - + this.createNewFacilityByMesh(mesh, FacilityType.XF_XFCM); } else if (TsTool.stringContain(mesh.name, FacilityType.XF_XFF)) { - + this.createNewFacilityByMesh(mesh, FacilityType.XF_XFF); } else if (TsTool.stringContain(mesh.name, FacilityType.XF_XFQ)) { - + this.createNewFacilityByMesh(mesh, FacilityType.XF_XFQ); } else if (TsTool.stringContain(mesh.name, FacilityType.XF_XFS)) { - + this.createNewFacilityByMesh(mesh, FacilityType.XF_XFS); } else if (TsTool.stringContain(mesh.name, FacilityType.XF_XFT)) { - - } - else if (TsTool.stringContain(mesh.name, FacilityType.ZD_YG)) { - + this.createNewFacilityByMesh(mesh, FacilityType.XF_XFT); } } @@ -599,22 +610,48 @@ export class FacilityWindow extends UIBase { * 从模型中创建加油站相关信息 * @param mesh */ - createOilingByMesh(mesh: AbstractMesh, buildingInfo: BuildingInfo) { + createOilingByMesh(mesh: AbstractMesh) { + if (TsTool.stringContain(mesh.name, FacilityType.JY_JYJ)) { + this.createNewFacilityByMesh(mesh, FacilityType.JY_JYJ); + } + else if (TsTool.stringContain(mesh.name, FacilityType.JY_SYGX)) { + this.createNewFacilityByMesh(mesh, FacilityType.JY_SYGX); + } + else if (TsTool.stringContain(mesh.name, FacilityType.JY_YG)) { + this.createNewFacilityByMesh(mesh, FacilityType.JY_YG); + } + else if (TsTool.stringContain(mesh.name, FacilityType.JY_YQHSGX)) { + this.createNewFacilityByMesh(mesh, FacilityType.JY_YQHSGX); + } } /** * 从模型创建阻挡物信息 * @param mesh */ - createStopByMesh(mesh: AbstractMesh, buildingInfo: BuildingInfo) { - + createStopByMesh(mesh: AbstractMesh) { + if (TsTool.stringContain(mesh.name, FacilityType.ZD_YG)) { + this.createNewFacilityByMesh(mesh, FacilityType.ZD_YG); + } + else if (TsTool.stringContain(mesh.name, FacilityType.ZD_SYGX)) { + this.createNewFacilityByMesh(mesh, FacilityType.ZD_SYGX); + } + else if (TsTool.stringContain(mesh.name, FacilityType.ZD_YQHSGX)) { + this.createNewFacilityByMesh(mesh, FacilityType.ZD_SYGX); + } + else if (TsTool.stringContain(mesh.name, FacilityType.ZD_XF)) { + this.createNewFacilityByMesh(mesh, FacilityType.ZD_XF); + } + else if (TsTool.stringContain(mesh.name, FacilityType.ZD_ZP)) { + this.createNewFacilityByMesh(mesh, FacilityType.ZD_ZP); + } } 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); + let result = new ModelData_facility(mesh.name, type, name, mesh.id, new TransformData(), FacilityPosType.In); return result; } @@ -636,6 +673,41 @@ export class FacilityWindow extends UIBase { return facilityInfo; } + /** + * 来自建筑中的设备 是否重复 + */ + isRepeatFacilityFromMesh(type: FacilityType, id: string) { + let currentBuidngItem = StatusManager.getStatus(BuildingStatus) + .buildingWindow.currentBuidngItem; + if (currentBuidngItem == null) { + alert("请先选中目标建筑"); + // ThreeDimensionalHomeComponent.instance.openSnackBar("请先选中目标建筑"); + return true; + } + let result = false; + + let facilityInfoByTypes = currentBuidngItem.buildingInfo.ModelInfo.facilityInfos; + if (facilityInfoByTypes != null) { + for (let i = 0; i < facilityInfoByTypes.length; i++) { + if (facilityInfoByTypes[i].type == type) { + let infos = facilityInfoByTypes[i].facilityInfo; + for (let j = 0; j < infos.length; j++) { + if (infos[j].modelData.resName == id) { + result = true; + console.log("重复的设备,不添加"); + break; + } + } + } + } + } + + + return result; + + + } + //#endregion } diff --git a/src/app/babylon/view/toolbar-window/toobar-window.ts b/src/app/babylon/view/toolbar-window/toobar-window.ts index 0f25a4b..19987bb 100644 --- a/src/app/babylon/view/toolbar-window/toobar-window.ts +++ b/src/app/babylon/view/toolbar-window/toobar-window.ts @@ -110,6 +110,14 @@ export class ToolbarWindow extends UIBase { BuildingWindow.instance.getModelAndCreateFacilityData(); } + /** + * 展示罩棚 + * @param show false表示隐藏罩棚 + */ + showZP(show: boolean) { + BuildingWindow.instance.showZP(show); + } + onInit() { super.onInit(); diff --git a/src/app/pages/left-domain/left-domain.component.html b/src/app/pages/left-domain/left-domain.component.html new file mode 100644 index 0000000..037c440 --- /dev/null +++ b/src/app/pages/left-domain/left-domain.component.html @@ -0,0 +1,12 @@ +
+ +
+ +
+ +
+ + +
+ +
diff --git a/src/app/pages/left-domain/left-domain.component.scss b/src/app/pages/left-domain/left-domain.component.scss new file mode 100644 index 0000000..6f18b6c --- /dev/null +++ b/src/app/pages/left-domain/left-domain.component.scss @@ -0,0 +1,34 @@ +.childContent{ + width: 100%; + height: 100%; + overflow: hidden; + display: flex; + flex-direction: column; + font-family: Source Han Sans CN; + color: #fff; + .childCenter{ + flex: 1; + overflow-x: hidden; + overflow-y: auto; + } + .childBottom{ + width: 100%; + height: 50px; + line-height: 50px; + text-align: center; + background: linear-gradient(360deg, #000D21 0%, #003B6E 100%); + box-shadow: 0px -2px 6px #36A2FF; + button{ + width: 35%; + height: 32px; + line-height: 32px; + padding: 0; + margin: 0 10px; + color: #91CCFF; + background: rgba(0, 129, 255, 0.61); + border: 1px solid #36A2FF; + cursor: pointer; + .anticon{ margin-right: 3px; } //字体图标 + } + } +} \ 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 new file mode 100644 index 0000000..a2e06bc --- /dev/null +++ b/src/app/pages/left-domain/left-domain.component.ts @@ -0,0 +1,40 @@ +import { Component, OnInit } from '@angular/core'; +import { PlanComponent } from '../plan/plan.component'; + +@Component({ + selector: 'app-left-domain', + templateUrl: './left-domain.component.html', + styleUrls: ['./left-domain.component.scss'] +}) +export class LeftDomainComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + this.initComponent() + } + + beforeFence: number; //当前选中功能栏 + + //初始化组件 + initComponent(type?: number) { + if (type != undefined && type != null) { + this.beforeFence = type + } else { + this.beforeFence = PlanComponent.instance.selectFence + } + } + + //编辑信息 + editInfo() { + + } + + //导出Excel + deriveExcel() { + + } + + + +} diff --git a/src/app/pages/pages.module.ts b/src/app/pages/pages.module.ts index e624f71..9068a3d 100644 --- a/src/app/pages/pages.module.ts +++ b/src/app/pages/pages.module.ts @@ -1,6 +1,6 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; -import { A11yModule } from '@angular/cdk/a11y'; +import { A11yModule } from '@angular/cdk/a11y'; import { DragDropModule } from '@angular/cdk/drag-drop'; import { PortalModule } from '@angular/cdk/portal'; import { ScrollingModule } from '@angular/cdk/scrolling'; @@ -33,8 +33,9 @@ import { TodayWarningAdminComponent } from './today-warning-admin/today-warning- import { CriminalRecordsAdminComponent } from './criminal-records-admin/criminal-records-admin.component'; import { EquipmentInfoComponent } from './equipment-info/equipment-info.component'; import { OilStationInfoComponent } from './oil-station-info/oil-station-info.component'; +import { LeftDomainComponent } from './left-domain/left-domain.component'; @NgModule({ - declarations: [LoginComponent, RegisterComponent, HomeComponent, PlanComponent, TodayWarningComponent, CriminalRecordsComponent, TodayWarningAdminComponent, CriminalRecordsAdminComponent, EquipmentInfoComponent, OilStationInfoComponent,], + declarations: [LoginComponent, RegisterComponent, HomeComponent, PlanComponent, TodayWarningComponent, CriminalRecordsComponent, TodayWarningAdminComponent, CriminalRecordsAdminComponent, LeftDomainComponent, EquipmentInfoComponent, OilStationInfoComponent], imports: [ PagesRoutingModule, CommonModule, diff --git a/src/app/pages/plan/plan.component.html b/src/app/pages/plan/plan.component.html index a79ab12..d626cd2 100644 --- a/src/app/pages/plan/plan.component.html +++ b/src/app/pages/plan/plan.component.html @@ -1,85 +1,110 @@
- - -
-
-
-
-

- -
-
-
- - -
+
+ +
+ + + + +
- - -
-
-
-
- -

{{item.getIconName()}}

+
+ + + +
+
+
+

{{allFence[selectFence]}}

+
+
-
-
- + - -
-
- - + +
+
+
+
+

+ +
+
+
+ + +
+
-
- - - - - + + + +
+
+
+
+ +

{{item.getIconName()}}

+
+
+
-
+ + + +
+
+ + +
+
+ + + + + +
+
+
+ + + + +
+ + 名称 + + + + + + 请选择模型类型 + + + + + + + + + 上传文件 + + 上传文件 +

选择文件:

+
+
+
+
+
- - - - -
- - 名称 - - - - - - 请选择模型类型 - - - - - - - - - 上传文件 - - 上传文件 -

选择文件:

-
-
-
-
-
\ No newline at end of file diff --git a/src/app/pages/plan/plan.component.scss b/src/app/pages/plan/plan.component.scss index b3eca9e..c98eb3c 100644 --- a/src/app/pages/plan/plan.component.scss +++ b/src/app/pages/plan/plan.component.scss @@ -2,7 +2,10 @@ width: 100%; height: 100%; overflow: hidden; - position: relative; + padding: 0px 10px 10px 10px; + display: flex; + flex-direction: column; + .center { flex: 1; overflow: hidden; position: relative; border: 1px solid #2399FF; box-shadow: 0px 0px 16px #2399FF; } canvas{ width: 100%; height: 100%; border: none; outline: none; } } .loading{ //loading @@ -25,6 +28,93 @@ white-space: nowrap; } +//头部 功能栏 +.header{ + width: 100%; + height: 50px; + text-align: center; + overflow: hidden; + position: relative; + button { + box-sizing: border-box; + width: 120px; + height: 36px; + line-height: 36px; + color: #fff; + border: 1px solid #23D9FF; + outline: none; + background: linear-gradient(180deg, #000D21 0%, #002751 42%, #57A9FF 100%); + border-radius: 0px; + cursor: pointer; + margin: 7px 10px 0px; + padding: 0; + } + .selectFence { background: linear-gradient(180deg, #000D21 0%, #00404D 49%, #23D9FF 100%); } //选种样式 + .rightFence{ + position: absolute; + top: 0px; + right: 0px; + width: 200px; + height: 50px; + line-height: 50px; + img { cursor: pointer; box-sizing: border-box; width: 36px; height: 36px; margin-left: 10px; } + } + .selectRightTopFast { border: 1px solid #fff; } //选种样式 +} + +//左侧子组件 +.leftChildComponent{ + width: 300px; + height: 90%; + position: absolute; + left: 3%; + top: 0; + bottom: 0; + margin: auto;/*这行代码是关键*/ + z-index: 10; + color: #fff; + transition: left 0.5s; + background: linear-gradient(360deg, #000D21 0%, rgba(0, 59, 110, 0.8) 100%); + display: flex; + flex-direction: column; + .leftChildHeader{ + display: flex; + width: 95%; + height: 30px; + line-height: 30px; + margin: 15px auto; + background: linear-gradient(270deg, rgba(35, 153, 255, 0) 0%, rgba(35, 153, 255, 0.8) 50%, rgba(35, 153, 255, 0) 100%); + div:first-child{ + width: 30px; + height: 30px; + border: 1px solid #2399FF; + box-shadow: 0px 2px 8px #2399FF; + border-radius: 50%; + text-align: center; + } + div:nth-child(2){ + box-sizing: border-box; + margin: 0 10px; + font-weight: 900; + font-size: 16px; + letter-spacing: 3px; + font-style: italic; + flex: 1; + } + div:last-child{ + width: 30px; + height: 30px; + text-align: center; + cursor: pointer; + .anticon{ color: #91CCFF; } //字体图标 + } + } + .leftChildCenter{ + flex: 1; + overflow: hidden; + } +} + //左侧建筑 .showLeftBuilding{ width: 30px; @@ -32,7 +122,7 @@ line-height: 30px; text-align: center; position: absolute; - left: 1px; + left: 0px; top: 50%; margin-top: -15px; color: #48A5FF; @@ -43,7 +133,7 @@ width: 230px; height: 70%; position: absolute; - left: 1px; + left: 0px; top: 0; bottom: 0; margin: auto;/*这行代码是关键*/ @@ -53,7 +143,7 @@ transition: margin-left 0.5s; display: flex; flex-direction: column; - .hideLeft { text-align: right; color: #fff; padding: 3px 5px; z-index: 10; } + .hideLeft { text-align: right; color: #fff; padding: 3px 5px; z-index: 1; } .leftHeader { overflow: hidden; text-align: center; @@ -94,7 +184,7 @@ position: absolute; left: 0; right: 0; - bottom: 1px; + bottom: 0px; margin: auto;/*这行代码是关键*/ color: #fff; background: rgba(0,17,33,0.7); diff --git a/src/app/pages/plan/plan.component.ts b/src/app/pages/plan/plan.component.ts index d84cc07..4c1043f 100644 --- a/src/app/pages/plan/plan.component.ts +++ b/src/app/pages/plan/plan.component.ts @@ -1,4 +1,4 @@ -import { Component, ElementRef, OnInit } from '@angular/core'; +import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; import { Game } from 'src/app/babylon/game'; import { LoginSatus } from 'src/app/babylon/controller/status/login-status'; import { StatusManager } from 'src/app/babylon/controller/status/status-manager'; @@ -11,12 +11,13 @@ import { ToolbarWindow } from 'src/app/babylon/view/toolbar-window/toobar-window import { BuildingStatus } from 'src/app/babylon/controller/status/building-status'; 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 { BuildingWindow, JYZInfoMoudleType } 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'; import { FacilityInfoUIItem } from 'src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item'; import { EventManager } from '@angular/platform-browser'; import { NzMessageService } from 'ng-zorro-antd/message'; +import { LeftDomainComponent } from '../left-domain/left-domain.component'; @@ -64,9 +65,12 @@ export class PlanComponent implements OnInit { this.beforeOneSatus = StatusManager.getStatus(LoginSatus); this.beforeOneSatus.onSelectInsSuccess(find) } else { //如果没有找到对应的单位key,则调用新建单位 - let name = 'ceshi'; - console.log("没找到单位,新建" + key); - loginStatus.createInsitution(key, name); + let isAdd = confirm('没有单位name,是否进行初始化?') + if (isAdd) { + let name = 'ceshi'; + console.log("没找到单位,新建" + key); + loginStatus.createInsitution(key, name); + } } } else { let find = data.find(item => { return item.key === ModeManager.institutionDemoKey }) @@ -87,7 +91,73 @@ export class PlanComponent implements OnInit { } //开发模式 选择单位 弹窗 - modelInit(InsList) { } + modelInit(InsList) { } + + allFence: string[] = ["基本信息", "加油机", "油罐设备", "消防设施", "安全疏散", "输油管线", "油气回收", "应急处置"]; //头部 功能栏 + selectFence: number = -1; //选中 头部功能栏 + isShowChildComponent: boolean = false; //是否 显示左侧子组件 + @ViewChild('leftDomain')leftDomain: LeftDomainComponent; //子组件引用 + isOpenAwning: boolean = true; //是否 打开罩棚 + selectMeasure: number = 0; //当前选择 测量工具 + + //切换 头部功能栏 + toggleHeaderFence(type: number) { + this.beforeOneSatus = StatusManager.getStatus(BuildingStatus); + let buildingWindow: BuildingWindow = this.beforeOneSatus.buildingWindow; + let fenceType: JYZInfoMoudleType = this.getFenceType(type) + if (this.selectFence != type) { + this.isShowChildComponent && this.leftDomain? this.leftDomain.initComponent(type) : null; //手动初始化子组件 + this.selectFence = type + this.isShowChildComponent = true + type>0 && type<7? buildingWindow.showJYZInfoModel(fenceType, true) : null + } else { //取消选中 + this.selectFence = -1 + this.isShowChildComponent = false + type>0 && type<7? buildingWindow.showJYZInfoModel(fenceType, false) : null + } + } + + //获取 头部功能栏Type + getFenceType(type: number): JYZInfoMoudleType { + let fenceType + if (type === 1) { + fenceType = JYZInfoMoudleType.JYJ + } else if (type === 2) { + fenceType = JYZInfoMoudleType.YG + } else if (type === 3) { + fenceType = JYZInfoMoudleType.XF + } else if (type === 4) { + fenceType = JYZInfoMoudleType.TSLX + } else if (type === 5) { + fenceType = JYZInfoMoudleType.SYG + } else if (type === 6) { + fenceType = JYZInfoMoudleType.YQHSGX + } + return fenceType + } + + //切换 头部罩棚 + toggleHeaderAwning(isOpen: boolean) { + this.isOpenAwning = isOpen + ToolbarWindow.instance.showZP(isOpen) + } + + //切换 测量工具 + toggleMeasure(type: number) { + if (this.selectMeasure != type) { //切换工具 + this.selectMeasure = type + if (type === 1) { + ToolbarWindow.instance.measureDistance() + } else if (type === 2) { + ToolbarWindow.instance.measureHeight() + } else { + ToolbarWindow.instance.measureArea() + } + } else { //关闭测量工具 + this.selectMeasure = 0 + ToolbarWindow.instance.endMeasure() + } + } buildingUIItems: BuildingUIItem[] = []; //左侧 建筑list beforeOneBuildingID: string = null; //选中 左侧建筑ID @@ -96,7 +166,7 @@ export class PlanComponent implements OnInit { editBuildingPop: BuildingUIItem = null; //显隐 编辑左侧建筑弹窗 isShowLeftBuilding: boolean = true; //显隐 建筑list toggleLeftBuilding(e) { this.isShowLeftBuilding = e }; //显隐 建筑list - + uploadList: File[] = []; //多选上传文件 //选择文件 selectFile(e) { @@ -214,7 +284,7 @@ export class PlanComponent implements OnInit { clearDevice() { let isClear = confirm('您确定要清空吗?') if (isClear) { - ToolbarWindow.instance.clearHomeLessFacilityData() + ToolbarWindow.instance.clearAllFacilityDataFromMesh() } } diff --git a/src/app/service/babylon/building-basic-infos.service.ts b/src/app/service/babylon/building-basic-infos.service.ts index 4cb08fc..8245839 100644 --- a/src/app/service/babylon/building-basic-infos.service.ts +++ b/src/app/service/babylon/building-basic-infos.service.ts @@ -8,42 +8,35 @@ import { catchError, retry } from 'rxjs/operators'; }) export class BuildingBasicInfosService { - readonly c_get = "/Get"; - readonly c_post = "/PostOrPut"; + constructor( + private http: HttpClient + ) { } - //获取单位信息的api - baseUrl = 'api/Services/3D/BuildingBasicInfo'; /** - * 事态标绘(电子沙盘)的api + * 单位信息的api [获取/保存] */ - markUrl = "api/Services/3D/Sandboxie"; + readonly api_buildingInfo = 'api/Services/3D/BuildingBasicInfo'; + /** + * 事态标绘(电子沙盘)的api [获取/保存] + */ + readonly api_sandBox = "api/Services/3D/Sandboxie"; - constructor( - private http: HttpClient - ) { } /** * 获取三维信息 */ getBuildingBasicInfos(name: string): Observable { - return this.http.get(this.baseUrl + this.c_get + '?name=' + name); + return this.getInfos(this.api_buildingInfo, name); } /** * 保存三维信息 * @param name * @param data */ - postBuildingBasicInfos(name: string, data: any): Observable { - let params = { - name: name, - content: JSON.stringify(data), - } - return this.http.post(this.baseUrl + this.c_post, {}, { params }) - .pipe( - catchError((err) => this.handleError(err)) - ); + postBuildingBasicInfos(name: string, data: object): Observable { + return this.postInfos(this.api_buildingInfo, name, data); } /** @@ -51,29 +44,69 @@ export class BuildingBasicInfosService { * @param name */ getMarkData(name: string): Observable { - // name = "bb"; + return this.getInfos(this.api_sandBox, name); + } + + /** + * 推送事态标绘的信息 + * @param name + * @param data + */ + postMarkData(name: string, data: object): Observable { + return this.postInfos(this.api_sandBox, name, data); + } + + + //#region 通用封装,新增api时调用即可,不需关心具体组装规则。若修改规则,只需修改此通用封装 + /** + * get类api所需的固定内容 + */ + readonly c_get = "/Get"; + /** + * post类api所需的固定内容 + */ + readonly c_post = "/PostOrPut"; + + /** + * 通用消息头 + */ + readonly headers = { + "Content-Type": "application/json" + }; + /** + * 通用get 类api的封装 + * @param api + * @param name + */ + getInfos(api: string, name: string) { let id = { "name": name }; - return this.http.get(this.markUrl + this.c_get, { params: id }).pipe( //'?name=' + + return this.http.get(api + this.c_get, { params: id }).pipe( catchError((err) => this.handleError(err)) ); } /** - * 推送事态标绘的信息 + * 通用post 类api的封装 + * @param api * @param name * @param data */ - postMarkData(name: string, data: any): Observable { + postInfos(api: string, name: string, data: object) { let params = { name: name, - content: JSON.stringify(data), - } - return this.http.post(this.markUrl + this.c_post, {}, { params }) + }; + + let headers = this.headers; + + return this.http.post(api + this.c_post, `'${JSON.stringify(data)}'`, { headers, params }) .pipe( catchError((err) => this.handleError(err)) ); } + //#endregion + //#region 错误捕捉 private handleError(error: HttpErrorResponse) { if (error.error instanceof ErrorEvent) { @@ -96,11 +129,5 @@ export class BuildingBasicInfosService { return throwError( error); } + //#endregion } - -/** - * 服务器返回的结果 - */ -class HttpResult { - -} \ No newline at end of file diff --git a/src/app/service/objects.service.ts b/src/app/service/objects.service.ts index af4280a..c983d62 100644 --- a/src/app/service/objects.service.ts +++ b/src/app/service/objects.service.ts @@ -27,7 +27,7 @@ enum EnvironmentType { export class ObjectsService { static readonly c_apiRoot = "/api/Objects/";//普通上传的API根路径 - static apiRoot_Multipart = "/api/";//分块上传的API根路径 + static readonly c_apiRoot_Multipart = "/api/";//分块上传的API根路径 /** * 当前所处环境(打包前根据需要设置) @@ -88,7 +88,7 @@ export class ObjectsService { // return this.http.post(ObjectsService.baseUrl + extensionPath, formData); let data = { keepOriginalName: 'true', filename: file.name } return new Promise((resolve, reject) => { - this.http.post(ObjectsService.apiRoot_Multipart + "NewMultipartUpload/" + this.getBucketName() + extensionPath, {}, { params: data }).subscribe(async (data: any) => { //初始化分段上传 + this.http.post(ObjectsService.c_apiRoot_Multipart + "NewMultipartUpload/" + this.getBucketName() + extensionPath, {}, { params: data }).subscribe(async (data: any) => { //初始化分段上传 let instance = this; let objectName = data.objectName let uploadId = data.uploadId @@ -107,7 +107,7 @@ export class ObjectsService { //同步写法实现异步调用 let result = await new Promise((resolve, reject) => { // await 需要后面返回一个 promise 对象 - this.http.post(ObjectsService.apiRoot_Multipart + `MultipartUpload/${instance.getBucketName()}${objectName}?uploadId=${uploadId}&partNumber=${i + 1}`, formData).subscribe((data: any) => { + this.http.post(ObjectsService.c_apiRoot_Multipart + `MultipartUpload/${instance.getBucketName()}${objectName}?uploadId=${uploadId}&partNumber=${i + 1}`, formData).subscribe((data: any) => { let msg = { "partNumber": data.partNumber || null, "eTag": data.eTag || null } resolve(msg) // 调用 promise 内置方法处理成功 }) @@ -117,7 +117,7 @@ export class ObjectsService { if (PartNumberETag.length === allSlice) { //分块上传完成 let data = PartNumberETag let paramsData = { uploadId: uploadId }; - let path = ObjectsService.apiRoot_Multipart + `CompleteMultipartUpload/${instance.getBucketName()}` + objectName; + let path = ObjectsService.c_apiRoot_Multipart + `CompleteMultipartUpload/${instance.getBucketName()}` + objectName; this.http.post(path, data, { params: paramsData }).subscribe(data => { let objData: any = new Object(); objData.fileName = file.name; diff --git a/src/assets/images/awningHide.png b/src/assets/images/awningHide.png new file mode 100644 index 0000000..65eea6a Binary files /dev/null and b/src/assets/images/awningHide.png differ diff --git a/src/assets/images/awningShow.png b/src/assets/images/awningShow.png new file mode 100644 index 0000000..40771ce Binary files /dev/null and b/src/assets/images/awningShow.png differ diff --git a/src/assets/images/facility/in/XF_MHQ_GF_35.png b/src/assets/images/facility/in/XF_MHQ_GF_35.png new file mode 100644 index 0000000..60d38b0 Binary files /dev/null and b/src/assets/images/facility/in/XF_MHQ_GF_35.png differ diff --git a/src/assets/images/facility/in/XF_MHQ_GF_4.png b/src/assets/images/facility/in/XF_MHQ_GF_4.png new file mode 100644 index 0000000..c2811d5 Binary files /dev/null and b/src/assets/images/facility/in/XF_MHQ_GF_4.png differ diff --git a/src/assets/images/facility/in/XF_MHQ_GF_8.png b/src/assets/images/facility/in/XF_MHQ_GF_8.png new file mode 100644 index 0000000..b3e78e2 Binary files /dev/null and b/src/assets/images/facility/in/XF_MHQ_GF_8.png differ diff --git a/src/assets/images/facility/in/XF_MHQ_PT_35.png b/src/assets/images/facility/in/XF_MHQ_PT_35.png new file mode 100644 index 0000000..dfc59c9 Binary files /dev/null and b/src/assets/images/facility/in/XF_MHQ_PT_35.png differ diff --git a/src/assets/images/facility/in/XF_MHQ_PT_4.png b/src/assets/images/facility/in/XF_MHQ_PT_4.png new file mode 100644 index 0000000..128ada5 Binary files /dev/null and b/src/assets/images/facility/in/XF_MHQ_PT_4.png differ diff --git a/src/assets/images/facility/in/XF_MHQ_PT_8.png b/src/assets/images/facility/in/XF_MHQ_PT_8.png new file mode 100644 index 0000000..de94ddc Binary files /dev/null and b/src/assets/images/facility/in/XF_MHQ_PT_8.png differ diff --git a/src/assets/images/facility/in/XF_MHT.png b/src/assets/images/facility/in/XF_MHT.png new file mode 100644 index 0000000..dd6647a Binary files /dev/null and b/src/assets/images/facility/in/XF_MHT.png differ diff --git a/src/assets/images/facility/in/XF_TSLX.png b/src/assets/images/facility/in/XF_TSLX.png new file mode 100644 index 0000000..e1f0b59 Binary files /dev/null and b/src/assets/images/facility/in/XF_TSLX.png differ diff --git a/src/assets/images/facility/in/XF_XFCM.png b/src/assets/images/facility/in/XF_XFCM.png new file mode 100644 index 0000000..c253fe4 Binary files /dev/null and b/src/assets/images/facility/in/XF_XFCM.png differ diff --git a/src/assets/images/facility/in/XF_XFF.png b/src/assets/images/facility/in/XF_XFF.png new file mode 100644 index 0000000..37feb73 Binary files /dev/null and b/src/assets/images/facility/in/XF_XFF.png differ diff --git a/src/assets/images/facility/in/XF_XFQ.png b/src/assets/images/facility/in/XF_XFQ.png new file mode 100644 index 0000000..a15f56d Binary files /dev/null and b/src/assets/images/facility/in/XF_XFQ.png differ diff --git a/src/assets/images/facility/in/XF_XFS.png b/src/assets/images/facility/in/XF_XFS.png new file mode 100644 index 0000000..002638a Binary files /dev/null and b/src/assets/images/facility/in/XF_XFS.png differ diff --git a/src/assets/images/facility/in/XF_XFT.png b/src/assets/images/facility/in/XF_XFT.png new file mode 100644 index 0000000..0e38f1a Binary files /dev/null and b/src/assets/images/facility/in/XF_XFT.png differ diff --git a/src/assets/images/facility/in/XKS.png b/src/assets/images/facility/in/XKS.png new file mode 100644 index 0000000..9c27faa Binary files /dev/null and b/src/assets/images/facility/in/XKS.png differ diff --git a/src/assets/images/heightFinding.png b/src/assets/images/heightFinding.png new file mode 100644 index 0000000..d0c0a03 Binary files /dev/null and b/src/assets/images/heightFinding.png differ diff --git a/src/assets/images/measuredArea.png b/src/assets/images/measuredArea.png new file mode 100644 index 0000000..7c38e7b Binary files /dev/null and b/src/assets/images/measuredArea.png differ diff --git a/src/assets/images/rangeFinding.png b/src/assets/images/rangeFinding.png new file mode 100644 index 0000000..e4c79f6 Binary files /dev/null and b/src/assets/images/rangeFinding.png differ