邵佳豪 3 years ago
parent
commit
eaff514050
  1. 23
      src/app/babylon/controller/config-manager.ts
  2. 14
      src/app/babylon/controller/info-manager.ts
  3. 38
      src/app/babylon/controller/scene-manager.ts
  4. 6
      src/app/babylon/controller/serve-manager.ts
  5. 3
      src/app/babylon/controller/status/login-status.ts
  6. 45
      src/app/babylon/model/data/model-data/model-data-facility.ts
  7. 10
      src/app/babylon/model/data/model-data/model-data.ts
  8. 10
      src/app/babylon/model/info/model/model-info-building.ts
  9. 10
      src/app/babylon/model/info/model/model-info-facility.ts
  10. 49
      src/app/babylon/model/info/model/model-info.ts
  11. 6
      src/app/babylon/view/building-window/building-ui-item.ts
  12. 210
      src/app/babylon/view/building-window/building-window.ts
  13. 124
      src/app/babylon/view/facility-window/facility-window.ts
  14. 8
      src/app/babylon/view/toolbar-window/toobar-window.ts
  15. 12
      src/app/pages/left-domain/left-domain.component.html
  16. 34
      src/app/pages/left-domain/left-domain.component.scss
  17. 40
      src/app/pages/left-domain/left-domain.component.ts
  18. 5
      src/app/pages/pages.module.ts
  19. 167
      src/app/pages/plan/plan.component.html
  20. 100
      src/app/pages/plan/plan.component.scss
  21. 86
      src/app/pages/plan/plan.component.ts
  22. 93
      src/app/service/babylon/building-basic-infos.service.ts
  23. 8
      src/app/service/objects.service.ts
  24. BIN
      src/assets/images/awningHide.png
  25. BIN
      src/assets/images/awningShow.png
  26. BIN
      src/assets/images/facility/in/XF_MHQ_GF_35.png
  27. BIN
      src/assets/images/facility/in/XF_MHQ_GF_4.png
  28. BIN
      src/assets/images/facility/in/XF_MHQ_GF_8.png
  29. BIN
      src/assets/images/facility/in/XF_MHQ_PT_35.png
  30. BIN
      src/assets/images/facility/in/XF_MHQ_PT_4.png
  31. BIN
      src/assets/images/facility/in/XF_MHQ_PT_8.png
  32. BIN
      src/assets/images/facility/in/XF_MHT.png
  33. BIN
      src/assets/images/facility/in/XF_TSLX.png
  34. BIN
      src/assets/images/facility/in/XF_XFCM.png
  35. BIN
      src/assets/images/facility/in/XF_XFF.png
  36. BIN
      src/assets/images/facility/in/XF_XFQ.png
  37. BIN
      src/assets/images/facility/in/XF_XFS.png
  38. BIN
      src/assets/images/facility/in/XF_XFT.png
  39. BIN
      src/assets/images/facility/in/XKS.png
  40. BIN
      src/assets/images/heightFinding.png
  41. BIN
      src/assets/images/measuredArea.png
  42. BIN
      src/assets/images/rangeFinding.png

23
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

14
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

38
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();
}
}
}

6
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

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

45
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",
}

10
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的idmesh
*/
resName: string;
/**
* () 使 DataManager.getResPath进行构造
*/
resPath: string;
@Type(() => TransformData)
transformData: TransformData; //变换信息
version: number = 1;//版本号

10
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);
}

10
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);
}
}

49
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() {

6
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);
}
/**

210
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<JYZInfoMoudleType, FacilityInfoByType[]> = new Map();
/**
*
*/
zdByMoudle: Map<JYZInfoMoudleType, FacilityInfoByType[]> = 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",
}

124
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>(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>(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
}

8
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();

12
src/app/pages/left-domain/left-domain.component.html

@ -0,0 +1,12 @@
<div class="childContent">
<div class="childCenter">
</div>
<div class="childBottom" *ngIf="beforeFence === 0">
<button (click)="editInfo()"><i nz-icon nzType="edit" nzTheme="outline"></i>编辑信息</button>
<button (click)="deriveExcel()"><i nz-icon nzType="file-excel" nzTheme="outline"></i>导出Excel</button>
</div>
</div>

34
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; } //字体图标
}
}
}

40
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() {
}
}

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

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

