16 #ifndef QGSCHUNKNODE_P_H
17 #define QGSCHUNKNODE_P_H
41 struct QgsChunkListEntry;
43 class QgsChunkQueueJob;
44 class QgsChunkQueueJobFactory;
57 QgsChunkNodeId(
int _d = -1,
int _x = -1,
int _y = -1,
int _z = -1 )
58 : d( _d ), x( _x ), y( _y ), z( _z ) {}
66 return QStringLiteral(
"%1/%2/%3" ).arg( d ).arg( x ).arg( y );
68 return QStringLiteral(
"%1/%2/%3/%4" ).arg( d ).arg( x ).arg( y ).arg( z );
72 bool operator==(
const QgsChunkNodeId &other )
const
74 return d == other.d && x == other.x && y == other.y && z == other.z;
77 bool operator!=(
const QgsChunkNodeId &other )
const
79 return !( *
this == other );
103 QgsChunkNode(
const QgsChunkNodeId &nodeId,
const QgsAABB &bbox,
float error, QgsChunkNode *parent =
nullptr );
136 QgsAABB bbox()
const {
return mBbox; }
138 float error()
const {
return mError; }
140 QgsChunkNodeId tileId()
const {
return mNodeId; }
142 QgsChunkNode *parent()
const {
return mParent; }
144 int childCount()
const {
return mChildCount; }
146 QgsChunkNode *
const *children()
const {
return mChildren; }
148 State state()
const {
return mState; }
151 QgsChunkListEntry *loaderQueueEntry()
const {
return mLoaderQueueEntry; }
153 QgsChunkListEntry *replacementQueueEntry()
const {
return mReplacementQueueEntry; }
155 QgsChunkLoader *loader()
const {
return mLoader; }
157 Qt3DCore::QEntity *entity()
const {
return mEntity; }
159 QgsChunkQueueJob *updater()
const {
return mUpdater; }
162 bool allChildChunksResident( QTime currentTime )
const;
165 void populateChildren(
const QVector<QgsChunkNode *> &children );
171 QList<QgsChunkNode *> descendants();
178 void setQueuedForLoad( QgsChunkListEntry *entry );
181 void cancelQueuedForLoad();
184 void setLoading( QgsChunkLoader *chunkLoader );
187 void cancelLoading();
190 void setLoaded( Qt3DCore::QEntity *mEntity );
196 void setQueuedForUpdate( QgsChunkListEntry *entry, QgsChunkQueueJobFactory *updateJobFactory );
199 void cancelQueuedForUpdate();
205 void cancelUpdating();
211 void setExactBbox(
const QgsAABB &box );
220 void updateParentBoundingBoxesRecursively()
const;
223 void setHasData(
bool hasData ) { mHasData = hasData; }
225 bool hasData()
const {
return mHasData; }
231 QgsChunkNodeId mNodeId;
233 QgsChunkNode *mParent;
234 QgsChunkNode *mChildren[8];
235 int mChildCount = -1;
239 QgsChunkListEntry *mLoaderQueueEntry;
240 QgsChunkListEntry *mReplacementQueueEntry;
242 QgsChunkLoader *mLoader;
243 Qt3DCore::QEntity *mEntity;
245 QgsChunkQueueJobFactory *mUpdaterFactory;
246 QgsChunkQueueJob *mUpdater;
248 QTime mEntityCreatedTime;
249 bool mHasData =
true;
254 #endif // CHUNKNODE_H