Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions rust/pyo3-geoarrow/src/scalar/bounding_rect.rs
Original file line number Diff line number Diff line change
@@ -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,
};
Expand Down Expand Up @@ -108,6 +108,18 @@ impl BoundingRect {
}
}

pub fn add_triangle(&mut self, triangle: &impl TriangleTrait<T = f64>) {
for coord in triangle.coords() {
self.add_coord(&coord);
}
}

pub fn add_line(&mut self, line: &impl LineTrait<T = f64>) {
for coord in line.coords() {
self.add_coord(&coord);
}
}

pub fn add_geometry(&mut self, geometry: &impl GeometryTrait<T = f64>) {
use GeometryType::*;

Expand All @@ -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),
}
}

Expand Down
Loading