[−][src]Trait shapefile::record::MultipartShape
Trait for the Shapes that may have multiple parts
Required methods
fn parts_indices(&self) -> &[i32]
Returns a non mutable slice of the parts as written in the file:
An array of length NumParts. Stores, for each PolyLine, the index of its first point in the points array. Array indexes are with respect to 0
Examples
use shapefile::record::MultipartShape; let filepath = "tests/data/linez.shp"; let polylines_z = shapefile::read_as::<&str, shapefile::PolylineZ>(filepath).unwrap(); let poly_z = &polylines_z[0]; assert_eq!(poly_z.parts_indices(), &[0, 5, 7]);
Provided methods
fn part(&self, index: usize) -> Option<&[PointType]>
Returns the slice of points corresponding to part n°ìndex
if the shape
actually has multiple parts
Examples
use shapefile::record::MultipartShape; let filepath = "tests/data/linez.shp"; let polylines_z = shapefile::read_as::<&str, shapefile::PolylineZ>(filepath).unwrap(); let poly_z = &polylines_z[0]; for points in poly_z.parts() { println!("{} points", points.len()); }
ⓘImportant traits for PartIterator<'a, PointType, Shape>
fn parts(&self) -> PartIterator<PointType, Self>
Returns an iterator over the parts of a MultipartShape
Examples
use shapefile::record::MultipartShape; let filepath = "tests/data/linez.shp"; let polylines_z = shapefile::read_as::<&str, shapefile::PolylineZ>(filepath).unwrap(); let poly_z = &polylines_z[0]; let poly_z_parts: Vec<&[shapefile::PointZ]> = poly_z.parts().collect(); assert_eq!(poly_z_parts.len(), 3);
Implementors
impl MultipartShape<PointZ> for Multipatch
[src]
impl MultipartShape<PointZ> for Multipatch
fn parts_indices(&self) -> &[i32] | [src] |
fn part(&self, index: usize) -> Option<&[PointType]> | [src] |
ⓘImportant traits for PartIterator<'a, PointType, Shape>
ⓘImportant traits for PartIterator<'a, PointType, Shape>
fn parts(&self) -> PartIterator<PointType, Self> | [src] |
impl<PointType> MultipartShape<PointType> for GenericPolygon<PointType>
[src]
impl<PointType> MultipartShape<PointType> for GenericPolygon<PointType>
fn parts_indices(&self) -> &[i32] | [src] |
fn part(&self, index: usize) -> Option<&[PointType]> | [src] |
ⓘImportant traits for PartIterator<'a, PointType, Shape>
ⓘImportant traits for PartIterator<'a, PointType, Shape>
fn parts(&self) -> PartIterator<PointType, Self> | [src] |
impl<PointType> MultipartShape<PointType> for GenericPolyline<PointType>
[src]
impl<PointType> MultipartShape<PointType> for GenericPolyline<PointType>
fn parts_indices(&self) -> &[i32] | [src] |
fn part(&self, index: usize) -> Option<&[PointType]> | [src] |
ⓘImportant traits for PartIterator<'a, PointType, Shape>
ⓘImportant traits for PartIterator<'a, PointType, Shape>
fn parts(&self) -> PartIterator<PointType, Self> | [src] |