rt-graphic-component/components/packages/Platform/THPlatform.js
joylink_zhaoerwei a08ef74550 站台微调
2024-01-10 16:59:12 +08:00

99 lines
3.7 KiB
JavaScript

import { THConsts } from './PlatformConfig.js';
import { JlPlatform, DoorCodeLozenge } from './JlPlatform.js';
class THPlatform extends JlPlatform {
doorCodeLozenge;
constructor() {
super(THConsts);
this.doorCodeLozenge = new DoorCodeLozenge(THConsts);
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;
}
/* const station = this.getGraphicApp().queryStore.queryByCodeAndType<Station>(
this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId,
Station.Type
); */
const doorGraphic = this.doorCodeLozenge.doorGraphic;
doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen;
/* if (!!station?.states.ipRtuStusDown) {
doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue;
} */ if (this.states.psdCut) {
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;
}
}
}
export { THPlatform };