邵佳豪 3 years ago
parent
commit
91fc9e7e83
  1. 12
      src/app/babylon/controller/data-manager.ts
  2. 4
      src/app/babylon/controller/info-manager.ts
  3. 9
      src/app/babylon/controller/scene-manager.ts
  4. 2
      src/app/babylon/controller/serve-manager.ts
  5. 6
      src/app/babylon/controller/status/building-status.ts
  6. 24
      src/app/babylon/model/data/institution/institution-data.ts
  7. 78
      src/app/babylon/model/data/institution/jyz-show-data.ts
  8. 4
      src/app/babylon/model/data/model-data/model-data-facility.ts
  9. 3
      src/app/babylon/model/info/model/model-info-building.ts
  10. 34
      src/app/babylon/model/info/model/model-info-facility.ts
  11. 16
      src/app/babylon/model/info/model/model-info.ts
  12. 83
      src/app/babylon/tool/babylon-tool.ts
  13. 2
      src/app/babylon/tool/gizmo-tool.ts
  14. 1
      src/app/babylon/tool/measure-tool.ts
  15. 8
      src/app/babylon/view/building-window/building-ui-item.ts
  16. 194
      src/app/babylon/view/building-window/building-window.ts
  17. 28
      src/app/babylon/view/facility-window/facility-window.ts
  18. 12
      src/app/babylon/view/toolbar-window/toobar-window.ts
  19. 69
      src/app/pages/left-domain/left-domain.component.html
  20. 47
      src/app/pages/left-domain/left-domain.component.scss
  21. 33
      src/app/pages/left-domain/left-domain.component.ts
  22. 4
      src/app/pages/pages.module.ts
  23. 9
      src/app/pages/plan/plan.component.html
  24. 20
      src/app/pages/plan/plan.component.scss
  25. 27
      src/app/pages/plan/plan.component.ts
  26. BIN
      src/assets/images/baseInfo/building.png
  27. BIN
      src/assets/images/baseInfo/date.png
  28. BIN
      src/assets/images/baseInfo/hospital.png
  29. BIN
      src/assets/images/baseInfo/phone.png
  30. BIN
      src/assets/images/baseInfo/police.png
  31. BIN
      src/assets/images/baseInfo/position.png
  32. BIN
      src/assets/images/baseInfo/road.png
  33. BIN
      src/assets/images/facility/in/XF_MHQ_GF_35.png
  34. BIN
      src/assets/images/facility/in/XF_MHQ_GF_4.png
  35. BIN
      src/assets/images/facility/in/XF_MHQ_GF_8.png
  36. BIN
      src/assets/images/facility/in/XF_MHQ_PT_35.png
  37. BIN
      src/assets/images/facility/in/XF_MHQ_PT_4.png
  38. BIN
      src/assets/images/facility/in/XF_MHQ_PT_8.png
  39. BIN
      src/assets/images/facility/in/XF_MHT.png
  40. BIN
      src/assets/images/facility/in/XF_XFCM.png
  41. BIN
      src/assets/images/facility/in/XF_XFF.png
  42. BIN
      src/assets/images/facility/in/XF_XFQ.png
  43. BIN
      src/assets/images/facility/in/XF_XFS.png
  44. BIN
      src/assets/images/facility/in/XF_XFT.png
  45. BIN
      src/assets/images/facility/in/XKS.png
  46. 10
      src/styles.scss

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

