rt-graphic-component/components/packages/Transponder/TransponderConfig.js
2024-01-04 10:44:03 +08:00

82 lines
3.6 KiB
JavaScript

var TransponderTypeEnum;
(function (TransponderTypeEnum) {
TransponderTypeEnum[TransponderTypeEnum["FB"] = 0] = "FB";
TransponderTypeEnum[TransponderTypeEnum["WB"] = 1] = "WB";
TransponderTypeEnum[TransponderTypeEnum["DB"] = 2] = "DB";
TransponderTypeEnum[TransponderTypeEnum["VB"] = 3] = "VB";
TransponderTypeEnum[TransponderTypeEnum["IB"] = 4] = "IB";
})(TransponderTypeEnum || (TransponderTypeEnum = {}));
function getTypePoints(type, TrConsts) {
const transponderTypePoints = {
[TransponderTypeEnum.FB]: [
[-TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, -TrConsts.height / 2 - TrConsts.lineWidth / 2],
[-TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, TrConsts.height / 2],
[TrConsts.height / 2, -TrConsts.height / 2],
[-TrConsts.height / 2, TrConsts.height / 2],
],
[TransponderTypeEnum.WB]: [
[-TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, -TrConsts.height / 2 - TrConsts.lineWidth / 2],
[0, -TrConsts.height / 2],
[0, TrConsts.height / 2],
[TrConsts.height / 2, 0],
[-TrConsts.height / 2, 0],
],
[TransponderTypeEnum.DB]: [
[-TrConsts.height, -TrConsts.height / 2],
[TrConsts.height, -TrConsts.height / 2],
[TrConsts.height, TrConsts.height / 2],
[-TrConsts.height, TrConsts.height / 2],
[-TrConsts.height, -TrConsts.height / 2 - TrConsts.lineWidth / 2],
[-TrConsts.height, -TrConsts.height / 2],
[TrConsts.height, TrConsts.height / 2],
[TrConsts.height, -TrConsts.height / 2],
[-TrConsts.height, TrConsts.height / 2],
],
[TransponderTypeEnum.VB]: [
[-TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, -TrConsts.height / 2 - TrConsts.lineWidth / 2],
],
[TransponderTypeEnum.IB]: [
[-TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, -TrConsts.height / 2 - TrConsts.lineWidth / 2],
[0, -TrConsts.height / 2],
[-TrConsts.height / 2, 0],
[-TrConsts.height / 2, TrConsts.height / 2],
[TrConsts.height / 2, -TrConsts.height / 2 + TrConsts.lineWidth / 2],
[TrConsts.height / 2, 0],
[0, TrConsts.height / 2],
],
};
return transponderTypePoints[type];
}
function getTransponderConsts() {
const transponderConsts = {
height: 12,
lineWidth: 2,
lineColor: '0xFFFFFF',
wblineColor: '0xFF0000',
textFontSize: 12,
textMarginY: 5, // 名称与应答器的距离
vblineColor: '0xFF00FF',
iblineColor: '0x0000FF',
};
return transponderConsts;
}
export { TransponderTypeEnum, getTransponderConsts, getTypePoints };