From 9d5fd7f07df231ff6f82e1fd900df4647883d071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristram=20Gr=C3=A4bener?= Date: Wed, 3 Apr 2024 18:30:36 +0200 Subject: [PATCH] flatbuffer format: use float for distances --- schema/lrs.fbs | 4 ++-- src/lrs_generated.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/schema/lrs.fbs b/schema/lrs.fbs index 2926e89..de2af9d 100644 --- a/schema/lrs.fbs +++ b/schema/lrs.fbs @@ -62,7 +62,7 @@ table Connection { endpoint:Endpoint = null; } -/// A traversal is a path in a network. +/// A traversal is a path in a network. /// Traversals may be used to model roads, railway tracks, railway lines or trips. /// Traversals are defined as a sequence of segment and direction pairs. enum Direction : byte { Increasing = 1, Decreasing = 2 } @@ -124,7 +124,7 @@ table LinearReferencingMethod { /// And that LRM is the reference for the two other traversals corresponding to each direction used_on:[TraversalRef]; anchor_indices:[uint64] (required); - distances:[uint64] (required); + distances:[double] (required); /// The unit used to measure the distance between anchors distance_unit:DistanceUnit = Meters; /// The unit used to express measures relative to anchors (12+230) diff --git a/src/lrs_generated.rs b/src/lrs_generated.rs index 8000ce5..bfe3fe7 100644 --- a/src/lrs_generated.rs +++ b/src/lrs_generated.rs @@ -105,7 +105,7 @@ pub const ENUM_VALUES_DIRECTION: [Direction; 2] = [ Direction::Decreasing, ]; -/// A traversal is a path in a network. +/// A traversal is a path in a network. /// Traversals may be used to model roads, railway tracks, railway lines or trips. /// Traversals are defined as a sequence of segment and direction pairs. #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] @@ -1992,11 +1992,11 @@ impl<'a> LinearReferencingMethod<'a> { unsafe { self._tab.get::>>(LinearReferencingMethod::VT_ANCHOR_INDICES, None).unwrap()} } #[inline] - pub fn distances(&self) -> flatbuffers::Vector<'a, u64> { + pub fn distances(&self) -> flatbuffers::Vector<'a, f64> { // Safety: // Created from valid Table for this object // which contains a valid value in this slot - unsafe { self._tab.get::>>(LinearReferencingMethod::VT_DISTANCES, None).unwrap()} + unsafe { self._tab.get::>>(LinearReferencingMethod::VT_DISTANCES, None).unwrap()} } /// The unit used to measure the distance between anchors #[inline] @@ -2028,7 +2028,7 @@ impl flatbuffers::Verifiable for LinearReferencingMethod<'_> { .visit_field::("traversal_index", Self::VT_TRAVERSAL_INDEX, false)? .visit_field::>>("used_on", Self::VT_USED_ON, false)? .visit_field::>>("anchor_indices", Self::VT_ANCHOR_INDICES, true)? - .visit_field::>>("distances", Self::VT_DISTANCES, true)? + .visit_field::>>("distances", Self::VT_DISTANCES, true)? .visit_field::("distance_unit", Self::VT_DISTANCE_UNIT, false)? .visit_field::("measure_unit", Self::VT_MEASURE_UNIT, false)? .finish(); @@ -2041,7 +2041,7 @@ pub struct LinearReferencingMethodArgs<'a> { pub traversal_index: Option<&'a TraversalRef>, pub used_on: Option>>, pub anchor_indices: Option>>, - pub distances: Option>>, + pub distances: Option>>, pub distance_unit: DistanceUnit, pub measure_unit: DistanceUnit, } @@ -2087,7 +2087,7 @@ impl<'a: 'b, 'b> LinearReferencingMethodBuilder<'a, 'b> { self.fbb_.push_slot_always::>(LinearReferencingMethod::VT_ANCHOR_INDICES, anchor_indices); } #[inline] - pub fn add_distances(&mut self, distances: flatbuffers::WIPOffset>) { + pub fn add_distances(&mut self, distances: flatbuffers::WIPOffset>) { self.fbb_.push_slot_always::>(LinearReferencingMethod::VT_DISTANCES, distances); } #[inline]