Struct geo::MultiLineString [−][src]
pub struct MultiLineString<T>(pub Vec<LineString<T>, Global>)
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>, Global>
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<T, Epsilon = T> + CoordNum,
<T as AbsDiffEq<T>>::Epsilon: Copy,
impl<T> AbsDiffEq<MultiLineString<T>> for MultiLineString<T> where
T: AbsDiffEq<T, Epsilon = T> + CoordNum,
<T as AbsDiffEq<T>>::Epsilon: Copy,
pub fn abs_diff_eq(
&self,
other: &MultiLineString<T>,
epsilon: <MultiLineString<T> as AbsDiffEq<MultiLineString<T>>>::Epsilon
) -> bool
pub fn abs_diff_eq(
&self,
other: &MultiLineString<T>,
epsilon: <MultiLineString<T> as AbsDiffEq<MultiLineString<T>>>::Epsilon
) -> bool
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
.
Find the closest point between self
and p
.
type Scalar = T
type Scalar = T
type Scalar = T
fn calculate_coordinate_position(
&self,
coord: &Coordinate<T>,
is_inside: &mut bool,
boundary_count: &mut usize
)
Return the number of coordinates in the MultiLineString
.
type Iter = Flatten<MapCoordsIter<'a, T, Iter<'a, LineString<T>>, LineString<T>>>
type ExteriorIter = Self::Iter
type Scalar = T
Iterate over all exterior and (if any) interior coordinates of a geometry. Read more
Iterate over all exterior coordinates of a geometry. Read more
Minimum distance from a Point to a MultiLineString
Minimum distance from a MultiLineString to a Point
impl<T> EuclideanLength<T, MultiLineString<T>> for MultiLineString<T> where
T: CoordFloat + Sum,
impl<T> EuclideanLength<T, MultiLineString<T>> for MultiLineString<T> where
T: CoordFloat + Sum,
Calculation of the length of a Line Read more
Performs the conversion.
Performs the conversion.
impl<T, ILS> FromIterator<ILS> for MultiLineString<T> where
T: CoordNum,
ILS: Into<LineString<T>>,
impl<T, ILS> FromIterator<ILS> for MultiLineString<T> where
T: CoordNum,
ILS: Into<LineString<T>>,
Creates a value from an iterator. Read more
Determine the length of a geometry on an ellipsoidal model of the earth. Read more
Some geometries, like a MultiPoint
, can have zero coordinates - we call these empty
. Read more
The dimensions of some geometries are fixed, e.g. a Point always has 0 dimensions. However
for others, the dimensionality depends on the specific geometry instance - for example
typical Rect
s are 2-dimensional, but it’s possible to create degenerate Rect
s which
have either 1 or 0 dimensions. Read more
The dimensions of the Geometry
’s boundary, as used by OGC-SFA. Read more
impl<T> HaversineLength<T, MultiLineString<T>> for MultiLineString<T> where
T: CoordFloat + FromPrimitive,
impl<T> HaversineLength<T, MultiLineString<T>> for MultiLineString<T> where
T: CoordFloat + FromPrimitive,
Determine the length of a geometry using the haversine formula. Read more
impl<T, G> Intersects<G> for MultiLineString<T> where
T: CoordNum,
LineString<T>: Intersects<G>,
impl<T, G> Intersects<G> for MultiLineString<T> where
T: CoordNum,
LineString<T>: Intersects<G>,
impl<T> Intersects<MultiLineString<T>> for Polygon<T> where
MultiLineString<T>: Intersects<Polygon<T>>,
T: CoordNum,
impl<T> Intersects<MultiLineString<T>> for Polygon<T> where
MultiLineString<T>: Intersects<Polygon<T>>,
T: CoordNum,
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?
Creates an iterator from a value. Read more
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?
Creates an iterator from a value. Read more
type Item = LineString<T>
type Item = LineString<T>
The type of the elements being iterated over.
type IntoIter = IntoIter<LineString<T>, Global>
type IntoIter = IntoIter<LineString<T>, Global>
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 !=
.
impl<T> RelativeEq<MultiLineString<T>> for MultiLineString<T> where
T: AbsDiffEq<T, Epsilon = T> + CoordNum + RelativeEq<T>,
impl<T> RelativeEq<MultiLineString<T>> for MultiLineString<T> where
T: AbsDiffEq<T, Epsilon = T> + CoordNum + RelativeEq<T>,
pub fn relative_eq(
&self,
other: &MultiLineString<T>,
epsilon: <MultiLineString<T> as AbsDiffEq<MultiLineString<T>>>::Epsilon,
max_relative: <MultiLineString<T> as AbsDiffEq<MultiLineString<T>>>::Epsilon
) -> bool
pub fn relative_eq(
&self,
other: &MultiLineString<T>,
epsilon: <MultiLineString<T> as AbsDiffEq<MultiLineString<T>>>::Epsilon,
max_relative: <MultiLineString<T> as AbsDiffEq<MultiLineString<T>>>::Epsilon
) -> bool
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);
pub fn default_max_relative(
) -> <MultiLineString<T> as AbsDiffEq<MultiLineString<T>>>::Epsilon
pub fn default_max_relative(
) -> <MultiLineString<T> as AbsDiffEq<MultiLineString<T>>>::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
The inverse of RelativeEq::relative_eq
.
Returns the simplified representation of a geometry, using the Ramer–Douglas–Peucker algorithm Read more
Returns the simplified representation of a geometry, using the Visvalingam-Whyatt algorithm Read more
Returns the simplified representation of a geometry, using a topology-preserving variant of the Visvalingam-Whyatt algorithm. Read more
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.
impl<T> VincentyLength<T, MultiLineString<T>> for MultiLineString<T> where
T: CoordFloat + FromPrimitive,
impl<T> VincentyLength<T, MultiLineString<T>> for MultiLineString<T> where
T: CoordFloat + FromPrimitive,
Determine the length of a geometry using Vincenty’s formulae. Read more
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
Rotate a Geometry around an arbitrary point by an angle, given in degrees Read more