-
Notifications
You must be signed in to change notification settings - Fork 2
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
lrs: expose planar coordinate system #86
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Baptiste Prevot <[email protected]>
e541bde
to
6d8bd3e
Compare
Lrs::from_bytes(data) | ||
.map(|lrs| Self { lrs }) | ||
.map_err(|err| err.to_string()) | ||
pub fn load(data: &[u8], planar: bool) -> Result<ExtLrs, String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The serialized data stores what kind of coordinates we are dealing with: https://github.com/OpenRailAssociation/liblrs/blob/main/schema/lrs.fbs#L8 (from the wording, we can see that it was a different use case that was initially though of, but it still work).
This will however draw a lot of small issues. I’m not sure how we could get a nice overview of all the fiddling we’ll have to do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really see the issues, could you elaborate ?
Is it that
- we need to set it through the builder (which my PR doesn't do, I reckon)
- we need to read it when deserializing (which my PR doesn't do either)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s both.
load
shouldn’t take a parameter as it’s defined in the datafile. Loading planar graph as spherical would result in unexpected results (plus the more complicated API).
Also @Tristramg, what do you think of the method of wrapping it in an enum ? |
@@ -321,24 +329,17 @@ impl Lrs { | |||
|
|||
/// Given a ID returns the corresponding lrs index (or None if not found) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Given a ID returns the corresponding lrs index (or None if not found) | |
/// Given an ID, returns the corresponding lrs index (or None if not found) |
} | ||
} | ||
|
||
/// Given a ID returns the corresponding lrs index (or None if not found) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Given a ID returns the corresponding lrs index (or None if not found) | |
/// Given an ID, returns the corresponding lrs index (or None if not found) |
} | ||
} | ||
|
||
/// Get the positon along the curve given a [`LrmScaleMeasure`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a [`LrmScaleMeasure`]
or
an [`LrmScaleMeasure`]
I think wrapping with an enum is very nice. The API of The only problem is how to handle this at |
@@ -1,10 +1,7 @@ | |||
//! High level extensions meant for an easy usage | |||
//! Those functions are exposed in wasm-bindings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`wasm-bindings`
or
[`wasm-bindings`]
Upon further thinking, maybe the enum as I did it resolves the symptoms and not the problem. Maybe Different ideas to not have the
|
I could also keep with the Enum, implement the two things you talked about (I think it's actually quite straightforward) and we'll make it cleaner later |
This is a first approach, I don't know if it's good enough.
The choice of having a
planar
argument forbuild
andload
doesn't convince me completely, what do you think ? (beside that it could be an enum)