Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formal BBox struct #377

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

benjamin051000
Copy link
Contributor

@benjamin051000 benjamin051000 commented Feb 20, 2025

We need a more standardized way to represent bounding boxes, as we kind of just throw the string around and parse it into the four corresponding values when we need to.

Fixes #375

To Do

  • Verify GUI mode sends this data with comma delimiters rather than space delim
  • Fix compile errors

@benjamin051000 benjamin051000 changed the title WIP: BBox struct RFC: Formal BBox struct Feb 20, 2025
@benjamin051000 benjamin051000 force-pushed the formalize-bbox branch 3 times, most recently from fabd9d0 to 4e65ed6 Compare February 22, 2025 03:26
@benjamin051000 benjamin051000 marked this pull request as ready for review February 22, 2025 03:27
@benjamin051000 benjamin051000 force-pushed the formalize-bbox branch 2 times, most recently from 0faf517 to aa7a51d Compare February 22, 2025 03:31
@benjamin051000
Copy link
Contributor Author

Blocked on #378

@benjamin051000 benjamin051000 changed the title RFC: Formal BBox struct Formal BBox struct Feb 22, 2025
@benjamin051000
Copy link
Contributor Author

Okay, on my local machine, I've definitely swapped a lat/lng somewhere... because renders are no longer working :( I'll try to figure out which

pub fn from_str(s: &str) -> Result<Self, String> {
let [min_lat, min_lng, max_lat, max_lng]: [f64; 4] = s
.split(',')
.map(|e| e.parse().unwrap())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this return an Err signifying parsing failure?

.map(|e| e.parse().unwrap())
.collect::<Vec<_>>()
.try_into()
.unwrap();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this return an Err? What cases will the try_into fail?

Comment on lines -407 to -409
fn reorder_bbox(bbox: &[f64]) -> (f64, f64, f64, f64) {
(bbox[1], bbox[0], bbox[3], bbox[2])
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, do I still need to do this? Maybe we can just make the GUI return it in the right order in the first place...

Comment on lines 133 to 137
bbox.1, bbox.0, bbox.3, bbox.2
bbox.min().lng,
bbox.min().lat,
bbox.max().lng,
bbox.max().lat
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's gotta be this that's causing the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I might be wrong, because when I switch these around, the API doesn't return any data. I guess I'm stumped as to why this no longer works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

It's rendering the grass, but nothing on top of it.

`BBox` represents a *valid* bounding box.

It's only possible to have a BBox object that's valid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with parsing bbox coords in elevation code
1 participant