pub struct MultiPolygon<T> {
    pub polygons: Vec<Polygon<T>>,
}
Expand description

A MultiPolygon is a list of polygons. There is no restrictions on the polygons (they can be intersecting, empty, etc.).

Fields§

§polygons: Vec<Polygon<T>>

The list of polygons which defines the content of this multi polygon.

Implementations§

source§

impl<T> MultiPolygon<T>

source

pub fn new() -> Self

Create an empty set of polygons.

source

pub fn from_polygons(polygons: Vec<Polygon<T>>) -> Self

Create a MultiPolygon from a vector of Polygons.

source

pub fn len(&self) -> usize

Return the number of polygons.

source

pub fn is_empty(&self) -> bool

Check if polygon is empty.

source

pub fn insert(&mut self, polygon: Polygon<T>)

Insert a polygon into the region.

source§

impl<T: Copy> MultiPolygon<T>

source

pub fn all_edges_iter(&self) -> impl Iterator<Item = Edge<T>> + '_

Iterate over all edges of the polygons including holes.

Trait Implementations§

source§

impl<T: Clone> Clone for MultiPolygon<T>

source§

fn clone(&self) -> MultiPolygon<T>

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<T: Debug> Debug for MultiPolygon<T>

source§

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

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

impl<T: Default> Default for MultiPolygon<T>

source§

fn default() -> MultiPolygon<T>

Returns the “default value” for a type. Read more
source§

impl<'de, T> Deserialize<'de> for MultiPolygon<T>where T: Deserialize<'de>,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T, IP: Into<Polygon<T>>> From<IP> for MultiPolygon<T>

source§

fn from(x: IP) -> Self

Converts to this type from the input type.
source§

impl<T> From<Vec<Polygon<T>, Global>> for MultiPolygon<T>

source§

fn from(polygons: Vec<Polygon<T>>) -> Self

Converts to this type from the input type.
source§

impl<T, IP: Into<Polygon<T>>> FromIterator<IP> for MultiPolygon<T>

source§

fn from_iter<I: IntoIterator<Item = IP>>(iter: I) -> Self

Creates a value from an iterator. Read more
source§

impl<T: Hash> Hash for MultiPolygon<T>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T> IntoIterator for MultiPolygon<T>

§

type Item = Polygon<T>

The type of the elements being iterated over.
§

type IntoIter = IntoIter<Polygon<T>, Global>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<T> MapPointwise<T> for MultiPolygon<T>where T: CoordinateType,

source§

fn transform<F: Fn(Point<T>) -> Point<T>>(&self, tf: F) -> Self

Point wise transformation.
source§

impl<T> Serialize for MultiPolygon<T>where T: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T: CoordinateType> TryBoundingBox<T> for MultiPolygon<T>

source§

fn try_bounding_box(&self) -> Option<Rect<T>>

Return the bounding box of this geometry if a bounding box is defined.
source§

impl<T> WindingNumber<T> for MultiPolygon<T>where T: CoordinateType,

source§

fn winding_number(&self, point: Point<T>) -> isize

Calculate the winding number of the polygon around this point. Read more
source§

fn contains_point_non_oriented(&self, point: Point<T>) -> bool

Check if point is inside the polygon, i.e. the polygons winds around the point a non-zero number of times. Read more
source§

fn contains_point(&self, point: Point<T>) -> bool

Check if point is inside the polygon, i.e. the polygon winds around the point an odd number of times. Read more

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for MultiPolygon<T>where T: RefUnwindSafe,

§

impl<T> Send for MultiPolygon<T>where T: Send,

§

impl<T> Sync for MultiPolygon<T>where T: Sync,

§

impl<T> Unpin for MultiPolygon<T>where T: Unpin,

§

impl<T> UnwindSafe for MultiPolygon<T>where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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, T> Mirror<T> for Swhere T: Copy + Zero + Sub<T, Output = T>, S: MapPointwise<T>,

source§

fn mirror_x(&self) -> S

Return the geometrical object mirrored at the x axis.

source§

fn mirror_y(&self) -> S

Return the geometrical object mirrored at the y axis.

source§

impl<S, T> RotateOrtho<T> for Swhere T: Copy + Zero + Sub<T, Output = T>, S: MapPointwise<T>,

source§

fn rotate_ortho(&self, a: Angle) -> S

Rotate the geometrical shape by a multiple of 90 degrees.
source§

impl<S, T> Scale<T> for Swhere T: Copy + Mul<T, Output = T>, S: MapPointwise<T>,

source§

fn scale(&self, factor: T) -> S

Scale the geometrical shape. Scaling center is the origin (0, 0).
source§

impl<T> ToOwned for Twhere 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<S, T> Translate<T> for Swhere T: Copy + Add<T, Output = T>, S: MapPointwise<T>,

source§

fn translate(&self, v: Vector<T>) -> S

Translate the geometrical object by a vector v.
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,