pub trait SpatialEntity {
// Required method
fn location(&self) -> &Location;
// Provided methods
fn bounds(&self) -> GeoBounds { ... }
fn to_geo_point(&self) -> Point<f64> { ... }
fn is_within_bounds(&self, bounds: &GeoBounds) -> bool { ... }
}Expand description
Trait for entities with a spatial location.
This trait provides a common interface for anything that has a geographic location, enabling spatial indexing and queries.
Required Methods§
Provided Methods§
Sourcefn bounds(&self) -> GeoBounds
fn bounds(&self) -> GeoBounds
Returns the geographic bounds of this entity.
For point entities, this returns a zero-size bounding box at the location. For entities with extent, this returns the full bounding box.
Sourcefn to_geo_point(&self) -> Point<f64>
fn to_geo_point(&self) -> Point<f64>
Returns the location as a geo-types Point.
Sourcefn is_within_bounds(&self, bounds: &GeoBounds) -> bool
fn is_within_bounds(&self, bounds: &GeoBounds) -> bool
Checks if this entity is within the given bounds.