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.
279 lines
6.3 KiB
279 lines
6.3 KiB
3 years ago
|
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/assets/babylon/controller/data-manager";
|
||
|
|
||
|
//设备数据
|
||
|
export class ModelData_facility extends ModelData {
|
||
|
posType: FacilityPosType = FacilityPosType.Outdoor;//位置类型
|
||
|
|
||
|
facilityType: FacilityType = FacilityType.AQCK;//具体设备类别
|
||
|
@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 = DataManager.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 = 10;
|
||
|
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.AQCK:
|
||
|
case FacilityType.DSXHS:
|
||
|
case FacilityType.DXXHS:
|
||
|
case FacilityType.SZDXXHS:
|
||
|
case FacilityType.SZDSXHS:
|
||
|
case FacilityType.DSSBJHQ:
|
||
|
case FacilityType.DXSBJHQ:
|
||
|
case FacilityType.QBSBJHQ:
|
||
|
case FacilityType.DGNSBJHQ:
|
||
|
|
||
|
case FacilityType.PL:
|
||
|
case FacilityType.TPBZ:
|
||
|
|
||
|
case FacilityType.XKS:
|
||
|
case FacilityType.BF:
|
||
|
case FacilityType.SX:
|
||
|
case FacilityType.LSXFB:
|
||
|
case FacilityType.WSXFB:
|
||
|
case FacilityType.CYXFB:
|
||
|
case FacilityType.SNXHS:
|
||
|
case FacilityType.FHM:
|
||
|
case FacilityType.HT:
|
||
|
case FacilityType.PTDT:
|
||
|
case FacilityType.XFDT:
|
||
|
case FacilityType.SSLT:
|
||
|
case FacilityType.FHJL: result = FacilityShowType.ModelAndTag; break;//展示模型和标签
|
||
|
|
||
|
case FacilityType.JTQ:
|
||
|
case FacilityType.JJQ:
|
||
|
case FacilityType.FHFQ: result = FacilityShowType.AreaAndTag; break;//展示可编辑多边形
|
||
|
case FacilityType.GD: result = FacilityShowType.GdAndTag; break;//展示高度和标签
|
||
|
}
|
||
|
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
//设备位置类型(室内还是室外)
|
||
|
export enum FacilityPosType {
|
||
|
Indoor = "indoor", //室内
|
||
|
Outdoor = "outdoor", //室外
|
||
|
Public = "public",//共有
|
||
|
}
|
||
|
|
||
|
//设备展示类型
|
||
|
export enum FacilityShowType {
|
||
|
Tag,//标签
|
||
|
ModelAndTag,//模型和标签
|
||
|
AreaAndTag,//区域和标签
|
||
|
GdAndTag,//高度和标签
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* 设备具体类型
|
||
|
*/
|
||
|
export enum FacilityType {
|
||
|
//室外
|
||
|
/**
|
||
|
* 安全出口
|
||
|
*/
|
||
|
AQCK = "AQCK",
|
||
|
/**
|
||
|
* 地上消火栓
|
||
|
*/
|
||
|
DSXHS = "DSXHS",
|
||
|
/**
|
||
|
* 地下消火栓
|
||
|
*/
|
||
|
DXXHS = "DXXHS",
|
||
|
/**
|
||
|
* 市政地上消火栓
|
||
|
*/
|
||
|
SZDSXHS = "SZDSXHS",
|
||
|
/**
|
||
|
* 市政地下消火栓
|
||
|
*/
|
||
|
SZDXXHS = "SZDXXHS",
|
||
|
/**
|
||
|
* 地上水泵接合器
|
||
|
*/
|
||
|
DSSBJHQ = "DSSBJHQ",
|
||
|
/**
|
||
|
* 地下水泵接合器
|
||
|
*/
|
||
|
DXSBJHQ = "DXSBJHQ",
|
||
|
/**
|
||
|
* 墙壁水泵接合器
|
||
|
*/
|
||
|
QBSBJHQ = "QBSBJHQ",
|
||
|
/**
|
||
|
* 多功能水泵接合器
|
||
|
*/
|
||
|
DGNSBJHQ = "DGNSBJHQ",
|
||
|
|
||
|
/**
|
||
|
* 高度
|
||
|
*/
|
||
|
GD = "GD",
|
||
|
/**
|
||
|
* 毗邻
|
||
|
*/
|
||
|
PL = "PL",
|
||
|
/**
|
||
|
* 禁停区
|
||
|
*/
|
||
|
JTQ = "JTQ",
|
||
|
/**
|
||
|
* 集结区
|
||
|
*/
|
||
|
JJQ = "JJQ",
|
||
|
/**
|
||
|
* 图片标注
|
||
|
*/
|
||
|
TPBZ = "TPBZ",//
|
||
|
|
||
|
//室内
|
||
|
/**
|
||
|
* 消控室
|
||
|
*/
|
||
|
XKS = "XKS",
|
||
|
/**
|
||
|
* 泵房
|
||
|
*/
|
||
|
BF = "BF",
|
||
|
/**
|
||
|
* 水箱
|
||
|
*/
|
||
|
SX = "SX",
|
||
|
/**
|
||
|
* 立式消防泵
|
||
|
*/
|
||
|
LSXFB = "LSXFB",
|
||
|
/**
|
||
|
* 卧式消防泵
|
||
|
*/
|
||
|
WSXFB = "WSXFB",
|
||
|
/**
|
||
|
* 柴油消防泵
|
||
|
*/
|
||
|
CYXFB = "CYXFB",
|
||
|
/**
|
||
|
* 室内消火栓
|
||
|
*/
|
||
|
SNXHS = "SNXHS",
|
||
|
/**
|
||
|
* 防火门
|
||
|
*/
|
||
|
FHM = "FHM",
|
||
|
/**
|
||
|
* 防火卷帘
|
||
|
*/
|
||
|
FHJL = "FHJL",
|
||
|
|
||
|
/**
|
||
|
* 疏散楼梯
|
||
|
*/
|
||
|
SSLT = "SSLT",
|
||
|
/**
|
||
|
* 消防电梯
|
||
|
*/
|
||
|
XFDT = "XFDT",
|
||
|
/**
|
||
|
* 普通电梯
|
||
|
*/
|
||
|
PTDT = "PTDT",
|
||
|
/**
|
||
|
* 货梯
|
||
|
*/
|
||
|
HT = "HT",
|
||
|
/**
|
||
|
* 避难层
|
||
|
*/
|
||
|
BNC = "BNC",
|
||
|
/**
|
||
|
* 危险源
|
||
|
*/
|
||
|
WXY = "WXY",
|
||
|
/**
|
||
|
* 重点区域
|
||
|
*/
|
||
|
ZDQY = "ZDQY",
|
||
|
/**
|
||
|
* 点位标注
|
||
|
*/
|
||
|
DWBZ = "DWBZ",
|
||
|
|
||
|
/**
|
||
|
* 防火分区
|
||
|
*/
|
||
|
FHFQ = "FHFQ",
|
||
|
}
|