|
|
|
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 {
|
|
|
|
static readonly c_resPath_assetsRoot = 'assets/'; //资源根目录
|
|
|
|
|
|
|
|
static readonly c_resPath_institutionsRoot = 'institutions/'; //单位
|
|
|
|
static readonly c_reaPath_facilityProperty = "facilityProperty";//设备属性资源(一般是图片)
|
|
|
|
static readonly c_resPath_facilitiesRoot = 'facilities/'; //设备资源
|
|
|
|
static readonly c_resPath_facilityIcon = "images/facility/";// 设备icon
|
|
|
|
|
|
|
|
|
|
|
|
static readonly c_size_facilityIconSize = 40;//设备icon的大小
|
|
|
|
|
|
|
|
static readonly c_time_longPress = 500;//长按时间(毫秒)
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取设备资源完整路径(从assets子目录开始)
|
|
|
|
* @param facilityPosType
|
|
|
|
* @param type
|
|
|
|
*/
|
|
|
|
static getResPath_facility(facilityPosType: FacilityPosType, type: FacilityType): string {
|
|
|
|
let result = "mesh/facilities/";
|
|
|
|
|
|
|
|
// result += facilityPosType.toString() + "/";
|
|
|
|
|
|
|
|
result += (type).toLocaleLowerCase();
|
|
|
|
result += "/";
|
|
|
|
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:
|
|
|
|
case FacilityType.JY_JYJ://临时
|
|
|
|
case FacilityType.JY_YG://临时
|
|
|
|
result = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (TsTool.stringContain(type, "XF_")) {
|
|
|
|
result = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取设备icon的url
|
|
|
|
* @param type 设备的类型
|
|
|
|
* @param pos 设备的位置(室内还是室外)
|
|
|
|
*/
|
|
|
|
static getFacilityIconUrl(type: FacilityType, pos: FacilityPosType): string {
|
|
|
|
|
|
|
|
let result = ConfigManager.c_resPath_assetsRoot + "images/facility/" + pos + '/' + type + ".png";
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据设备类型获取名称
|
|
|
|
* @param type 设备类型
|
|
|
|
*/
|
|
|
|
static getFacilityTypeName(type: FacilityType): string {
|
|
|
|
let result = "未知";
|
|
|
|
switch (type) {
|
|
|
|
//自定义放置
|
|
|
|
case FacilityType.PL: result = "毗邻"; break;
|
|
|
|
case FacilityType.QY: result = "区域"; break;
|
|
|
|
case FacilityType.TPBZ: result = "图片"; break;
|
|
|
|
case FacilityType.DWBZ: result = "点位"; break;
|
|
|
|
//内建
|
|
|
|
case FacilityType.XF_MHQ_PT_4: result = "4kg普通灭火器"; break;
|
|
|
|
case FacilityType.XF_MHQ_PT_8: result = "8kg普通灭火器"; break;
|
|
|
|
case FacilityType.XF_MHQ_PT_35: result = "35kg普通灭火器"; break;
|
|
|
|
case FacilityType.XF_MHQ_GF_4: result = "4kg干粉灭火器"; break;
|
|
|
|
case FacilityType.XF_MHQ_GF_8: result = "8kg干粉灭火器"; break;
|
|
|
|
case FacilityType.XF_MHQ_GF_35: result = "35kg干粉灭火器"; break;
|
|
|
|
case FacilityType.XF_MHT: result = "灭火毯"; break;
|
|
|
|
case FacilityType.XF_XFQ: result = "消防锹"; break;
|
|
|
|
case FacilityType.XF_XFT: result = "消防桶"; break;
|
|
|
|
case FacilityType.XF_XFCM: result = "消防长矛"; break;
|
|
|
|
case FacilityType.XF_XFF: result = "消防斧"; break;
|
|
|
|
case FacilityType.XF_XFS: result = "消防沙"; break;
|
|
|
|
case FacilityType.JY_JYJ: result = "加油机"; break;
|
|
|
|
case FacilityType.JY_YG: result = "油罐"; break;
|
|
|
|
case FacilityType.JY_SYGX: result = "输油管线"; break;
|
|
|
|
case FacilityType.JY_YQHSGX: result = "油气回收管线"; break;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询某设备所处位置类型(室内还是室外)
|
|
|
|
* @param facilityType
|
|
|
|
*/
|
|
|
|
static getPosType(facilityType: FacilityType): FacilityPosType {
|
|
|
|
let result = FacilityPosType.In;
|
|
|
|
|
|
|
|
switch (facilityType) {
|
|
|
|
case FacilityType.PL:
|
|
|
|
case FacilityType.QY:
|
|
|
|
case FacilityType.TPBZ:
|
|
|
|
case FacilityType.DWBZ: result = FacilityPosType.Out; break;
|
|
|
|
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//#region 事态标绘
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 事态标绘的名称配置
|
|
|
|
*/
|
|
|
|
static s_markName = new Map<MarkType, string>([
|
|
|
|
|
|
|
|
[MarkType.SYD, "伤员"],
|
|
|
|
[MarkType.DT, "歹徒"],
|
|
|
|
[MarkType.LYX, "漏油(小)"],
|
|
|
|
[MarkType.LYD, "漏油(大)"],
|
|
|
|
[MarkType.H, "火(大)"],
|
|
|
|
[MarkType.SNH, "火(小)"],
|
|
|
|
[MarkType.YWA, "烟雾(大)"],
|
|
|
|
[MarkType.YWB, "烟雾(小)"],
|
|
|
|
[MarkType.MHF, "消防员"],
|
|
|
|
[MarkType.PMC, "泡沫车"],
|
|
|
|
[MarkType.GA, "公安"],
|
|
|
|
[MarkType.JJ, "交警"],
|
|
|
|
[MarkType.YS, "医生"],
|
|
|
|
[MarkType.JHC, "救护车"],
|
|
|
|
[MarkType.JC, "警车"],
|
|
|
|
[MarkType.GK, "顾客"],
|
|
|
|
[MarkType.JCA, "轿车"],
|
|
|
|
[MarkType.JL, "经理"],
|
|
|
|
[MarkType.ZG, "主管"],
|
|
|
|
[MarkType.SYY, "收银员"],
|
|
|
|
[MarkType.JYY, "加油员"],
|
|
|
|
[MarkType.XYY, "卸油员"],
|
|
|
|
[MarkType.XFSD, "消防沙(堆)"],
|
|
|
|
[MarkType.XFSQ, "消防沙(圈)"],
|
|
|
|
[MarkType.XFT, "消防桶"],
|
|
|
|
[MarkType.JJX, "警戒线"],
|
|
|
|
[MarkType.JGLX, "进攻路线"],
|
|
|
|
[MarkType.CT, "撤退"],
|
|
|
|
[MarkType.WZ, "文字"],
|
|
|
|
[MarkType.QYSDA, "区域设定"],
|
|
|
|
[MarkType.QYSDB, "区域设定"],
|
|
|
|
]);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取事态标绘素材的名称
|
|
|
|
* @param type
|
|
|
|
*/
|
|
|
|
static getMarkName(type: MarkType) {
|
|
|
|
if (ConfigManager.s_markName.has(type)) {
|
|
|
|
return ConfigManager.s_markName.get(type);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return "未知";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取事态标绘模型的路径
|
|
|
|
* @param type
|
|
|
|
* @param pos
|
|
|
|
*/
|
|
|
|
static getMarkModelPath(pos: MarkTagPos, type: MarkType): string {
|
|
|
|
|
|
|
|
let result = "mesh/mark/" + pos.toLocaleLowerCase() + "/" + type.toLocaleLowerCase() + "/";
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取事态标绘素材的图标
|
|
|
|
* @param type
|
|
|
|
* @param pos
|
|
|
|
*/
|
|
|
|
static getMarkIconUrl(pos: MarkTagPos, type: MarkType): string {
|
|
|
|
|
|
|
|
let result = ConfigManager.c_resPath_assetsRoot + "images/mark/" + pos.toLocaleLowerCase() + "/" + type.toLocaleLowerCase() + ".png";
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
}
|