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]
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]
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: Clone> Clone for GenericPolyline<PointType>
[src]fn clone(&self) -> GenericPolyline<PointType>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<PointType: Debug> Debug for GenericPolyline<PointType>
[src]
impl<PointType: Debug> Debug for GenericPolyline<PointType>
[src]impl<PointType: HasXY> From<GenericPolyline<PointType>> for GenericPolygon<PointType>
[src]
impl<PointType: HasXY> From<GenericPolyline<PointType>> for GenericPolygon<PointType>
[src]fn from(polyline: GenericPolyline<PointType>) -> Self
[src]
impl<PointType> From<Line<f64>> for GenericPolyline<PointType> where
PointType: From<Point<f64>> + ShrinkablePoint + GrowablePoint + Copy,
[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<LineString<f64>> for GenericPolyline<PointType> where
PointType: From<Coordinate<f64>> + ShrinkablePoint + GrowablePoint + Copy,
[src]fn from(line: LineString<f64>) -> Self
[src]
impl<PointType> From<MultiLineString<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]fn from(mls: MultiLineString<f64>) -> Self
[src]
impl<PointType: PartialEq> PartialEq<GenericPolyline<PointType>> for GenericPolyline<PointType>
[src]
impl<PointType: PartialEq> PartialEq<GenericPolyline<PointType>> for GenericPolyline<PointType>
[src]fn eq(&self, other: &GenericPolyline<PointType>) -> bool
[src]
fn ne(&self, other: &GenericPolyline<PointType>) -> bool
[src]
impl<PointType> StructuralPartialEq 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> RefUnwindSafe for GenericPolyline<PointType> where
PointType: RefUnwindSafe,
impl<PointType> Send for GenericPolyline<PointType> where
PointType: Send,
impl<PointType> Send for GenericPolyline<PointType> where
PointType: Send,
impl<PointType> Sync for GenericPolyline<PointType> where
PointType: Sync,
impl<PointType> Sync for GenericPolyline<PointType> where
PointType: Sync,
impl<PointType> Unpin for GenericPolyline<PointType> where
PointType: Unpin,
impl<PointType> Unpin for GenericPolyline<PointType> where
PointType: Unpin,
impl<PointType> UnwindSafe for GenericPolyline<PointType> where
PointType: UnwindSafe,
impl<PointType> UnwindSafe for GenericPolyline<PointType> where
PointType: UnwindSafe,