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

#include <SurfacePatchModel.h>

+ Inheritance diagram for SurfacePatchModel:
+ Collaboration diagram for SurfacePatchModel:

Public Types

enum  Roles {
  CenterXRole = Qt::UserRole + 1 , CenterYRole , SpanRole , ZoomRole ,
  HeightsRole , ReadyRole , CoveredRole , TileImageRole ,
  HasTileImageRole , EdgeLodDeltasRole , TileXRole , TileYRole
}
 

Signals

void sceneChanged ()
 
void terrainChanged ()
 
void debugHillsChanged ()
 
void mapTypeChanged ()
 
void statsChanged ()
 
void statsEnabledChanged ()
 
void statsTextChanged ()
 
void capturingChanged ()
 
void terrainHeightsChanged ()
 terrainHeightAt answers changed somewhere: consumers re-query
 

Public Member Functions

 SurfacePatchModel (QObject *parent=nullptr)
 
 ~SurfacePatchModel () override
 
GeoScenescene () const
 
void setScene (GeoScene *scene)
 
bool terrain () const
 
void setTerrain (bool terrain)
 
bool debugHills () const
 
void setDebugHills (bool debugHills)
 
QString mapType () const
 
void setMapType (const QString &mapType)
 
int gridSize () const
 
HeightFieldheightField () const
 
Q_INVOKABLE double terrainHeightAt (const QGeoCoordinate &coordinate) const
 
double maxRangeMultiplier () const
 
int patchCount () const
 
int pendingCount () const
 
int maxZoomLevel () const
 
int pendingImageCount () const
 Tile image requests awaiting delivery or failure.
 
void setTileImageNetworkManager (QNetworkAccessManager *networkManager)
 
bool statsEnabled () const
 
void setStatsEnabled (bool enabled)
 
QString statsText () const
 
bool capturing () const
 
Q_INVOKABLE void startCapture ()
 Starts recording the per-second perf samples (plus camera context)
 
Q_INVOKABLE QString stopCapture ()
 
Q_INVOKABLE void analyzeSurface () const
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role) const override
 
QHash< int, QByteArray > roleNames () const override
 

Detailed Description

QML bridge between SurfaceModel and the Repeater3D that renders the surface: one row per active patch, updated incrementally (no model resets on pan/zoom).

Patch positions are exposed in scene coordinates (see GeoScene): world mercator meters relative to the scene's re-anchorable origin.

Definition at line 41 of file SurfacePatchModel.h.

Member Enumeration Documentation

◆ Roles

Enumerator
CenterXRole 

patch center x in scene meters

CenterYRole 

patch center y in scene meters

SpanRole 

patch edge length (m)

ZoomRole 

quadtree zoom level

HeightsRole 

vertex height grid (empty = flat)

ReadyRole 
CoveredRole 

pending but overlapped by a ready patch: delegate suppresses rendering

TileImageRole 

drapable image: own tile, or ancestor/descendant fallback while loading

HasTileImageRole 

QImage is opaque to QML; bool validity for bindings.

EdgeLodDeltasRole 

{N,S,W,E} coarser-neighbor LOD deltas for edge stitching

TileXRole 

slippy tile x of the patch key

TileYRole 

slippy tile y of the patch key

Definition at line 62 of file SurfacePatchModel.h.

Constructor & Destructor Documentation

◆ SurfacePatchModel()

SurfacePatchModel::SurfacePatchModel ( QObject *  parent = nullptr)
explicit

Definition at line 29 of file SurfacePatchModel.cc.

◆ ~SurfacePatchModel()

SurfacePatchModel::~SurfacePatchModel ( )
overridedefault

Member Function Documentation

◆ analyzeSurface()

◆ capturing()

bool SurfacePatchModel::capturing ( ) const
inline

Definition at line 136 of file SurfacePatchModel.h.

◆ capturingChanged

void SurfacePatchModel::capturingChanged ( )
signal

Referenced by startCapture(), and stopCapture().

◆ data()

◆ debugHills()

bool SurfacePatchModel::debugHills ( ) const
inline

Definition at line 88 of file SurfacePatchModel.h.

Referenced by setDebugHills().

◆ debugHillsChanged

void SurfacePatchModel::debugHillsChanged ( )
signal

Referenced by setDebugHills().

◆ gridSize()

int SurfacePatchModel::gridSize ( ) const

Definition at line 323 of file SurfacePatchModel.cc.

References SurfaceModel::kGridSize.

◆ heightField()

HeightField * SurfacePatchModel::heightField ( ) const
inline

The shared terrain field patches sample from. Owned here; replaced whenever the surface model is rebuilt.

Definition at line 102 of file SurfacePatchModel.h.

◆ mapType()

QString SurfacePatchModel::mapType ( ) const
inline

Definition at line 92 of file SurfacePatchModel.h.

Referenced by setMapType().

◆ mapTypeChanged

void SurfacePatchModel::mapTypeChanged ( )
signal

Referenced by setMapType().

◆ maxRangeMultiplier()

double SurfacePatchModel::maxRangeMultiplier ( ) const

