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: CoordinateType> Geometry<T>
[src]
pub fn as_point(self) -> Option<Point<T>>
[src]
If this Geometry is a Point, then return that, else None.
use geo::*; 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]
If this Geometry is a LineString, then return that LineString, else None.
pub fn as_line(self) -> Option<Line<T>>
[src]
If this Geometry is a Line, then return that Line, else None.
pub fn as_polygon(self) -> Option<Polygon<T>>
[src]
If this Geometry is a Polygon, then return that, else None.
pub fn as_multipoint(self) -> Option<MultiPoint<T>>
[src]
If this Geometry is a MultiPoint, then return that, else None.
pub fn as_multilinestring(self) -> Option<MultiLineString<T>>
[src]
If this Geometry is a MultiLineString, then return that, else None.
pub fn as_multipolygon(self) -> Option<MultiPolygon<T>>
[src]
If this Geometry is a MultiPolygon, then return that, else None.
Trait Implementations
impl<T: PartialEq> PartialEq for Geometry<T> where
T: CoordinateType,
[src]
T: CoordinateType,
fn eq(&self, __arg_0: &Geometry<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Geometry<T>) -> bool
[src]
This method tests for !=
.
impl<T: Clone> Clone for Geometry<T> where
T: CoordinateType,
[src]
T: CoordinateType,
fn clone(&self) -> Geometry<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Debug> Debug for Geometry<T> where
T: CoordinateType,
[src]
T: CoordinateType,
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T: CoordinateType> From<Point<T>> for Geometry<T>
[src]
impl<T: CoordinateType> From<LineString<T>> for Geometry<T>
[src]
fn from(x: LineString<T>) -> Geometry<T>
[src]
Performs the conversion.
impl<T: CoordinateType> From<Polygon<T>> for Geometry<T>
[src]
impl<T: CoordinateType> From<MultiPoint<T>> for Geometry<T>
[src]
fn from(x: MultiPoint<T>) -> Geometry<T>
[src]
Performs the conversion.
impl<T: CoordinateType> From<MultiLineString<T>> for Geometry<T>
[src]
fn from(x: MultiLineString<T>) -> Geometry<T>
[src]
Performs the conversion.
impl<T: CoordinateType> From<MultiPolygon<T>> for Geometry<T>
[src]
fn from(x: MultiPolygon<T>) -> Geometry<T>
[src]
Performs the conversion.
impl<T: CoordinateType, NT: CoordinateType> MapCoords<T, NT> for Geometry<T>
[src]
type Output = Geometry<NT>
fn map_coords(&self, func: &Fn(&(T, T)) -> (NT, NT)) -> Self::Output
[src]
Apply a function to all the coordinates in a geometric object, returning a new object. Read more
impl<T: CoordinateType> MapCoordsInplace<T> for Geometry<T>
[src]
fn map_coords_inplace(&mut self, func: &Fn(&(T, T)) -> (T, T))
[src]
Apply a function to all the coordinates in a geometric object, in place Read more
impl ToPostgis<Geometry> for Geometry<f64>
[src]
fn to_postgis_with_srid(&self, srid: Option<i32>) -> Geometry
[src]
Converts this geometry to a PostGIS type, using the supplied SRID.
fn to_postgis_wgs84(&self) -> T
[src]
Converts this WGS84 geometry to a PostGIS type.