[][src]Trait shapefile::record::traits::MultipointShape

pub trait MultipointShape<PointType> {
    fn point<I: SliceIndex<[PointType]>>(
        &self,
        index: I
    ) -> Option<&<I as SliceIndex<[PointType]>>::Output>;
fn points(&self) -> &[PointType]; }

Trait that allows access to the slice of points of shapes that have multiple points.

For convenience, even Point, PointM, PointZ implements this trait meaning that all shapes are MultipointShape

Required methods

fn point<I: SliceIndex<[PointType]>>(
    &self,
    index: I
) -> Option<&<I as SliceIndex<[PointType]>>::Output>

fn points(&self) -> &[PointType]

Returns a non mutable slice to the points

Examples

use shapefile::record::{MultipointShape, Polyline};
let file_path = "tests/data/line.shp";
let polylines = shapefile::read_as::<&str, Polyline>(file_path).unwrap();
let first = &polylines[0];
for point in first.points() {
    println!("{}, {}", point.x, point.y);
}
use shapefile::record::{MultipointShape, PolylineZ};
let file_path = "tests/data/linez.shp";
let polylines = shapefile::read_as::<&str, PolylineZ>(file_path).unwrap();
let first = &polylines[0];
for point in first.points() {
    println!("{} {} {}", point.x, point.y, point.z);
}
Loading content...

Implementors

impl MultipointShape<Point> for Point[src]

impl MultipointShape<PointM> for PointM[src]

impl MultipointShape<PointZ> for Multipatch[src]

impl MultipointShape<PointZ> for PointZ[src]

impl<PointType> MultipointShape<PointType> for GenericMultipoint<PointType>[src]

impl<PointType> MultipointShape<PointType> for GenericPolygon<PointType>[src]

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

Loading content...