QGIS API Documentation 4.3.0-Master (16eddb2670e)
Loading...
Searching...
No Matches
qgsrulebasedchunkloader_p.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsrulebasedchunkloader_p.h
3 --------------------------------------
4 Date : November 2019
5 Copyright : (C) 2019 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 QGSRULEBASEDCHUNKLOADER_H
17#define QGSRULEBASEDCHUNKLOADER_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"
32#include "qgschunkloader.h"
33#include "qgsfeaturerequest.h"
35
36#include <QFutureWatcher>
37#include <QMutex>
38
39#define SIP_NO_FILE
40
42class QgsVectorLayer;
45class QgsFeature3DHandler;
46
47namespace Qt3DCore
48{
49 class QTransform;
50}
51
59class QgsRuleBasedChunkLoader : public QgsQuadtreeChunkLoader
60{
61 Q_OBJECT
62
63 public:
65 QgsRuleBasedChunkLoader( const Qgs3DRenderContext &context, QgsVectorLayer *vl, QgsRuleBased3DRenderer::Rule *rootRule, double zMin, double zMax, int maxFeatures );
66 ~QgsRuleBasedChunkLoader() override;
67
68 QFuture<QgsChunkLoaderResult> loadChunk( QgsChunkNode *node ) override;
69 QFuture<QVector<QgsChunkNode *>> createChildren( QgsChunkNode *node ) override;
70
72 struct NodeIsLeafMap
73 {
74 QHash< QString, bool > map;
75 QMutex mutex;
76 };
77
79 struct ChunkData
80 {
82 Qgs3DRenderContext renderCtx;
83 };
84
85 static void loadChunkInWorker(
86 QPromise<ChunkData> &promise,
88 Qgs3DRenderContext renderCtx,
89 const std::unique_ptr<QgsRuleBased3DRenderer::Rule> &rootRule,
90 const std::unique_ptr<QgsVectorLayerFeatureSource> &source,
91 const QgsFeatureRequest &req,
92 QgsChunkNode *node,
93 int maxFeatures,
94 const std::shared_ptr<NodeIsLeafMap> &nodesAreLeaves
95 );
96
97 Qt3DCore::QEntity *createEntity( QgsChunkNode *node, ChunkData data, Qt3DCore::QEntity *parent );
98
99 Qgs3DRenderContext mRenderContext;
100 QgsVectorLayer *mLayer;
101 std::unique_ptr<QgsRuleBased3DRenderer::Rule> mRootRule;
102 std::shared_ptr<NodeIsLeafMap> mNodesAreLeafs;
103 int mMaxFeatures;
104};
105
106
118class QgsRuleBasedChunkedEntity : public QgsAbstractFeatureBasedChunkedEntity
119{
120 Q_OBJECT
121 public:
123 explicit QgsRuleBasedChunkedEntity( Qgs3DMapSettings *map, QgsVectorLayer *vl, double zMin, double zMax, const QgsVectorLayer3DTilingSettings &tilingSettings, QgsRuleBased3DRenderer::Rule *rootRule );
124
125 ~QgsRuleBasedChunkedEntity() override;
126
127 private:
128 bool applyTerrainOffset() const override;
129};
130
132
133#endif // QGSRULEBASEDCHUNKLOADER_H
Definition of the world.
Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
QHash< const QgsRuleBased3DRenderer::Rule *, QgsFeature3DHandler * > RuleToHandlerMap
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.