@ -1,85 +1,110 @@
<div class="loading" *ngIf="isShowLoading"><nz-spin nzSimple [nzSize]="'large'"></nz-spin></div>
<div class="content">
<canvas id="center"></canvas>
<!-- 左侧建筑栏 -->
<div class="showLeftBuilding" title="显示" *ngIf="!isShowLeftBuilding" (click)="toggleLeftBuilding(true)"><i nz-icon nzType="right" nzTheme="outline"></i></div>
<div class="leftBuilding" [ngClass]="{'isShowLeftBuilding': isShowLeftBuilding === false}">
<div class="hideLeft"><i nz-icon nzType="close" nzTheme="outline" title="隐藏" (click)="toggleLeftBuilding(false)"></i></div>
<div class="leftHeader">
<h1><label>模型列表</label></h1>
<button nz-button nzType="primary" (click)="addBuildingPop = true">新建</button>
</div>
<div class="leftCenter">
<div class="everyBuilding" *ngFor="let item of buildingUIItems" (click)='selectLeftBuilding(item)' [ngClass]="{'selectLeftBuilding': beforeOneBuildingID == item.getBuildingID()}">
<label style="flex: 1;" class="overflowText modelTitle">{{item.getBuildingName()}}</label>
<label style="width: 65px; overflow: hidden;">
<i nz-icon nzType="plus-circle" nzTheme="outline" title="聚焦" (click)="positionModelBuilding($event,item)"></i>
<i nz-icon nzType="edit" nzTheme="outline" title="编辑" (click)="editModelBuilding($event,item)" style="margin: 0 5px;"></i>
<i nz-icon nzType="delete" nzTheme="outline" title="删除" (click)="deleteModelBuilding($event,item)"></i>
</label>
</div>
<div class="header">
<button *ngFor="let item of allFence; let key = index;" [ngClass]="{'selectFence': selectFence === key}" (click)="toggleHeaderFence(key)">{{item}}</button>
<div class="rightFence">
<img src="../../../assets/images/awningShow.png" [hidden]="!isOpenAwning" (click)="toggleHeaderAwning(false)">
<img src="../../../assets/images/awningHide.png" [hidden]="isOpenAwning" (click)="toggleHeaderAwning(true)">
<img src="../../../assets/images/rangeFinding.png" title="测量距离" (click)="toggleMeasure(1)" [ngClass]="{'selectRightTopFast': selectMeasure == 1}">
<img src="../../../assets/images/heightFinding.png" title="测量高度" (click)="toggleMeasure(2)" [ngClass]="{'selectRightTopFast': selectMeasure == 2}">
<img src="../../../assets/images/measuredArea.png" title="测量面积" (click)="toggleMeasure(3)" [ngClass]="{'selectRightTopFast': selectMeasure == 3}">
</div>
</div>
<!-- 左侧建筑栏 -->
<!-- 底部图标栏 -->
<div class="bottomIcons">
<div class="autoScroll"><i nz-icon nzType="left" nzTheme="outline" (click)="bottomScroll(0)"></i></div>
<div class="bottomCenter" id="bottomCenter">
<div class="everyIcon" (click)='selectBottomIcon(item)' *ngFor="let item of allFacilityUIItemes" [ngClass]="{'selectLeftIcon': beforeOneIcon == item.getIconID()}">
<img [src]="item.getIconURL()">
<p>{{item.getIconName()}}</p>
<div class="center">
<canvas id="center"></canvas>
<!-- 左侧子组件 -->
<div class="leftChildComponent" *ngIf="isShowChildComponent" [ngStyle]="{ 'left': isShowLeftBuilding? '15%' : null }">
<div class="leftChildHeader">
<div><i nz-icon nzType="star" nzTheme="outline"></i></div>
<div><p>{{allFence[selectFence]}}</p></div>
<div (click)="toggleHeaderFence(selectFence)" title="关闭"><i nz-icon nzType="close-circle" nzTheme="outline"></i></div>
</div>
<div class="leftChildCenter"><app-left-domain #leftDomain></app-left-domain></div>
</div>
<div class="autoScroll"><i nz-icon nzType="right" nzTheme="outline" (click)="bottomScroll(1)"></i></div>
</div>
<!-- 底部图标栏 -->
<!-- 左侧子组件 -->
<!-- 右上角快捷栏 -->
<div class="rightTopFast">
<div class="publicFast leftFunction">
<button title="获取设备" (click)="getDevice()"></button>
<button title="清空设备" (click)="clearDevice()"></button>
<!-- 左侧建筑栏 -->
<div class="showLeftBuilding" title="显示" *ngIf="!isShowLeftBuilding" (click)="toggleLeftBuilding(true)"><i nz-icon nzType="right" nzTheme="outline"></i></div>
<div class="leftBuilding" [ngClass]="{'isShowLeftBuilding': isShowLeftBuilding === false}">
<div class="hideLeft"><i nz-icon nzType="close" nzTheme="outline" title="隐藏" (click)="toggleLeftBuilding(false)"></i></div>
<div class="leftHeader">
<h1><label>模型列表</label></h1>
<button nz-button nzType="primary" (click)="addBuildingPop = true">新建</button>
</div>
<div class="leftCenter">
<div class="everyBuilding" *ngFor="let item of buildingUIItems" (click)='selectLeftBuilding(item)' [ngClass]="{'selectLeftBuilding': beforeOneBuildingID == item.getBuildingID()}">
<label style="flex: 1;" class="overflowText modelTitle">{{item.getBuildingName()}}</label>
<label style="width: 65px; overflow: hidden;">
<i nz-icon nzType="plus-circle" nzTheme="outline" title="聚焦" (click)="positionModelBuilding($event,item)"></i>
<i nz-icon nzType="edit" nzTheme="outline" title="编辑" (click)="editModelBuilding($event,item)" style="margin: 0 5px;"></i>
<i nz-icon nzType="delete" nzTheme="outline" title="删除" (click)="deleteModelBuilding($event,item)"></i>
</label>
</div>
</div>
</div>
<div class="publicFast leftFast">
<button title="平移" (click)="translation()" [ngClass]="{'selectRightTopFast': selectRightTopFast == 0}"></button>
<button title="旋转" (click)="revolve()" [ngClass]="{'selectRightTopFast': selectRightTopFast == 1}"></button>
<button title="缩放" (click)="scale()" [ngClass]="{'selectRightTopFast': selectRightTopFast == 2}"></button>
<button title="吸附" (click)="adsorb()" [ngClass]="{'leftFastIsTure': selectAdsorb }"></button>
<button title="切换至顶视图" (click)="toggleTopLevelView()" [ngClass]="{'leftFastIsTure': topLevelView }"></button>
<!-- 左侧建筑栏 -->
<!-- 底部图标栏 -->
<div class="bottomIcons">
<div class="autoScroll"><i nz-icon nzType="left" nzTheme="outline" (click)="bottomScroll(0)"></i></div>
<div class="bottomCenter" id="bottomCenter">
<div class="everyIcon" (click)='selectBottomIcon(item)' *ngFor="let item of allFacilityUIItemes" [ngClass]="{'selectLeftIcon': beforeOneIcon == item.getIconID()}">
<img [src]="item.getIconURL()">
<p>{{item.getIconName()}}</p>
</div>
</div>
<div class="autoScroll"><i nz-icon nzType="right" nzTheme="outline" (click)="bottomScroll(1)"></i></div>
</div>
<div style="margin: 0 10px;background-color: #0080FF;" title="保存"><button (click)="preserve()"><i nz-icon nzType="save" nzTheme="outline" style="font-size: 20px;"></i></button></div>
<!-- 底部图标栏 -->
<!-- 右上角快捷栏 -->
<div class="rightTopFast">
<div class="publicFast leftFunction">
<button title="获取设备" (click)="getDevice()"></button>
<button title="清空设备" (click)="clearDevice()"></button>
</div>
<div class="publicFast leftFast">
<button title="平移" (click)="translation()" [ngClass]="{'selectRightTopFast': selectRightTopFast == 0}"></button>
<button title="旋转" (click)="revolve()" [ngClass]="{'selectRightTopFast': selectRightTopFast == 1}"></button>
<button title="缩放" (click)="scale()" [ngClass]="{'selectRightTopFast': selectRightTopFast == 2}"></button>
<button title="吸附" (click)="adsorb()" [ngClass]="{'leftFastIsTure': selectAdsorb }"></button>
<button title="切换至顶视图" (click)="toggleTopLevelView()" [ngClass]="{'leftFastIsTure': topLevelView }"></button>
</div>
<div style="margin: 0 10px;background-color: #0080FF;" title="保存"><button (click)="preserve()"><i nz-icon nzType="save" nzTheme="outline" style="font-size: 20px;"></i></button></div>
</div>
<!-- 右上角快捷栏 -->
<!-- 新增/编辑左侧建筑弹窗 -->
<nz-modal [(nzVisible)]="addBuildingPop || editBuildingPop" nzTitle="创建/编辑建筑" (nzOnCancel)="addBuildingPop = false; editBuildingPop = null;" (nzOnOk)="addModelBuilding(form.value)" [nzOkDisabled]='name.invalid||modelType.invalid'>
<form nz-form #form='ngForm'>
<nz-form-item>
<nz-form-label [nzSpan]="6">名称</nz-form-label>
<nz-form-control [nzSpan]="18" nzErrorTip="请输入必填项">
<input nz-input #name='ngModel' [(ngModel)]="modelBuilding.name" name="name" required/>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6">请选择模型类型</nz-form-label>
<nz-form-control [nzSpan]="18" nzErrorTip="请选择必填项">
<nz-select #modelType='ngModel' [(ngModel)]="modelBuilding.modelType" name="modelType" required>
<nz-option nzValue="normal" nzLabel="建筑物"></nz-option>
<nz-option nzValue="environment" nzLabel="场景"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6">上传文件</nz-form-label>
<nz-form-control [nzSpan]="18" nzErrorTip="请上传文件">
<a href="javascript:;" class="uploadBackGround"><input type="file" (change)='selectFile($event)' multiple>上传文件<i nz-icon nzType="cloud-upload" nzTheme="outline"></i></a>
<p *ngIf="uploadList.length" style="font-size: 14px; text-align: left; max-height: 500px; overflow: hidden;">选择文件: <label *ngFor="let item of uploadList">{{item.name}}, </label></p>
</nz-form-control>
</nz-form-item>
</form>
</nz-modal>
<!-- 新增/编辑左侧建筑弹窗 -->
</div>
<!-- 右上角快捷栏 -->
<!-- 新增/编辑左侧建筑弹窗 -->
<nz-modal [(nzVisible)]="addBuildingPop || editBuildingPop" nzTitle="创建/编辑建筑" (nzOnCancel)="addBuildingPop = false; editBuildingPop = null;" (nzOnOk)="addModelBuilding(form.value)" [nzOkDisabled]='name.invalid||modelType.invalid'>
<form nz-form #form='ngForm'>
<nz-form-item>
<nz-form-label [nzSpan]="6">名称</nz-form-label>
<nz-form-control [nzSpan]="18" nzErrorTip="请输入必填项">
<input nz-input #name='ngModel' [(ngModel)]="modelBuilding.name" name="name" required/>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6">请选择模型类型</nz-form-label>
<nz-form-control [nzSpan]="18" nzErrorTip="请选择必填项">
<nz-select #modelType='ngModel' [(ngModel)]="modelBuilding.modelType" name="modelType" required>
<nz-option nzValue="normal" nzLabel="建筑物"></nz-option>
<nz-option nzValue="environment" nzLabel="场景"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6">上传文件</nz-form-label>
<nz-form-control [nzSpan]="18" nzErrorTip="请上传文件">
<a href="javascript:;" class="uploadBackGround"><input type="file" (change)='selectFile($event)' multiple>上传文件<i nz-icon nzType="cloud-upload" nzTheme="outline"></i></a>
<p *ngIf="uploadList.length" style="font-size: 14px; text-align: left; max-height: 500px; overflow: hidden;">选择文件: <label *ngFor="let item of uploadList">{{item.name}}, </label></p>
</nz-form-control>
</nz-form-item>
</form>
</nz-modal>
<!-- 新增/编辑左侧建筑弹窗 -->
</div>

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

