Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui-spacetimechart: implements "splitting" #919

Merged
merged 3 commits into from
Feb 27, 2025
Merged

ui-spacetimechart: implements "splitting" #919

merged 3 commits into from
Feb 27, 2025

Conversation

jacomyal
Copy link
Contributor

This pull request addresses issue osrd-project/osrd-confidential#870.

It allows giving a SpaceTimeChart flat steps, i.e. SpaceScales with a to value equal to the previous one's (where the chart is effectively split). Then, it adds a story that combines flat steps with a custom layer, to overdraw flat steps with a custom component.

Details:

  • Adds back-and-forth trains in stories
  • Improves and fixes getPathDirection, to handle trains that change directions
  • Updates getSpaceBreakpoints to no more deduplicate repeated values, which allows easily detecting flat steps
  • Updates getNormalizedScaleAtPosition and getSpaceToPixel to allow retrieving both sides of the flat steps
  • Fixes getPathSegments with flat steps
  • Updates space graduations and path pauses rendering, so that they are rendered on both sides of the flat steps
  • Adds a story to showcase all this

@jacomyal jacomyal requested a review from a team as a code owner February 21, 2025 11:11
@jacomyal jacomyal requested review from Yohh and Akctarus February 21, 2025 11:11
@Yohh Yohh self-assigned this Feb 21, 2025
@theocrsb theocrsb self-assigned this Feb 24, 2025
@jacomyal jacomyal force-pushed the ajy/split-get branch 2 times, most recently from 40aca82 to 78cde61 Compare February 24, 2025 16:49
Copy link
Contributor

@theocrsb theocrsb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and tested

This commit simply adds some trains that go back and forth in the
stories, to test that things work properly with directions changes.

Signed-off-by: Alexis Jacomy <[email protected]>
Details:
- Moves getDirection from PathLayer to new utils/paths.ts, renames it
  getPathDirection
- Adds options to look for direction from a given point, going forward
  or backward
- Adds unit tests
- Fixes drawExtremities in PathLayer, so that it looks for local path
  direction, and properly handles paths with U-turns

Signed-off-by: Alexis Jacomy <[email protected]>
This commit fixes osrd-project/osrd-confidential#870.

Details:
- Updates getSpaceBreakpoints to no more deduplicate repeted values
  (those repeted values are now used to detect flat steps)
- Updates getNormalizedScaleAtPosition to accept an option to return
  last matching scale instead of first (important now that a single
  position can match multiple pixel positions)
- Similarly updates getSpaceToPixel to return a function that accepts a
  new fromEnd option
- Fixes getPathSegments in PathLayer to properly handle flat steps
- Renders space graduations twice on flat steps (one before, one after)
- Renders path pauses twice on flat steps as well (one before, one after)
- Adds a new story to showcase how to split the space time chart

Signed-off-by: Alexis Jacomy <[email protected]>
Copy link
Contributor

@Math-R Math-R left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm !

@jacomyal jacomyal added this pull request to the merge queue Feb 27, 2025
Merged via the queue into dev with commit 2f5e675 Feb 27, 2025
6 checks passed
@jacomyal jacomyal deleted the ajy/split-get branch February 27, 2025 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants