pub struct GridIndex<T: Clone> {
width: f64,
height: f64,
x_cell_count: usize,
y_cell_count: usize,
x_scale: f64,
y_scale: f64,
estimated_elements_per_cell: usize,
box_elements: Vec<(T, Box2D<f64, ScreenSpace>)>,
circle_elements: Vec<(T, Circle<f64>)>,
box_cells: Vec<Vec<u32>>,
circle_cells: Vec<Vec<u32>>,
}Expand description
maplibre/maplibre-native#4add9ea original name: GridIndex
Fields§
§width: f64§height: f64§x_cell_count: usize§y_cell_count: usize§x_scale: f64§y_scale: f64§estimated_elements_per_cell: usize§box_elements: Vec<(T, Box2D<f64, ScreenSpace>)>§circle_elements: Vec<(T, Circle<f64>)>§box_cells: Vec<Vec<u32>>§circle_cells: Vec<Vec<u32>>Implementations§
Source§impl<T: Clone> GridIndex<T>
impl<T: Clone> GridIndex<T>
Sourcepub fn new(width: f64, height: f64, cell_size: u32) -> Self
pub fn new(width: f64, height: f64, cell_size: u32) -> Self
maplibre/maplibre-native#4add9ea original name: new
Sourcepub fn reserve(&mut self, value: usize)
pub fn reserve(&mut self, value: usize)
Set the expected number of elements per cell to avoid small re-allocations for populated cells maplibre/maplibre-native#4add9ea original name: reserve
Sourcepub fn insert(&mut self, t: T, bbox: Box2D<f64, ScreenSpace>)
pub fn insert(&mut self, t: T, bbox: Box2D<f64, ScreenSpace>)
maplibre/maplibre-native#4add9ea original name: insert
Sourcepub fn insert_circle(&mut self, t: T, circle: Circle<f64>)
pub fn insert_circle(&mut self, t: T, circle: Circle<f64>)
maplibre/maplibre-native#4add9ea original name: insert_circle
Sourcepub fn query(&self, query_box: &Box2D<f64, ScreenSpace>) -> Vec<T>
pub fn query(&self, query_box: &Box2D<f64, ScreenSpace>) -> Vec<T>
maplibre/maplibre-native#4add9ea original name: query
Sourcepub fn query_with_boxes(
&self,
query_box: &Box2D<f64, ScreenSpace>,
) -> Vec<(T, Box2D<f64, ScreenSpace>)>
pub fn query_with_boxes( &self, query_box: &Box2D<f64, ScreenSpace>, ) -> Vec<(T, Box2D<f64, ScreenSpace>)>
maplibre/maplibre-native#4add9ea original name: query_with_boxes
Sourcepub fn hit_test<F>(
&self,
query_box: &Box2D<f64, ScreenSpace>,
predicate: Option<F>,
) -> bool
pub fn hit_test<F>( &self, query_box: &Box2D<f64, ScreenSpace>, predicate: Option<F>, ) -> bool
maplibre/maplibre-native#4add9ea original name: hit_test
Source§impl<T: Clone> GridIndex<T>
impl<T: Clone> GridIndex<T>
Sourcefn no_intersection(&self, query_box: &Box2D<f64, ScreenSpace>) -> bool
fn no_intersection(&self, query_box: &Box2D<f64, ScreenSpace>) -> bool
maplibre/maplibre-native#4add9ea original name: no_intersection
Sourcefn complete_intersection(&self, query_box: &Box2D<f64, ScreenSpace>) -> bool
fn complete_intersection(&self, query_box: &Box2D<f64, ScreenSpace>) -> bool
maplibre/maplibre-native#4add9ea original name: complete_intersection
Sourcefn convert_to_box(circle: &Circle<f64>) -> Box2D<f64, ScreenSpace>
fn convert_to_box(circle: &Circle<f64>) -> Box2D<f64, ScreenSpace>
maplibre/maplibre-native#4add9ea original name: convert_to_box
Sourcefn query_internal<F>(&self, query_bbox: &Box2D<f64, ScreenSpace>, result_fn: F)
fn query_internal<F>(&self, query_bbox: &Box2D<f64, ScreenSpace>, result_fn: F)
maplibre/maplibre-native#4add9ea original name: query_internal
Sourcefn query_internal_circles<F>(&self, query_bcircle: &Circle<f64>, result_fn: F)
fn query_internal_circles<F>(&self, query_bcircle: &Circle<f64>, result_fn: F)
maplibre/maplibre-native#4add9ea original name: query_internal_circles
Sourcefn convert_to_x_cell_coord(&self, x: f64) -> usize
fn convert_to_x_cell_coord(&self, x: f64) -> usize
maplibre/maplibre-native#4add9ea original name: convert_to_x_cell_coord
Sourcefn convert_to_y_cell_coord(&self, y: f64) -> usize
fn convert_to_y_cell_coord(&self, y: f64) -> usize
maplibre/maplibre-native#4add9ea original name: convert_to_y_cell_coord
Sourcefn boxes_collide(
first: &Box2D<f64, ScreenSpace>,
second: &Box2D<f64, ScreenSpace>,
) -> bool
fn boxes_collide( first: &Box2D<f64, ScreenSpace>, second: &Box2D<f64, ScreenSpace>, ) -> bool
maplibre/maplibre-native#4add9ea original name: boxes_collide
Sourcefn circles_collide(first: &Circle<f64>, second: &Circle<f64>) -> bool
fn circles_collide(first: &Circle<f64>, second: &Circle<f64>) -> bool
maplibre/maplibre-native#4add9ea original name: circles_collide
Sourcefn circle_and_box_collide(
circle: &Circle<f64>,
box_: &Box2D<f64, ScreenSpace>,
) -> bool
fn circle_and_box_collide( circle: &Circle<f64>, box_: &Box2D<f64, ScreenSpace>, ) -> bool
maplibre/maplibre-native#4add9ea original name: circle_and_box_collide
Auto Trait Implementations§
impl<T> Freeze for GridIndex<T>
impl<T> RefUnwindSafe for GridIndex<T>where
T: RefUnwindSafe,
impl<T> Send for GridIndex<T>where
T: Send,
impl<T> Sync for GridIndex<T>where
T: Sync,
impl<T> Unpin for GridIndex<T>where
T: Unpin,
impl<T> UnwindSafe for GridIndex<T>where
T: UnwindSafe,
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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