pub enum SpatialIndex {
VertexOrientedIndex {
rtree: RTree<MapVertexRTreeObject>,
tolerance: Option<Length>,
},
EdgeOrientedIndex {
rtree: RTree<MapEdgeRTreeObject>,
tolerance: Option<Length>,
},
}Variants§
Implementations§
Source§impl SpatialIndex
impl SpatialIndex
Sourcepub fn build(
spatial_index_type: &SpatialIndexType,
graph: Arc<Graph>,
geometry_models: &[GeometryModel],
tolerance: Option<Length>,
) -> SpatialIndex
pub fn build( spatial_index_type: &SpatialIndexType, graph: Arc<Graph>, geometry_models: &[GeometryModel], tolerance: Option<Length>, ) -> SpatialIndex
build a spatial index of the declared SpatialIndexType
Sourcepub fn new_vertex_oriented(
vertices: &[Vertex],
tolerance: Option<Length>,
) -> Self
pub fn new_vertex_oriented( vertices: &[Vertex], tolerance: Option<Length>, ) -> Self
creates a new instance of the rtree model that is vertex-oriented; that is, the rtree is built over the vertices in the graph, and nearest neighbor searches return a VertexId.
Sourcepub fn new_edge_oriented(
graph: Arc<Graph>,
geometry_models: &[GeometryModel],
tolerance: Option<Length>,
) -> Self
pub fn new_edge_oriented( graph: Arc<Graph>, geometry_models: &[GeometryModel], tolerance: Option<Length>, ) -> Self
creates a new instance of the rtree model that is edge-oriented; that is, the rtree is built over the edges in the graph, and nearest neighbor searches return the edge’s destination vertex.
- future work: make SearchOrientation set which incident vertex is returned.
Sourcepub fn nearest_graph_id(
&self,
point: &Point<f32>,
) -> Result<NearestSearchResult, MapError>
pub fn nearest_graph_id( &self, point: &Point<f32>, ) -> Result<NearestSearchResult, MapError>
gets the nearest graph id, which is a VertexId or EdgeId depending on the orientation of the RTree.
Sourcepub fn nearest_graph_id_iter<'a>(
&'a self,
point: &'a Point<f32>,
) -> Box<dyn Iterator<Item = Result<NearestSearchResult, MapError>> + 'a>
pub fn nearest_graph_id_iter<'a>( &'a self, point: &'a Point<f32>, ) -> Box<dyn Iterator<Item = Result<NearestSearchResult, MapError>> + 'a>
builds an iterator over map edges ordered by nearness to the given point. applies the (map-matching) distance tolerance filter.
Sourcepub fn is_edge_oriented(&self) -> bool
pub fn is_edge_oriented(&self) -> bool
Returns true if this is an edge-oriented spatial index.
Auto Trait Implementations§
impl Freeze for SpatialIndex
impl RefUnwindSafe for SpatialIndex
impl Send for SpatialIndex
impl Sync for SpatialIndex
impl Unpin for SpatialIndex
impl UnsafeUnpin for SpatialIndex
impl UnwindSafe for SpatialIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more