CesiumGS / CesiumGS/cesium-native

Separate sync and async parts of QuadtreeRasterOverlayTileProvider::mapRasterTilesToGeometryTile

Open
#499 0 comments 0 reactions 0 assignees View on GitHub
quality
Dominant language
C++
Stars
623
Forks
277
PR merge metrics
No merged PRs in 30d

Description

As originally identified in https://github.com/CesiumGS/cesium-native/issues/303#issuecomment-893553334, `mapRasterTilesToGeometryTile` does a bunch of synchronous work to figure out which raster overlay quadtree tiles overlap a given geometry tile. And then it _also_ calls `getQuadtreeTile` for each of those quadtree tiles to get a shared future for its image data.

This would be much cleaner if we separate this into two functions. The first is fully synchronous and returns a list of mapped tile IDs. And the second takes a list of tile IDs and returns either `vector>` or Future>`.

In addition to being conceptually nicer, it would also allow us to write tests for the tricky synchronous part without needing to deal with the asynchronous part.

Really the only downside to this we need an extra temporary vector and need to make two passes over it (once to populate it, once to read it), but the cost should be plenty low here. Functional programming languages have great ways to achieve this composability without the temporary and two passes. I think C++20's ranges and coroutines would be similar, but I'm not sure of their cost.

Contributor guide

Open the contributing guide

Research direction

Start by locating QuadtreeRasterOverlayTileProvider::mapRasterTilesToGeometryTile and inspect its callers. Separate the synchronous mapped-tile-ID calculation from the asynchronous image-loading step, then add tests for the synchronous calculation as described in the issue; done means both stages remain functional and the mapping can be tested without asynchronous work.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
39/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.