maplibre-rs icon indicating copy to clipboard operation
maplibre-rs copied to clipboard

Increase coords consistency and clamp zoom level to numerically feasible range

Open shumpohl opened this issue 2 years ago • 5 comments

  • Clamp the integer ZoomLevel to 0..31 when converted from floating point Zoom
  • Restrict traversal of WorldTileCoords to supported zoom level range
  • Construct QuadKey with the morton_encoding crate. This change is here because the previous QuadKey depended on the ZoomLevel type.

Fixes crash from #161 by making the "backend" more robust.

Does not implemented the desired zoom limit. This is done in #180

💻 Examples

You can arbitrarily zoom in/out in the demo without panic.

🚨 Test instructions

Launch demo and start zooming :)

✔️ PR Todo

I am not satisfied with these points yet and lack the domain knowledge to proceed:

  • [ ] Check get_children usage in renderer
  • [ ] Properly handle signedness of WorldTileCoords
  • [ ] Check if saturation in ViewRegion::iter is the correct way to go

shumpohl avatar Apr 11 '23 12:04 shumpohl

Did you verify by running this?

Yes. Works on my Windows 10 machine.

shumpohl avatar Apr 12 '23 21:04 shumpohl

Format can be fixed with just fmt

maxammann avatar Apr 15 '23 01:04 maxammann

Rebased on main, and cargo fmt-ed it

nyurik avatar Jun 01 '23 13:06 nyurik

@terrorfisch I updated this to the lastest main. If you want to go over it again, then I can review this one.

Regardin the morton-encoding dependency: I think it would be nice to include the efficiency aspect (compiled down to 20 instructions) in the source code as comment.

maxammann avatar Oct 20 '23 20:10 maxammann

@terrorfisch Same here, I would still love to merge this :)

maxammann avatar Jul 26 '24 14:07 maxammann