QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
Loading...
Searching...
No Matches
qgschunkloader.h
Go to the documentation of this file.
1/***************************************************************************
2 qgschunkloader.h
3 --------------------------------------
4 Date : July 2017
5 Copyright : (C) 2017 by Martin Dobias
6 Email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSCHUNKLOADER_H
17#define QGSCHUNKLOADER_H
18
20
21//
22// W A R N I N G
23// -------------
24//
25// This file is not part of the QGIS API. It exists purely as an
26// implementation detail. This header file may change from version to
27// version without notice, or even be removed.
28//
29
30#include "qgis_3d.h"
31#include "qgsbox3d.h"
32#include "qgschunkqueuejob.h"
33
34#define SIP_NO_FILE
35
43class QgsChunkLoader : public QgsChunkQueueJob
44{
45 Q_OBJECT
46 public:
48 QgsChunkLoader( QgsChunkNode *node )
49 : QgsChunkQueueJob( node )
50 {}
51
56 virtual Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) = 0;
57};
58
59
64class QgsChunkLoaderFactory : public QObject
65{
66 Q_OBJECT
67 public:
68 ~QgsChunkLoaderFactory() override = default;
69
71 virtual QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const = 0;
72
74 virtual int primitivesCount( QgsChunkNode *node ) const
75 {
76 Q_UNUSED( node );
77 return 0;
78 }
79
81 virtual QgsChunkNode *createRootNode() const = 0;
83 virtual QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const = 0;
84
96 virtual bool canCreateChildren( QgsChunkNode *node )
97 {
98 Q_UNUSED( node );
99 return true;
100 }
101
112 virtual void prepareChildren( QgsChunkNode *node ) { Q_UNUSED( node ); }
113
114 signals:
116 void childrenPrepared( QgsChunkNode *node );
117};
118
119
127class _3D_EXPORT QgsQuadtreeChunkLoaderFactory : public QgsChunkLoaderFactory
128{
129 Q_OBJECT
130 public:
131 QgsQuadtreeChunkLoaderFactory();
132 ~QgsQuadtreeChunkLoaderFactory() override;
133
135 void setupQuadtree( const QgsBox3D &rootBox3D, float rootError, int maxLevel = -1, const QgsBox3D &clippingBox3D = QgsBox3D() );
136
137 QgsChunkNode *createRootNode() const override;
138 QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
139
140 protected:
141 QgsBox3D mRootBox3D;
142 QgsBox3D mClippingBox3D;
143 float mRootError = 0;
145 int mMaxLevel = -1;
146};
147
156class QgsChunkUpdaterFactory : public QgsChunkQueueJobFactory
157{
158 public:
159 QgsChunkUpdaterFactory( QgsChunkLoaderFactory *loaderFactory )
160 : mChunkLoaderFactory( loaderFactory )
161 {}
162
163 QgsChunkQueueJob *createJob( QgsChunkNode *chunk ) override { return mChunkLoaderFactory->createChunkLoader( chunk ); }
164
165 private:
166 QgsChunkLoaderFactory *mChunkLoaderFactory;
167};
168
170
171#endif // QGSCHUNKLOADER_H