[−][src]Struct shapefile::record::polyline::GenericPolyline
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_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]
fn clone(&self) -> GenericPolyline<PointType>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[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]
fn from(polyline: GenericPolyline<PointType>) -> Self
[src]
impl<PointType> From<GenericPolyline<PointType>> for MultiLineString<f64> where
PointType: Copy,
Coordinate<f64>: From<PointType>,
[src]
PointType: Copy,
Coordinate<f64>: From<PointType>,
fn from(polyline: GenericPolyline<PointType>) -> Self
[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]
PointType: From<Point<f64>> + ShrinkablePoint + GrowablePoint + Copy,
impl<PointType> From<LineString<f64>> for GenericPolyline<PointType> where
PointType: From<Coordinate<f64>> + ShrinkablePoint + GrowablePoint + Copy,
[src]
PointType: From<Coordinate<f64>> + ShrinkablePoint + GrowablePoint + Copy,
impl<PointType> From<MultiLineString<f64>> for GenericPolyline<PointType> where
PointType: From<Coordinate<f64>> + ShrinkablePoint + GrowablePoint + Copy,
[src]
PointType: From<Coordinate<f64>> + ShrinkablePoint + GrowablePoint + Copy,
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]
Auto Trait Implementations
impl<PointType> RefUnwindSafe for GenericPolyline<PointType> where
PointType: RefUnwindSafe,
PointType: RefUnwindSafe,
impl<PointType> Send for GenericPolyline<PointType> where
PointType: Send,
PointType: Send,
impl<PointType> Sync for GenericPolyline<PointType> where
PointType: Sync,
PointType: Sync,
impl<PointType> Unpin for GenericPolyline<PointType> where
PointType: Unpin,
PointType: Unpin,
impl<PointType> UnwindSafe for GenericPolyline<PointType> where
PointType: UnwindSafe,
PointType: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<S> ReadableShape for S where
S: ConcreteReadableShape,
[src]
S: ConcreteReadableShape,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,