logo

Struct geo_types::MultiLineString[][src]

pub struct MultiLineString<T>(pub Vec<LineString<T>>)
where
    T: CoordNum
;
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

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(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(vec![closed_line_string.clone()]).is_closed());

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

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

Trait Implementations

Equality assertion with an absolute limit.

Examples
use geo_types::{MultiLineString, line_string};

let a = MultiLineString(vec![line_string![(x: 0., y: 0.), (x: 10., y: 10.)]]);
let b = MultiLineString(vec![line_string![(x: 0., y: 0.), (x: 10.01, y: 10.)]]);

approx::abs_diff_eq!(a, b, epsilon=0.1);
approx::abs_diff_ne!(a, b, epsilon=0.001);

Used for specifying relative comparisons.

The default tolerance to use when testing values that are close together. Read more

The inverse of AbsDiffEq::abs_diff_eq.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

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 !=.

Equality assertion within a relative limit.

Examples
use geo_types::{MultiLineString, line_string};

let a = MultiLineString(vec![line_string![(x: 0., y: 0.), (x: 10., y: 10.)]]);
let b = MultiLineString(vec![line_string![(x: 0., y: 0.), (x: 10.01, y: 10.)]]);

approx::assert_relative_eq!(a, b, max_relative=0.1);
approx::assert_relative_ne!(a, b, max_relative=0.0001);

The default relative tolerance for testing values that are far-apart. Read more

The inverse of RelativeEq::relative_eq.

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

Performs the conversion.

Performs the conversion.

Should always be Self

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.