diff --git a/rust/pyo3-geoarrow/src/scalar/bounding_rect.rs b/rust/pyo3-geoarrow/src/scalar/bounding_rect.rs index fdcef08ca..8226b46d2 100644 --- a/rust/pyo3-geoarrow/src/scalar/bounding_rect.rs +++ b/rust/pyo3-geoarrow/src/scalar/bounding_rect.rs @@ -1,9 +1,9 @@ use std::ops::Add; use geo_traits::{ - CoordTrait, GeometryCollectionTrait, GeometryTrait, GeometryType, LineStringTrait, + CoordTrait, GeometryCollectionTrait, GeometryTrait, GeometryType, LineStringTrait, LineTrait, MultiLineStringTrait, MultiPointTrait, MultiPolygonTrait, PointTrait, PolygonTrait, RectTrait, - UnimplementedGeometryCollection, UnimplementedLine, UnimplementedLineString, + TriangleTrait, UnimplementedGeometryCollection, UnimplementedLine, UnimplementedLineString, UnimplementedMultiLineString, UnimplementedMultiPoint, UnimplementedMultiPolygon, UnimplementedPoint, UnimplementedPolygon, UnimplementedTriangle, }; @@ -108,6 +108,18 @@ impl BoundingRect { } } + pub fn add_triangle(&mut self, triangle: &impl TriangleTrait) { + for coord in triangle.coords() { + self.add_coord(&coord); + } + } + + pub fn add_line(&mut self, line: &impl LineTrait) { + for coord in line.coords() { + self.add_coord(&coord); + } + } + pub fn add_geometry(&mut self, geometry: &impl GeometryTrait) { use GeometryType::*; @@ -120,7 +132,8 @@ impl BoundingRect { MultiPolygon(g) => self.add_multi_polygon(g), GeometryCollection(g) => self.add_geometry_collection(g), Rect(g) => self.add_rect(g), - Triangle(_) | Line(_) => todo!(), + Triangle(g) => self.add_triangle(g), + Line(g) => self.add_line(g), } }