Trait PolygonTrait

Source
pub trait PolygonTrait: Sized + GeometryTrait {
    type RingType<'a>: 'a + LineStringTrait<T = <Self as GeometryTrait>::T>
       where Self: 'a;

    // Required methods
    fn exterior(&self) -> Option<Self::RingType<'_>>;
    fn num_interiors(&self) -> usize;
    unsafe fn interior_unchecked(&self, i: usize) -> Self::RingType<'_>;

    // Provided methods
    fn interiors(
        &self,
    ) -> impl DoubleEndedIterator + ExactSizeIterator<Item = Self::RingType<'_>> { ... }
    fn interior(&self, i: usize) -> Option<Self::RingType<'_>> { ... }
}
Expand description

A trait for accessing data from a generic Polygon.

A Polygon’s outer boundary (exterior ring) is represented by a LineString. It may contain zero or more holes (interior rings), also represented by LineStrings.

Refer to geo_types::Polygon for information about semantics and validity.

Required Associated Types§

Source

type RingType<'a>: 'a + LineStringTrait<T = <Self as GeometryTrait>::T> where Self: 'a

The coordinate type of this geometry The type of each underlying ring, which implements LineStringTrait

Required Methods§

Source

fn exterior(&self) -> Option<Self::RingType<'_>>

The exterior ring of the polygon

Source

fn num_interiors(&self) -> usize

The number of interior rings in this Polygon

Source

unsafe fn interior_unchecked(&self, i: usize) -> Self::RingType<'_>

Access to a specified interior ring in this Polygon

§Safety

Accessing an index out of bounds is UB.

Provided Methods§

Source

fn interiors( &self, ) -> impl DoubleEndedIterator + ExactSizeIterator<Item = Self::RingType<'_>>

An iterator of the interior rings of this Polygon

Source

fn interior(&self, i: usize) -> Option<Self::RingType<'_>>

Access to a specified interior ring in this Polygon Will return None if the provided index is out of bounds

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, T: CoordNum> PolygonTrait for &'a Polygon<T>

Source§

type RingType<'b> = &'a LineString<<&'a Polygon<T> as GeometryTrait>::T> where Self: 'b

Source§

fn exterior(&self) -> Option<Self::RingType<'_>>

Source§

fn num_interiors(&self) -> usize

Source§

unsafe fn interior_unchecked(&self, i: usize) -> Self::RingType<'_>

Source§

impl<T: CoordNum> PolygonTrait for Polygon<T>

Source§

type RingType<'a> = &'a LineString<<Polygon<T> as GeometryTrait>::T> where Self: 'a

Source§

fn exterior(&self) -> Option<Self::RingType<'_>>

Source§

fn num_interiors(&self) -> usize

Source§

unsafe fn interior_unchecked(&self, i: usize) -> Self::RingType<'_>

Implementors§