SurfaceModel::kMaxRangeMultiplier, exposed so the scene camera's far clip plane can cover the full retained patch range

Definition at line 328 of file SurfacePatchModel.cc.

References SurfaceModel::kMaxRangeMultiplier.

◆ maxZoomLevel()

int SurfacePatchModel::maxZoomLevel ( ) const

Definition at line 338 of file SurfacePatchModel.cc.

References TileMath::TileKey::zoom.

◆ patchCount()

int SurfacePatchModel::patchCount ( ) const
inline

Definition at line 113 of file SurfacePatchModel.h.

◆ pendingCount()

int SurfacePatchModel::pendingCount ( ) const

Definition at line 333 of file SurfacePatchModel.cc.

References SurfaceModel::pendingCount().

◆ pendingImageCount()

int SurfacePatchModel::pendingImageCount ( ) const
inline

Tile image requests awaiting delivery or failure.

Definition at line 119 of file SurfacePatchModel.h.

◆ roleNames()

QHash< int, QByteArray > SurfacePatchModel::roleNames ( ) const
override

◆ rowCount()

int SurfacePatchModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

Definition at line 529 of file SurfacePatchModel.cc.

◆ scene()

GeoScene * SurfacePatchModel::scene ( ) const
inline

Definition at line 78 of file SurfacePatchModel.h.

Referenced by setScene().

◆ sceneChanged

void SurfacePatchModel::sceneChanged ( )
signal

Referenced by setScene().

◆ setDebugHills()

void SurfacePatchModel::setDebugHills ( bool  debugHills)

Definition at line 96 of file SurfacePatchModel.cc.

References debugHills(), and debugHillsChanged().

◆ setMapType()

void SurfacePatchModel::setMapType ( const QString &  mapType)

Provider type string for tile imagery (see TileImageSource). Empty disables imagery: TileImageRole stays a null QImage for every patch.

Definition at line 107 of file SurfacePatchModel.cc.

References mapType(), mapTypeChanged(), TileImageSource::tileImageFailed(), and TileImageSource::tileImageReady().

◆ setScene()

void SurfacePatchModel::setScene ( GeoScene scene)

◆ setStatsEnabled()

void SurfacePatchModel::setStatsEnabled ( bool  enabled)

Enables the once-per-second perf counter sampling behind statsText: model update rate/duration, patch churn, and fallback composites

Definition at line 363 of file SurfacePatchModel.cc.

References statsEnabledChanged(), and statsTextChanged().

◆ setTerrain()

void SurfacePatchModel::setTerrain ( bool  terrain)

Real terrain elevations (see TerrariumTileFetcher); false gives a flat z=0 surface. debugHills overrides either.

Definition at line 85 of file SurfacePatchModel.cc.

References terrain(), and terrainChanged().

◆ setTileImageNetworkManager()

void SurfacePatchModel::setTileImageNetworkManager ( QNetworkAccessManager *  networkManager)
inline

Network manager for tile imagery fetches, applied at the next setMapType (test injection seam)

Definition at line 123 of file SurfacePatchModel.h.

◆ startCapture()

void SurfacePatchModel::startCapture ( )

Starts recording the per-second perf samples (plus camera context)

Definition at line 421 of file SurfacePatchModel.cc.

References capturingChanged().

◆ statsChanged

void SurfacePatchModel::statsChanged ( )
signal

◆ statsEnabled()

bool SurfacePatchModel::statsEnabled ( ) const
inline

Definition at line 128 of file SurfacePatchModel.h.

◆ statsEnabledChanged

void SurfacePatchModel::statsEnabledChanged ( )
signal

Referenced by setStatsEnabled().

◆ statsText()

QString SurfacePatchModel::statsText ( ) const
inline

Definition at line 134 of file SurfacePatchModel.h.

◆ statsTextChanged

void SurfacePatchModel::statsTextChanged ( )
signal

Referenced by setStatsEnabled(), and stopCapture().

◆ stopCapture()

QString SurfacePatchModel::stopCapture ( )

Stops recording and writes the samples as CSV; returns the file path (empty on write failure)

Definition at line 442 of file SurfacePatchModel.cc.

References capturingChanged(), data(), and statsTextChanged().

◆ terrain()

bool SurfacePatchModel::terrain ( ) const
inline

Definition at line 82 of file SurfacePatchModel.h.

Referenced by setTerrain().

◆ terrainChanged

void SurfacePatchModel::terrainChanged ( )
signal

Referenced by setTerrain().

◆ terrainHeightAt()

double SurfacePatchModel::terrainHeightAt ( const QGeoCoordinate &  coordinate) const

Best-estimate terrain height (true meters) at a coordinate: real data where loaded, coarser estimate or 0 elsewhere (see HeightField). Emits terrainHeightsChanged as estimates improve.

Definition at line 314 of file SurfacePatchModel.cc.

References TileMath::geoToWorld(), and HeightField::heightAt().

◆ terrainHeightsChanged

void SurfacePatchModel::terrainHeightsChanged ( )
signal

terrainHeightAt answers changed somewhere: consumers re-query

Referenced by GeoMapItem::setSurfaceModel().


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