Struct shapefile::record::polyline::GenericPolyline[][src]

pub struct GenericPolyline<PointType> { /* fields omitted */ }

Generic struct to create Polyline; PolylineM, PolylineZ

Polylines can have multiple parts.

Polylines parts must have 2 at least 2 points

To create a polyline with only one part use new, to create a polyline with multiple parts use with_parts

geo-types

shapefile’s Polyline can be converted to geo_types’s MultiLineString<f64>

geo-types’s Line, LineString, MultiLineString can be converted to shapefile’s Polyline

let mut polylines = shapefile::read_shapes_as::<_, shapefile::Polyline>("tests/data/line.shp")?;
let geo_polyline: geo_types::MultiLineString<f64> = polylines.pop().unwrap().into();
let polyline = shapefile::Polyline::from(geo_polyline);

Implementations

impl<PointType: ShrinkablePoint + GrowablePoint + Copy> GenericPolyline<PointType>[src]

Creating a Polyline

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

Examples

Polyline with single part

use shapefile::{Point, Polyline};
let points = vec![
    Point::new(1.0, 1.0),
    Point::new(2.0, 2.0),
];
let poly = Polyline::new(points);

panic

This will panic if the vec has less than 2 points

pub fn with_parts(parts: Vec<Vec<PointType>>) -> Self[src]

Examples

Polyline with multiple parts

use shapefile::{Point, Polyline};
let first_part = vec![
    Point::new(1.0, 1.0),
    Point::new(2.0, 2.0),
];

let second_part = vec![
    Point::new(3.0, 1.0),
    Point::new(5.0, 6.0),
];

let third_part = vec![
    Point::new(17.0, 15.0),
    Point::new(18.0, 19.0),
    Point::new(20.0, 19.0),
];
let poly = Polyline::with_parts(vec![first_part, second_part, third_part]);

panic

This will panic if any of the parts are less than 2 points

impl<PointType> GenericPolyline<PointType>[src]

pub fn bbox(&self) -> &GenericBBox<PointType>[src]

Returns the bounding box associated to the polyline

pub fn parts(&self) -> &Vec<Vec<PointType>>[src]

Returns a reference to all the parts

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

Returns a reference to a part

pub fn into_inner(self) -> Vec<Vec<PointType>>[src]

Consumes the polyline and returns the parts

pub fn total_point_count(&self) -> usize[src]

Returns the number of points contained in all the parts

Trait Implementations

impl<PointType: Clone> Clone for GenericPolyline<PointType>[src]

impl<PointType: Debug> Debug for GenericPolyline<PointType>[src]

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

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

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

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

impl<PointType> From<Line<f64>> for GenericPolyline<PointType> where
    PointType: From<Point<f64>> + ShrinkablePoint + GrowablePoint + Copy
[src]

impl<PointType> From<LineString<f64>> for GenericPolyline<PointType> where
    PointType: From<Coordinate<f64>> + ShrinkablePoint + GrowablePoint + Copy
[src]

impl<PointType> From<MultiLineString<f64>> for GenericPolyline<PointType> where
    PointType: From<Coordinate<f64>> + ShrinkablePoint + GrowablePoint + Copy
[src]

impl<PointType: PartialEq> PartialEq<GenericPolyline<PointType>> for GenericPolyline<PointType>[src]

impl<PointType> StructuralPartialEq for GenericPolyline<PointType>[src]

Auto Trait Implementations

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

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

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

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

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

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<S> ReadableShape for S where
    S: ConcreteReadableShape
[src]

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

type Owned = T

The resulting type after obtaining ownership.

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.