QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ElevationTilePyramid Class Reference

#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
 

Detailed Description

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.

Member Function Documentation

◆ bestTileFor()

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().

◆ hasDescendant()

bool ElevationTilePyramid::hasDescendant ( const TileMath::TileKey key) const
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().

◆ hasTile()

bool ElevationTilePyramid::hasTile ( const TileMath::TileKey key) const
inline

Definition at line 68 of file ElevationTilePyramid.h.

Referenced by HeightField::hasTile().

◆ insertTile()

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().

◆ lookupCountForTest()

qint64 ElevationTilePyramid::lookupCountForTest ( ) const
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().

◆ setPinnedKeys()

void ElevationTilePyramid::setPinnedKeys ( QSet< TileMath::TileKey keys)
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().

◆ tileCount()

int ElevationTilePyramid::tileCount ( ) const
inline

Definition at line 74 of file ElevationTilePyramid.h.

Referenced by HeightField::tileCount().

Member Data Documentation

◆ kMaxTiles

constexpr int ElevationTilePyramid::kMaxTiles = 128
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().


The documentation for this class was generated from the following files: