16 #ifndef QGSCHUNKNODE_P_H
17 #define QGSCHUNKNODE_P_H
41 struct QgsChunkListEntry;
43 class QgsChunkQueueJob;
44 class QgsChunkQueueJobFactory;
51 QgsChunkNodeId(
int _x = -1,
int _y = -1,
int _z = -1 )
52 : x( _x ), y( _y ), z( _z ) {}
57 QString text()
const {
return QStringLiteral(
"%1/%2/%3" ).arg( z ).arg( x ).arg( y ); }
78 QgsChunkNode(
int tileX,
int tileY,
int tileZ,
const QgsAABB &bbox,
float error, QgsChunkNode *parent =
nullptr );
111 QgsAABB bbox()
const {
return mBbox; }
113 float error()
const {
return mError; }
115 int tileX()
const {
return mTileX; }
117 int tileY()
const {
return mTileY; }
119 int tileZ()
const {
return mTileZ; }
121 QgsChunkNodeId tileId()
const {
return QgsChunkNodeId( mTileX, mTileY, mTileZ ); }
123 QgsChunkNode *parent()
const {
return mParent; }
125 QgsChunkNode *
const *children()
const {
return mChildren; }
127 State state()
const {
return mState; }
130 QgsChunkListEntry *loaderQueueEntry()
const {
return mLoaderQueueEntry; }
132 QgsChunkListEntry *replacementQueueEntry()
const {
return mReplacementQueueEntry; }
134 QgsChunkLoader *loader()
const {
return mLoader; }
136 Qt3DCore::QEntity *entity()
const {
return mEntity; }
138 QgsChunkQueueJob *updater()
const {
return mUpdater; }
141 bool allChildChunksResident( QTime currentTime )
const;
144 void ensureAllChildrenExist();
150 QList<QgsChunkNode *> descendants();
157 void setQueuedForLoad( QgsChunkListEntry *entry );
160 void cancelQueuedForLoad();
163 void setLoading( QgsChunkLoader *chunkLoader );
166 void cancelLoading();
169 void setLoaded( Qt3DCore::QEntity *mEntity );
175 void setQueuedForUpdate( QgsChunkListEntry *entry, QgsChunkQueueJobFactory *updateJobFactory );
178 void cancelQueuedForUpdate();
184 void cancelUpdating();
190 void setExactBbox(
const QgsAABB &box );
193 void setHasData(
bool hasData ) { mHasData = hasData; }
195 bool hasData()
const {
return mHasData; }
201 int mTileX, mTileY, mTileZ;
203 QgsChunkNode *mParent;
204 QgsChunkNode *mChildren[4];
208 QgsChunkListEntry *mLoaderQueueEntry;
209 QgsChunkListEntry *mReplacementQueueEntry;
211 QgsChunkLoader *mLoader;
212 Qt3DCore::QEntity *mEntity;
214 QgsChunkQueueJobFactory *mUpdaterFactory;
215 QgsChunkQueueJob *mUpdater;
217 QTime mEntityCreatedTime;
218 bool mHasData =
true;
223 #endif // CHUNKNODE_H