pub enum Geometry<T = f64>where
T: CoordNum,{
Point(Point<T>),
Line(Line<T>),
LineString(LineString<T>),
Polygon(Polygon<T>),
MultiPoint(MultiPoint<T>),
MultiLineString(MultiLineString<T>),
MultiPolygon(MultiPolygon<T>),
GeometryCollection(GeometryCollection<T>),
Rect(Rect<T>),
Triangle(Triangle<T>),
}geo-types only.Expand description
An enum representing any possible geometry type.
All geometry variants (Point, LineString, etc.) can be converted to a Geometry using
Into::into. Conversely, TryFrom::try_from can be used to convert a Geometry
back to one of it’s specific enum members.
§Example
use std::convert::TryFrom;
use geo_types::{Point, point, Geometry, GeometryCollection};
let p = point!(x: 1.0, y: 1.0);
let pe: Geometry = p.into();
let pn = Point::try_from(pe).unwrap();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>)
Rect(Rect<T>)
Triangle(Triangle<T>)
Implementations§
Source§impl<T> Geometry<T>where
T: CoordNum,
impl<T> Geometry<T>where
T: CoordNum,
Sourcepub fn into_point(self) -> Option<Point<T>>
👎Deprecated: Will be removed in an upcoming version. Switch to std::convert::TryInto<Point>
pub fn into_point(self) -> Option<Point<T>>
If this Geometry is a Point, then return that, else None.
§Examples
use geo_types::*;
use std::convert::TryInto;
let g = Geometry::Point(Point::new(0., 0.));
let p2: Point<f32> = g.try_into().unwrap();
assert_eq!(p2, Point::new(0., 0.,));Sourcepub fn into_line_string(self) -> Option<LineString<T>>
👎Deprecated: Will be removed in an upcoming version. Switch to std::convert::TryInto<LineString>
pub fn into_line_string(self) -> Option<LineString<T>>
If this Geometry is a LineString, then return that LineString, else None.
Sourcepub fn into_line(self) -> Option<Line<T>>
👎Deprecated: Will be removed in an upcoming version. Switch to std::convert::TryInto<Line>
pub fn into_line(self) -> Option<Line<T>>
If this Geometry is a Line, then return that Line, else None.
Sourcepub fn into_polygon(self) -> Option<Polygon<T>>
👎Deprecated: Will be removed in an upcoming version. Switch to std::convert::TryInto<Polygon>
pub fn into_polygon(self) -> Option<Polygon<T>>
If this Geometry is a Polygon, then return that, else None.
Sourcepub fn into_multi_point(self) -> Option<MultiPoint<T>>
👎Deprecated: Will be removed in an upcoming version. Switch to std::convert::TryInto<MultiPoint>
pub fn into_multi_point(self) -> Option<MultiPoint<T>>
If this Geometry is a MultiPoint, then return that, else None.
Sourcepub fn into_multi_line_string(self) -> Option<MultiLineString<T>>
👎Deprecated: Will be removed in an upcoming version. Switch to std::convert::TryInto<MultiLineString>
pub fn into_multi_line_string(self) -> Option<MultiLineString<T>>
If this Geometry is a MultiLineString, then return that, else None.
Sourcepub fn into_multi_polygon(self) -> Option<MultiPolygon<T>>
👎Deprecated: Will be removed in an upcoming version. Switch to std::convert::TryInto<MultiPolygon>
pub fn into_multi_polygon(self) -> Option<MultiPolygon<T>>
If this Geometry is a MultiPolygon, then return that, else None.
Trait Implementations§
Source§impl<T> Encode<'_, Exasol> for Geometry<T>
impl<T> Encode<'_, Exasol> for Geometry<T>
Source§fn encode_by_ref(
&self,
buf: &mut ExaBuffer,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
fn encode_by_ref( &self, buf: &mut ExaBuffer, ) -> Result<IsNull, Box<dyn Error + Sync + Send>>
Source§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
Source§impl<'a, T> From<&'a LineString<T>> for Geometry<T>where
T: CoordNum,
impl<'a, T> From<&'a LineString<T>> for Geometry<T>where
T: CoordNum,
Source§fn from(line_string: &'a LineString<T>) -> Geometry<T>
fn from(line_string: &'a LineString<T>) -> Geometry<T>
Source§impl<'a, T> From<&'a MultiLineString<T>> for Geometry<T>where
T: CoordNum,
impl<'a, T> From<&'a MultiLineString<T>> for Geometry<T>where
T: CoordNum,
Source§fn from(multi_line_string: &'a MultiLineString<T>) -> Geometry<T>
fn from(multi_line_string: &'a MultiLineString<T>) -> Geometry<T>
Source§impl<'a, T> From<&'a MultiPolygon<T>> for Geometry<T>where
T: CoordNum,
impl<'a, T> From<&'a MultiPolygon<T>> for Geometry<T>where
T: CoordNum,
Source§fn from(multi_polygon: &'a MultiPolygon<T>) -> Geometry<T>
fn from(multi_polygon: &'a MultiPolygon<T>) -> Geometry<T>
Source§impl<T> From<LineString<T>> for Geometry<T>where
T: CoordNum,
impl<T> From<LineString<T>> for Geometry<T>where
T: CoordNum,
Source§fn from(x: LineString<T>) -> Geometry<T>
fn from(x: LineString<T>) -> Geometry<T>
Source§impl<T> From<MultiLineString<T>> for Geometry<T>where
T: CoordNum,
impl<T> From<MultiLineString<T>> for Geometry<T>where
T: CoordNum,
Source§fn from(x: MultiLineString<T>) -> Geometry<T>
fn from(x: MultiLineString<T>) -> Geometry<T>
Source§impl<T> From<MultiPoint<T>> for Geometry<T>where
T: CoordNum,
impl<T> From<MultiPoint<T>> for Geometry<T>where
T: CoordNum,
Source§fn from(x: MultiPoint<T>) -> Geometry<T>
fn from(x: MultiPoint<T>) -> Geometry<T>
Source§impl<T> From<MultiPolygon<T>> for Geometry<T>where
T: CoordNum,
impl<T> From<MultiPolygon<T>> for Geometry<T>where
T: CoordNum,
Source§fn from(x: MultiPolygon<T>) -> Geometry<T>
fn from(x: MultiPolygon<T>) -> Geometry<T>
Source§impl<'a, T> GeometryTrait for &'a Geometry<T>where
T: CoordNum + 'a,
impl<'a, T> GeometryTrait for &'a Geometry<T>where
T: CoordNum + 'a,
Source§type PointType<'b> = Point<<&'a Geometry<T> as GeometryTrait>::T>
where
&'a Geometry<T>: 'b
type PointType<'b> = Point<<&'a Geometry<T> as GeometryTrait>::T> where &'a Geometry<T>: 'b
Source§type LineStringType<'b> = LineString<<&'a Geometry<T> as GeometryTrait>::T>
where
&'a Geometry<T>: 'b
type LineStringType<'b> = LineString<<&'a Geometry<T> as GeometryTrait>::T> where &'a Geometry<T>: 'b
Source§type PolygonType<'b> = Polygon<<&'a Geometry<T> as GeometryTrait>::T>
where
&'a Geometry<T>: 'b
type PolygonType<'b> = Polygon<<&'a Geometry<T> as GeometryTrait>::T> where &'a Geometry<T>: 'b
Source§type MultiPointType<'b> = MultiPoint<<&'a Geometry<T> as GeometryTrait>::T>
where
&'a Geometry<T>: 'b
type MultiPointType<'b> = MultiPoint<<&'a Geometry<T> as GeometryTrait>::T> where &'a Geometry<T>: 'b
Source§type MultiLineStringType<'b> = MultiLineString<<&'a Geometry<T> as GeometryTrait>::T>
where
&'a Geometry<T>: 'b
type MultiLineStringType<'b> = MultiLineString<<&'a Geometry<T> as GeometryTrait>::T> where &'a Geometry<T>: 'b
Source§type MultiPolygonType<'b> = MultiPolygon<<&'a Geometry<T> as GeometryTrait>::T>
where
&'a Geometry<T>: 'b
type MultiPolygonType<'b> = MultiPolygon<<&'a Geometry<T> as GeometryTrait>::T> where &'a Geometry<T>: 'b
Source§type GeometryCollectionType<'b> = GeometryCollection<<&'a Geometry<T> as GeometryTrait>::T>
where
&'a Geometry<T>: 'b
type GeometryCollectionType<'b> = GeometryCollection<<&'a Geometry<T> as GeometryTrait>::T> where &'a Geometry<T>: 'b
Source§type RectType<'b> = Rect<<&'a Geometry<T> as GeometryTrait>::T>
where
&'a Geometry<T>: 'b
type RectType<'b> = Rect<<&'a Geometry<T> as GeometryTrait>::T> where &'a Geometry<T>: 'b
Source§type TriangleType<'b> = Triangle<<&'a Geometry<T> as GeometryTrait>::T>
where
&'a Geometry<T>: 'b
type TriangleType<'b> = Triangle<<&'a Geometry<T> as GeometryTrait>::T> where &'a Geometry<T>: 'b
Source§type LineType<'b> = Line<<&'a Geometry<T> as GeometryTrait>::T>
where
&'a Geometry<T>: 'b
type LineType<'b> = Line<<&'a Geometry<T> as GeometryTrait>::T> where &'a Geometry<T>: 'b
Source§fn dim(&self) -> Dimensions
fn dim(&self) -> Dimensions
Source§fn as_type(
&self,
) -> GeometryType<'_, Point<T>, LineString<T>, Polygon<T>, MultiPoint<T>, MultiLineString<T>, MultiPolygon<T>, GeometryCollection<T>, Rect<T>, Triangle<T>, Line<T>>
fn as_type( &self, ) -> GeometryType<'_, Point<T>, LineString<T>, Polygon<T>, MultiPoint<T>, MultiLineString<T>, MultiPolygon<T>, GeometryCollection<T>, Rect<T>, Triangle<T>, Line<T>>
GeometryType enum, which allows for downcasting to a specific
typeSource§impl<T> GeometryTrait for Geometry<T>where
T: CoordNum,
impl<T> GeometryTrait for Geometry<T>where
T: CoordNum,
Source§type PointType<'b> = Point<<Geometry<T> as GeometryTrait>::T>
where
Geometry<T>: 'b
type PointType<'b> = Point<<Geometry<T> as GeometryTrait>::T> where Geometry<T>: 'b
Source§type LineStringType<'b> = LineString<<Geometry<T> as GeometryTrait>::T>
where
Geometry<T>: 'b
type LineStringType<'b> = LineString<<Geometry<T> as GeometryTrait>::T> where Geometry<T>: 'b
Source§type PolygonType<'b> = Polygon<<Geometry<T> as GeometryTrait>::T>
where
Geometry<T>: 'b
type PolygonType<'b> = Polygon<<Geometry<T> as GeometryTrait>::T> where Geometry<T>: 'b
Source§type MultiPointType<'b> = MultiPoint<<Geometry<T> as GeometryTrait>::T>
where
Geometry<T>: 'b
type MultiPointType<'b> = MultiPoint<<Geometry<T> as GeometryTrait>::T> where Geometry<T>: 'b
Source§type MultiLineStringType<'b> = MultiLineString<<Geometry<T> as GeometryTrait>::T>
where
Geometry<T>: 'b
type MultiLineStringType<'b> = MultiLineString<<Geometry<T> as GeometryTrait>::T> where Geometry<T>: 'b
Source§type MultiPolygonType<'b> = MultiPolygon<<Geometry<T> as GeometryTrait>::T>
where
Geometry<T>: 'b
type MultiPolygonType<'b> = MultiPolygon<<Geometry<T> as GeometryTrait>::T> where Geometry<T>: 'b
Source§type GeometryCollectionType<'b> = GeometryCollection<<Geometry<T> as GeometryTrait>::T>
where
Geometry<T>: 'b
type GeometryCollectionType<'b> = GeometryCollection<<Geometry<T> as GeometryTrait>::T> where Geometry<T>: 'b
Source§type RectType<'b> = Rect<<Geometry<T> as GeometryTrait>::T>
where
Geometry<T>: 'b
type RectType<'b> = Rect<<Geometry<T> as GeometryTrait>::T> where Geometry<T>: 'b
Source§type TriangleType<'b> = Triangle<<Geometry<T> as GeometryTrait>::T>
where
Geometry<T>: 'b
type TriangleType<'b> = Triangle<<Geometry<T> as GeometryTrait>::T> where Geometry<T>: 'b
Source§type LineType<'b> = Line<<Geometry<T> as GeometryTrait>::T>
where
Geometry<T>: 'b
type LineType<'b> = Line<<Geometry<T> as GeometryTrait>::T> where Geometry<T>: 'b
Source§fn dim(&self) -> Dimensions
fn dim(&self) -> Dimensions
Source§fn as_type(
&self,
) -> GeometryType<'_, Point<T>, LineString<T>, Polygon<T>, MultiPoint<T>, MultiLineString<T>, MultiPolygon<T>, GeometryCollection<T>, Rect<T>, Triangle<T>, Line<T>>
fn as_type( &self, ) -> GeometryType<'_, Point<T>, LineString<T>, Polygon<T>, MultiPoint<T>, MultiLineString<T>, MultiPolygon<T>, GeometryCollection<T>, Rect<T>, Triangle<T>, Line<T>>
GeometryType enum, which allows for downcasting to a specific
typeSource§impl<T> ToWkt<T> for Geometry<T>
§Examples
use geo_types::{point, Geometry};
use wkt::ToWkt;
let geometry: Geometry<f64> = Geometry::Point(point!(x: 1., y: 2.));
assert_eq!(geometry.wkt_string(), "POINT(1 2)");
impl<T> ToWkt<T> for Geometry<T>
§Examples
use geo_types::{point, Geometry};
use wkt::ToWkt;
let geometry: Geometry<f64> = Geometry::Point(point!(x: 1., y: 2.));
assert_eq!(geometry.wkt_string(), "POINT(1 2)");Source§impl<T> TryFrom<Geometry<T>> for Line<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
impl<T> TryFrom<Geometry<T>> for Line<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
Source§impl<T> TryFrom<Geometry<T>> for LineString<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
impl<T> TryFrom<Geometry<T>> for LineString<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
Source§impl<T> TryFrom<Geometry<T>> for MultiLineString<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
impl<T> TryFrom<Geometry<T>> for MultiLineString<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
Source§impl<T> TryFrom<Geometry<T>> for MultiPoint<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
impl<T> TryFrom<Geometry<T>> for MultiPoint<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
Source§impl<T> TryFrom<Geometry<T>> for MultiPolygon<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
impl<T> TryFrom<Geometry<T>> for MultiPolygon<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
Source§impl<T> TryFrom<Geometry<T>> for Point<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
impl<T> TryFrom<Geometry<T>> for Point<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
Source§impl<T> TryFrom<Geometry<T>> for Polygon<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
impl<T> TryFrom<Geometry<T>> for Polygon<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
Source§impl<T> TryFrom<Geometry<T>> for Rect<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
impl<T> TryFrom<Geometry<T>> for Rect<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
Source§impl<T> TryFrom<Geometry<T>> for Triangle<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
impl<T> TryFrom<Geometry<T>> for Triangle<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
Source§impl<T> TryFromWkt<T> for Geometry<T>
impl<T> TryFromWkt<T> for Geometry<T>
impl<T> Eq for Geometry<T>
impl<T> ExaHasArrayType for Geometry<T>where
T: CoordNum,
impl<T> StructuralPartialEq for Geometry<T>where
T: CoordNum,
Auto Trait Implementations§
impl<T> Freeze for Geometry<T>where
T: Freeze,
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more