QGIS API Documentation 4.3.0-Master (16eddb2670e)
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 "qgschunknode.h"
33
34#include <QFuture>
35#include <Qt3DCore/QEntity>
36
37#define SIP_NO_FILE
38
46struct QgsChunkLoaderResult
47{
48 public:
55 std::function<Qt3DCore::QEntity *( Qt3DCore::QEntity *parent )> createEntity;
56
57 static const QgsChunkLoaderResult sEmpty;
58};
59
60
67class QgsChunkLoader : public QObject
68{
69 Q_OBJECT
70 public:
71 ~QgsChunkLoader() override = default;
72
74 virtual QFuture<QgsChunkLoaderResult> loadChunk( QgsChunkNode *node ) = 0;
75
80 virtual QFuture<QgsChunkLoaderResult> updateChunk( QgsChunkNode *node );
81
83 virtual int primitivesCount( QgsChunkNode *node ) const
84 {
85 Q_UNUSED( node );
86 return 0;
87 }
88
90 virtual QgsChunkNode *createRootNode() const = 0;
92 virtual QFuture<QVector<QgsChunkNode *>> createChildren( QgsChunkNode *node ) = 0;
93};
94
95
103class _3D_EXPORT QgsQuadtreeChunkLoader : public QgsChunkLoader
104{
105 Q_OBJECT
106 public:
107 QgsQuadtreeChunkLoader();
108 ~QgsQuadtreeChunkLoader() override;
109
111 void setupQuadtree( const QgsBox3D &rootBox3D, float rootError, int maxLevel = -1, const QgsBox3D &clippingBox3D = QgsBox3D() );
112
113 QgsChunkNode *createRootNode() const override;
114 QFuture<QVector<QgsChunkNode *>> createChildren( QgsChunkNode *node ) override;
115
116 protected:
117 QgsBox3D mRootBox3D;
118 QgsBox3D mClippingBox3D;
119 float mRootError = 0;
121 int mMaxLevel = -1;
122};
123
125
126#endif // QGSCHUNKLOADER_H