logo
pub struct MultiLineString<T: CoordNum>(pub Vec<LineString<T>>);
Expand description

A collection of LineStrings. Can be created from a Vec of LineStrings or from an Iterator which yields LineStrings. Iterating over this object yields the component LineStrings.

Semantics

The boundary of a MultiLineString is obtained by applying the “mod 2” union rule: A Point is in the boundary of a MultiLineString if it is in the boundaries of an odd number of elements of the MultiLineString.

The interior of a MultiLineString is the union of the interior, and boundary of the constituent LineStrings, except for the boundary as defined above. In other words, it is the set difference of the boundary from the union of the interior and boundary of the constituents.

A MultiLineString is simple if and only if all of its elements are simple and the only intersections between any two elements occur at Points that are on the boundaries of both elements. A MultiLineString is closed if all of its elements are closed. The boundary of a closed MultiLineString is always empty.

Tuple Fields

0: Vec<LineString<T>>

Implementations

Instantiate Self from the raw content value

True if the MultiLineString is empty or if all of its LineStrings are closed - see LineString::is_closed.

Examples
use geo_types::{MultiLineString, LineString, line_string};

let open_line_string: LineString<f32> = line_string![(x: 0., y: 0.), (x: 5., y: 0.)];
assert!(!MultiLineString::new(vec![open_line_string.clone()]).is_closed());

let closed_line_string: LineString<f32> = line_string![(x: 0., y: 0.), (x: 5., y: 0.), (x: 0., y: 0.)];
assert!(MultiLineString::new(vec![closed_line_string.clone()]).is_closed());

// MultiLineString is not closed if *any* of it's LineStrings are not closed
assert!(!MultiLineString::new(vec![open_line_string, closed_line_string]).is_closed());

// An empty MultiLineString is closed
assert!(MultiLineString::<f32>::new(vec![]).is_closed());

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Creates a value from an iterator. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Convert a Geometry enum into its inner type.

Fails if the enum case does not match the type you are trying to convert it to.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.