import { THConsts } from './common/PlatformConfig.js'; import { JlPlatform, DoorGraphic, CodeGraphic, LozengeGraphic } from './common/JlPlatform.js'; import { THStation } from '../Station/THStation.js'; class THPlatform extends JlPlatform { doorGraphic; codeGraphic; lozengeGraphic; constructor() { super(THConsts); this.doorGraphic = new DoorGraphic(THConsts); this.addChild(this.doorGraphic); this.codeGraphic = new CodeGraphic(THConsts); this.addChild(this.codeGraphic); this.lozengeGraphic = new LozengeGraphic(THConsts); this.addChild(this.lozengeGraphic); } 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.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.doorGraphic.draw(); this.codeGraphic.draw(); this.lozengeGraphic.draw(); if (this.datas.direction == 'down') { this.doorGraphic.changePosition(this.position); this.codeGraphic.changePosition(this.position); this.lozengeGraphic.changePosition(this.position); } //门的状态 if (this.datas.hasdoor) { if (this.states.psdOpen) { doorGraphic.doorCloseGraphic.visible = false; } else { doorGraphic.doorCloseGraphic.visible = true; } } if (this.states.emergstop) { this.lozengeGraphic.lozenge.visible = true; } else { this.lozengeGraphic.lozenge.visible = false; } //扣车 const codeGraphic = this.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 };