diff --git a/geom/src/bounds.rs b/geom/src/bounds.rs index 837a0735c4..22a6935c82 100644 --- a/geom/src/bounds.rs +++ b/geom/src/bounds.rs @@ -5,7 +5,7 @@ use aabb_quadtree::geom::{Point, Rect}; use crate::{LonLat, Polygon, Pt2D, Ring}; /// Represents a rectangular boundary of `Pt2D` points. -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Bounds { pub min_x: f64, pub min_y: f64, @@ -24,6 +24,15 @@ impl Bounds { } } + pub fn zero() -> Self { + Bounds { + min_x: 0.0, + min_y: 0.0, + max_x: 0.0, + max_y: 0.0, + } + } + /// Create a boundary covering some points. pub fn from(pts: &Vec) -> Bounds { let mut b = Bounds::new();