Struct MultiPolygon

Source
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() -> MultiPolygon<T>

Create an empty set of polygons.

Source

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

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> MultiPolygon<T>
where T: Copy,

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 BooleanOp<Ratio<i32>> for MultiPolygon<Ratio<i32>>

Source§

fn boolean_op( &self, operation: Operation, other: &MultiPolygon<Ratio<i32>>, polygon_semantics: PolygonSemantics, ) -> MultiPolygon<Ratio<i32>>

Compute the boolean operation of self and other. Read more
Source§

fn intersection(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean intersection self & other. Read more
Source§

fn difference(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean difference self - other. Read more
Source§

fn union(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean union self | other. Read more
Source§

fn xor(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean exclusive OR self ^ other. Read more
Source§

impl BooleanOp<Ratio<i64>> for MultiPolygon<Ratio<i64>>

Source§

fn boolean_op( &self, operation: Operation, other: &MultiPolygon<Ratio<i64>>, polygon_semantics: PolygonSemantics, ) -> MultiPolygon<Ratio<i64>>

Compute the boolean operation of self and other. Read more
Source§

fn intersection(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean intersection self & other. Read more
Source§

fn difference(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean difference self - other. Read more
Source§

fn union(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean union self | other. Read more
Source§

fn xor(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean exclusive OR self ^ other. Read more
Source§

impl BooleanOp<f32> for MultiPolygon<f32>

Source§

fn boolean_op( &self, operation: Operation, other: &MultiPolygon<f32>, polygon_semantics: PolygonSemantics, ) -> MultiPolygon<f32>

Compute the boolean operation of self and other. Read more
Source§

fn intersection(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean intersection self & other. Read more
Source§

fn difference(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean difference self - other. Read more
Source§

fn union(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean union self | other. Read more
Source§

fn xor(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean exclusive OR self ^ other. Read more
Source§

impl BooleanOp<f64> for MultiPolygon<f64>

Source§

fn boolean_op( &self, operation: Operation, other: &MultiPolygon<f64>, polygon_semantics: PolygonSemantics, ) -> MultiPolygon<f64>

Compute the boolean operation of self and other. Read more
Source§

fn intersection(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean intersection self & other. Read more
Source§

fn difference(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean difference self - other. Read more
Source§

fn union(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean union self | other. Read more
Source§

fn xor(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean exclusive OR self ^ other. Read more
Source§

impl BooleanOp<i32> for MultiPolygon<i32>

Source§

fn boolean_op( &self, operation: Operation, other: &MultiPolygon<i32>, polygon_semantics: PolygonSemantics, ) -> MultiPolygon<i32>

Compute the boolean operation of self and other. Read more
Source§

fn intersection(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean intersection self & other. Read more
Source§

fn difference(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean difference self - other. Read more
Source§

fn union(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean union self | other. Read more
Source§

fn xor(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean exclusive OR self ^ other. Read more
Source§

impl BooleanOp<i64> for MultiPolygon<i64>

Source§

fn boolean_op( &self, operation: Operation, other: &MultiPolygon<i64>, polygon_semantics: PolygonSemantics, ) -> MultiPolygon<i64>

Compute the boolean operation of self and other. Read more
Source§

fn intersection(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean intersection self & other. Read more
Source§

fn difference(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean difference self - other. Read more
Source§

fn union(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean union self | other. Read more
Source§

fn xor(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean exclusive OR self ^ other. Read more
Source§

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

Source§

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

Returns a duplicate 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 for MultiPolygon<T>
where T: Debug,

Source§

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

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

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

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<MultiPolygon<T>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

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

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

Source§

fn from(x: IP) -> MultiPolygon<T>

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

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

Source§

fn from_iter<I>(iter: I) -> MultiPolygon<T>
where I: IntoIterator<Item = IP>,

Creates a value from an iterator. Read more
Source§

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

Source§

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

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>

Source§

type Item = Polygon<T>

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<Polygon<T>>

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

fn into_iter(self) -> <MultiPolygon<T> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

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

Source§

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

Point wise transformation.
Source§

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

Source§

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

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

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

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> Freeze for MultiPolygon<T>

§

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 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<S, T> Mirror<T> for S
where T: Copy + Zero + Sub<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 S
where T: Copy + Zero + Sub<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 S
where T: Copy + Mul<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 T
where T: Clone,

Source§

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 S
where T: Copy + Add<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 T
where U: Into<T>,

Source§

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>,

Source§

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.
Source§

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