pub struct AssociatedNetElement {
pub netelement_id: String,
pub probability: f64,
pub start_intrinsic: f64,
pub end_intrinsic: f64,
pub gnss_start_index: usize,
pub gnss_end_index: usize,
pub origin: PathOrigin,
}Expand description
Represents a netelement within a calculated train path
Contains the netelement ID, probability score, and projection details for GNSS positions associated with this segment in the path.
§Examples
use tp_lib_core::AssociatedNetElement;
let segment = AssociatedNetElement::new(
"NE_A".to_string(),
0.87,
0.25,
0.78,
5,
12,
)?;
// This segment spans from 25% to 78% along netelement NE_A
// and is associated with GNSS positions 5-12 in the input dataFields§
§netelement_id: StringID of the netelement (track segment)
probability: f64Aggregate probability score for this segment in the path (0.0 to 1.0) Calculated from distance/heading probability and coverage correction
start_intrinsic: f64Intrinsic coordinate where the path enters this segment (0.0 to 1.0) 0.0 = start of segment, 1.0 = end of segment
end_intrinsic: f64Intrinsic coordinate where the path exits this segment (0.0 to 1.0)
gnss_start_index: usizeIndex of the first GNSS position associated with this segment
gnss_end_index: usizeIndex of the last GNSS position associated with this segment
origin: PathOriginWhether this segment was placed by the algorithm or manually added by a user.
Defaults to PathOrigin::Algorithm for backward compatibility with older path files
that do not carry this field.
Implementations§
Source§impl AssociatedNetElement
impl AssociatedNetElement
Sourcepub fn new(
netelement_id: String,
probability: f64,
start_intrinsic: f64,
end_intrinsic: f64,
gnss_start_index: usize,
gnss_end_index: usize,
) -> Result<Self, ProjectionError>
pub fn new( netelement_id: String, probability: f64, start_intrinsic: f64, end_intrinsic: f64, gnss_start_index: usize, gnss_end_index: usize, ) -> Result<Self, ProjectionError>
Create a new associated netelement with validation
Sourcepub fn fractional_length(&self) -> f64
pub fn fractional_length(&self) -> f64
Calculate length of path segment as fraction of total netelement
Sourcepub fn fractional_coverage(&self) -> f64
pub fn fractional_coverage(&self) -> f64
Calculate the fractional coverage of this segment (0.0 to 1.0) Same as fractional_length, representing what portion of the netelement is covered
Trait Implementations§
Source§impl Clone for AssociatedNetElement
impl Clone for AssociatedNetElement
Source§fn clone(&self) -> AssociatedNetElement
fn clone(&self) -> AssociatedNetElement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AssociatedNetElement
impl Debug for AssociatedNetElement
Source§impl<'de> Deserialize<'de> for AssociatedNetElement
impl<'de> Deserialize<'de> for AssociatedNetElement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for AssociatedNetElement
impl PartialEq for AssociatedNetElement
Source§impl Serialize for AssociatedNetElement
impl Serialize for AssociatedNetElement
impl StructuralPartialEq for AssociatedNetElement
Auto Trait Implementations§
impl Freeze for AssociatedNetElement
impl RefUnwindSafe for AssociatedNetElement
impl Send for AssociatedNetElement
impl Sync for AssociatedNetElement
impl Unpin for AssociatedNetElement
impl UnsafeUnpin for AssociatedNetElement
impl UnwindSafe for AssociatedNetElement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more