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