use crate::Float;
use geo_types::MultiLineString;
#[derive(Debug, Clone)]
pub struct Line {
pub(crate) geometry: MultiLineString<Float>,
pub(crate) threshold: Float,
}
impl Line {
pub fn geometry(&self) -> &MultiLineString<Float> {
&self.geometry
}
pub fn into_inner(self) -> (MultiLineString<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,
}
}
}