Struct shapefile::record::multipatch::Multipatch
source · pub struct Multipatch { /* private fields */ }
Expand description
Shapefile’s Multipatch shape (p 24/34)
The following things are important with Multipatch shape:
- Ring types must be closed (the various constructors will close the rings if you did not close them yourself)
- InnerRings must follow their OuterRings (this is not checked)
- Parts must not intersects or penetrate each others (this is not checked)
- The points organization of
TriangleStrip
andTriangleFan
is not checked
Implementations§
source§impl Multipatch
impl Multipatch
sourcepub fn new(patch: Patch) -> Self
pub fn new(patch: Patch) -> Self
Creates a Multipatch with one patch
The constructor closes rings patch
Examples
use shapefile::{PointZ, Multipatch, NO_DATA, Patch};
let points = vec![
PointZ::new(0.0, 0.0, 0.0, NO_DATA),
PointZ::new(0.0, 1.0, 0.0, NO_DATA),
PointZ::new(1.0, 1.0, 0.0, NO_DATA),
PointZ::new(1.0, 0.0, 0.0, NO_DATA),
];
let multip = Multipatch::new(Patch::OuterRing(points));
sourcepub fn with_parts(patches: Vec<Patch>) -> Self
pub fn with_parts(patches: Vec<Patch>) -> Self
Creates a Multipatch with multiple patches
Closes any patch part that is a ring
Example
use shapefile::{PointZ, Multipatch, NO_DATA, Patch};
let multipatch = Multipatch::with_parts(vec![
Patch::OuterRing(vec![
PointZ::new(0.0, 0.0, 0.0, NO_DATA),
PointZ::new(0.0, 4.0, 0.0, NO_DATA),
PointZ::new(4.0, 4.0, 0.0, NO_DATA),
PointZ::new(4.0, 0.0, 0.0, NO_DATA),
]),
Patch::InnerRing(vec![
PointZ::new(0.0, 0.0, 0.0, NO_DATA),
PointZ::new(0.0, 2.0, 0.0, NO_DATA),
PointZ::new(2.0, 2.0, 0.0, NO_DATA),
PointZ::new(2.0, 0.0, 0.0, NO_DATA),
])
]);
sourcepub fn bbox(&self) -> &GenericBBox<PointZ>
pub fn bbox(&self) -> &GenericBBox<PointZ>
Returns the bounding box of the points contained in this multipatch
sourcepub fn patches(&self) -> &Vec<Patch>
pub fn patches(&self) -> &Vec<Patch>
Returns a reference to the patches of the Multipatch Shape
sourcepub fn patch(&self, index: usize) -> Option<&Patch>
pub fn patch(&self, index: usize) -> Option<&Patch>
Returns a reference to the patch at given index
sourcepub fn into_inner(self) -> Vec<Patch>
pub fn into_inner(self) -> Vec<Patch>
Consumes the shape and returns the patches
pub fn total_point_count(&self) -> usize
Trait Implementations§
source§impl Clone for Multipatch
impl Clone for Multipatch
source§fn clone(&self) -> Multipatch
fn clone(&self) -> Multipatch
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl ConcreteReadableShape for Multipatch
impl ConcreteReadableShape for Multipatch
source§impl Debug for Multipatch
impl Debug for Multipatch
source§impl Display for Multipatch
impl Display for Multipatch
source§impl EsriShape for Multipatch
impl EsriShape for Multipatch
source§impl From<Multipatch> for Shape
impl From<Multipatch> for Shape
source§fn from(concrete: Multipatch) -> Self
fn from(concrete: Multipatch) -> Self
source§impl HasShapeType for Multipatch
impl HasShapeType for Multipatch
source§impl PartialEq<Multipatch> for Multipatch
impl PartialEq<Multipatch> for Multipatch
source§fn eq(&self, other: &Multipatch) -> bool
fn eq(&self, other: &Multipatch) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl TryFrom<Multipatch> for MultiPolygon<f64>
impl TryFrom<Multipatch> for MultiPolygon<f64>
Converts a Multipatch to Multipolygon
For simplicity,reasons, Triangle Fan & Triangle Strip are considered
to be valid polygons
When the individual types of rings in a collection of rings representing a polygonal patch with holes are unknown, the sequence must start with First Ring, followed by a number of Rings. A sequence of Rings not preceded by an First Ring is treated as a sequence of Outer Rings without holes.