@ -1,6 +1,7 @@
import { HttpErrorResponse } from '@angular/common/http';
import { Quaternion, Vector3 } from '@babylonjs/core';
import { plainToClass } from 'class-transformer';
import { PlanComponent } from 'src/app/pages/plan/plan.component';
import {
BuildingData,
BuildingData_ChemicalPlant,
@ -85,10 +86,11 @@ export class DataManager {
}
console.error("获取单位信息失败,本地捏造数据");
DataManager.initDebugData_institution();
if (onSuccess) {
onSuccess(key);
}
PlanComponent.instance.openSnackBar("获取单位失败,请刷新重试");
// DataManager.initDebugData_institution();
// if (onSuccess) {
// onSuccess(key);
// }
});
}
else {
@ -322,7 +324,7 @@ export class DataManager {
*/
static initDebugData_mark() {
DataManager.allMarkData = AllMarkData.CreateAllMarkData();
console.log(DataManager.allMarkData, "态势标会");
// console.log(DataManager.allMarkData, "态势标会");
}
static init(simpleData: InsitutionDataSimple, onSuccess?: (key: string) => void) {

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

@ -164,7 +164,6 @@ export class InfoManager {
modelEditData: ModelEditData,
buildingInfo: BuildingInfo = null
) {
console.trace("创建设备", buildingInfo);
let facilities = modelEditData.facilities;
@ -176,11 +175,9 @@ export class InfoManager {
let facilityData = facilities[i].facilities[j]
if (facilityData.posType == FacilityPosType.In && buildingInfo.ModelInfo != null) {
mesh = buildingInfo.ModelInfo.getChildrenByName(facilityData.resName);
console.log("内建模型找到", mesh);
}
FacilityWindow.instance.createFacility(
modelEditData.facilities[i].facilities[j],
false,
@ -192,6 +189,7 @@ export class InfoManager {
if (ModeManager.currentMode == ModeType.Look) {
modelInfo.setIconEnable(false);//查看模式下隐藏所有设备ui
}
}
);
}

9
src/app/babylon/controller/scene-manager.ts

@ -133,9 +133,10 @@ export class SceneManager {
Vector3.Zero(), //目标位置
this.scene //定义摄像机所属的场景
);
camera.minZ = 0;//最近拍摄距离
camera.maxZ = 6000; //摄像机拍摄的最远距离
// camera.upperBetaLimit = 1.5; //beta方向上的旋转限制(防止看到模型底面)
camera.lowerRadiusLimit = 3; //相机距离拍摄目标的最小距离(防止穿插)
camera.lowerRadiusLimit = 1; //相机距离拍摄目标的最小距离(防止穿插)
camera.setTarget(Vector3.Zero()); //设置拍摄目标
camera.attachControl(this.canvas, true); //把相机连接到画布
this.defaultCamera = camera;
@ -256,16 +257,18 @@ export class SceneManager {
{
mainTextureRatio: 1,
});
this.highLightLayer.innerGlow = false;
this.highLightLayer.innerGlow = true;
this.highLightLayer.outerGlow = true;
}
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++;
}
}

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

@ -34,7 +34,7 @@ export class ServeManager {
) => void, onError?: (key: string, error: any) => void) {
this.buildingBISrv.getBuildingBasicInfos(key)
.subscribe(data => {
console.log("得到单位信息" + key, data);
//console.log("得到单位信息" + key, data);
if (onSuccess) {
onSuccess(key, JSON.parse((data as any).result));
}

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

@ -137,9 +137,13 @@ export class BuildingStatus extends StatusBase {
//判断已经有了就不创建了
// InfoManager.createFacilityInfos(buildingInfo.buildingData.outdoorData, buildingInfo);
//显示
this.buildingWindow.showFacilityInfosIcon(this.currentBuildingInfo, true);
//this.buildingWindow.showFacilityInfosIcon(this.currentBuildingInfo, true);
}
this.buildingWindow.changeCurrentBuildingInfo(buildingInfo.ModelInfo);
}
//模型变化

24
src/app/babylon/model/data/institution/institution-data.ts

@ -1,6 +1,7 @@
import { Vector3 } from "@babylonjs/core";
import { Type } from "class-transformer";
import { BuildingData_ChemicalPlant, BuildingData_Environment, BuildingData_Normal, BuildingType } from "./building/building-data";
import { JYZInfoMoudleType, JYZShowData } from "./jyz-show-data";
//单位信息
export class InstitutionData {
@ -25,6 +26,11 @@ export class InstitutionData {
@Type(() => Vector3)
pos: Vector3 = new Vector3(0, 0, 0);
/**
*
*/
@Type(() => JYZShowData)
JYZShowDatas: JYZShowData[] = [];
//获取一个最新的key(根据前一个同类建筑key,加一)
public getNewKey(buildingType: BuildingType): string {
@ -65,6 +71,21 @@ export class InstitutionData {
return result;
}
/**
*
* @param type
*/
getMoudleShowData(type: JYZInfoMoudleType) {
let result: JYZShowData = null;
for (let i = 0; i < this.JYZShowDatas.length; i++) {
if (this.JYZShowDatas[i].moudleType == type) {
result = this.JYZShowDatas[i];
break;
}
}
return result;
}
}
@ -89,4 +110,5 @@ export class NormalData {
//console.log("getName==" + this.name);
return this.name;
}
}
}

78
src/app/babylon/model/data/institution/jyz-show-data.ts

@ -0,0 +1,78 @@
import { ArcRotateCamera } from "@babylonjs/core/Cameras/arcRotateCamera";
import { Type } from "class-transformer";
import { ArcRotateCameraData } from "../camera-data";
/**
*
*/
export class JYZShowData {
/**
*
*/
moudleType: JYZInfoMoudleType;
/**
*
*/
@Type(() => ArcRotateCameraData)
cameraData: ArcRotateCameraData;
/**
*
*/
showZP: boolean;
constructor(moudleType: JYZInfoMoudleType, camera: ArcRotateCamera, showZP: boolean) {
this.moudleType = moudleType;
this.cameraData = new ArcRotateCameraData();
this.cameraData.getDataFromCamera(camera);
}
}
/**
*
*/
export enum JYZInfoMoudleType {
/**
*
*/
JBXX = "JBXX",
/**
*
*/
YJCZ = "YJCZ",
/**
*
*/
XF = "XF",
/**
*
*/
JYJ = "JYJ",
/**
*
*/
YG = "YG",
/**
*
*/
SYG = "SYG",
/**
* 线
*/
YQHSGX = "YQHSGX",
/**
*
*/
AQSS = "AQSS",
/**
*
*/
ZP = "ZP",
}

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

@ -246,11 +246,11 @@ export enum FacilityType {
/**
* 线
*/
XF_TSLX = "XF_TSLX",
AQSS_TSLX = "AQSS_TSLX",
/**
*
*/
XF_SSD = "XF_SSD",
AQSS_SSD = "AQSS_SSD",
/**
*

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

@ -48,8 +48,9 @@ export class ModelInfo_building extends ModelInfo {
if (this.neiRoot == null) {
for (let i = 0; i < allTransformNode.length; i++) {
if (TsTool.stringContain(allTransformNode[i].name, "wai")) {
if (TsTool.stringContain(allTransformNode[i].name, "WAI")) {
this.neiRoot = allTransformNode[i];
console.log("找到关键节点wai");
break;
}
}

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

@ -1,8 +1,9 @@
import { AbstractMesh, EventState } from "@babylonjs/core";
import { AbstractMesh, Color3, EventState, Mesh } from "@babylonjs/core";
import { Button, Control, Ellipse, Rectangle, Vector2WithInfo } from "@babylonjs/gui";
import { ConfigManager } from "src/app/babylon/controller/config-manager";
import { SceneManager } from "src/app/babylon/controller/scene-manager";
import { BabylonUIStyleTool } from "src/app/babylon/tool/babylon-ui-style-tool";
import { TsTool } from "src/app/babylon/tool/ts-tool";
import { FacilityWindow } from "src/app/babylon/view/facility-window/facility-window";
import { FacilityInfoInSceneWindow } from "src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window";
import { PropertyBaseWindow } from "src/app/babylon/view/property-window/property-base-window";
@ -92,6 +93,7 @@ export class ModelInfo_facility extends ModelInfo {
});
this.uiFollowRoot.zIndex = BabylonUIStyleTool.c_zIndex_facilityIcon;
this.showFollowUI(false);
}
@ -156,6 +158,36 @@ export class ModelInfo_facility extends ModelInfo {
}
}
/**
* ()
* @param play false表示停止
*/
playShowAnim(play: boolean) {
this.showFollowUI(play);
if (this.modelBox != null) {
if (play) {
SceneManager.Instance.addToHighLight(this.modelBox as Mesh, Color3.Yellow());
}
else {
SceneManager.Instance.removeFromHighLight(this.modelBox as Mesh);
}
let facilityData = this.modelData as ModelData_facility;
if (facilityData.facilityType == FacilityType.JY_SYGX || facilityData.facilityType == FacilityType.JY_YQHSGX) {
let allChildren = this.modelBox.getChildMeshes();
for (let i = 0; i < allChildren.length; i++) {
if (TsTool.stringContain(allChildren[i].name, "UV")) {
allChildren[i].setEnabled(play);
}
}
}
}
}
dispose(disposeMesh?: boolean) {
if (this.areaInfo != null) {
this.areaInfo.dispose();

16
src/app/babylon/model/info/model/model-info.ts

@ -133,25 +133,9 @@ export class ModelInfo {
showFollowUI(show: boolean) {
if (this.uiFollowRoot != null) {
this.uiFollowRoot.isVisible = show;
}
}
/**
* ()
* @param play false表示停止
*/
playShowAnim(play: boolean) {
if (this.modelBox != null) {
if (play) {
SceneManager.Instance.addToHighLight(this.modelBox as Mesh, Color3.Green());
}
else {
SceneManager.Instance.removeFromHighLight(this.modelBox as Mesh);
}
}
}
/**
*

83
src/app/babylon/tool/babylon-tool.ts

@ -288,6 +288,89 @@ export class BabylonTool {
}
public static AnimMoveCameraTargetAB(
camera: ArcRotateCamera,
allFrame: number,
target: Vector3,
radius: number,
alpha: number,
beta: number,
) {
//缓动动画
let easingFunction = new QuadraticEase();
easingFunction.setEasingMode(EasingFunction.EASINGMODE_EASEOUT);
//target
let anim_target = new Animation(
'CameraAnim_target',
'target',
60,
Animation.ANIMATIONTYPE_VECTOR3,
Animation.ANIMATIONLOOPMODE_CYCLE
);
let keys_target = [
{ frame: 0, value: camera.target },
{ frame: allFrame, value: target },
];
anim_target.setKeys(keys_target);
anim_target.setEasingFunction(easingFunction);
//radius
let anim_radius = new Animation(
'CameraAnim_radius',
'radius',
60,
Animation.ANIMATIONTYPE_FLOAT,
Animation.ANIMATIONLOOPMODE_CYCLE
);
let keys_radius = [
{ frame: 0, value: camera.radius },
{ frame: allFrame, value: radius },
];
anim_radius.setKeys(keys_radius);
anim_radius.setEasingFunction(easingFunction);
//beta
let anim_a = new Animation(
'CameraAnim_a',
'alpha',
60,
Animation.ANIMATIONTYPE_FLOAT,
Animation.ANIMATIONLOOPMODE_CYCLE
);
let keys_a = [
{ frame: 0, value: camera.alpha },
{ frame: allFrame, value: alpha },
];
anim_a.setKeys(keys_a);
//beta
let anim_b = new Animation(
'CameraAnim_b',
'beta',
60,
Animation.ANIMATIONTYPE_FLOAT,
Animation.ANIMATIONLOOPMODE_CYCLE
);
let keys_b = [
{ frame: 0, value: camera.beta },
{ frame: allFrame, value: beta },
];
anim_b.setKeys(keys_b);
camera.animations = [];
camera.animations.push(anim_target);
camera.animations.push(anim_radius);
camera.animations.push(anim_a);
camera.animations.push(anim_b);
camera._scene.beginAnimation(camera, 0, allFrame, false);
}
//动画移动摄像机target
public static AnimMoveCameraTarget(
camera: ArcRotateCamera,

2
src/app/babylon/tool/gizmo-tool.ts

@ -96,6 +96,8 @@ export class GizmoTool {
GizmoTool.s_camera.panningSensibility = speed;//动态修改平移灵敏度
GizmoTool.s_camera.wheelDeltaPercentage = 0.005;
if (SceneManager.Instance.cameraMode_Is2D) {
let camera = SceneManager.Instance.defaultCamera;
camera.beta = 0;

1
src/app/babylon/tool/measure-tool.ts

@ -105,7 +105,6 @@ export class MeasureTool {
*
*/
addMeasurePoint(pickInfo: PickingInfo) {
console.log("测量", pickInfo);
if (this.currentMeasureInfo != null) {
this.currentMeasureInfo.addPoint(pickInfo.pickedPoint);
}

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

@ -212,6 +212,14 @@ export class BuildingUIItem {
}
/**
*
* @param mesh
*/
createAQSSFromMesh(mesh: AbstractMesh) {
FacilityWindow.instance.createAQSSFromMesh(mesh);
}
/**
*
* @param mesh

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

@ -1,5 +1,5 @@
import { AbstractMesh, Material, Mesh } from "@babylonjs/core";
import { AbstractMesh, Material, Mesh, PBRMaterial, Texture } from "@babylonjs/core";
import { PlanComponent } from "src/app/pages/plan/plan.component";
import { DataManager } from "../../controller/data-manager";
import { InfoManager } from "../../controller/info-manager";
@ -8,6 +8,7 @@ import { ServeManager } from "../../controller/serve-manager";
import { BuildingStatus } from "../../controller/status/building-status";
import { StatusManager } from "../../controller/status/status-manager";
import { BuildingData, BuildingData_ChemicalPlant, BuildingData_Environment, BuildingData_Normal, BuildingType } from "../../model/data/institution/building/building-data";
import { JYZInfoMoudleType, JYZShowData } from "../../model/data/institution/jyz-show-data";
import { ModelType } from "../../model/data/model-data/model-data";
import { FacilityType } from "../../model/data/model-data/model-data-facility";
import { ModelEditData } from "../../model/data/model-data/model-edit-data";
@ -17,6 +18,7 @@ import { BuildingInfo_Environment } from "../../model/info/building/building-inf
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 { BabylonTool } from "../../tool/babylon-tool";
import { TsTool } from "../../tool/ts-tool";
import { UIBase } from "../window-base/ui-base";
import { BuildingUIItem } from "./building-ui-item";
@ -24,6 +26,7 @@ import { BuildingUIItem } from "./building-ui-item";
//建筑界面
export class BuildingWindow extends UIBase {
/**
* uv动画材质的特殊命名
*/
@ -215,12 +218,13 @@ export class BuildingWindow extends UIBase {
*/
showJYZInfoModel(type: JYZInfoMoudleType, show: boolean) {
console.log("showJYZInfoModel", type, show);
if (this.currentJYZInfoMoudleType == type) {
if (show) {
return; //与上次显示的模块相同
}
else {
this.showJYZModules(type, show);
this.showJYZModules(type, show); //单纯隐藏
}
}
else {
@ -230,6 +234,27 @@ export class BuildingWindow extends UIBase {
this.showJYZModules(type, show);//展示本次要展示的内容
}
if (show) {
if (type == JYZInfoMoudleType.YJCZ) {
//进入应急处置
}
else {//恢复查看状态
let showData = DataManager.institutionData.getMoudleShowData(type);
if (showData != null) {
let camera = SceneManager.Instance.defaultCamera;
//showData.cameraData.setDataToCamera(camera);
let cameraData = showData.cameraData;
BabylonTool.AnimMoveCameraTargetAB(camera, 60, cameraData.target, cameraData.radius, cameraData.alpha, cameraData.beta);
this.showZP(showData.showZP);
PlanComponent.instance.isOpenAwning = showData.showZP;
}
}
}
else {
if (type == JYZInfoMoudleType.YJCZ) {
//退出应急处置
}
}
}
@ -251,7 +276,10 @@ export class BuildingWindow extends UIBase {
this.three = PlanComponent.instance;
this.three.buildingUIItems = this.buildingUIItems
this.buildingUIItems.length ? this.three.beforeOneBuildingID = this.three.buildingUIItems[0].getBuildingID() : null
let instance = this;
SceneManager.Instance.scene.onBeforeRenderObservable.add(() => {
instance.onUpdate();
})
}
onShow() {
@ -264,6 +292,11 @@ export class BuildingWindow extends UIBase {
super.onHide();
}
onUpdate() {
this.updateUVAnim();
}
//#endregion
@ -308,10 +341,15 @@ export class BuildingWindow extends UIBase {
}
}
console.log("选中建筑", modelInfo);
this.showJYZModules(JYZInfoMoudleType.AQSS, false);
this.showJYZModules(JYZInfoMoudleType.YQHSGX, false);
this.showJYZModules(JYZInfoMoudleType.YQHSGX, false);
//this.onChangeCurrentBuildingItem(item);
// this.three.selectLeftBuilding(item);
}
/**
@ -545,6 +583,11 @@ export class BuildingWindow extends UIBase {
*/
readonly c_xiaoFang = "XF_";
/**
*
*/
readonly c_shuSan = "AQSS_";
/**
*
*/
@ -593,18 +636,22 @@ export class BuildingWindow extends UIBase {
if (TsTool.stringContain(nodeName, "primitive")) {
//复合材质被分解为多个子mesh,不看做特殊意义的对象
}
else if (TsTool.stringContain(nodeName, this.c_zheDang))//遮挡
{
this.currentBuidngItem.createStopByMesh(allNode[i]);
}
else if (TsTool.stringContain(nodeName, this.c_xiaoFang)) //消防
{
this.currentBuidngItem.createFacilityByMesh(allNode[i]);
}
else if (TsTool.stringContain(nodeName, this.c_shuSan)) {
this.currentBuidngItem.createAQSSFromMesh(allNode[i]);//安全疏散
}
else if (TsTool.stringContain(nodeName, this.c_jiaYou))//加油站
{
this.currentBuidngItem.createOilingByMesh(allNode[i]);
}
else if (TsTool.stringContain(nodeName, this.c_zheDang))//遮挡
{
this.currentBuidngItem.createStopByMesh(allNode[i]);
}
}
}
@ -618,6 +665,11 @@ export class BuildingWindow extends UIBase {
//#region 加油站基本信息模块的显隐表现
/**
* UV动画速度
*/
readonly c_uvAnimSpeed = 0.001;
/**
*
*/
@ -638,6 +690,13 @@ export class BuildingWindow extends UIBase {
*/
mat_UV: Map<JYZInfoMoudleType, Material[]> = new Map();
/**
*
*/
currentZPShow: boolean = true;
/**
*
* @param type
@ -659,15 +718,22 @@ export class BuildingWindow extends UIBase {
if (infos != null) {
for (let j = 0; j < infos.length; j++) {
infos[j].playShowAnim(show);
//安全疏散,特殊,要在不显示时隐藏本体
if (type == JYZInfoMoudleType.AQSS) {
infos[j].setEnable(show);
}
}
}
}
//阻挡类物体
let zdByType: FacilityInfoByType[] = [];
if (this.zdByMoudle.has(type)) {
zdByType = this.zdByMoudle.get(type);
}
else {
}
for (let i = 0; i < zdByType.length; i++) {
let infos = zdByType[i].facilityInfo;
if (infos != null) {
@ -676,6 +742,7 @@ export class BuildingWindow extends UIBase {
}
}
}
if (show) {
this.currentJYZInfoMoudleType = type;
}
@ -711,6 +778,17 @@ export class BuildingWindow extends UIBase {
for (let i = 0; i < allFacilityByType.length; i++) {
let l_facilityByType = allFacilityByType[i];
// if (moudleType == JYZInfoMoudleType.XF) //消防-逃生
// {
// if (TsTool.stringContain(l_facilityByType.type, FacilityType.XF_TSLX)) {
// continue;
// }
// if (TsTool.stringContain(l_facilityByType.type, FacilityType.XF_SSD)) {
// continue;
// }
// }
if (TsTool.stringContain(l_facilityByType.type, zdKey)) {
if (!this.zdByMoudle.has(moudleType)) {
this.zdByMoudle.set(moudleType, []);
@ -738,6 +816,7 @@ export class BuildingWindow extends UIBase {
}
}
}
this.currentZPShow = show;
}
/**
@ -748,8 +827,8 @@ export class BuildingWindow extends UIBase {
getUVMat(facilityType: FacilityType, mesh: AbstractMesh) {
let moudleType: JYZInfoMoudleType = null;
switch (facilityType) {
case FacilityType.XF_TSLX:
moudleType = JYZInfoMoudleType.TSLX;
case FacilityType.AQSS_TSLX:
moudleType = JYZInfoMoudleType.AQSS;
break;
case FacilityType.JY_SYGX:
moudleType = JYZInfoMoudleType.SYG;
@ -783,6 +862,7 @@ export class BuildingWindow extends UIBase {
if (!isRepeat)//不重复,就添加进去
{
this.mat_UV.get(moudleType).push(l_mat);
console.log("找到uv", l_mat);
}
}
}
@ -801,54 +881,72 @@ export class BuildingWindow extends UIBase {
for (let i = 0; i < childMesh.length; i++) {
let mat = childMesh[i].material;
if (TsTool.stringContain(mat.name, this.c_MAT_UV)) {
// for(let j =0;j< result.length;j++)
// {
// if(mat != result[j])
// {
result.push(mat);
// }
// }
}
}
return result;
}
//#endregion
}
/**
*
*/
export enum JYZInfoMoudleType {
/**
*
*/
XF = "XF",
/**
*
*/
JYJ = "JYJ",
/**
*
*/
YG = "YG",
/**
*
*/
SYG = "SYG",
/**
* 线
* uv动画 update
*/
YQHSGX = "YQHSGX",
/**
* 线
*/
TSLX = "TSLX",
updateUVAnim() {
// console.log("uv", this.mat_UV);
if (this.mat_UV == null || this.currentJYZInfoMoudleType == null) {
return;
}
let mats = this.mat_UV.get(this.currentJYZInfoMoudleType);
if (mats == null) {
return;
}
for (let i = 0; i < mats.length; i++) {
let mat = mats[i];
if (mat instanceof PBRMaterial) {
(mat.albedoTexture as Texture).vOffset += SceneManager.Instance.scene.deltaTime * this.c_uvAnimSpeed;
}
}
}
/**
*
*
*/
ZP = "ZP",
}
saveShowMoudleData() {
let moudleType = this.currentJYZInfoMoudleType;
let camera = SceneManager.Instance.defaultCamera;
let showZP = this.currentZPShow;
if (DataManager.institutionData.JYZShowDatas == null) {
DataManager.institutionData.JYZShowDatas = [];
}
let jyzShowData: JYZShowData = null;
for (let i = 0; i < DataManager.institutionData.JYZShowDatas.length; i++) {
if (DataManager.institutionData.JYZShowDatas[i].moudleType == moudleType) {
jyzShowData = DataManager.institutionData.JYZShowDatas[i];
break;
}
}
if (jyzShowData == null) {
jyzShowData = new JYZShowData(moudleType, camera, showZP);
}
jyzShowData.moudleType = moudleType;
jyzShowData.cameraData.getDataFromCamera(camera);
jyzShowData.showZP = showZP;
}
//#endregion
}

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

@ -587,12 +587,6 @@ export class FacilityWindow extends UIBase {
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);
}
@ -610,6 +604,19 @@ export class FacilityWindow extends UIBase {
}
}
/**
*
* @param mesh
*/
createAQSSFromMesh(mesh: AbstractMesh) {
if (TsTool.stringContain(mesh.name, FacilityType.AQSS_SSD)) {
this.createNewFacilityByMesh(mesh, FacilityType.AQSS_SSD);
}
else if (TsTool.stringContain(mesh.name, FacilityType.AQSS_TSLX)) {
this.createNewFacilityByMesh(mesh, FacilityType.AQSS_TSLX);
}
}
/**
*
* @param mesh
@ -617,19 +624,19 @@ export class FacilityWindow extends UIBase {
createOilingByMesh(mesh: AbstractMesh) {
if (TsTool.stringContain(mesh.name, FacilityType.JY_JYJ)) {
console.log("找到加油机", mesh)
// console.log("找到加油机", mesh)
this.createNewFacilityByMesh(mesh, FacilityType.JY_JYJ);
}
else if (TsTool.stringContain(mesh.name, FacilityType.JY_SYGX)) {
console.log("找到输油管线", mesh)
// console.log("找到输油管线", mesh)
this.createNewFacilityByMesh(mesh, FacilityType.JY_SYGX);
}
else if (TsTool.stringContain(mesh.name, FacilityType.JY_YG)) {
console.log("找到油罐", mesh)
// console.log("找到油罐", mesh)
this.createNewFacilityByMesh(mesh, FacilityType.JY_YG);
}
else if (TsTool.stringContain(mesh.name, FacilityType.JY_YQHSGX)) {
console.log("找到油气回收", mesh)
// console.log("找到油气回收", mesh)
this.createNewFacilityByMesh(mesh, FacilityType.JY_YQHSGX);
}
}
@ -649,6 +656,7 @@ export class FacilityWindow extends UIBase {
this.createNewFacilityByMesh(mesh, FacilityType.ZD_YQHSGX);
}
if (TsTool.stringContain(mesh.name, FacilityType.ZD_XF)) {
console.log("找到消防阻挡物", mesh.name);
this.createNewFacilityByMesh(mesh, FacilityType.ZD_XF);
}
if (TsTool.stringContain(mesh.name, FacilityType.ZD_ZP)) {

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

@ -89,6 +89,8 @@ export class ToolbarWindow extends UIBase {
//#endregion
//#region 加油站专用
/**
* info和data
*/
@ -118,6 +120,16 @@ export class ToolbarWindow extends UIBase {
BuildingWindow.instance.showZP(show);
}
/**
*
*/
saveShowMoudleData() {
BuildingWindow.instance.saveShowMoudleData();
PlanComponent.instance.openSnackBar("记录当前视角");
}
//#endregion
onInit() {
super.onInit();

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

@ -1,7 +1,74 @@
<div class="childContent">
<div class="childCenter">
<!-- 基本信息 -->
<div class="publicBox baseInfo" *ngIf="beforeFence === 0">
<div class="interval">
<p class="title">北京市第十九加油站<button class="titleBotton">自营</button></p>
<p class="text"><img src="../../../assets/images/baseInfo/position.png" class="textIcon">北京市朝阳区朝外大街关东店33号</p>
<p class="text"><img src="../../../assets/images/baseInfo/building.png" class="textIcon">山东省淄博市</p>
<p class="text"><img src="../../../assets/images/baseInfo/date.png" class="textIcon">2020.7.26开业</p>
<p class="text"><img src="../../../assets/images/baseInfo/road.png" class="textIcon">4车道</p>
</div>
<div class="interval">
<p class="title">营业执照</p>
<p class="textImage"><img src="../../../assets/images/upload.png"></p>
</div>
</div>
<!-- 基本信息 -->
<!-- 加油机 -->
<div class="publicBox refueller" *ngIf="beforeFence === 1">
<div class="interval">
<p class="title">1类加油机</p>
<div class="table">
<div class="tableHeader">
<p>品牌</p>
<p>超大牌</p>
<p>油枪数量</p>
<p>油品品号</p>
<p>油泵类型</p>
</div>
<div class="tableContent">
<p>超大牌</p>
<p>2</p>
<p>4</p>
<p>92#</p>
<p>自吸泵</p>
</div>
</div>
</div>
</div>
<!-- 加油机 -->
<!-- 油罐设备 -->
<div class="publicBox refueller oilTank" *ngIf="beforeFence === 2">
<div class="interval">
<p class="title">1号油罐</p>
<div class="table">
<div class="tableHeader">
<p>油品品号</p>
<p>油罐容积</p>
<p>安全容积</p>
<p>数量</p>
<p>罐区</p>
<p>油罐类型</p>
</div>
<div class="tableContent">
<p>92#</p>
<p>200L</p>
<p>180L</p>
<p>1</p>
<p>独立罐区</p>
<p>防渗罐池</p>
</div>
</div>
</div>
</div>
<!-- 油罐设备 -->
<!-- 消防设施 -->
<div class="publicBox fireFacilities" *ngIf="beforeFence === 3">
<nz-tree #nzTreeComponent [nzData]="treeData"></nz-tree>
</div>
<!-- 消防设施 -->
</div>
<div class="childBottom" *ngIf="beforeFence === 0">

47
src/app/pages/left-domain/left-domain.component.scss

@ -5,11 +5,11 @@
display: flex;
flex-direction: column;
font-family: Source Han Sans CN;
font-weight: 400;
color: #fff;
.childCenter{
flex: 1;
overflow-x: hidden;
overflow-y: auto;
overflow: hidden;
}
.childBottom{
width: 100%;
@ -31,4 +31,47 @@
.anticon{ margin-right: 3px; } //字体图标
}
}
}
.title{ font-size: 16px; height: 20px; line-height: 20px; margin-bottom: 20px; } //头部header
.publicBox{ width: 100%; height: 100%; overflow-y: auto; padding: 0 20px; }
.baseInfo{ //基本信息
.interval{ margin-top: 10px; border-bottom: 1px solid rgb(197, 226, 245); } //分隔div
p{ height: 20px; line-height: 20px; }
.titleBotton{ background: #2399FF; border-radius: 3px; height: 20px; line-height: 20px; font-size: 12px; margin-left: 5px; padding: 0 5px; border: none; outline: none; }
.text{ font-size: 14px; margin-bottom: 15px; }
.textIcon{ width: 20px; height: 20px; vertical-align: top; margin-right: 5px; }
.textImage{ margin-bottom: 15px; height: auto; line-height: normal; img{ width: auto; height: 130px; } }
}
.refueller{ //加油机
.interval{ margin-top: 10px; } //分隔div
.table{
width: 100%;
border: 1px solid #91CCFF;
border-bottom: none;
display: flex;
p{ height: 32px; line-height: 32px; margin: 0px; }
.tableHeader{
flex: 4;
text-align: right;
color: #23D9FF;
p{ padding-right: 15px; border-right: 1px solid #91CCFF; border-bottom: 1px solid #91CCFF; background: rgba(145, 204, 255, 0.2); }
}
.tableContent{
flex: 6;
text-align: left;
p{ padding-left: 20px; border-bottom: 1px solid #91CCFF; }
}
}
}
.oilTank{ //油管设备
}
.fireFacilities{ //消防设施
.ant-tree{
height: 32px;
line-height: 32px;
background-color: transparent;
color: #C4E2FC;
}
}

33
src/app/pages/left-domain/left-domain.component.ts

@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ViewChild } from '@angular/core';
import { NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree';
import { PlanComponent } from '../plan/plan.component';
@Component({
@ -15,6 +16,8 @@ export class LeftDomainComponent implements OnInit {
}
beforeFence: number; //当前选中功能栏
@ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent;
treeData: NzTreeNodeOptions[] = treeData.nodes; //tree data
//初始化组件
initComponent(type?: number) {
@ -38,3 +41,31 @@ export class LeftDomainComponent implements OnInit {
}
export class treeData {
static nodes: NzTreeNodeOptions[] = [
{
title: '灭火器',
key: '1',
selectable: false,
children: [
{ title: '4KG手提干粉灭火器', key: '1', selectable: false, },
{ title: '4KG手提泡沫灭火器', key: '2', selectable: false, },
{ title: '4KG手提二氧化碳灭火器', key: '3', selectable: false, },
{ title: '35KG手推灭火器', key: '4', selectable: false, },
]
},
{
title: '灭火毯',
key: '2',
selectable: false,
children: []
},
{
title: '消防锹',
key: '3',
selectable: false,
children: []
},
];
}

4
src/app/pages/pages.module.ts

@ -29,6 +29,7 @@ import { NzPaginationModule } from 'ng-zorro-antd/pagination';
import { NzDropDownModule } from 'ng-zorro-antd/dropdown';
import { NzMessageModule } from 'ng-zorro-antd/message';
import { NzSpinModule } from 'ng-zorro-antd/spin';
import { NzTreeModule } from 'ng-zorro-antd/tree';
import { TodayWarningAdminComponent } from './today-warning-admin/today-warning-admin.component';
import { CriminalRecordsAdminComponent } from './criminal-records-admin/criminal-records-admin.component';
import { EquipmentInfoComponent } from './equipment-info/equipment-info.component';
@ -63,7 +64,8 @@ import { EditequipmentComponent } from './equipment-info/editequipment/editequip
NzPaginationModule,
NzDropDownModule,
NzMessageModule,
NzSpinModule
NzSpinModule,
NzTreeModule
],
entryComponents :[AddequipmentComponent,EditequipmentComponent]
})

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

@ -59,7 +59,7 @@
<div class="autoScroll"><i nz-icon nzType="right" nzTheme="outline" (click)="bottomScroll(1)"></i></div>
</div>
<!-- 底部图标栏 -->
<!-- 右上角快捷栏 -->
<div class="rightTopFast">
<div class="publicFast leftFunction">
@ -73,10 +73,13 @@
<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 class="save">
<button (click)="preserve(false)" title="保存模块"><i nz-icon nzType="file-done" nzTheme="outline"></i></button>
<button (click)="preserve(true)" title="保存"><i nz-icon nzType="save" nzTheme="outline"></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'>

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

@ -212,27 +212,31 @@
//右上角快捷栏
.rightTopFast{
width: 340px;
width: 400px;
height: 38px;
position: absolute;
right: 1px;
top: 3%;
overflow: hidden;
box-sizing: border-box;
display: flex;
>div { height: 38px; border-radius: 5px; }
button {
width: 36px;
height: 36px;
width: 38px;
height: 38px;
border: none;
outline: none;
background-color: transparent;
color: #fff;
cursor: pointer;
padding: 0;
}
.save{
margin: 0 10px;
button{ background-color: #0080FF; border-radius: 5px; }
button:first-child{ margin-right: 10px; }
.anticon{ font-size: 20px; line-height: 40px; } //字体图标
}
.publicFast {
box-sizing: border-box;
padding: 1px 3px;
padding: 0px 3px;
background-color: rgba(0,0,0,0.5);
}
.leftFast {
@ -244,7 +248,7 @@
.leftFastIsTure { border: 1px solid #fff; } //吸附样式
}
.leftFunction {
margin: 0 10px;
margin-right: 10px;
}
.selectRightTopFast { border: 1px solid #fff; } //选种样式
}

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

@ -11,13 +11,14 @@ 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, JYZInfoMoudleType } from 'src/app/babylon/view/building-window/building-window';
import { BuildingWindow } from 'src/app/babylon/view/building-window/building-window';
import { FacilityUIItem } from 'src/app/babylon/view/facility-window/facility-ui-item';
import { FacilityWindow } from 'src/app/babylon/view/facility-window/facility-window';
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';
import { JYZInfoMoudleType } from 'src/app/babylon/model/data/institution/jyz-show-data';
@ -58,10 +59,10 @@ export class PlanComponent implements OnInit {
loginStatus.getInstitutionListFromServe((result: InsitutionDataSimple[], data: any) => {
if (ModeManager.institutionDemoKey == ModeManager.c_demoKey_null) { //无指定测试单位,则为正式启动,根据当前单位key寻找
let key = 'ceshi';
console.log("获取数据", data);
// console.log("获取数据", data);
let find = data.find(item => { return item.key === key })
if (find) { //如果在data中找到了对应的单位key,则表示已经有三维数据,直接进入
console.log("找到已有单位" + key);
// console.log("找到已有单位" + key);
this.beforeOneSatus = StatusManager.getStatus<LoginSatus>(LoginSatus);
this.beforeOneSatus.onSelectInsSuccess(find)
} else { //如果没有找到对应的单位key,则调用新建单位
@ -109,29 +110,33 @@ export class PlanComponent implements OnInit {
this.isShowChildComponent && this.leftDomain ? this.leftDomain.initComponent(type) : null; //手动初始化子组件
this.selectFence = type
this.isShowChildComponent = true
type > 0 && type < 7 ? buildingWindow.showJYZInfoModel(fenceType, true) : null
buildingWindow.showJYZInfoModel(fenceType, true)
} else { //取消选中
this.selectFence = -1
this.isShowChildComponent = false
type > 0 && type < 7 ? buildingWindow.showJYZInfoModel(fenceType, false) : null
buildingWindow.showJYZInfoModel(fenceType, false)
}
}
//获取 头部功能栏Type
getFenceType(type: number): JYZInfoMoudleType {
let fenceType
if (type === 1) {
if (type === 0) {
fenceType = JYZInfoMoudleType.JBXX
} else 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
fenceType = JYZInfoMoudleType.AQSS
} else if (type === 5) {
fenceType = JYZInfoMoudleType.SYG
} else if (type === 6) {
fenceType = JYZInfoMoudleType.YQHSGX
} else if (type === 7) {
fenceType = JYZInfoMoudleType.YJCZ
}
return fenceType
}
@ -323,8 +328,12 @@ export class PlanComponent implements OnInit {
}
//保存
preserve() {
ToolbarWindow.instance.onBtnSave();
preserve(type: boolean) {
if (type) {
ToolbarWindow.instance.onBtnSave();
} else {
ToolbarWindow.instance.saveShowMoudleData();
}
}
//通用 消息通知栏

BIN
src/assets/images/baseInfo/building.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

BIN
src/assets/images/baseInfo/date.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

BIN
src/assets/images/baseInfo/hospital.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

BIN
src/assets/images/baseInfo/phone.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

BIN
src/assets/images/baseInfo/police.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

BIN
src/assets/images/baseInfo/position.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

BIN
src/assets/images/baseInfo/road.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

10
src/styles.scss

@ -102,5 +102,15 @@ h1 {
font-size: 16px;
}
//滚动条样式
::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-thumb {
background-image: linear-gradient(#2495f8,#1c73c2,#02233f,);
}
::-webkit-scrollbar-track {
background-color: #0d4070;
}

Loading…
Cancel
Save