Add the possibility to convert all the types from geo-types
x4d3 opened this issue · 0 comments
x4d3 commented
It would be great if we could convert/project all the geo-types directly, internaly usingconvert_array
(when the feature is eanbled)
For example something like
impl Proj {
pub fn convert_line_string<'a, T>(&self, line_string: &'a mut geo_types::LineString<T>) -> Result<&'a mut geo_types::LineString<T>, ProjError>
where
T: crate::proj::CoordinateType,
{
self.convert_array(&mut line_string.0)?;
Ok(line_string)
}
pub fn convert_polygon<T>(&self, polygon: &geo_types::Polygon<T>) -> Result<geo_types::Polygon<T>, ProjError>
where
T: crate::proj::CoordinateType,
{
let mut exterior = polygon.exterior().clone();
let mut interiors = polygon.interiors().clone();
self.convert_line_string(&mut exterior)?;
for interior in interiors{
self.convert_line_string(&mut interior.clone())?;
}
Ok(geo_types::Polygon::new(exterior, interiors.to_vec()))
}
}