rt-graphic-component/components/Platform/XiAnPlatform.js
2024-01-02 14:36:14 +08:00

103 lines
4.0 KiB
JavaScript

import { XiAnConsts } from './PlatformConfig.js';
import { JlPlatform } from './JlPlatform.js';
class XiAnPlatform extends JlPlatform {
constructor(categoryType) {
super(categoryType);
}
get states() {
return this.getStates();
}
doRepaint() {
this.rectGraphic.stateFillColor = XiAnConsts.noTrainStop;
if (this.states.trainberth) {
this.rectGraphic.stateFillColor = XiAnConsts.trainStop;
}
if (this.states.upSkipstop || this.states.downSkipstop) {
this.rectGraphic.stateFillColor = XiAnConsts.trainJump;
}
/* const station = this.getGraphicApp().queryStore.queryByCodeAndType<Station>(
this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId,
Station.Type
); */
if (this.doorGraphic) {
this.doorGraphic.stateFillColor = XiAnConsts.doorGraphic.doorGreen;
/* if (!!station?.states.ipRtuStusDown) {
this.doorGraphic.stateFillColor = XiAnConsts.doorGraphic.doorBlue;
} */ if (this.states.psdCut) {
this.doorGraphic.stateFillColor = XiAnConsts.doorGraphic.doorRed;
}
}
super.doRepaint();
if (this.doorGraphic) {
if (this.states.psdOpen) {
this.doorGraphic.doorCloseGraphic.visible = false;
}
else {
this.doorGraphic.doorCloseGraphic.visible = true;
}
}
if (this.lozengeGraphic) {
if (this.states.emergstop) {
this.lozengeGraphic.lozenge.visible = true;
}
else {
this.lozengeGraphic.lozenge.visible = false;
}
}
if (this.codeGraphic) {
if (this.states.upHold ||
this.states.upOccHold ||
this.states.downHold ||
this.states.downOccHold) {
this.codeGraphic.character.text = 'H';
this.codeGraphic.character.visible = true;
this.codeGraphic.circle.visible = true;
//上行扣车
if (this.states.upHold) {
this.codeGraphic.character.style.fill =
XiAnConsts.codeGraphic.HCharYellow;
}
if (this.states.upOccHold) {
this.codeGraphic.character.style.fill =
XiAnConsts.codeGraphic.HCharWhite;
}
if (this.states.upHold && this.states.upOccHold) {
this.codeGraphic.character.style.fill =
XiAnConsts.codeGraphic.HCharRed;
}
//下行扣车
if (this.states.downHold) {
this.codeGraphic.character.style.fill =
XiAnConsts.codeGraphic.HCharYellow;
}
if (this.states.downOccHold) {
this.codeGraphic.character.style.fill =
XiAnConsts.codeGraphic.HCharWhite;
}
if (this.states.downHold && this.states.downOccHold) {
this.codeGraphic.character.style.fill =
XiAnConsts.codeGraphic.HCharRed;
}
}
//运行等级
if (this.states.nextSectionRunLevel) {
this.codeGraphic.runLevel.visible = false;
this.codeGraphic.runLevel.text = this.states.nextSectionRunLevel;
}
//运行时间
if (this.states.nextSectionRunTime) {
this.codeGraphic.runTime.visible = true;
this.codeGraphic.runTime.text = this.states.nextSectionRunTime;
}
//停站时间
if (this.states.stopTime) {
this.codeGraphic.stopTime.visible = true;
this.codeGraphic.stopTime.text = this.states.stopTime;
}
}
}
}
export { XiAnPlatform };