diff --git a/core/kt-osrd-rjs-parser/src/main/kotlin/fr/sncf/osrd/RawInfraRJSParser.kt b/core/kt-osrd-rjs-parser/src/main/kotlin/fr/sncf/osrd/RawInfraRJSParser.kt index 4391ecec06e..cbb0c08c8c8 100644 --- a/core/kt-osrd-rjs-parser/src/main/kotlin/fr/sncf/osrd/RawInfraRJSParser.kt +++ b/core/kt-osrd-rjs-parser/src/main/kotlin/fr/sncf/osrd/RawInfraRJSParser.kt @@ -797,6 +797,10 @@ fun parseRJSInfra(rjsInfra: RJSInfra): RawInfra { props["chLongLabel"] = sncf.chLongLabel props["trigram"] = sncf.trigram } + val weight = operationalPoint.weight + if (weight != null) { + props["weight"] = weight + } if (opPart.extensions?.sncf != null) props["kp"] = opPart.extensions!!.sncf!!.kp val partId = builder.operationalPointPart( diff --git a/core/osrd-railjson/src/main/java/fr/sncf/osrd/railjson/schema/infra/RJSOperationalPoint.java b/core/osrd-railjson/src/main/java/fr/sncf/osrd/railjson/schema/infra/RJSOperationalPoint.java index 6800efe54b4..f4f395793fe 100644 --- a/core/osrd-railjson/src/main/java/fr/sncf/osrd/railjson/schema/infra/RJSOperationalPoint.java +++ b/core/osrd-railjson/src/main/java/fr/sncf/osrd/railjson/schema/infra/RJSOperationalPoint.java @@ -14,11 +14,15 @@ public class RJSOperationalPoint implements Identified { @Nullable public RJSOperationalPointExtensions extensions; + @Nullable + public String weight; + public RJSOperationalPoint( - String id, List parts, @Nullable RJSOperationalPointExtensions extensions) { + String id, List parts, @Nullable RJSOperationalPointExtensions extensions, @Nullable String weight) { this.id = id; this.parts = parts; this.extensions = extensions; + this.weight = weight; } @Override diff --git a/core/src/main/kotlin/fr/sncf/osrd/api/api_v2/path_properties/PathPropResponse.kt b/core/src/main/kotlin/fr/sncf/osrd/api/api_v2/path_properties/PathPropResponse.kt index 8267422efea..2ca9d675556 100644 --- a/core/src/main/kotlin/fr/sncf/osrd/api/api_v2/path_properties/PathPropResponse.kt +++ b/core/src/main/kotlin/fr/sncf/osrd/api/api_v2/path_properties/PathPropResponse.kt @@ -32,7 +32,8 @@ data class OperationalPointResponse( val id: String, val part: OperationalPointPartResponse, val extensions: OperationalPointExtensions?, - val position: Offset + val position: Offset, + val weight: Long? ) data class OperationalPointPartResponse( diff --git a/core/src/main/kotlin/fr/sncf/osrd/api/api_v2/path_properties/PathPropResponseConverter.kt b/core/src/main/kotlin/fr/sncf/osrd/api/api_v2/path_properties/PathPropResponseConverter.kt index 8b7a7fd2b67..c45b6dd6c51 100644 --- a/core/src/main/kotlin/fr/sncf/osrd/api/api_v2/path_properties/PathPropResponseConverter.kt +++ b/core/src/main/kotlin/fr/sncf/osrd/api/api_v2/path_properties/PathPropResponseConverter.kt @@ -101,8 +101,9 @@ private fun makeOperationalPoints( val opExtensions = if (opSncfExtension == null && opIdExtension == null) null else OperationalPointExtensions(opSncfExtension, opIdExtension) + val weight = if (opPartProps["weight"] == null) null else opPartProps["weight"]!!.toLong() val opResult = - OperationalPointResponse(operationalPointId, opPartResult, opExtensions, offset) + OperationalPointResponse(operationalPointId, opPartResult, opExtensions, offset, weight) res.add(opResult) } return res diff --git a/editoast/openapi.yaml b/editoast/openapi.yaml index df21a9065db..d494fc93178 100644 --- a/editoast/openapi.yaml +++ b/editoast/openapi.yaml @@ -8010,6 +8010,7 @@ components: - id - part - position + - weight properties: extensions: $ref: '#/components/schemas/OperationalPointExtensions' @@ -8024,6 +8025,12 @@ components: format: int64 description: Distance from the beginning of the path in mm minimum: 0 + weight: + type: integer + format: int32 + description: Importance of the operational point + nullable: true + minimum: 0 description: Operational points along the path nullable: true slopes: diff --git a/editoast/src/core/path_properties.rs b/editoast/src/core/path_properties.rs index e298d8adbc5..4581e1c7548 100644 --- a/editoast/src/core/path_properties.rs +++ b/editoast/src/core/path_properties.rs @@ -78,6 +78,9 @@ pub struct OperationalPointOnPath { extensions: OperationalPointExtensions, /// Distance from the beginning of the path in mm position: u64, + /// Importance of the operational point + #[schema(required)] + weight: Option, } /// Zones along a path. Each value is associated to a range of the path. diff --git a/front/src/applications/operationalStudies/__tests__/sampleData.ts b/front/src/applications/operationalStudies/__tests__/sampleData.ts index a7d314b1168..5e0c1a90439 100644 --- a/front/src/applications/operationalStudies/__tests__/sampleData.ts +++ b/front/src/applications/operationalStudies/__tests__/sampleData.ts @@ -611,6 +611,7 @@ export const sampleWithMultipleOperationalPoints: NonNullable< }, }, position: 0, + weight: null, }, { id: 'Mid_West_station', @@ -625,6 +626,7 @@ export const sampleWithMultipleOperationalPoints: NonNullable< }, }, position: 12050000, + weight: null, }, { id: 'Mid_East_station', @@ -639,6 +641,7 @@ export const sampleWithMultipleOperationalPoints: NonNullable< }, }, position: 26500000, + weight: null, }, ]; @@ -687,5 +690,6 @@ export const sampleWithOneOperationalPoint: OperationalPoint[] = [ }, }, position: 4069000, + weight: null, }, ]; diff --git a/front/src/applications/operationalStudies/helpers/upsertMapWaypointsInOperationalPoints.ts b/front/src/applications/operationalStudies/helpers/upsertMapWaypointsInOperationalPoints.ts index 3af759c4c38..c276fe07bf9 100644 --- a/front/src/applications/operationalStudies/helpers/upsertMapWaypointsInOperationalPoints.ts +++ b/front/src/applications/operationalStudies/helpers/upsertMapWaypointsInOperationalPoints.ts @@ -35,6 +35,7 @@ export const upsertMapWaypointsInOperationalPoints = ( }, part: { track: step.track, position: step.offset }, position: positionOnPath, + weight: null, }; waypointCounter += 1; diff --git a/front/src/common/api/generatedEditoastApi.ts b/front/src/common/api/generatedEditoastApi.ts index bbbaf449098..6f92ba23046 100644 --- a/front/src/common/api/generatedEditoastApi.ts +++ b/front/src/common/api/generatedEditoastApi.ts @@ -2567,6 +2567,8 @@ export type PathProperties = { part: OperationalPointPart; /** Distance from the beginning of the path in mm */ position: number; + /** Importance of the operational point */ + weight: number | null; }[] | null; slopes?: { diff --git a/front/src/modules/simulationResult/components/SpeedSpaceChart/__tests__/helpers.spec.ts b/front/src/modules/simulationResult/components/SpeedSpaceChart/__tests__/helpers.spec.ts index 808f76924e4..d551a0eb0f3 100644 --- a/front/src/modules/simulationResult/components/SpeedSpaceChart/__tests__/helpers.spec.ts +++ b/front/src/modules/simulationResult/components/SpeedSpaceChart/__tests__/helpers.spec.ts @@ -48,6 +48,7 @@ describe('formatStops', () => { position: 0, track: 'track', }, + weight: null, }, ]; const expected = [{ position: { start: 0 }, value: 'name ch' }];