陈鹏飞 3 years ago
parent
commit
8f93b1c834
  1. 24
      src/app/babylon/model/data/institution/institution-data.ts
  2. 78
      src/app/babylon/model/data/institution/jyz-show-data.ts
  3. 83
      src/app/babylon/tool/babylon-tool.ts
  4. 98
      src/app/babylon/view/building-window/building-window.ts
  5. 12
      src/app/babylon/view/toolbar-window/toobar-window.ts
  6. 3
      src/app/pages/plan/plan.component.ts
  7. BIN
      src/assets/images/facility/in/XF_MHQ_GF_35.png
  8. BIN
      src/assets/images/facility/in/XF_MHQ_GF_4.png
  9. BIN
      src/assets/images/facility/in/XF_MHQ_GF_8.png
  10. BIN
      src/assets/images/facility/in/XF_MHQ_PT_35.png
  11. BIN
      src/assets/images/facility/in/XF_MHQ_PT_4.png
  12. BIN
      src/assets/images/facility/in/XF_MHQ_PT_8.png
  13. BIN
      src/assets/images/facility/in/XF_MHT.png
  14. BIN
      src/assets/images/facility/in/XF_XFCM.png
  15. BIN
      src/assets/images/facility/in/XF_XFF.png
  16. BIN
      src/assets/images/facility/in/XF_XFQ.png
  17. BIN
      src/assets/images/facility/in/XF_XFS.png
  18. BIN
      src/assets/images/facility/in/XF_XFT.png
  19. BIN
      src/assets/images/facility/in/XKS.png

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

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

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 //动画移动摄像机target
public static AnimMoveCameraTarget( public static AnimMoveCameraTarget(
camera: ArcRotateCamera, camera: ArcRotateCamera,

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

@ -8,6 +8,7 @@ import { ServeManager } from "../../controller/serve-manager";
import { BuildingStatus } from "../../controller/status/building-status"; import { BuildingStatus } from "../../controller/status/building-status";
import { StatusManager } from "../../controller/status/status-manager"; import { StatusManager } from "../../controller/status/status-manager";
import { BuildingData, BuildingData_ChemicalPlant, BuildingData_Environment, BuildingData_Normal, BuildingType } from "../../model/data/institution/building/building-data"; 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 { ModelType } from "../../model/data/model-data/model-data";
import { FacilityType } from "../../model/data/model-data/model-data-facility"; import { FacilityType } from "../../model/data/model-data/model-data-facility";
import { ModelEditData } from "../../model/data/model-data/model-edit-data"; 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 { BuildingInfo_Normal } from "../../model/info/building/building-info-normal";
import { ModelInfo_building } from "../../model/info/model/model-info-building"; import { ModelInfo_building } from "../../model/info/model/model-info-building";
import { FacilityInfoByType } from "../../model/info/model/model-info-facility"; import { FacilityInfoByType } from "../../model/info/model/model-info-facility";
import { BabylonTool } from "../../tool/babylon-tool";
import { TsTool } from "../../tool/ts-tool"; import { TsTool } from "../../tool/ts-tool";
import { UIBase } from "../window-base/ui-base"; import { UIBase } from "../window-base/ui-base";
import { BuildingUIItem } from "./building-ui-item"; import { BuildingUIItem } from "./building-ui-item";
@ -24,6 +26,7 @@ import { BuildingUIItem } from "./building-ui-item";
//建筑界面 //建筑界面
export class BuildingWindow extends UIBase { export class BuildingWindow extends UIBase {
/** /**
* uv动画材质的特殊命名 * uv动画材质的特殊命名
*/ */
@ -215,12 +218,13 @@ export class BuildingWindow extends UIBase {
*/ */
showJYZInfoModel(type: JYZInfoMoudleType, show: boolean) { showJYZInfoModel(type: JYZInfoMoudleType, show: boolean) {
console.log("showJYZInfoModel", type, show); console.log("showJYZInfoModel", type, show);
if (this.currentJYZInfoMoudleType == type) { if (this.currentJYZInfoMoudleType == type) {
if (show) { if (show) {
return; //与上次显示的模块相同 return; //与上次显示的模块相同
} }
else { else {
this.showJYZModules(type, show); this.showJYZModules(type, show); //单纯隐藏
} }
} }
else { else {
@ -230,6 +234,27 @@ export class BuildingWindow extends UIBase {
this.showJYZModules(type, show);//展示本次要展示的内容 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) {
//退出应急处置
}
}
} }
@ -642,6 +667,11 @@ export class BuildingWindow extends UIBase {
*/ */
mat_UV: Map<JYZInfoMoudleType, Material[]> = new Map(); mat_UV: Map<JYZInfoMoudleType, Material[]> = new Map();
/**
*
*/
currentZPShow: boolean = true;
/** /**
* *
* @param type * @param type
@ -765,6 +795,7 @@ export class BuildingWindow extends UIBase {
} }
} }
} }
this.currentZPShow = show;
} }
/** /**
@ -840,42 +871,39 @@ export class BuildingWindow extends UIBase {
return result; return result;
} }
/**
*
*/
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 //#endregion
} }
/**
*
*/
export enum JYZInfoMoudleType {
/**
*
*/
XF = "XF",
/**
*
*/
JYJ = "JYJ",
/**
*
*/
YG = "YG",
/**
*
*/
SYG = "SYG",
/**
* 线
*/
YQHSGX = "YQHSGX",
/**
*
*/
AQSS = "AQSS",
/**
*
*/
ZP = "ZP",
}

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

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

3
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 { BuildingStatus } from 'src/app/babylon/controller/status/building-status';
import { BuildingUIItem } from 'src/app/babylon/view/building-window/building-ui-item'; 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 { 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 { FacilityUIItem } from 'src/app/babylon/view/facility-window/facility-ui-item';
import { FacilityWindow } from 'src/app/babylon/view/facility-window/facility-window'; import { FacilityWindow } from 'src/app/babylon/view/facility-window/facility-window';
import { FacilityInfoUIItem } from 'src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item'; import { FacilityInfoUIItem } from 'src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item';
import { EventManager } from '@angular/platform-browser'; import { EventManager } from '@angular/platform-browser';
import { NzMessageService } from 'ng-zorro-antd/message'; import { NzMessageService } from 'ng-zorro-antd/message';
import { LeftDomainComponent } from '../left-domain/left-domain.component'; import { LeftDomainComponent } from '../left-domain/left-domain.component';
import { JYZInfoMoudleType } from 'src/app/babylon/model/data/institution/jyz-show-data';

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

Loading…
Cancel
Save