Enum geo::Geometry [−][src]
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>), }
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>)
Methods
impl<T> Geometry<T> where
T: CoordinateType, [src]
impl<T> Geometry<T> where
T: CoordinateType, pub fn as_point(self) -> Option<Point<T>>[src]
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.,));
pub fn as_linestring(self) -> Option<LineString<T>>[src]
pub fn as_linestring(self) -> Option<LineString<T>>If this Geometry is a LineString, then return that LineString, else None.
pub fn as_line(self) -> Option<Line<T>>[src]
pub fn as_line(self) -> Option<Line<T>>If this Geometry is a Line, then return that Line, else None.
pub fn as_polygon(self) -> Option<Polygon<T>>[src]
pub fn as_polygon(self) -> Option<Polygon<T>>If this Geometry is a Polygon, then return that, else None.
pub fn as_multipoint(self) -> Option<MultiPoint<T>>[src]
pub fn as_multipoint(self) -> Option<MultiPoint<T>>If this Geometry is a MultiPoint, then return that, else None.
pub fn as_multilinestring(self) -> Option<MultiLineString<T>>[src]
pub fn as_multilinestring(self) -> Option<MultiLineString<T>>If this Geometry is a MultiLineString, then return that, else None.
pub fn as_multipolygon(self) -> Option<MultiPolygon<T>>[src]
pub fn as_multipolygon(self) -> Option<MultiPolygon<T>>If this Geometry is a MultiPolygon, then return that, else None.
Trait Implementations
impl<T> Clone for Geometry<T> where
T: Clone + CoordinateType, [src]
impl<T> Clone for Geometry<T> where
T: Clone + CoordinateType, fn clone(&self) -> Geometry<T>[src]
fn clone(&self) -> Geometry<T>Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl<T> Debug for Geometry<T> where
T: Debug + CoordinateType, [src]
impl<T> Debug for Geometry<T> where
T: Debug + CoordinateType, fn fmt(&self, f: &mut Formatter) -> Result<(), Error>[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>Formats the value using the given formatter. Read more
impl<T> PartialEq<Geometry<T>> for Geometry<T> where
T: PartialEq<T> + CoordinateType, [src]
impl<T> PartialEq<Geometry<T>> for Geometry<T> where
T: PartialEq<T> + CoordinateType, fn eq(&self, other: &Geometry<T>) -> bool[src]
fn eq(&self, other: &Geometry<T>) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Geometry<T>) -> bool[src]
fn ne(&self, other: &Geometry<T>) -> boolThis method tests for !=.
impl<T> From<LineString<T>> for Geometry<T> where
T: CoordinateType, [src]
impl<T> From<LineString<T>> for Geometry<T> where
T: CoordinateType, fn from(x: LineString<T>) -> Geometry<T>[src]
fn from(x: LineString<T>) -> Geometry<T>Performs the conversion.
impl<T> From<MultiLineString<T>> for Geometry<T> where
T: CoordinateType, [src]
impl<T> From<MultiLineString<T>> for Geometry<T> where
T: CoordinateType, fn from(x: MultiLineString<T>) -> Geometry<T>[src]
fn from(x: MultiLineString<T>) -> Geometry<T>Performs the conversion.
impl<T> From<MultiPoint<T>> for Geometry<T> where
T: CoordinateType, [src]
impl<T> From<MultiPoint<T>> for Geometry<T> where
T: CoordinateType, fn from(x: MultiPoint<T>) -> Geometry<T>[src]
fn from(x: MultiPoint<T>) -> Geometry<T>Performs the conversion.
impl<T> From<Point<T>> for Geometry<T> where
T: CoordinateType, [src]
impl<T> From<Point<T>> for Geometry<T> where
T: CoordinateType, impl<T> From<MultiPolygon<T>> for Geometry<T> where
T: CoordinateType, [src]
impl<T> From<MultiPolygon<T>> for Geometry<T> where
T: CoordinateType, fn from(x: MultiPolygon<T>) -> Geometry<T>[src]
fn from(x: MultiPolygon<T>) -> Geometry<T>Performs the conversion.
impl<T> From<Polygon<T>> for Geometry<T> where
T: CoordinateType, [src]
impl<T> From<Polygon<T>> for Geometry<T> where
T: CoordinateType, impl<T: CoordinateType, NT: CoordinateType> MapCoords<T, NT> for Geometry<T>[src]
impl<T: CoordinateType, NT: CoordinateType> MapCoords<T, NT> for Geometry<T>type Output = Geometry<NT>
fn map_coords(&self, func: &Fn(&(T, T)) -> (NT, NT)) -> Self::Output[src]
fn map_coords(&self, func: &Fn(&(T, T)) -> (NT, NT)) -> Self::OutputApply a function to all the coordinates in a geometric object, returning a new object. Read more
impl<T: CoordinateType, NT: CoordinateType> TryMapCoords<T, NT> for Geometry<T>[src]
impl<T: CoordinateType, NT: CoordinateType> TryMapCoords<T, NT> for Geometry<T>type Output = Geometry<NT>
fn try_map_coords(
&self,
func: &Fn(&(T, T)) -> Result<(NT, NT), Error>
) -> Result<Self::Output, Error>[src]
fn try_map_coords(
&self,
func: &Fn(&(T, T)) -> Result<(NT, NT), Error>
) -> Result<Self::Output, Error>Map a fallible function over all the coordinates in a geometry, returning a Result Read more
impl<T: CoordinateType> MapCoordsInplace<T> for Geometry<T>[src]
impl<T: CoordinateType> MapCoordsInplace<T> for Geometry<T>