Skip to main content

SpatialEntity

Trait SpatialEntity 

Source
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§

Source

fn location(&self) -> &Location

Returns the primary location of this entity.

Provided Methods§

Source

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.

Source

fn to_geo_point(&self) -> Point<f64>

Returns the location as a geo-types Point.

Source

fn is_within_bounds(&self, bounds: &GeoBounds) -> bool

Checks if this entity is within the given bounds.

Implementors§