pub type Position = [f64; 2];
pub type Ring = Vec<Position>;
pub type Polygon = Vec<Ring>;
pub type MultiPolygon = Vec<Polygon>;
pub type BBox = [f64; 4];
#[derive(Debug, Clone, PartialEq)]
pub enum Geometry {
Polygon(Polygon),
MultiPolygon(MultiPolygon),
}
impl Geometry {
pub(crate) fn into_multi(self) -> MultiPolygon {
match self {
Geometry::Polygon(p) => vec![p],
Geometry::MultiPolygon(mp) => mp,
}
}
}
impl From<Polygon> for Geometry {
fn from(p: Polygon) -> Self {
Geometry::Polygon(p)
}
}
impl From<MultiPolygon> for Geometry {
fn from(mp: MultiPolygon) -> Self {
Geometry::MultiPolygon(mp)
}
}