pub struct Multipatch { /* private fields */ }
Expand description

Shapefile’s Multipatch shape (p 24/34)

The following things are important with Multipatch shape:

  1. Ring types must be closed (the various constructors will close the rings if you did not close them yourself)
  2. InnerRings must follow their OuterRings (this is not checked)
  3. Parts must not intersects or penetrate each others (this is not checked)
  4. The points organization of TriangleStrip and TriangleFan is not checked

Implementations§

source§

impl Multipatch

source

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));
source

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),
    ])
]);
source

pub fn bbox(&self) -> &GenericBBox<PointZ>

Returns the bounding box of the points contained in this multipatch

source

pub fn patches(&self) -> &Vec<Patch>

Returns a reference to the patches of the Multipatch Shape

source

pub fn patch(&self, index: usize) -> Option<&Patch>

Returns a reference to the patch at given index

source

pub fn into_inner(self) -> Vec<Patch>

Consumes the shape and returns the patches

source

pub fn total_point_count(&self) -> usize

Trait Implementations§

source§

impl Clone for Multipatch

source§

fn clone(&self) -> Multipatch

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ConcreteReadableShape for Multipatch

source§

fn read_shape_content<T: Read>( source: &mut T, record_size: i32 ) -> Result<Self, Error>

Function that actually reads the ActualShape from the source and returns it
source§

impl Debug for Multipatch

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Multipatch

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl EsriShape for Multipatch

source§

fn x_range(&self) -> [f64; 2]

source§

fn y_range(&self) -> [f64; 2]

source§

fn z_range(&self) -> [f64; 2]

Should return the Z range of this shape
source§

fn m_range(&self) -> [f64; 2]

Should return the M range of this shape
source§

impl From<Multipatch> for Shape

source§

fn from(concrete: Multipatch) -> Self

Converts to this type from the input type.
source§

impl HasShapeType for Multipatch

source§

fn shapetype() -> ShapeType

Returns the ShapeType
source§

impl PartialEq for Multipatch

source§

fn eq(&self, other: &Multipatch) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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.

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_from(mp: Multipatch) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Shape> for Multipatch

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(shape: Shape) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl WritableShape for Multipatch

source§

fn size_in_bytes(&self) -> usize

Returns the size in bytes that the Shapes will take once written. Does not include the shapetype
source§

fn write_to<T: Write>(&self, dest: &mut T) -> Result<(), Error>

Writes the shape to the dest
source§

impl ConcreteShape for Multipatch

source§

impl StructuralPartialEq for Multipatch

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<S> ReadableShape for S

source§

fn read_from<T>(source: &mut T, record_size: i32) -> Result<S, Error>
where T: Read,

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.