86
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>(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>(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()
}
}

93
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<string> {
return this.http.get<string>(this.baseUrl + this.c_get + '?name=' + name);
return this.getInfos(this.api_buildingInfo, name);
}
/**
*
* @param name
* @param data
*/
postBuildingBasicInfos(name: string, data: any): Observable<any> {
let params = {
name: name,
content: JSON.stringify(data),
}
return this.http.post<any>(this.baseUrl + this.c_post, {}, { params })
.pipe(
catchError((err) => this.handleError(err))
);
postBuildingBasicInfos(name: string, data: object): Observable<any> {
return this.postInfos(this.api_buildingInfo, name, data);
}
/**
@ -51,29 +44,69 @@ export class BuildingBasicInfosService {
* @param name
*/
getMarkData(name: string): Observable<string> {
// name = "bb";
return this.getInfos(this.api_sandBox, name);
}
/**
*
* @param name
* @param data
*/
postMarkData(name: string, data: object): Observable<any> {
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<string>(this.markUrl + this.c_get, { params: id }).pipe( //'?name='
return this.http.get<string>(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<any> {
postInfos(api: string, name: string, data: object) {
let params = {
name: name,
content: JSON.stringify(data),
}
return this.http.post<any>(this.markUrl + this.c_post, {}, { params })
};
let headers = this.headers;
return this.http.post<any>(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 {
}

8
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;

BIN
src/assets/images/awningHide.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
src/assets/images/awningShow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
src/assets/images/facility/in/XF_MHQ_GF_35.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
src/assets/images/facility/in/XF_MHQ_GF_4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
src/assets/images/facility/in/XF_MHQ_GF_8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
src/assets/images/facility/in/XF_MHQ_PT_35.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
src/assets/images/facility/in/XF_MHQ_PT_4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
src/assets/images/facility/in/XF_MHQ_PT_8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
src/assets/images/facility/in/XF_MHT.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
src/assets/images/facility/in/XF_TSLX.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
src/assets/images/facility/in/XF_XFCM.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
src/assets/images/facility/in/XF_XFF.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
src/assets/images/facility/in/XF_XFQ.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
src/assets/images/facility/in/XF_XFS.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
src/assets/images/facility/in/XF_XFT.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
src/assets/images/facility/in/XKS.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
src/assets/images/heightFinding.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
src/assets/images/measuredArea.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
src/assets/images/rangeFinding.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Loading…
Cancel
Save