pub enum Shape {
Show 14 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),
}
Expand description
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_shapes("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§
Trait Implementations§
source§impl From<GenericMultipoint<Point>> for Shape
impl From<GenericMultipoint<Point>> for Shape
source§fn from(concrete: Multipoint) -> Self
fn from(concrete: Multipoint) -> Self
Converts to this type from the input type.
source§impl From<GenericMultipoint<PointM>> for Shape
impl From<GenericMultipoint<PointM>> for Shape
source§fn from(concrete: MultipointM) -> Self
fn from(concrete: MultipointM) -> Self
Converts to this type from the input type.
source§impl From<GenericMultipoint<PointZ>> for Shape
impl From<GenericMultipoint<PointZ>> for Shape
source§fn from(concrete: MultipointZ) -> Self
fn from(concrete: MultipointZ) -> Self
Converts to this type from the input type.
source§impl From<Multipatch> for Shape
impl From<Multipatch> for Shape
source§fn from(concrete: Multipatch) -> Self
fn from(concrete: Multipatch) -> Self
Converts to this type from the input type.
source§impl ReadableShape for Shape
impl ReadableShape for Shape
source§impl TryFrom<Geometry> for Shape
impl TryFrom<Geometry> for Shape
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
source§impl TryFrom<Shape> for Multipoint
impl TryFrom<Shape> for Multipoint
source§impl TryFrom<Shape> for MultipointM
impl TryFrom<Shape> for MultipointM
source§impl TryFrom<Shape> for MultipointZ
impl TryFrom<Shape> for MultipointZ
source§impl TryFrom<Shape> for Geometry<f64>
impl TryFrom<Shape> for Geometry<f64>
Tries to convert a shapefile’s Shape into a geo_types::Geometry
This conversion can fail because the conversion of shapefile’s polygons & multipatch into their geo_types counter parts can fail. And the NullShape has no equivalent Geometry;
source§impl TryFrom<Shape> for Multipatch
impl TryFrom<Shape> for Multipatch
Auto Trait Implementations§
impl Freeze for Shape
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnwindSafe for Shape
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
Mutably borrows from an owned value. Read more