Struct geo_types::MultiLineString [−][src]
pub struct MultiLineString<T>(pub Vec<LineString<T>>)
where
T: CoordNum;
Expand description
A collection of
LineString
s. Can
be created from a Vec
of LineString
s or from an
Iterator which yields LineString
s. Iterating over this
object yields the component LineString
s.
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
LineString
s, 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 Point
s 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
impl<T> AbsDiffEq<MultiLineString<T>> for MultiLineString<T> where
T: AbsDiffEq<Epsilon = T> + CoordNum,
T::Epsilon: Copy,
impl<T> AbsDiffEq<MultiLineString<T>> for MultiLineString<T> where
T: AbsDiffEq<Epsilon = T> + CoordNum,
T::Epsilon: Copy,
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);
type Epsilon = T
type Epsilon = T
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
.
Performs the conversion.
Creates a value from an iterator. Read more
type Item = LineString<T>
type Item = LineString<T>
The type of the elements being iterated over.
type IntoIter = IntoIter<LineString<T>>
type IntoIter = IntoIter<LineString<T>>
Which kind of iterator are we turning this into?
type Item = &'a LineString<T>
type Item = &'a LineString<T>
The type of the elements being iterated over.
type IntoIter = Iter<'a, LineString<T>>
type IntoIter = Iter<'a, LineString<T>>
Which kind of iterator are we turning this into?
type Item = &'a mut LineString<T>
type Item = &'a mut LineString<T>
The type of the elements being iterated over.
type IntoIter = IterMut<'a, LineString<T>>
type IntoIter = IterMut<'a, LineString<T>>
Which kind of iterator are we turning this into?
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
impl<T> RelativeEq<MultiLineString<T>> for MultiLineString<T> where
T: AbsDiffEq<Epsilon = T> + CoordNum + RelativeEq,
impl<T> RelativeEq<MultiLineString<T>> for MultiLineString<T> where
T: AbsDiffEq<Epsilon = T> + CoordNum + RelativeEq,
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.
Auto Trait Implementations
impl<T> RefUnwindSafe for MultiLineString<T> where
T: RefUnwindSafe,
impl<T> Send for MultiLineString<T> where
T: Send,
impl<T> Sync for MultiLineString<T> where
T: Sync,
impl<T> Unpin for MultiLineString<T> where
T: Unpin,
impl<T> UnwindSafe for MultiLineString<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more