Skip to content

fix: 2080 - new "world safe" visible bounds for camera #2091

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

monsieurtanuki
Copy link
Contributor

What

  • This PR introduces the concept of "world safe" latlng bounds: with a north, a south, a longitude center and a longitude width.
  • With "world safe" bounds, we can have bounds wider than a world.
  • The bounds of the camera are computed as wide as they actually are. Therefore, potentially wider than the world, instead of limited to the currently projected left and right sides of the page.
  • A typical use-case is for the camera bounds when we're culling polygons. We now compare polygon bounds with more relevant camera bounds.
  • TODO:
    • try to refactor so that polygons and polylines share significant parts of the culling algorithm
    • try to refactor as there's repeated code about poly continuity, as a list of pixels and as a list of latlngs
    • maybe copy/move the concept of "drawInSingleWorld" down to the polygon or polyline level

Screenshots

one world the other world
image image

Impacted files

  • camera.dart: now computes "worldSafe" visible bounds
  • latlng_bounds.dart: new "worldSafe" constructor, that can be wider than a world, and longitudeCenter and longitudeWidth concepts. Refactored "isOverlapping" accordingly.
  • polygon.dart: added widgets for the test

Impacted files:
* `camera.dart`: now computes "worldSafe" visible bounds
* `latlng_bounds.dart`: new "worldSafe" constructor, that can be wider than a world, and longitudeCenter and longitudeWidth concepts. Refactored "isOverlapping" accordingly.
* `polygon.dart`: added widgets for the test
@JaffaKetchup JaffaKetchup requested a review from a team May 15, 2025 22:15
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.

Fundamental issues with bounds usage for multi-worlds => culling issues
1 participant