pub struct GenericPolyline<PointType> { /* private fields */ }Expand description
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§
Source§impl<PointType: ShrinkablePoint + GrowablePoint + Copy> GenericPolyline<PointType>
Creating a Polyline
impl<PointType: ShrinkablePoint + GrowablePoint + Copy> GenericPolyline<PointType>
Creating a Polyline
Sourcepub fn with_parts(parts: Vec<Vec<PointType>>) -> Self
pub fn with_parts(parts: Vec<Vec<PointType>>) -> Self
§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
Source§impl<PointType> GenericPolyline<PointType>
impl<PointType> GenericPolyline<PointType>
Sourcepub fn bbox(&self) -> &GenericBBox<PointType>
pub fn bbox(&self) -> &GenericBBox<PointType>
Returns the bounding box associated to the polyline
Sourcepub fn into_inner(self) -> Vec<Vec<PointType>>
pub fn into_inner(self) -> Vec<Vec<PointType>>
Consumes the polyline and returns the parts
Sourcepub fn total_point_count(&self) -> usize
pub fn total_point_count(&self) -> usize
Returns the number of points contained in all the parts
Trait Implementations§
Source§impl<PointType: Clone> Clone for GenericPolyline<PointType>
impl<PointType: Clone> Clone for GenericPolyline<PointType>
Source§fn clone(&self) -> GenericPolyline<PointType>
fn clone(&self) -> GenericPolyline<PointType>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<PointType: Debug> Debug for GenericPolyline<PointType>
impl<PointType: Debug> Debug for GenericPolyline<PointType>
Source§impl<PointType: HasXY> From<GenericPolyline<PointType>> for GenericPolygon<PointType>
impl<PointType: HasXY> From<GenericPolyline<PointType>> for GenericPolygon<PointType>
Source§fn from(polyline: GenericPolyline<PointType>) -> Self
fn from(polyline: GenericPolyline<PointType>) -> Self
Converts to this type from the input type.
Source§impl<PointType> From<GenericPolyline<PointType>> for MultiLineString<f64>
Available on crate feature geo-types only.
impl<PointType> From<GenericPolyline<PointType>> for MultiLineString<f64>
Available on crate feature
geo-types only.Source§fn from(polyline: GenericPolyline<PointType>) -> Self
fn from(polyline: GenericPolyline<PointType>) -> Self
Converts to this type from the input type.
Source§impl<PointType> From<Line> for GenericPolyline<PointType>
Available on crate feature geo-types only.
impl<PointType> From<Line> for GenericPolyline<PointType>
Available on crate feature
geo-types only.Source§impl<PointType> From<LineString> for GenericPolyline<PointType>
Available on crate feature geo-types only.
impl<PointType> From<LineString> for GenericPolyline<PointType>
Available on crate feature
geo-types only.Source§fn from(line: LineString<f64>) -> Self
fn from(line: LineString<f64>) -> Self
Converts to this type from the input type.
Source§impl<PointType> From<MultiLineString> for GenericPolyline<PointType>
Available on crate feature geo-types only.
impl<PointType> From<MultiLineString> for GenericPolyline<PointType>
Available on crate feature
geo-types only.Source§fn from(mls: MultiLineString<f64>) -> Self
fn from(mls: MultiLineString<f64>) -> Self
Converts to this type from the input type.
Source§impl<PointType: PartialEq> PartialEq for GenericPolyline<PointType>
impl<PointType: PartialEq> PartialEq for GenericPolyline<PointType>
impl<PointType> StructuralPartialEq for GenericPolyline<PointType>
Auto Trait Implementations§
impl<PointType> Freeze for GenericPolyline<PointType>where
PointType: Freeze,
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§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> ReadableShape for Swhere
S: ConcreteReadableShape,
impl<S> ReadableShape for Swhere
S: ConcreteReadableShape,
Source§impl<T, G> ToGeoMultiLineString<T> for Gwhere
T: CoordNum,
G: MultiLineStringTrait<T = T>,
impl<T, G> ToGeoMultiLineString<T> for Gwhere
T: CoordNum,
G: MultiLineStringTrait<T = T>,
Source§fn to_multi_line_string(&self) -> MultiLineString<T>
fn to_multi_line_string(&self) -> MultiLineString<T>
Convert to a geo_types
MultiLineString.