Skip to content

Commit

Permalink
core: infra: ignore OP parts on missing tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
eckter committed May 27, 2024
1 parent 12c3979 commit 322c5d1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import fr.sncf.osrd.geom.LineString
import fr.sncf.osrd.railjson.schema.common.graph.EdgeDirection
import fr.sncf.osrd.railjson.schema.common.graph.EdgeEndpoint
import fr.sncf.osrd.railjson.schema.geom.RJSLineString
import fr.sncf.osrd.railjson.schema.infra.RJSInfra
import fr.sncf.osrd.railjson.schema.infra.RJSRoute
import fr.sncf.osrd.railjson.schema.infra.RJSSwitch
import fr.sncf.osrd.railjson.schema.infra.RJSSwitchType
import fr.sncf.osrd.railjson.schema.infra.RJSTrackSection
import fr.sncf.osrd.railjson.schema.infra.*
import fr.sncf.osrd.railjson.schema.infra.trackobjects.RJSRouteWaypoint
import fr.sncf.osrd.railjson.schema.infra.trackobjects.RJSSignal
import fr.sncf.osrd.railjson.schema.infra.trackranges.RJSElectrification
Expand Down Expand Up @@ -789,12 +785,16 @@ fun parseRJSInfra(rjsInfra: RJSInfra): RawInfra {
props["trigram"] = sncf.trigram
}
if (opPart.extensions?.sncf != null) props["kp"] = opPart.extensions!!.sncf!!.kp
builder.operationalPointPart(
operationalPointId,
trackSectionName,
trackSectionOffset,
props
)
val partId =
builder.operationalPointPart(
operationalPointId,
trackSectionName,
trackSectionOffset,
props
)
if (partId == null) {
// TODO warning
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import fr.sncf.osrd.utils.*
import fr.sncf.osrd.utils.indexing.*
import fr.sncf.osrd.utils.units.*
import java.util.*
import kotlin.collections.HashMap
import kotlin.collections.set
import kotlin.time.Duration

Expand Down Expand Up @@ -531,7 +530,10 @@ class RawInfraFromRjsBuilder {
trackSectionName: String,
trackSectionOffset: Offset<TrackSection>,
props: Map<String, String>
): OperationalPointPartId {
): OperationalPointPartId? {
if (!trackSectionNameToIdxMap.contains(trackSectionName)) {
return null
}
val trackSectionChunks = getTrackSectionDistanceSortedChunks(trackSectionName)
val chunkDistanceIdx = trackSectionChunks.floorEntry(trackSectionOffset.distance)
val opPartIdx =
Expand Down

0 comments on commit 322c5d1

Please sign in to comment.