Struct geo::GeometryCollection [−][src]
A collection of Geometry
types.
It can be created from a Vec
of Geometries, or from an Iterator which yields Geometries.
Looping over this object yields its component Geometry
enum members (not the underlying geometry
primitives), and it supports iteration and indexing as
well as the various
MapCoords
functions, which are directly applied to the
underlying geometry primitives.
Examples
Looping
use std::convert::TryFrom; use geo_types::{Point, point, Geometry, GeometryCollection}; let p = point!(x: 1.0, y: 1.0); let pe = Geometry::Point(p); let gc = GeometryCollection(vec![pe]); for geom in gc { println!("{:?}", Point::try_from(geom).unwrap().x()); }
Implements iter()
use std::convert::TryFrom; use geo_types::{Point, point, Geometry, GeometryCollection}; let p = point!(x: 1.0, y: 1.0); let pe = Geometry::Point(p); let gc = GeometryCollection(vec![pe]); gc.iter().for_each(|geom| println!("{:?}", geom));
Mutable Iteration
use std::convert::TryFrom; use geo_types::{Point, point, Geometry, GeometryCollection}; let p = point!(x: 1.0, y: 1.0); let pe = Geometry::Point(p); let mut gc = GeometryCollection(vec![pe]); gc.iter_mut().for_each(|geom| { if let Geometry::Point(p) = geom { p.set_x(0.2); } }); let updated = gc[0].clone(); assert_eq!(Point::try_from(updated).unwrap().x(), 0.2);
Indexing
use std::convert::TryFrom; use geo_types::{Point, point, Geometry, GeometryCollection}; let p = point!(x: 1.0, y: 1.0); let pe = Geometry::Point(p); let gc = GeometryCollection(vec![pe]); println!("{:?}", gc[0]);
Implementations
impl<T> GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
pub fn new() -> GeometryCollection<T>
[src]
Return an empty GeometryCollection
pub fn len(&self) -> usize
[src]
Number of geometries in this GeometryCollection
pub fn is_empty(&self) -> bool
[src]
Is this GeometryCollection empty
impl<'a, T> GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
pub fn iter(&'a self) -> IterHelper<'a, T>
[src]
pub fn iter_mut(&'a mut self) -> IterMutHelper<'a, T>
[src]
Trait Implementations
impl<T> AbsDiffEq<GeometryCollection<T>> for GeometryCollection<T> where
T: AbsDiffEq<T, Epsilon = T> + CoordNum,
<T as AbsDiffEq<T>>::Epsilon: Copy,
[src]
T: AbsDiffEq<T, Epsilon = T> + CoordNum,
<T as AbsDiffEq<T>>::Epsilon: Copy,
type Epsilon = T
Used for specifying relative comparisons.
pub fn default_epsilon(
) -> <GeometryCollection<T> as AbsDiffEq<GeometryCollection<T>>>::Epsilon
[src]
) -> <GeometryCollection<T> as AbsDiffEq<GeometryCollection<T>>>::Epsilon
pub fn abs_diff_eq(
&self,
other: &GeometryCollection<T>,
epsilon: <GeometryCollection<T> as AbsDiffEq<GeometryCollection<T>>>::Epsilon
) -> bool
[src]
&self,
other: &GeometryCollection<T>,
epsilon: <GeometryCollection<T> as AbsDiffEq<GeometryCollection<T>>>::Epsilon
) -> bool
Equality assertion with an absolute limit.
Examples
use geo_types::{GeometryCollection, point}; let a = GeometryCollection(vec![point![x: 0.0, y: 0.0].into()]); let b = GeometryCollection(vec![point![x: 0.0, y: 0.1].into()]); approx::abs_diff_eq!(a, b, epsilon=0.1); approx::abs_diff_ne!(a, b, epsilon=0.001);
pub fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
impl<T> Area<T> for GeometryCollection<T> where
T: CoordFloat,
[src]
T: CoordFloat,
fn signed_area(&self) -> T
[src]
fn unsigned_area(&self) -> T
[src]
impl<T> BoundingRect<T> for GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
impl<T> Centroid for GeometryCollection<T> where
T: GeoFloat,
[src]
T: GeoFloat,
impl<T> Clone for GeometryCollection<T> where
T: Clone + CoordNum,
[src]
T: Clone + CoordNum,
pub fn clone(&self) -> GeometryCollection<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Contains<Coordinate<T>> for GeometryCollection<T> where
T: GeoNum,
[src]
T: GeoNum,
fn contains(&self, coord: &Coordinate<T>) -> bool
[src]
impl<F> Contains<GeometryCollection<F>> for MultiPolygon<F> where
F: GeoFloat,
[src]
F: GeoFloat,
fn contains(&self, rhs: &GeometryCollection<F>) -> bool
[src]
impl<T> Contains<Point<T>> for GeometryCollection<T> where
T: GeoNum,
[src]
T: GeoNum,
impl<T> CoordinatePosition for GeometryCollection<T> where
T: GeoNum,
[src]
T: GeoNum,
type Scalar = T
fn calculate_coordinate_position(
&self,
coord: &Coordinate<T>,
is_inside: &mut bool,
boundary_count: &mut usize
)
[src]
&self,
coord: &Coordinate<T>,
is_inside: &mut bool,
boundary_count: &mut usize
)
fn coordinate_position(&self, coord: &Coordinate<Self::Scalar>) -> CoordPos
[src]
impl<'a, T: CoordNum + 'a> CoordsIter<'a> for GeometryCollection<T>
[src]
type Iter = Box<dyn Iterator<Item = Coordinate<T>> + 'a>
type ExteriorIter = Box<dyn Iterator<Item = Coordinate<T>> + 'a>
type Scalar = T
fn coords_iter(&'a self) -> Self::Iter
[src]
fn coords_count(&'a self) -> usize
[src]
Return the number of coordinates in the GeometryCollection
.
fn exterior_coords_iter(&'a self) -> Self::ExteriorIter
[src]
impl<T> Debug for GeometryCollection<T> where
T: Debug + CoordNum,
[src]
T: Debug + CoordNum,
impl<T> Default for GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
pub fn default() -> GeometryCollection<T>
[src]
impl<T> Eq for GeometryCollection<T> where
T: Eq + CoordNum,
[src]
T: Eq + CoordNum,
impl<T, IG> From<IG> for GeometryCollection<T> where
T: CoordNum,
IG: Into<Geometry<T>>,
[src]
T: CoordNum,
IG: Into<Geometry<T>>,
Convert any Geometry (or anything that can be converted to a Geometry) into a GeometryCollection
pub fn from(x: IG) -> GeometryCollection<T>
[src]
impl<T, IG> FromIterator<IG> for GeometryCollection<T> where
T: CoordNum,
IG: Into<Geometry<T>>,
[src]
T: CoordNum,
IG: Into<Geometry<T>>,
Collect Geometries (or what can be converted to a Geometry) into a GeometryCollection
pub fn from_iter<I>(iter: I) -> GeometryCollection<T> where
I: IntoIterator<Item = IG>,
[src]
I: IntoIterator<Item = IG>,
impl<C: GeoNum> HasDimensions for GeometryCollection<C>
[src]
fn is_empty(&self) -> bool
[src]
fn dimensions(&self) -> Dimensions
[src]
fn boundary_dimensions(&self) -> Dimensions
[src]
impl<T> Hash for GeometryCollection<T> where
T: Hash + CoordNum,
[src]
T: Hash + CoordNum,
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T> Index<usize> for GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
type Output = Geometry<T>
The returned type after indexing.
pub fn index(&self, index: usize) -> &Geometry<T>
[src]
impl<T> IndexMut<usize> for GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
impl<T, G> Intersects<G> for GeometryCollection<T> where
T: CoordNum,
Geometry<T>: Intersects<G>,
[src]
T: CoordNum,
Geometry<T>: Intersects<G>,
fn intersects(&self, rhs: &G) -> bool
[src]
impl<T> Intersects<GeometryCollection<T>> for Coordinate<T> where
GeometryCollection<T>: Intersects<Coordinate<T>>,
T: CoordNum,
[src]
GeometryCollection<T>: Intersects<Coordinate<T>>,
T: CoordNum,
fn intersects(&self, rhs: &GeometryCollection<T>) -> bool
[src]
impl<T> Intersects<GeometryCollection<T>> for Line<T> where
GeometryCollection<T>: Intersects<Line<T>>,
T: CoordNum,
[src]
GeometryCollection<T>: Intersects<Line<T>>,
T: CoordNum,
fn intersects(&self, rhs: &GeometryCollection<T>) -> bool
[src]
impl<T> Intersects<GeometryCollection<T>> for Rect<T> where
GeometryCollection<T>: Intersects<Rect<T>>,
T: CoordNum,
[src]
GeometryCollection<T>: Intersects<Rect<T>>,
T: CoordNum,
fn intersects(&self, rhs: &GeometryCollection<T>) -> bool
[src]
impl<T> Intersects<GeometryCollection<T>> for Polygon<T> where
GeometryCollection<T>: Intersects<Polygon<T>>,
T: CoordNum,
[src]
GeometryCollection<T>: Intersects<Polygon<T>>,
T: CoordNum,
fn intersects(&self, rhs: &GeometryCollection<T>) -> bool
[src]
impl<T> IntoIterator for GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
type Item = Geometry<T>
The type of the elements being iterated over.
type IntoIter = IntoIteratorHelper<T>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> <GeometryCollection<T> as IntoIterator>::IntoIter
[src]
impl<'a, T> IntoIterator for &'a mut GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
type Item = &'a mut Geometry<T>
The type of the elements being iterated over.
type IntoIter = IterMutHelper<'a, T>
Which kind of iterator are we turning this into?
pub fn into_iter(
self
) -> <&'a mut GeometryCollection<T> as IntoIterator>::IntoIter
[src]
self
) -> <&'a mut GeometryCollection<T> as IntoIterator>::IntoIter
impl<'a, T> IntoIterator for &'a GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
type Item = &'a Geometry<T>
The type of the elements being iterated over.
type IntoIter = IterHelper<'a, T>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> <&'a GeometryCollection<T> as IntoIterator>::IntoIter
[src]
impl<T: CoordNum, NT: CoordNum> MapCoords<T, NT> for GeometryCollection<T>
[src]
type Output = GeometryCollection<NT>
fn map_coords(&self, func: impl Fn(&(T, T)) -> (NT, NT) + Copy) -> Self::Output
[src]
impl<T: CoordNum> MapCoordsInplace<T> for GeometryCollection<T>
[src]
impl<T> PartialEq<GeometryCollection<T>> for GeometryCollection<T> where
T: PartialEq<T> + CoordNum,
[src]
T: PartialEq<T> + CoordNum,
pub fn eq(&self, other: &GeometryCollection<T>) -> bool
[src]
pub fn ne(&self, other: &GeometryCollection<T>) -> bool
[src]
impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for Point<F>
[src]
fn relate(&self, other: &GeometryCollection<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for Line<F>
[src]
fn relate(&self, other: &GeometryCollection<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for LineString<F>
[src]
fn relate(&self, other: &GeometryCollection<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for Polygon<F>
[src]
fn relate(&self, other: &GeometryCollection<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for MultiPoint<F>
[src]
fn relate(&self, other: &GeometryCollection<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for MultiLineString<F>
[src]
fn relate(&self, other: &GeometryCollection<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for MultiPolygon<F>
[src]
fn relate(&self, other: &GeometryCollection<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for Rect<F>
[src]
fn relate(&self, other: &GeometryCollection<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for Triangle<F>
[src]
fn relate(&self, other: &GeometryCollection<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for GeometryCollection<F>
[src]
fn relate(&self, other: &GeometryCollection<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, Line<F>> for GeometryCollection<F>
[src]
fn relate(&self, other: &Line<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, LineString<F>> for GeometryCollection<F>
[src]
fn relate(&self, other: &LineString<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, MultiLineString<F>> for GeometryCollection<F>
[src]
fn relate(&self, other: &MultiLineString<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, MultiPoint<F>> for GeometryCollection<F>
[src]
fn relate(&self, other: &MultiPoint<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, MultiPolygon<F>> for GeometryCollection<F>
[src]
fn relate(&self, other: &MultiPolygon<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, Point<F>> for GeometryCollection<F>
[src]
fn relate(&self, other: &Point<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, Polygon<F>> for GeometryCollection<F>
[src]
fn relate(&self, other: &Polygon<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, Rect<F>> for GeometryCollection<F>
[src]
fn relate(&self, other: &Rect<F>) -> IntersectionMatrix
[src]
impl<F: GeoFloat> Relate<F, Triangle<F>> for GeometryCollection<F>
[src]
fn relate(&self, other: &Triangle<F>) -> IntersectionMatrix
[src]
impl<T> RelativeEq<GeometryCollection<T>> for GeometryCollection<T> where
T: AbsDiffEq<T, Epsilon = T> + CoordNum + RelativeEq<T>,
[src]
T: AbsDiffEq<T, Epsilon = T> + CoordNum + RelativeEq<T>,
pub fn default_max_relative(
) -> <GeometryCollection<T> as AbsDiffEq<GeometryCollection<T>>>::Epsilon
[src]
) -> <GeometryCollection<T> as AbsDiffEq<GeometryCollection<T>>>::Epsilon
pub fn relative_eq(
&self,
other: &GeometryCollection<T>,
epsilon: <GeometryCollection<T> as AbsDiffEq<GeometryCollection<T>>>::Epsilon,
max_relative: <GeometryCollection<T> as AbsDiffEq<GeometryCollection<T>>>::Epsilon
) -> bool
[src]
&self,
other: &GeometryCollection<T>,
epsilon: <GeometryCollection<T> as AbsDiffEq<GeometryCollection<T>>>::Epsilon,
max_relative: <GeometryCollection<T> as AbsDiffEq<GeometryCollection<T>>>::Epsilon
) -> bool
Equality assertion within a relative limit.
Examples
use geo_types::{GeometryCollection, point}; let a = GeometryCollection(vec![point![x: 1.0, y: 2.0].into()]); let b = GeometryCollection(vec![point![x: 1.0, y: 2.01].into()]); approx::assert_relative_eq!(a, b, max_relative=0.1); approx::assert_relative_ne!(a, b, max_relative=0.0001);
pub fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
impl<T> StructuralEq for GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
impl<T> StructuralPartialEq for GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
impl<T: CoordNum, NT: CoordNum> TryMapCoords<T, NT> for GeometryCollection<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for GeometryCollection<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for GeometryCollection<T> where
T: Send,
T: Send,
impl<T> Sync for GeometryCollection<T> where
T: Sync,
T: Sync,
impl<T> Unpin for GeometryCollection<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for GeometryCollection<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<'a, T, G> Extremes<'a, T> for G where
T: CoordNum,
G: CoordsIter<'a, Scalar = T>,
[src]
T: CoordNum,
G: CoordsIter<'a, Scalar = T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, G> RotatePoint<T> for G where
T: CoordFloat,
G: MapCoords<T, T, Output = G>,
[src]
T: CoordFloat,
G: MapCoords<T, T, Output = G>,
pub fn rotate_around_point(&Self, T, Point<T>) -> G
[src]
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, G> Translate<T> for G where
T: CoordNum,
G: MapCoords<T, T, Output = G> + MapCoordsInplace<T>,
[src]
T: CoordNum,
G: MapCoords<T, T, Output = G> + MapCoordsInplace<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,