editoast: refactor of projection algorithm #10164
Draft
+263
−114
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #9686
This is a complete rewrite of the projection algorithm. The idea is to support the case when multiple track ranges with the same track section identifier are projected on an axis.
PathProjection
can't support that use case since the constructor assert for no duplicate identifiers.In order to minimize the modifications, we decided to not change the constructor of
PathProjection
. The important change is the inversion of the semantic for the functionget_intersection()
: before,self
was projected ontrack_ranges
, now, we projecttrack_ranges
onself
. Since we will always project on a continuous path, we can then keep the constructor ofPathProjection
with it assertions about no duplicate identifiers.Warning
There is still a bunch of things to do.
PathProjection::get_intersection()
needs to be inverted (remember, now,track_ranges
is projected onpath
, not the other way around)Debug
forTrackRange
(or maybe it should be aDisplay
implementation instead?)The ones that shouldn't be merged
When you have a projection path
A+0-100
,B+0-100
and you want to project the following track ranges on it,A+0-150
andB+0-100
, the result should be 2 intersections,(0, 100)
and(100, 200)
and you don't want to merge them (or do we?). Indeed, the train path you're trying to project is moving in space but also in time onA+100-150
which means that betweenA+100
andB+0
, there will be a hole in the Space-Time Chart.An attempt to solve this problem has been done by introducing the
is_exhaustive
in theTrackRangeEvent
: the idea is to keep the information that the overlap is exhaustive on the track range being projected, or not. It does work forBegin
where it can be used... but I didn't find an obvious way to use theis_exhaustive
fromEnd
🤷Unsolved questions about this merge strategy