中化加油站项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

292 lines
6.0 KiB

import { ModelData } from "./model-data";
import { TransformData } from "../transform-data";
import { PropertyData_Base } from "../institution/facility/property-data/property-data-base";
import { classToClass, Type } from "class-transformer";
import { Vector3 } from "@babylonjs/core";
import { DataManager } from "src/app/babylon/controller/data-manager";
import { ConfigManager } from "src/app/babylon/controller/config-manager";
//设备数据
export class ModelData_facility extends ModelData {
/**
* 位置类型
*/
posType: FacilityPosType = FacilityPosType.Out;
/**
* 具体设备类别
*/
facilityType: FacilityType = FacilityType.PL;
@Type(() => PropertyData_Base)
propertyData: PropertyData_Base = null;//属性信息
@Type(() => Vector3)
areaPoints: Vector3[] = [];//区域位点
constructor(key: string, type: FacilityType, name: string, resName: string, transformData: TransformData, posType: FacilityPosType, isModel: boolean = true) {
super(key, name, null, resName, transformData, isModel);
this.facilityType = type;
this.posType = posType;
if (type != undefined) {
let showType = ModelData_facility.getShowType(type);
switch (showType) {
case FacilityShowType.ModelAndTag:
this.resName = resName;
this.resPath = ConfigManager.getResPath_facility(this.posType, type);
break;
case FacilityShowType.AreaAndTag:
this.areaPoints = this.newAreapPoints();
break;
}
// this.resPath = ConfigManager.c_resPath_facilitiesRoot + this.posType.toString() + "/" + type.toLowerCase() + "/";
this.propertyData = DataManager.createPropertyData(key, type);
}
}
/**
* 获取表现类型
*/
getShowtype() {
let showType = ModelData_facility.getShowType(this.facilityType);
return showType
}
clone(key: string): ModelData_facility {
let result = new ModelData_facility(key, this.facilityType, this.name, this.resName, this.transformData.clone(), this.posType);
result.propertyData = this.propertyData.clone(key);
result.areaPoints = classToClass(this.areaPoints);
return result;
}
//新建区域位点
newAreapPoints(): Vector3[] {
let size = 3;
let x = 0.75 * size;
let z = 0.5 * size;
let result: Vector3[] = [];
result.push(new Vector3(0, 0, 1 * size));
result.push(new Vector3(x, 0, z));
result.push(new Vector3(x, 0, -z));
result.push(new Vector3(0, 0, -1 * size));
result.push(new Vector3(-x, 0, -z));
result.push(new Vector3(-x, 0, z));
return result;
}
/**
* 查询展示方式
* @param facilityType 设备具体类型
*/
static getShowType(facilityType: FacilityType): FacilityShowType {
let result = FacilityShowType.ModelAndTag;
switch (facilityType) {
case FacilityType.PL:
case FacilityType.DWBZ:
case FacilityType.TPBZ: result = FacilityShowType.ModelAndTag; break;//展示模型和标签
case FacilityType.QY: result = FacilityShowType.AreaAndTag; break;//展示可编辑多边形
}
return result;
}
}
//设备位置类型(室内还是室外)
export enum FacilityPosType {
/**
* 内置在建筑模型中
*/
In = "in",
/**
* 在编辑时单独放置
*/
Out = "out",
}
//设备展示类型
export enum FacilityShowType {
Tag,//标签
ModelAndTag,//模型和标签
AreaAndTag,//区域和标签
GdAndTag,//高度和标签
}
/**
* 设备具体类型
*/
export enum FacilityType {
//外部自定义
/**
* 毗邻
*/
PL = "PL",
/**
* 区域
*/
QY = "QY",
/**
* 图片标注
*/
TPBZ = "TPBZ",
/**
* 点位标注
*/
DWBZ = "DWBZ",
//模型内置
/**
* 二氧化碳灭火器 - 4kg
*/
XF_MHQ_PT_4 = "XF_MHQ_PT_4",
/**
* 二氧化碳灭火器 - 8kg
*/
XF_MHQ_PT_8 = "XF_MHQ_PT_8",
/**
* 二氧化碳灭火器 - 35kg (手推)
*/
XF_MHQ_PT_35 = "XF_MHQ_PT_35",
/**
* 干粉灭火器 - 4kg
*/
XF_MHQ_GF_4 = "XF_MHQ_GF_4",
/**
* 干粉灭火器 - 8kg
*/
XF_MHQ_GF_8 = "XF_MHQ_GF_8",
/**
* 干粉灭火器 - 36kg(手推)
*/
XF_MHQ_GF_35 = "XF_MHQ_GF_35",
/**
* 干粉灭火器 - 36kg(手推)
*/
XF_MHQ_GF_25 = "XF_MHQ_GF_25",
/**
* 灭火毯
*/
XF_MHT = "XF_MHT",
/**
* 消防锹
*/
XF_XFQ = "XF_XFQ",
/**
* 消防桶
*/
XF_XFT = "XF_XFT",
/**
* 消防长矛
*/
XF_XFCM = "XF_XFCM",
/**
* 消防斧
*/
XF_XFF = "XF_XFF",
/**
* 消防沙
*/
XF_XFS = "XF_XFS",
/**
* 消防的阻挡物
*/
ZD_XF = "ZD_XF",
/**
* 加油机
*/
JY_JYJ = "JY_JYJ",
/**
* 油罐
*/
JY_YG = "JY_YG",
/**
* 展示油罐是要隐藏的阻挡物
*/
ZD_YG = "ZD_YG",
/**
* 输油管线
*/
JY_SYGX = "JY_SYGX",
/**
* 输油管线阻挡物
*/
ZD_SYGX = "ZD_SYGX",
/**
* 油气回收管线
*/
JY_YQHSGX = "JY_YQHSGX",
/**
* 阀门
*/
JY_FM = "JY_FM",
/**
* 卸油口盖
*/
JY_XYKG = "JY_XYKG",
/**
* 油气回收管线 阻挡物
*/
ZD_YQHSGX = "ZD_YQHSGX",
/**
* 逃生路线
*/
AQSS_TSLX = "AQSS_TSLX",
/**
* 疏散点
*/
AQSS_SSD = "AQSS_SSD",
/**
* 罩棚
*/
ZD_ZP = "ZD_ZP",
}
/**
* 建筑中设备类型
*/
export enum FacilityInBuildingType {
/**
* 消防设备
*/
Facility,
/**
* 加油站相关
*/
Oilling,
/**
* 阻挡物
*/
Stop,
}