From 857bbb8347667a52cc5f2318daabe31c6921b2da Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 16 Jul 2024 12:39:25 +0200 Subject: [PATCH] wip: front: create node transitions in NGE --- .../components/MacroEditor/import.ts | 12 ++++++++++++ .../components/MacroEditor/types.ts | 9 ++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/front/src/applications/operationalStudies/components/MacroEditor/import.ts b/front/src/applications/operationalStudies/components/MacroEditor/import.ts index 18749e5d0de..d21a1cf1985 100644 --- a/front/src/applications/operationalStudies/components/MacroEditor/import.ts +++ b/front/src/applications/operationalStudies/components/MacroEditor/import.ts @@ -241,6 +241,18 @@ const importTimetable = async ( return port; }; + let transitionId = 0; + const createTransition = (port1Id: number, port2Id: number) => { + const transition = { + id: transitionId, + port1Id, + port2Id, + isNonStopTransit: false, + }; + transitionId += 1; + return transition; + }; + let trainrunSectionId = 0; const trainrunSections: TrainrunSection[] = trainSchedules .map((trainSchedule) => { diff --git a/front/src/applications/operationalStudies/components/MacroEditor/types.ts b/front/src/applications/operationalStudies/components/MacroEditor/types.ts index 31c494e1d66..a3b93e705f0 100644 --- a/front/src/applications/operationalStudies/components/MacroEditor/types.ts +++ b/front/src/applications/operationalStudies/components/MacroEditor/types.ts @@ -14,7 +14,7 @@ export type Node = { positionX: number; positionY: number; ports: Port[]; - transitions: unknown[]; + transitions: Transition[]; connections: unknown[]; resourceId: number; /** Number of tracks where train can stop */ @@ -34,6 +34,13 @@ export type Port = { trainrunSectionId: number; }; +export type Transition = { + id: number; + port1Id: number; + port2Id: number; + isNonStopTransit: boolean; +}; + export enum PortAlignment { Top, Bottom,