use crate::Float;
use geo_types::MultiPolygon;
#[derive(Debug, Clone)]
pub struct Contour {
pub(crate) geometry: MultiPolygon<Float>,
pub(crate) threshold: Float,
}
impl Contour {
pub fn geometry(&self) -> &MultiPolygon<Float> {
&self.geometry
}
pub fn into_inner(self) -> (MultiPolygon<Float>, Float) {
(self.geometry, self.threshold)
}
pub fn threshold(&self) -> Float {
self.threshold
}
#[cfg(feature = "geojson")]
pub fn to_geojson(&self) -> geojson::Feature {
let mut properties = geojson::JsonObject::with_capacity(1);
properties.insert("threshold".to_string(), self.threshold.into());
geojson::Feature {
bbox: None,
geometry: Some(geojson::Geometry::from(self.geometry())),
id: None,
properties: Some(properties),
foreign_members: None,
}
}
}