rt-graphic-component/components/common/common.js

50 lines
1.7 KiB
JavaScript
Raw Normal View History

2024-01-04 10:40:55 +08:00
var DevicePort;
(function (DevicePort) {
2024-01-04 15:14:25 +08:00
DevicePort["A"] = "A";
DevicePort["B"] = "B";
DevicePort["C"] = "C";
2024-01-04 10:40:55 +08:00
})(DevicePort || (DevicePort = {}));
var DeviceType;
(function (DeviceType) {
DeviceType[DeviceType["Section"] = 0] = "Section";
DeviceType[DeviceType["Turnout"] = 1] = "Turnout";
DeviceType[DeviceType["TrainWindow"] = 2] = "TrainWindow";
DeviceType[DeviceType["AxleCounting"] = 3] = "AxleCounting";
DeviceType[DeviceType["SectionLink"] = 4] = "SectionLink";
DeviceType[DeviceType["Signal"] = 5] = "Signal";
DeviceType[DeviceType["Station"] = 6] = "Station";
DeviceType[DeviceType["ScreenDoor"] = 7] = "ScreenDoor";
DeviceType[DeviceType["SignalFaultAlarm"] = 8] = "SignalFaultAlarm";
DeviceType[DeviceType["Breakers"] = 9] = "Breakers";
DeviceType[DeviceType["PowerScreen"] = 10] = "PowerScreen";
})(DeviceType || (DeviceType = {}));
var Direction;
(function (Direction) {
Direction[Direction["LEFT"] = 0] = "LEFT";
Direction[Direction["RIGHT"] = 1] = "RIGHT";
})(Direction || (Direction = {}));
var IRelatedRef;
(function (IRelatedRef) {
function create(type, id, port) {
const typeNum = Object.keys(DeviceType).indexOf(type);
if (typeNum < 0)
throw Error('Invalid device type');
return {
deviceType: typeNum,
id,
devicePort: port,
};
}
IRelatedRef.create = create;
})(IRelatedRef || (IRelatedRef = {}));
function protoPort2Data(port) {
if (port === DevicePort.A)
return 'A';
if (port === DevicePort.B)
return 'B';
if (port === DevicePort.C)
return 'C';
}
export { DevicePort, DeviceType, Direction, IRelatedRef, protoPort2Data };