列车计算车次窗调整

This commit is contained in:
fan 2023-08-04 15:55:15 +08:00
parent 5fb9bb0e3c
commit d684043743

View File

@ -13,6 +13,7 @@ import { state } from 'src/protos/device_status';
import { TrainWindow } from '../trainWindow/TrainWindow';
import { Turnout } from '../turnout/Turnout';
import { LogicSection } from '../logicSection/LogicSection';
import { Section } from '../section/Section';
export interface ITrainData extends GraphicData {
get code(): string; // 车号
@ -201,7 +202,7 @@ export class TrainHead extends Container {
aColor = DiriveModelColorEnum.RM;
pColor = DiriveModelColorEnum.RM;
}
if (states.mode?.ipModeTrainBerthed) {
if (states.mode?.ipModeTrainStoped) {
this.pause.lineStyle(pauseW, pColor, 1);
this.pause.moveTo(pausePoint[0], pausePoint[1]);
this.pause.lineTo(pausePoint[2], pausePoint[3]);
@ -405,14 +406,28 @@ export class Train extends JlGraphic {
this.states.devName,
deviceTypeString.get(this.states.devType)
);
const windowRelations = dev?.queryRelationByType(TrainWindow.Type);
if (!windowRelations || !windowRelations.length || !dev) {
if (!dev) {
return;
}
const p = windowRelations[0]
?.getOtherGraphic<TrainWindow>(dev)
.getPositionOnCanvas();
let window = null;
if (dev.type === Turnout.Type) {
const sectionRelations = dev.queryRelationByType(Section.Type);
const sectionRel = sectionRelations.find((relation) => {
const sec = relation.getOtherGraphic<Section>(dev);
return sec.datas.children.includes(dev.datas.id);
});
const section = sectionRel?.getOtherGraphic<Section>(dev);
if (section) {
const windowRelations = section.queryRelationByType(TrainWindow.Type);
window = windowRelations[0]?.getOtherGraphic<TrainWindow>(section);
}
} else {
const windowRelations = dev.queryRelationByType(TrainWindow.Type);
window = windowRelations[0]?.getOtherGraphic<TrainWindow>(dev);
}
const p = window?.getPositionOnCanvas();
if (!p) {
console.error('或获取到列车位置');
return;
}