maplibre / maplibre-rs

Experimental Maps for Web, Mobile and Desktop
Apache License 2.0
1.34k stars 77 forks source link

Simplify and move Stencil reference functions #241

Closed Tristramg closed 1 year ago

Tristramg commented 1 year ago

This pull request is more a question of style concerning stencil_reference_value_2d and stencil_reference_value_3d

The first commits changes a bit how the pattern matching is written. I believe it’s a bit more “rusty” and we have the guarantee the matching is complete.

The second commit moves those functions as a member of WorldTileCoord instead of TileViewPattern. I’m still missing the bigger picture of all those parts. The observation was that no information of TileViewPattern is required to do the computation, but I’ll perfectly understand that there are broader implications.

maxammann commented 1 year ago

Historically they moved a little bit around in code. So thanks for moving them to the right location.

I think the 2d is not used anymore. I think this would be a good PR to just remove it and document via a commit why it was removed. Here is why:

The 2d version of calculating the stencil value is only valid for cases where only tiles from exactly one zoom level are displayed at once. As soon as multiple zoom levels are presented at once, the stencil value needs to be distinct across zoom levels.

Can you remove it and commit with that message?

Tristramg commented 1 year ago

Function removed! Thank you for the context