pub trait MultiPolygon: Geometry<Kind = MultiPolygonTag> {
type ItemPolygon: Polygon<Point = Self::Point>;
// Required method
fn polygons(&self) -> impl ExactSizeIterator<Item = &Self::ItemPolygon>;
}Expand description
A multi-polygon — a collection of polygons belonging to each other (e.g. Hawaii).
Mirrors the MultiPolygon concept (doc/concept/multi_polygon.qbk);
the canonical model is boost::geometry::model::multi_polygon in
boost/geometry/geometries/multi_polygon.hpp, which derives from
std::vector<Polygon> and asserts concepts::Polygon<Polygon> on
its element type. The Rust port mirrors that assertion by bounding
MultiPolygon::ItemPolygon on the Polygon concept, and
additionally pins ItemPolygon::Point = Self::Point so the multi’s
point_type<MPG> projection stays consistent across the collection.
§Examples
use geometry_trait::MultiPolygon;
fn count<M: MultiPolygon>(m: &M) -> usize { m.polygons().len() }Required Associated Types§
Sourcetype ItemPolygon: Polygon<Point = Self::Point>
type ItemPolygon: Polygon<Point = Self::Point>
The element polygon type.
Mirrors the Polygon template parameter on
boost::geometry::model::multi_polygon<Polygon, …>
(boost/geometry/geometries/multi_polygon.hpp).
Required Methods§
Sourcefn polygons(&self) -> impl ExactSizeIterator<Item = &Self::ItemPolygon>
fn polygons(&self) -> impl ExactSizeIterator<Item = &Self::ItemPolygon>
The polygons of this multi-polygon, in declared order.
Plays the role of boost::begin(mpg) / boost::end(mpg) from
boost/geometry/geometries/multi_polygon.hpp when read
together.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".