[−][src]Struct geo::GeometryCollection
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: CoordinateType,
[src]
T: CoordinateType,
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: CoordinateType,
[src]
T: CoordinateType,
pub fn iter(&'a self) -> IterHelper<'a, T>
[src]
pub fn iter_mut(&'a mut self) -> IterMutHelper<'a, T>
[src]
Trait Implementations
impl<T> Area<T> for GeometryCollection<T> where
T: Float,
[src]
T: Float,
pub fn signed_area(&self) -> T
[src]
pub fn unsigned_area(&self) -> T
[src]
impl<T> BoundingRect<T> for GeometryCollection<T> where
T: CoordinateType,
[src]
T: CoordinateType,
impl<T> Clone for GeometryCollection<T> where
T: Clone + CoordinateType,
[src]
T: Clone + CoordinateType,
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: HasKernel,
[src]
T: HasKernel,
pub fn contains(&self, coord: &Coordinate<T>) -> bool
[src]
impl<T> Contains<Point<T>> for GeometryCollection<T> where
T: HasKernel,
[src]
T: HasKernel,
impl<T> CoordinatePosition for GeometryCollection<T> where
T: HasKernel,
[src]
T: HasKernel,
type Scalar = T
pub 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
)
pub fn coordinate_position(&self, coord: &Coordinate<Self::Scalar>) -> CoordPos
[src]
impl<'a, T: CoordinateType + 'a> CoordsIter<'a, T> for GeometryCollection<T>
[src]
type Iter = Box<dyn Iterator<Item = Coordinate<T>> + 'a>
pub fn coords_iter(&'a self) -> Self::Iter
[src]
impl<T> Debug for GeometryCollection<T> where
T: Debug + CoordinateType,
[src]
T: Debug + CoordinateType,
impl<T> Eq for GeometryCollection<T> where
T: Eq + CoordinateType,
[src]
T: Eq + CoordinateType,
impl<T, IG> From<IG> for GeometryCollection<T> where
IG: Into<Geometry<T>>,
T: CoordinateType,
[src]
IG: Into<Geometry<T>>,
T: CoordinateType,
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
IG: Into<Geometry<T>>,
T: CoordinateType,
[src]
IG: Into<Geometry<T>>,
T: CoordinateType,
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: CoordinateType> HasDimensions for GeometryCollection<C>
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn dimensions(&self) -> Dimensions
[src]
pub fn boundary_dimensions(&self) -> Dimensions
[src]
impl<T> Hash for GeometryCollection<T> where
T: Hash + CoordinateType,
[src]
T: Hash + CoordinateType,
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: CoordinateType,
[src]
T: CoordinateType,
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: CoordinateType,
[src]
T: CoordinateType,
impl<T, G> Intersects<G> for GeometryCollection<T> where
T: CoordinateType,
Geometry<T>: Intersects<G>,
[src]
T: CoordinateType,
Geometry<T>: Intersects<G>,
pub fn intersects(&self, rhs: &G) -> bool
[src]
impl<T> Intersects<GeometryCollection<T>> for Coordinate<T> where
GeometryCollection<T>: Intersects<Coordinate<T>>,
T: CoordinateType,
[src]
GeometryCollection<T>: Intersects<Coordinate<T>>,
T: CoordinateType,
pub fn intersects(&self, rhs: &GeometryCollection<T>) -> bool
[src]
impl<T> Intersects<GeometryCollection<T>> for Line<T> where
GeometryCollection<T>: Intersects<Line<T>>,
T: CoordinateType,
[src]
GeometryCollection<T>: Intersects<Line<T>>,
T: CoordinateType,
pub fn intersects(&self, rhs: &GeometryCollection<T>) -> bool
[src]
impl<T> Intersects<GeometryCollection<T>> for Rect<T> where
GeometryCollection<T>: Intersects<Rect<T>>,
T: CoordinateType,
[src]
GeometryCollection<T>: Intersects<Rect<T>>,
T: CoordinateType,
pub fn intersects(&self, rhs: &GeometryCollection<T>) -> bool
[src]
impl<T> Intersects<GeometryCollection<T>> for Polygon<T> where
GeometryCollection<T>: Intersects<Polygon<T>>,
T: CoordinateType,
[src]
GeometryCollection<T>: Intersects<Polygon<T>>,
T: CoordinateType,
pub fn intersects(&self, rhs: &GeometryCollection<T>) -> bool
[src]
impl<'a, T> IntoIterator for &'a GeometryCollection<T> where
T: CoordinateType,
[src]
T: CoordinateType,
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<'a, T> IntoIterator for &'a mut GeometryCollection<T> where
T: CoordinateType,
[src]
T: CoordinateType,
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<T> IntoIterator for GeometryCollection<T> where
T: CoordinateType,
[src]
T: CoordinateType,
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<T: CoordinateType, NT: CoordinateType> MapCoords<T, NT> for GeometryCollection<T>
[src]
type Output = GeometryCollection<NT>
pub fn map_coords(
&self,
func: impl Fn(&(T, T)) -> (NT, NT) + Copy
) -> Self::Output
[src]
&self,
func: impl Fn(&(T, T)) -> (NT, NT) + Copy
) -> Self::Output
impl<T: CoordinateType> MapCoordsInplace<T> for GeometryCollection<T>
[src]
impl<T> PartialEq<GeometryCollection<T>> for GeometryCollection<T> where
T: PartialEq<T> + CoordinateType,
[src]
T: PartialEq<T> + CoordinateType,
pub fn eq(&self, other: &GeometryCollection<T>) -> bool
[src]
pub fn ne(&self, other: &GeometryCollection<T>) -> bool
[src]
impl<T> StructuralEq for GeometryCollection<T> where
T: CoordinateType,
[src]
T: CoordinateType,
impl<T> StructuralPartialEq for GeometryCollection<T> where
T: CoordinateType,
[src]
T: CoordinateType,
impl<T: CoordinateType, NT: CoordinateType> 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<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
G: MapCoords<T, T, Output = G>,
T: Float,
[src]
G: MapCoords<T, T, Output = G>,
T: Float,
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
G: MapCoords<T, T, Output = G> + MapCoordsInplace<T>,
T: CoordinateType,
[src]
G: MapCoords<T, T, Output = G> + MapCoordsInplace<T>,
T: CoordinateType,
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>,