Checkpoint all changes
This commit is contained in:
parent
65877acf95
commit
66c2a25457
28 changed files with 3035 additions and 621 deletions
|
|
@ -19,18 +19,18 @@ impl GridIndex {
|
|||
let mut min_lon = f64::INFINITY;
|
||||
let mut max_lon = f64::NEG_INFINITY;
|
||||
|
||||
for i in 0..lat.len() {
|
||||
if lat[i] < min_lat {
|
||||
min_lat = lat[i];
|
||||
for index in 0..lat.len() {
|
||||
if lat[index] < min_lat {
|
||||
min_lat = lat[index];
|
||||
}
|
||||
if lat[i] > max_lat {
|
||||
max_lat = lat[i];
|
||||
if lat[index] > max_lat {
|
||||
max_lat = lat[index];
|
||||
}
|
||||
if lon[i] < min_lon {
|
||||
min_lon = lon[i];
|
||||
if lon[index] < min_lon {
|
||||
min_lon = lon[index];
|
||||
}
|
||||
if lon[i] > max_lon {
|
||||
max_lon = lon[i];
|
||||
if lon[index] > max_lon {
|
||||
max_lon = lon[index];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -52,11 +52,11 @@ impl GridIndex {
|
|||
|
||||
let mut cells: Vec<Vec<u32>> = vec![Vec::new(); rows * cols];
|
||||
|
||||
for i in 0..lat.len() {
|
||||
let grid_row = ((lat[i] - min_lat) / cell_size) as usize;
|
||||
let grid_col = ((lon[i] - min_lon) / cell_size) as usize;
|
||||
let idx = grid_row * cols + grid_col;
|
||||
cells[idx].push(i as u32);
|
||||
for index in 0..lat.len() {
|
||||
let grid_row = ((lat[index] - min_lat) / cell_size) as usize;
|
||||
let grid_col = ((lon[index] - min_lon) / cell_size) as usize;
|
||||
let cell_index = grid_row * cols + grid_col;
|
||||
cells[cell_index].push(index as u32);
|
||||
}
|
||||
|
||||
tracing::debug!("Grid index built");
|
||||
|
|
@ -96,7 +96,7 @@ impl GridIndex {
|
|||
west: f64,
|
||||
north: f64,
|
||||
east: f64,
|
||||
mut f: impl FnMut(u32),
|
||||
mut callback: impl FnMut(u32),
|
||||
) {
|
||||
let Some((row_min, row_max, col_min, col_max)) =
|
||||
self.clamp_bounds(south, west, north, east)
|
||||
|
|
@ -108,7 +108,7 @@ impl GridIndex {
|
|||
let row_start = row * self.cols;
|
||||
for col in col_min..=col_max {
|
||||
for &row_idx in &self.cells[row_start + col] {
|
||||
f(row_idx);
|
||||
callback(row_idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue