Skip to content

Commit 9d5fd7f

Browse files
committed
flatbuffer format: use float for distances
1 parent 27f866b commit 9d5fd7f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

schema/lrs.fbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ table Connection {
6262
endpoint:Endpoint = null;
6363
}
6464

65-
/// A traversal is a path in a network.
65+
/// A traversal is a path in a network.
6666
/// Traversals may be used to model roads, railway tracks, railway lines or trips.
6767
/// Traversals are defined as a sequence of segment and direction pairs.
6868
enum Direction : byte { Increasing = 1, Decreasing = 2 }
@@ -124,7 +124,7 @@ table LinearReferencingMethod {
124124
/// And that LRM is the reference for the two other traversals corresponding to each direction
125125
used_on:[TraversalRef];
126126
anchor_indices:[uint64] (required);
127-
distances:[uint64] (required);
127+
distances:[double] (required);
128128
/// The unit used to measure the distance between anchors
129129
distance_unit:DistanceUnit = Meters;
130130
/// The unit used to express measures relative to anchors (12+230)

src/lrs_generated.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub const ENUM_VALUES_DIRECTION: [Direction; 2] = [
105105
Direction::Decreasing,
106106
];
107107

108-
/// A traversal is a path in a network.
108+
/// A traversal is a path in a network.
109109
/// Traversals may be used to model roads, railway tracks, railway lines or trips.
110110
/// Traversals are defined as a sequence of segment and direction pairs.
111111
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
@@ -1992,11 +1992,11 @@ impl<'a> LinearReferencingMethod<'a> {
19921992
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(LinearReferencingMethod::VT_ANCHOR_INDICES, None).unwrap()}
19931993
}
19941994
#[inline]
1995-
pub fn distances(&self) -> flatbuffers::Vector<'a, u64> {
1995+
pub fn distances(&self) -> flatbuffers::Vector<'a, f64> {
19961996
// Safety:
19971997
// Created from valid Table for this object
19981998
// which contains a valid value in this slot
1999-
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(LinearReferencingMethod::VT_DISTANCES, None).unwrap()}
1999+
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(LinearReferencingMethod::VT_DISTANCES, None).unwrap()}
20002000
}
20012001
/// The unit used to measure the distance between anchors
20022002
#[inline]
@@ -2028,7 +2028,7 @@ impl flatbuffers::Verifiable for LinearReferencingMethod<'_> {
20282028
.visit_field::<TraversalRef>("traversal_index", Self::VT_TRAVERSAL_INDEX, false)?
20292029
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, TraversalRef>>>("used_on", Self::VT_USED_ON, false)?
20302030
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u64>>>("anchor_indices", Self::VT_ANCHOR_INDICES, true)?
2031-
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u64>>>("distances", Self::VT_DISTANCES, true)?
2031+
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, f64>>>("distances", Self::VT_DISTANCES, true)?
20322032
.visit_field::<DistanceUnit>("distance_unit", Self::VT_DISTANCE_UNIT, false)?
20332033
.visit_field::<DistanceUnit>("measure_unit", Self::VT_MEASURE_UNIT, false)?
20342034
.finish();
@@ -2041,7 +2041,7 @@ pub struct LinearReferencingMethodArgs<'a> {
20412041
pub traversal_index: Option<&'a TraversalRef>,
20422042
pub used_on: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, TraversalRef>>>,
20432043
pub anchor_indices: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u64>>>,
2044-
pub distances: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u64>>>,
2044+
pub distances: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>,
20452045
pub distance_unit: DistanceUnit,
20462046
pub measure_unit: DistanceUnit,
20472047
}
@@ -2087,7 +2087,7 @@ impl<'a: 'b, 'b> LinearReferencingMethodBuilder<'a, 'b> {
20872087
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(LinearReferencingMethod::VT_ANCHOR_INDICES, anchor_indices);
20882088
}
20892089
#[inline]
2090-
pub fn add_distances(&mut self, distances: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>) {
2090+
pub fn add_distances(&mut self, distances: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) {
20912091
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(LinearReferencingMethod::VT_DISTANCES, distances);
20922092
}
20932093
#[inline]

0 commit comments

Comments
 (0)