Skip to main content

MultiPolygon

Struct MultiPolygon 

Source
#[repr(transparent)]
pub struct MultiPolygon<Pg: PolygonTrait>(pub Vec<Pg>);
Expand description

Default MultiPolygon — a Vec<Pg> newtype where Pg is any concrete PolygonTrait implementor.

Mirrors boost::geometry::model::multi_polygon<Polygon> from boost/geometry/geometries/multi_polygon.hpp:48-92. The #[repr(transparent)] annotation guarantees the in-memory layout matches the underlying Vec<Pg>, mirroring the invariant Boost relies on by inheriting publicly from std::vector<Polygon> (boost/geometry/geometries/multi_polygon.hpp:55).

Tuple Fields§

§0: Vec<Pg>

Implementations§

Source§

impl<Pg: PolygonTrait> MultiPolygon<Pg>

Source

pub const fn new() -> Self

Construct an empty multi-polygon.

Mirrors the default multi_polygon() constructor at boost/geometry/geometries/multi_polygon.hpp:63-65.

Source

pub const fn from_vec(v: Vec<Pg>) -> Self

Wrap an existing Vec<Pg> as a multi-polygon without copying.

Rust analogue of the iterator-range multi_polygon(Iterator, Iterator) constructor at boost/geometry/geometries/multi_polygon.hpp:68-71.

Source

pub fn push(&mut self, pg: Pg)

Append a polygon to the back of the multi-polygon.

Plays the role of std::vector::push_back on the inherited base_type in boost/geometry/geometries/multi_polygon.hpp:55-59.

Trait Implementations§

Source§

impl<Pg: Clone + PolygonTrait> Clone for MultiPolygon<Pg>

Source§

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

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<Pg: Debug + PolygonTrait> Debug for MultiPolygon<Pg>

Source§

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

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

impl<Pg: PolygonTrait> Default for MultiPolygon<Pg>

Source§

fn default() -> Self

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

impl<Pg: PolygonTrait> Geometry for MultiPolygon<Pg>

Tag this concrete type as a MultiPolygon. Mirrors the traits::tag<model::multi_polygon<...>> specialisation at boost/geometry/geometries/multi_polygon.hpp:100-115.

Source§

type Kind = MultiPolygonTag

One of the *Tag types from geometry_tag. Read more
Source§

type Point = <Pg as Geometry>::Point

The point type this geometry is built from. For a value modelling Point, this is Self. Read more
Source§

impl<Pg: PolygonTrait> MultiPolygon for MultiPolygon<Pg>

Wire the MultiPolygon concept up. The polygons() iterator hands back self.0.iter()slice::Iter is already ExactSizeIterator. Plays the role of boost::begin(mpg) / boost::end(mpg) on model::multi_polygon (boost/geometry/geometries/multi_polygon.hpp:55-59).

Source§

type ItemPolygon = Pg

The element polygon type. Read more
Source§

fn polygons(&self) -> impl ExactSizeIterator<Item = &Pg>

The polygons of this multi-polygon, in declared order. Read more
Source§

impl<Pg: PartialEq + PolygonTrait> PartialEq for MultiPolygon<Pg>

Source§

fn eq(&self, other: &MultiPolygon<Pg>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<A, const D: usize, OldCs, T, Cs, const CW: bool, const CL: bool> RebindGeometry<T, Cs> for MultiPolygon<Polygon<Point<A, D, OldCs>, CW, CL>>

Source§

type Output = MultiPolygon<Polygon<Point<T, D, Cs>, CW, CL>>

The corresponding rebound stock model.
Source§

impl<Pg: PartialEq + PolygonTrait> StructuralPartialEq for MultiPolygon<Pg>

Auto Trait Implementations§

§

impl<Pg> Freeze for MultiPolygon<Pg>

§

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

§

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

§

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

§

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

§

impl<Pg> UnsafeUnpin for MultiPolygon<Pg>

§

impl<Pg> UnwindSafe for MultiPolygon<Pg>
where Pg: 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> SameAs<T> for T

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