QGIS API Documentation 4.1.0-Master (9af12b5a203)
Loading...
Searching...
No Matches
qgscategorizedchunkloader_p.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscategorizedchunkloader_p.h
3 --------------------------------------
4 Date : November 2025
5 Copyright : (C) 2025 by Jean Felder
6 Email : jean dot felder at oslandia 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 QGSCATEGORIZEDCHUNKLOADER_H
17#define QGSCATEGORIZEDCHUNKLOADER_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 "qgs3drendercontext.h"
33#include "qgschunkloader.h"
34
35#include <QFutureWatcher>
36
37#define SIP_NO_FILE
38
40class QgsVectorLayer;
43class QgsFeature3DHandler;
44
45namespace Qt3DCore
46{
47 class QTransform;
48}
49
57class QgsCategorizedChunkLoaderFactory : public QgsQuadtreeChunkLoaderFactory
58{
59 Q_OBJECT
60
61 public:
63 QgsCategorizedChunkLoaderFactory( const Qgs3DRenderContext &context, QgsVectorLayer *vectorLayer, const QgsCategorized3DRenderer *renderer, double zMin, double zMax, int maxFeatures );
64 ~QgsCategorizedChunkLoaderFactory() override;
65
67 virtual QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
68 bool canCreateChildren( QgsChunkNode *node ) override;
69 QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
70
71 Qgs3DRenderContext mRenderContext;
72 const QgsVectorLayer *mLayer = nullptr;
73 const Qgs3DCategoryList *mCategories = nullptr;
74 QString mAttributeName;
76 mutable QHash< QString, bool > mNodesAreLeafs;
77 int mMaxFeatures = 0;
78};
79
80
89class QgsCategorizedChunkLoader : public QgsChunkLoader
90{
91 Q_OBJECT
92
93 public:
95 QgsCategorizedChunkLoader( const QgsCategorizedChunkLoaderFactory *factory, QgsChunkNode *node );
96 ~QgsCategorizedChunkLoader() override;
97
98 void start() override;
99 virtual void cancel() override;
100 virtual Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
101
102 private:
103 const QSet<QString> prepareHandlers( const QgsBox3D &chunkExtent );
104 void processFeature( const QgsFeature &feature ) const;
105 QString filter() const;
106
107 private:
108 const QgsCategorizedChunkLoaderFactory *mFactory = nullptr;
109 Qgs3DRenderContext mContext;
110 std::unique_ptr<QgsVectorLayerFeatureSource> mSource;
111 bool mCanceled = false;
112 QFutureWatcher<void> *mFutureWatcher = nullptr;
113 bool mNodeIsLeaf = false;
114
115 std::vector<std::unique_ptr<QgsFeature3DHandler>> mHandlers;
117 QHash<QString, QgsFeature3DHandler *> mFeaturesHandlerHash;
118 std::unique_ptr<QgsExpression> mExpression;
119 int mAttributeIdx = -1;
120};
121
122
134class QgsCategorizedChunkedEntity : public QgsAbstractFeatureBasedChunkedEntity
135{
136 Q_OBJECT
137 public:
139 explicit QgsCategorizedChunkedEntity(
140 Qgs3DMapSettings *mapSettings, QgsVectorLayer *vectorLayer, double zMin, double zMax, const QgsVectorLayer3DTilingSettings &tilingSettings, const QgsCategorized3DRenderer *renderer
141 );
142
143 ~QgsCategorizedChunkedEntity() override;
144
145 private:
146 bool applyTerrainOffset() const override;
147};
148
150
151#endif // QGSCATEGORIZEDCHUNKLOADER_H
Definition of the world.
Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
Partial snapshot of vector layer's state (only the members necessary for access to features).
Represents a vector layer which manages a vector based dataset.
QList< Qgs3DRendererCategory > Qgs3DCategoryList