pub enum Geometry<T>where
T: CoordinateType,{
Point(Point<T>),
Line(Line<T>),
LineString(LineString<T>),
Polygon(Polygon<T>),
MultiPoint(MultiPoint<T>),
MultiLineString(MultiLineString<T>),
MultiPolygon(MultiPolygon<T>),
GeometryCollection(GeometryCollection<T>),
}
Expand description
An enum representing any possible geometry type.
All Geo
types can be converted to a Geometry
member using .into()
(as part of the
std::convert::Into
pattern).
Variants
Point(Point<T>)
Line(Line<T>)
LineString(LineString<T>)
Polygon(Polygon<T>)
MultiPoint(MultiPoint<T>)
MultiLineString(MultiLineString<T>)
MultiPolygon(MultiPolygon<T>)
GeometryCollection(GeometryCollection<T>)
Implementations
sourceimpl<T: CoordinateType> Geometry<T>
impl<T: CoordinateType> Geometry<T>
sourcepub fn as_point(self) -> Option<Point<T>>
pub fn as_point(self) -> Option<Point<T>>
If this Geometry is a Point, then return that, else None.
Examples
use geo_types::*;
let g = Geometry::Point(Point::new(0., 0.));
let p2: Point<f32> = g.as_point().unwrap();
assert_eq!(p2, Point::new(0., 0.,));
sourcepub fn as_linestring(self) -> Option<LineString<T>>
pub fn as_linestring(self) -> Option<LineString<T>>
If this Geometry is a LineString, then return that LineString, else None.
sourcepub fn as_line(self) -> Option<Line<T>>
pub fn as_line(self) -> Option<Line<T>>
If this Geometry is a Line, then return that Line, else None.
sourcepub fn as_polygon(self) -> Option<Polygon<T>>
pub fn as_polygon(self) -> Option<Polygon<T>>
If this Geometry is a Polygon, then return that, else None.
sourcepub fn as_multipoint(self) -> Option<MultiPoint<T>>
pub fn as_multipoint(self) -> Option<MultiPoint<T>>
If this Geometry is a MultiPoint, then return that, else None.
sourcepub fn as_multilinestring(self) -> Option<MultiLineString<T>>
pub fn as_multilinestring(self) -> Option<MultiLineString<T>>
If this Geometry is a MultiLineString, then return that, else None.
sourcepub fn as_multipolygon(self) -> Option<MultiPolygon<T>>
pub fn as_multipolygon(self) -> Option<MultiPolygon<T>>
If this Geometry is a MultiPolygon, then return that, else None.
Trait Implementations
sourceimpl<T: Clone> Clone for Geometry<T>where
T: CoordinateType,
impl<T: Clone> Clone for Geometry<T>where
T: CoordinateType,
sourceimpl<T: Debug> Debug for Geometry<T>where
T: CoordinateType,
impl<T: Debug> Debug for Geometry<T>where
T: CoordinateType,
sourceimpl<T: CoordinateType> From<LineString<T>> for Geometry<T>
impl<T: CoordinateType> From<LineString<T>> for Geometry<T>
sourcefn from(x: LineString<T>) -> Geometry<T>
fn from(x: LineString<T>) -> Geometry<T>
Converts to this type from the input type.
sourceimpl<T: CoordinateType> From<MultiLineString<T>> for Geometry<T>
impl<T: CoordinateType> From<MultiLineString<T>> for Geometry<T>
sourcefn from(x: MultiLineString<T>) -> Geometry<T>
fn from(x: MultiLineString<T>) -> Geometry<T>
Converts to this type from the input type.
sourceimpl<T: CoordinateType> From<MultiPoint<T>> for Geometry<T>
impl<T: CoordinateType> From<MultiPoint<T>> for Geometry<T>
sourcefn from(x: MultiPoint<T>) -> Geometry<T>
fn from(x: MultiPoint<T>) -> Geometry<T>
Converts to this type from the input type.
sourceimpl<T: CoordinateType> From<MultiPolygon<T>> for Geometry<T>
impl<T: CoordinateType> From<MultiPolygon<T>> for Geometry<T>
sourcefn from(x: MultiPolygon<T>) -> Geometry<T>
fn from(x: MultiPolygon<T>) -> Geometry<T>
Converts to this type from the input type.
sourceimpl<T: CoordinateType> From<Point<T>> for Geometry<T>
impl<T: CoordinateType> From<Point<T>> for Geometry<T>
sourceimpl<T: CoordinateType> From<Polygon<T>> for Geometry<T>
impl<T: CoordinateType> From<Polygon<T>> for Geometry<T>
sourceimpl<T: PartialEq> PartialEq<Geometry<T>> for Geometry<T>where
T: CoordinateType,
impl<T: PartialEq> PartialEq<Geometry<T>> for Geometry<T>where
T: CoordinateType,
impl<T> StructuralPartialEq for Geometry<T>where
T: CoordinateType,
Auto Trait Implementations
impl<T> RefUnwindSafe for Geometry<T>where
T: RefUnwindSafe,
impl<T> Send for Geometry<T>where
T: Send,
impl<T> Sync for Geometry<T>where
T: Sync,
impl<T> Unpin for Geometry<T>where
T: Unpin,
impl<T> UnwindSafe for Geometry<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more