Struct survex_rs::data::SurveyData

source ·
pub struct SurveyData {
    pub stations: Stations,
    pub graph: StationGraph,
}
Expand description

Handles the creation and management of stations, as well as holding the graph of stations.

Fields§

§stations: Stations§graph: StationGraph

Implementations§

source§

impl SurveyData

source

pub fn new() -> Self

Create an empty SurveyData instance with no stations or connections. This method should not be used directly. Instead, create a SurveyData instance from a Survex file using the load_from_path helper function.

source

pub fn get_by_label(&self, label: &str) -> Option<RefStation>

Retrieve a reference to a Station by its label. Only exact matches are returned. To retrieve a station by partial label use get_by_label_part.

source

pub fn get_by_label_part(&self, label: &str) -> Option<RefStation>

Retrieve a reference to a Station by its label, allowing for partial matches. If multiple stations match the given label, None is returned, unless one of the matches is an exact match, in which case that station is returned.

source

pub fn get_by_coords(&self, coords: &Point) -> Option<RefStation>

Retrieve a reference to a Station by its coordinates. If multiple stations exist at the given coordinates, the first station found is returned.

source

pub fn get_by_index(&self, index: NodeIndex) -> Option<RefStation>

Retrieve a reference to a Station by its index in the graph.

source

pub fn add_or_update( &mut self, coords: Point, label: &str ) -> (RefStation, NodeIndex)

This helper method is used to add or update a Station to both the stations vector and the graph.

If a Station with the given label already exists, the existing station is updated with the new coordinates. Otherwise, a new Station is created and added to the stations vector and the graph. In either case, a reference to the station is returned in a tuple along with the index of the station in the graph.

Trait Implementations§

source§

impl Default for SurveyData

source§

fn default() -> Self

Returns an empty SurveyData instance with no stations.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V