rt-graphic-component/components/packages/Platform/THPlatform.js

109 lines
4.0 KiB
JavaScript
Raw Normal View History

2024-01-11 13:38:16 +08:00
import { THConsts } from './common/PlatformConfig.js';
import { JlPlatform, DoorCodeLozenge } from './common/JlPlatform.js';
2024-01-10 17:25:39 +08:00
import { THStation } from '../Station/THStation.js';
2024-01-10 15:46:15 +08:00
class THPlatform extends JlPlatform {
doorCodeLozenge;
constructor() {
super(THConsts);
2024-01-10 16:59:12 +08:00
this.doorCodeLozenge = new DoorCodeLozenge(THConsts);
2024-01-10 15:46:15 +08:00
this.addChild(this.doorCodeLozenge);
}
get states() {
return this.getStates();
}
doRepaint() {
this.rectGraphic.stateFillColor = THConsts.noTrainStop;
if (this.states.trainberth) {
this.rectGraphic.stateFillColor = THConsts.trainStop;
}
if (this.states.upSkipstop || this.states.downSkipstop) {
this.rectGraphic.stateFillColor = THConsts.trainJump;
}
2024-01-11 09:21:44 +08:00
const station = this.getGraphicApp().queryStore.queryByCodeAndType(this.states.rtuId > 9
? '' + this.states.rtuId
: '0' + this.states.rtuId, THStation.Type);
2024-01-10 15:46:15 +08:00
const doorGraphic = this.doorCodeLozenge.doorGraphic;
doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen;
2024-01-11 09:21:44 +08:00
if (!!station?.states.ipRtuStusDown) {
2024-01-10 15:46:15 +08:00
doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue;
2024-01-11 09:21:44 +08:00
}
else if (this.states.psdCut) {
2024-01-10 15:46:15 +08:00
doorGraphic.stateFillColor = THConsts.doorGraphic.doorRed;
}
super.draw();
this.doorCodeLozenge.draw(this.datas.hasdoor, this.datas.direction);
//门的状态
if (this.datas.hasdoor) {
if (this.states.psdOpen) {
doorGraphic.doorCloseGraphic.visible = false;
}
else {
doorGraphic.doorCloseGraphic.visible = true;
}
}
if (this.states.emergstop) {
this.doorCodeLozenge.lozengeGraphic.lozenge.visible = true;
}
else {
this.doorCodeLozenge.lozengeGraphic.lozenge.visible = false;
}
//扣车
const codeGraphic = this.doorCodeLozenge.codeGraphic;
if (this.states.upHold ||
this.states.upOccHold ||
this.states.downHold ||
this.states.downOccHold) {
codeGraphic.character.text = 'H';
codeGraphic.character.visible = true;
codeGraphic.circle.visible = true;
//上行扣车
if (this.states.upHold) {
codeGraphic.character.style.fill = THConsts.codeGraphic.HCharYellow;
}
if (this.states.upOccHold) {
codeGraphic.character.style.fill = THConsts.codeGraphic.HCharWhite;
}
if (this.states.upHold && this.states.upOccHold) {
codeGraphic.character.style.fill = THConsts.codeGraphic.HCharRed;
}
//下行扣车
if (this.states.downHold) {
codeGraphic.character.style.fill = THConsts.codeGraphic.HCharYellow;
}
if (this.states.downOccHold) {
codeGraphic.character.style.fill = THConsts.codeGraphic.HCharWhite;
}
if (this.states.downHold && this.states.downOccHold) {
codeGraphic.character.style.fill = THConsts.codeGraphic.HCharRed;
}
}
//运行等级
if (this.states.nextSectionRunLevel) {
codeGraphic.runLevel.visible = false;
codeGraphic.runLevel.text = this.states.nextSectionRunLevel;
}
//运行时间
if (this.states.nextSectionRunTime) {
codeGraphic.runTime.visible = true;
codeGraphic.runTime.text = this.states.nextSectionRunTime;
}
//停站时间
if (this.states.stopTime) {
codeGraphic.stopTime.visible = true;
codeGraphic.stopTime.text = this.states.stopTime;
}
}
2024-01-10 17:25:39 +08:00
buildRelation() {
2024-01-11 09:21:44 +08:00
super.buildCommonRelation();
2024-01-10 17:25:39 +08:00
}
saveRelations() {
2024-01-11 09:21:44 +08:00
super.saveCommonRelations();
2024-01-10 17:25:39 +08:00
}
loadRelations() {
2024-01-11 09:21:44 +08:00
super.loadCommonRelations();
2024-01-10 17:25:39 +08:00
}
2024-01-10 15:46:15 +08:00
}
export { THPlatform };