Skip to content

Commit febb488

Browse files
committed
add isTrainrunTargetRightOrBottom()
Signed-off-by: Louis Greiner <[email protected]>
1 parent 9184f79 commit febb488

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/app/services/data/trainrun.service.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,29 @@ export class TrainrunService {
931931
return labelIDCauntMap;
932932
}
933933

934+
isTrainrunTargetRightOrBottom(): boolean {
935+
if (!this.getSelectedTrainrun()) {
936+
return false;
937+
}
938+
const firstNode = this.getFirstTrainrunSection(this.getSelectedTrainrun()).getSourceNode();
939+
const lastNode = this.getLastTrainrunSection(this.getSelectedTrainrun()).getTargetNode();
940+
return GeneralViewFunctions.getRightOrBottomNode(firstNode, lastNode) === lastNode;
941+
}
942+
943+
getLeftOrTopExtremitySection(): TrainrunSection {
944+
if (!this.getSelectedTrainrun()) {
945+
return null;
946+
}
947+
948+
const bothEndNodes = this.getBothEndNodesWithTrainrunId(this.getSelectedTrainrun().getId());
949+
const leftOrTopNode = GeneralViewFunctions.getLeftOrTopNode(
950+
bothEndNodes.endNode1,
951+
bothEndNodes.endNode2,
952+
);
953+
954+
return leftOrTopNode.getExtremityTrainrunSection(this.getSelectedTrainrun().getId());
955+
}
956+
934957
getSbbArrowForTrainrunSectionDirection(): string {
935958
if (!this.getSelectedTrainrun() || this.getSelectedTrainrun().isRoundTrip()) {
936959
return "arrows-left-right-medium";

0 commit comments

Comments
 (0)