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

#include <TerrariumTileFetcher.h>

+ Inheritance diagram for TerrariumTileFetcher:
+ Collaboration diagram for TerrariumTileFetcher:

Public Member Functions

 TerrariumTileFetcher (QObject *parent=nullptr, QNetworkAccessManager *networkManager=nullptr)
 networkManager overrides the internally created one (test injection seam)
 
int requestPatchHeights (const TileMath::TileKey &key, int gridSize) final
 
void cancelRequest (int requestId) final
 Cancel a pending request. No signal is emitted for a cancelled request.
 
bool requestTile (const TileMath::TileKey &key) override
 
int pendingCount () const
 
TileMath::TileKey lastFetchKey () const
 
- Public Member Functions inherited from HeightSource
 HeightSource (QObject *parent=nullptr)
 
void setHeightField (HeightField *field)
 Field that receives whole tiles requested via requestTile (not owned)
 

Static Public Attributes

static constexpr int kMaxTileZoom = 15
 Highest zoom the terrarium dataset serves (deeper patches sample the ancestor)
 
static constexpr int kAnchorZoom = 10
 
static constexpr int kMaxGridSize = 256
 Largest supported patch grid (matches PatchGeometry::kMaxGridSize)
 

Additional Inherited Members

- Signals inherited from HeightSource
void patchHeightsReady (int requestId, const QList< float > &heights)
 heights has (gridSize+1)^2 entries, row-major from the north-west corner
 
void patchHeightsFailed (int requestId)
 
- Protected Member Functions inherited from HeightSource
int _nextRequestId ()
 
- Protected Attributes inherited from HeightSource
HeightField * _heightField = nullptr
 tile delivery target for requestTile (not owned)
 

Detailed Description

Fetcher over the AWS Open Data Terrain Tiles (terrarium encoding): real elevations at every patch zoom from one slippy PNG tile per patch, cache-first through QGC's shared tile database with a direct network fallback on miss (fetched tiles are stored back).

requestTile delivers whole decoded tiles into an attached HeightField, which notifies consumers via regionChanged. A failed fetch inserts nothing: the field keeps serving its current best estimate.

A tile at z/x/y maps to the terrarium tile at the same z/x/y, so fetch cost is constant across the LOD range — no flat floor or blend band like the fixed resolution Copernicus pipeline needed. Above the dataset's top zoom the z15 ancestor tile is fetched instead.

The legacy per-patch HeightSource API (bilinear vertex-grid sampling with edge clamp) remains until SurfaceModel switches to sampling the field.

Definition at line 41 of file TerrariumTileFetcher.h.

Constructor & Destructor Documentation

◆ TerrariumTileFetcher()

TerrariumTileFetcher::TerrariumTileFetcher ( QObject *  parent = nullptr,
QNetworkAccessManager *  networkManager = nullptr 
)
explicit

networkManager overrides the internally created one (test injection seam)

Definition at line 144 of file TerrariumTileFetcher.cc.

Member Function Documentation

◆ cancelRequest()

void TerrariumTileFetcher::cancelRequest ( int  requestId)
finalvirtual

Cancel a pending request. No signal is emitted for a cancelled request.

Implements HeightSource.

Definition at line 285 of file TerrariumTileFetcher.cc.

◆ lastFetchKey()

TileMath::TileKey TerrariumTileFetcher::lastFetchKey ( ) const
inline

Tile key submitted by the most recent fetch (test observability for the deep-zoom ancestor path)

Definition at line 73 of file TerrariumTileFetcher.h.

◆ pendingCount()

int TerrariumTileFetcher::pendingCount ( ) const
inline

Definition at line 69 of file TerrariumTileFetcher.h.

◆ requestPatchHeights()

int TerrariumTileFetcher::requestPatchHeights ( const TileMath::TileKey &  key,
int  gridSize 
)
finalvirtual

Request the vertex height grid for a patch. Returns a request id (> 0). gridSize must be a power of two (see HeightField::samplePatch).

Implements HeightSource.

Definition at line 150 of file TerrariumTileFetcher.cc.

References HeightSource::_nextRequestId(), TileMath::isValidKey(), kMaxGridSize, kMaxTileZoom, TileMath::TileKey::x, TileMath::TileKey::y, and TileMath::TileKey::zoom.

◆ requestTile()

bool TerrariumTileFetcher::requestTile ( const TileMath::TileKey &  key)
overridevirtual

Ensures the attached field holds this tile (clamped to the z15 ancestor above kMaxTileZoom), plus the kAnchorZoom ancestors of it and its neighbors. Returns false when no field is attached, the key is invalid, or the fetch could not start; true when the tile is already held, already in flight, or a fetch was started.

Reimplemented from HeightSource.

Definition at line 201 of file TerrariumTileFetcher.cc.

References HeightSource::_heightField, HeightField::hasTile(), TileMath::isValidKey(), and requestTile().

Referenced by requestTile().

Member Data Documentation

◆ kAnchorZoom

constexpr int TerrariumTileFetcher::kAnchorZoom = 10
staticconstexpr

Coarse ancestor zoom fetched alongside every finer tile, for the tile and its neighbors; finer tiles wait for all of them so no region ever has fine data next to no data at all (a cliff to 0 m). A failed anchor stops blocking.

Definition at line 55 of file TerrariumTileFetcher.h.

◆ kMaxGridSize

constexpr int TerrariumTileFetcher::kMaxGridSize = 256
staticconstexpr

Largest supported patch grid (matches PatchGeometry::kMaxGridSize)

Definition at line 58 of file TerrariumTileFetcher.h.

Referenced by requestPatchHeights().

◆ kMaxTileZoom

constexpr int TerrariumTileFetcher::kMaxTileZoom = 15
staticconstexpr

Highest zoom the terrarium dataset serves (deeper patches sample the ancestor)

Definition at line 50 of file TerrariumTileFetcher.h.

Referenced by requestPatchHeights().


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