|
QGroundControl
Ground Control Station for MAVLink Drones
|
#include <ElevationTilePyramid.h>
Classes | |
| struct | Grid |
| Decoded elevation samples for one tile, row-major from the NW corner. More... | |
| struct | View |
Public Member Functions | |
| bool | insertTile (const TileMath::TileKey &key, Grid grid, TileMath::TileKey *evictedKey=nullptr) |
| bool | hasTile (const TileMath::TileKey &key) const |
| View | bestTileFor (const TileMath::TileKey &key) const |
| int | tileCount () const |
| void | setPinnedKeys (QSet< TileMath::TileKey > keys) |
| bool | hasDescendant (const TileMath::TileKey &key) const |
| qint64 | lookupCountForTest () const |
Static Public Attributes | |
| static constexpr int | kMaxTiles = 128 |
In-memory working set of decoded elevation tiles, keyed by slippy tile.
This is the synchronous sampling layer of the continuous-drape design: the persistent store remains QGC's shared tile cache database (encoded tiles, async); this pyramid retains what the fetch path has already decoded so a height estimate is answerable immediately at mesh time. Lookup serves a query tile from itself or its nearest stored ancestor with the sub-window to sample — never a descendant — so coverage is continuous wherever any ancestor data exists.
Not thread-safe: confine to one thread or synchronize externally. This includes the const lookup methods — they mutate recency/instrumentation state, so even concurrent reads race. Bounded working set: least-recently-used tiles are evicted past kMaxTiles.
Definition at line 35 of file ElevationTilePyramid.h.
| ElevationTilePyramid::View ElevationTilePyramid::bestTileFor | ( | const TileMath::TileKey & | key | ) | const |
Finest stored tile covering key: the tile itself when present, else the nearest ancestor. View pointers stay valid until the next insert.
Definition at line 86 of file ElevationTilePyramid.cc.
References TileMath::isValidKey(), TileMath::kMinZoom, TileMath::TileKey::x, TileMath::TileKey::y, and TileMath::TileKey::zoom.
Referenced by HeightField::backingKeyFor(), HeightField::heightAt(), and HeightField::samplePatch().
|
inline |
True when any stored tile lies strictly deeper within key's extent (i.e. a lookup inside key could resolve finer than key itself)
Definition at line 83 of file ElevationTilePyramid.h.
Referenced by HeightField::heightAt(), and HeightField::samplePatch().
|
inline |
Definition at line 68 of file ElevationTilePyramid.h.
Referenced by HeightField::hasTile().
| bool ElevationTilePyramid::insertTile | ( | const TileMath::TileKey & | key, |
| Grid | grid, | ||
| TileMath::TileKey * | evictedKey = nullptr |
||
| ) |
Stores grid for key, replacing any previous tile. Invalid grids are rejected (returns false). When the insert evicts a tile, its key is written to evictedKey (left untouched otherwise).
Definition at line 39 of file ElevationTilePyramid.cc.
References ElevationTilePyramid::Grid::isValid(), TileMath::isValidKey(), and kMaxTiles.
Referenced by HeightField::insertTile().
|
inline |
Perf instrumentation: number of bestTileFor resolutions performed (test hook, not API — semantics track the resolution strategy)
Definition at line 87 of file ElevationTilePyramid.h.
Referenced by HeightField::lookupCountForTest().
|
inline |
Tiles that must not be evicted (they back rendered patches or resolve them as ancestors). kMaxTiles becomes a soft cap: when every resident tile is pinned, inserts grow past it rather than break a rendered mesh.
Definition at line 79 of file ElevationTilePyramid.h.
Referenced by HeightField::setPinnedKeys().
|
inline |
Definition at line 74 of file ElevationTilePyramid.h.
Referenced by HeightField::tileCount().
|
staticconstexpr |
Working-set cap: least-recently-used tiles are evicted at insert time (256x256 float tiles ~256KB each, so the cap bounds memory at ~32MB)
Definition at line 40 of file ElevationTilePyramid.h.
Referenced by insertTile().