[][src]Struct shapefile::record::poly::GenericPolygon

pub struct GenericPolygon<PointType> {
    pub bbox: BBox,
    pub points: Vec<PointType>,
    pub parts: Vec<i32>,
}

Fields

bbox: BBoxpoints: Vec<PointType>parts: Vec<i32>

Methods

impl<PointType: HasXY> GenericPolygon<PointType>[src]

pub fn new(points: Vec<PointType>, parts: Vec<i32>) -> Self[src]

Examples

Creating a PolygonZ

use shapefile::{PointZ, PolygonZ, NO_DATA, MultipointShape};
let points = vec![
    PointZ::new(1.0, 1.0, 0.0, NO_DATA),
    PointZ::new(2.0, 2.0, 17.0, NO_DATA),
];
let poly = PolygonZ::new(points, vec![0]);

assert_eq!(poly.point(1), Some(&PointZ::new(2.0, 2.0, 17.0, NO_DATA)));

Trait Implementations

impl<PointType> MultipointShape<PointType> for GenericPolygon<PointType>[src]

impl<PointType> MultipartShape<PointType> for GenericPolygon<PointType>[src]

fn part(&self, index: usize) -> Option<&[PointType]>[src]

Returns the slice of points corresponding to part n°ìndex if the shape actually has multiple parts Read more

Important traits for PartIterator<'a, PointType, Shape>
fn parts(&self) -> PartIterator<PointType, Self>[src]

Returns an iterator over the parts of a MultipartShape Read more

impl<PointType> From<GenericPolygon<PointType>> for GenericPolyline<PointType>[src]

impl<PointType> From<GenericPolyline<PointType>> for GenericPolygon<PointType>[src]

impl<PointType> From<Polygon<f64>> for GenericPolygon<PointType> where
    PointType: HasXY + From<Coordinate<f64>>, 
[src]

geo_types guarantees that Polygons exterior and interiors are closed

impl<PointType> From<MultiPolygon<f64>> for GenericPolygon<PointType> where
    PointType: HasXY + From<Coordinate<f64>>, 
[src]

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

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

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

impl<PointType> TryFrom<GenericPolygon<PointType>> for MultiPolygon<f64> where
    PointType: HasXY + Copy,
    Point<f64>: From<PointType>, 
[src]

Converts a shapefile polygon into a geo_types MultiPolygon

Because in a shapefile A Polygon may contain multiple outer rings which are really just multiple polygons

Vertices of rings defining holes in polygons are in a counterclockwise direction

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<PointType> Sync for GenericPolygon<PointType> where
    PointType: Sync

impl<PointType> Send for GenericPolygon<PointType> where
    PointType: Send

impl<PointType> Unpin for GenericPolygon<PointType> where
    PointType: Unpin

impl<PointType> RefUnwindSafe for GenericPolygon<PointType> where
    PointType: RefUnwindSafe

impl<PointType> UnwindSafe for GenericPolygon<PointType> where
    PointType: UnwindSafe

Blanket Implementations

impl<S> ReadableShape for S where
    S: ConcreteReadableShape
[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.

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

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

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