[][src]Enum geo::algorithm::dimensions::Dimensions

pub enum Dimensions {
    Empty,
    ZeroDimensional,
    OneDimensional,
    TwoDimensional,
}

Geometries can have 0, 1, or two dimensions. Or, in the case of an empty geometry, a special Empty dimensionality.

Examples

use geo_types::{Point, Rect, line_string};
use geo::algorithm::dimensions::{HasDimensions, Dimensions};

let point = Point::new(0.0, 5.0);
let line_string = line_string![(x: 0.0, y: 0.0), (x: 5.0, y: 5.0), (x: 0.0, y: 5.0)];
let rect = Rect::new((0.0, 0.0), (10.0, 10.0));
assert_eq!(Dimensions::ZeroDimensional, point.dimensions());
assert_eq!(Dimensions::OneDimensional, line_string.dimensions());
assert_eq!(Dimensions::TwoDimensional, rect.dimensions());

assert!(point.dimensions() < line_string.dimensions());
assert!(rect.dimensions() > line_string.dimensions());

Variants

Empty

Some geometries, like a MultiPoint or GeometryColletion may have no elements - thus no dimensions. Note that this is distinct from being ZeroDimensional, like a Point.

ZeroDimensional

Dimension of a point

OneDimensional

Dimension of a line or curve

TwoDimensional

Dimension of a surface

Trait Implementations

impl Clone for Dimensions[src]

impl Copy for Dimensions[src]

impl Debug for Dimensions[src]

impl Eq for Dimensions[src]

impl Ord for Dimensions[src]

impl PartialEq<Dimensions> for Dimensions[src]

impl PartialOrd<Dimensions> for Dimensions[src]

impl StructuralEq for Dimensions[src]

impl StructuralPartialEq for Dimensions[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.