rt-graphic-component/components/packages/Platform/THPlatform.js
joylink_zhaoerwei 3c81ca8a83 重新打包
2024-01-11 13:38:16 +08:00

109 lines
4.0 KiB
JavaScript

import { THConsts } from './common/PlatformConfig.js';
import { JlPlatform, DoorCodeLozenge } from './common/JlPlatform.js';
import { THStation } from '../Station/THStation.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(this.states.rtuId > 9
? '' + this.states.rtuId
: '0' + this.states.rtuId, THStation.Type);
const doorGraphic = this.doorCodeLozenge.doorGraphic;
doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen;
if (!!station?.states.ipRtuStusDown) {
doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue;
}
else 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;
}
}
buildRelation() {
super.buildCommonRelation();
}
saveRelations() {
super.saveCommonRelations();
}
loadRelations() {
super.loadCommonRelations();
}
}
export { THPlatform };