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

Vcs/zoom rectangle 3 #925

Open
wants to merge 1 commit into
base: vcs/zoom-rectangle-2
Choose a base branch
from

Conversation

anisometropie
Copy link
Contributor

@anisometropie anisometropie commented Feb 21, 2025

closes OpenRailAssociation/osrd#10960

y scale requirements

  • min zoom => the entire path is shown
    the scale min zoom metre/px value depends on the length of the path (which is not the case with the time axis, which are constants)
  • max zoom => the entire height of the manchette is 500 meter.

map yZoom -> mm/px scale

Previously, yZoom was used as a multiplier. yScale was just changed by increments of 0.5 (using the + or - buttons) and the height in pixel was just multiplied by yScale. This approach is not enough as we need to be able to navigate arbitrary zoom levels and to know how much the size of a rectangle means in term of yZoom.
To do that we need functions to map back and forth between the yZoom level and the value of the scale in mm/px.
this is what zoomValueToSpaceScale spaceScaleToZoomValue do.

seeing that with the min zoom level we need to display the entire path, min Zoom scale value also depends on the length of the path. min and max scale values are given by getExtremaScales

in non proportional mode (linear, every stop has the same height on the manchette), we’re not using a mm/px scale. We directly convert rectangle px height (extended to the full chart height) means in term of stop height.

scale example:
in our story with path of 168 km and manchette height = 528 px, we get min zoom scale of 318287 m/px.

zoom level mm/px
1 343672
10,5 946

https://www.desmos.com/calculator/o1cq38zueu?lang=fr

@anisometropie anisometropie changed the base branch from dev to vcs/zoom-rectangle-2 February 21, 2025 18:40
@anisometropie anisometropie force-pushed the vcs/zoom-rectangle-3 branch 2 times, most recently from 0e24c5e to c9db372 Compare March 5, 2025 13:39
@anisometropie anisometropie force-pushed the vcs/zoom-rectangle-2 branch 3 times, most recently from 37a0dc2 to 5594012 Compare March 6, 2025 08:15
@anisometropie anisometropie force-pushed the vcs/zoom-rectangle-3 branch 5 times, most recently from 1ed0e5a to bf420d8 Compare March 6, 2025 16:50
@anisometropie anisometropie marked this pull request as ready for review March 6, 2025 16:52
@anisometropie anisometropie requested a review from a team as a code owner March 6, 2025 16:52
@anisometropie anisometropie force-pushed the vcs/zoom-rectangle-3 branch 5 times, most recently from c525b6e to 083f0c5 Compare March 6, 2025 23:12
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.

1 participant