use crate::types::{BBox, BackendKind, CoordType, EntryId, Point};
pub mod grid;
pub mod kdtree;
pub mod quadtree;
pub mod rtree;
pub use grid::GridIndex;
pub use kdtree::KDTree;
pub use quadtree::Quadtree;
pub use rtree::RTree;
pub trait SpatialBackend<T, C, const D: usize>: Send + Sync
where
C: CoordType,
{
fn insert(&mut self, point: Point<C, D>, payload: T) -> EntryId;
fn remove(&mut self, id: EntryId) -> Option<T>;
fn range_query(&self, bbox: &BBox<C, D>) -> Vec<(EntryId, &T)>;
fn knn_query(&self, point: &Point<C, D>, k: usize) -> Vec<(f64, EntryId, &T)>;
fn spatial_join(&self, other: &dyn SpatialBackend<T, C, D>) -> Vec<(EntryId, EntryId)>;
fn bulk_load(entries: Vec<(Point<C, D>, T)>) -> Self
where
Self: Sized;
fn len(&self) -> usize;
fn is_empty(&self) -> bool {
self.len() == 0
}
fn kind(&self) -> BackendKind;
fn all_entries(&self) -> Vec<(Point<C, D>, EntryId, &T)>;
}