[][src]Enum shapefile::record::Shape

pub enum Shape {
    NullShape,
    Point(Point),
    PointM(PointM),
    PointZ(PointZ),
    Polyline(Polyline),
    PolylineM(PolylineM),
    PolylineZ(PolylineZ),
    Polygon(Polygon),
    PolygonM(PolygonM),
    PolygonZ(PolygonZ),
    Multipoint(Multipoint),
    MultipointM(MultipointM),
    MultipointZ(MultipointZ),
    Multipatch(Multipatch),
}

enum of Shapes that can be read or written to a shapefile

geo-types

shapefile::Shape and geo_types::Geometry<f64> can be converted from one to another, however this conversion is not infallible so it is done using TryFrom

use std::convert::TryFrom;
use shapefile::Shape;
let mut shapes = shapefile::read("tests/data/line.shp")?;
let last_shape = shapes.pop().unwrap();
let geometry = geo_types::Geometry::<f64>::try_from(last_shape);

assert_eq!(geometry.is_ok(), true);
assert_eq!(geo_types::Geometry::<f64>::try_from(Shape::NullShape).is_err(), true);

Variants

NullShape
Point(Point)
PointM(PointM)
PointZ(PointZ)
Polyline(Polyline)
PolylineM(PolylineM)
PolylineZ(PolylineZ)
Polygon(Polygon)
PolygonM(PolygonM)
PolygonZ(PolygonZ)
Multipoint(Multipoint)
MultipointM(MultipointM)
MultipointZ(MultipointZ)
Multipatch(Multipatch)

Implementations

impl Shape[src]

pub fn shapetype(&self) -> ShapeType[src]

Returns the shapetype

Trait Implementations

impl Display for Shape[src]

impl From<GenericMultipoint<Point>> for Shape[src]

impl From<GenericMultipoint<PointM>> for Shape[src]

impl From<GenericMultipoint<PointZ>> for Shape[src]

impl From<GenericPolygon<Point>> for Shape[src]

impl From<GenericPolygon<PointM>> for Shape[src]

impl From<GenericPolygon<PointZ>> for Shape[src]

impl From<GenericPolyline<Point>> for Shape[src]

impl From<GenericPolyline<PointM>> for Shape[src]

impl From<GenericPolyline<PointZ>> for Shape[src]

impl From<Multipatch> for Shape[src]

impl From<Point> for Shape[src]

impl From<PointM> for Shape[src]

impl From<PointZ> for Shape[src]

impl HasShapeType for Shape[src]

impl ReadableShape for Shape[src]

impl TryFrom<Geometry<f64>> for Shape[src]

Converts a Geometry to a Shape

Since all Geometries are in 2D, the resulting shape will be 2D (Polygon, Polyline, etc and not PolylineM, PolylineZ, etc)

Fails if the geometry is a GeometryCollection, Rect, or Triangle

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<Shape> for Point[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Shape> for PointM[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Shape> for MultipointM[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Shape> for MultipointZ[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Shape> for Multipatch[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Shape> for PointZ[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Shape> for Polyline[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Shape> for PolylineM[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Shape> for PolylineZ[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Shape> for Polygon[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Shape> for PolygonM[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Shape> for PolygonZ[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Shape> for Multipoint[src]

type Error = Error

The type returned in the event of a conversion error.

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> ToString for T where
    T: Display + ?Sized
[src]

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.