lrs: expose planar coordinate system#86
lrs: expose planar coordinate system#86Castavo wants to merge 1 commit intoOpenRailAssociation:mainfrom
Conversation
Signed-off-by: Baptiste Prevot <pro.baptiste.prevot@gmail.com>
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.
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.
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.
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.
| /// 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.
| /// 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.
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.
`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
planarargument forbuildandloaddoesn't convince me completely, what do you think ? (beside that it could be an enum)