QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 "qgschunkloader_p.h"
31 #include "qgsfeature3dhandler_p.h"
32 #include "qgschunkedentity_p.h"
33 #include "qgsrulebased3drenderer.h"
34 #include <QFutureWatcher>
35 
36 #define SIP_NO_FILE
37 
38 class Qgs3DMapSettings;
39 class QgsVectorLayer;
42 class QgsFeature3DHandler;
43 
44 namespace Qt3DCore
45 {
46  class QTransform;
47 }
48 
56 class QgsRuleBasedChunkLoaderFactory : public QgsQuadtreeChunkLoaderFactory
57 {
58  Q_OBJECT
59 
60  public:
62  QgsRuleBasedChunkLoaderFactory( const Qgs3DMapSettings &map, QgsVectorLayer *vl, QgsRuleBased3DRenderer::Rule *rootRule, int leafLevel, double zMin, double zMax );
63  ~QgsRuleBasedChunkLoaderFactory() override;
64 
66  virtual QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
67 
68  const Qgs3DMapSettings &mMap;
69  QgsVectorLayer *mLayer;
70  std::unique_ptr<QgsRuleBased3DRenderer::Rule> mRootRule;
71  int mLeafLevel;
72 };
73 
74 
83 class QgsRuleBasedChunkLoader : public QgsChunkLoader
84 {
85  Q_OBJECT
86 
87  public:
89  QgsRuleBasedChunkLoader( const QgsRuleBasedChunkLoaderFactory *factory, QgsChunkNode *node );
90  ~QgsRuleBasedChunkLoader() override;
91 
92  virtual void cancel() override;
93  virtual Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
94 
95  private:
96  const QgsRuleBasedChunkLoaderFactory *mFactory;
98  Qgs3DRenderContext mContext;
99  std::unique_ptr<QgsVectorLayerFeatureSource> mSource;
100  bool mCanceled = false;
101  QFutureWatcher<void> *mFutureWatcher = nullptr;
102  std::unique_ptr<QgsRuleBased3DRenderer::Rule> mRootRule;
103 };
104 
105 
117 class QgsRuleBasedChunkedEntity : public QgsChunkedEntity
118 {
119  Q_OBJECT
120  public:
122  explicit QgsRuleBasedChunkedEntity( QgsVectorLayer *vl, double zMin, double zMax, const QgsVectorLayer3DTilingSettings &tilingSettings, QgsRuleBased3DRenderer::Rule *rootRule, const Qgs3DMapSettings &map );
123 
124  ~QgsRuleBasedChunkedEntity();
125  private slots:
126  void onTerrainElevationOffsetChanged( float newOffset );
127  private:
128  Qt3DCore::QTransform *mTransform = nullptr;
129 };
130 
132 
133 #endif // QGSRULEBASEDCHUNKLOADER_H
qgsfeature3dhandler_p.h
QgsRuleBased3DRenderer::RuleToHandlerMap
QHash< const QgsRuleBased3DRenderer::Rule *, QgsFeature3DHandler * > RuleToHandlerMap
Definition: qgsrulebased3drenderer.h:67
qgschunkloader_p.h
QgsAbstract3DSymbol
Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
Definition: qgsabstract3dsymbol.h:46
qgschunkedentity_p.h
Qt3DCore
Definition: qgsabstract3drenderer.h:30
Qgs3DMapSettings
Definition of the world.
Definition: qgs3dmapsettings.h:57
qgsrulebased3drenderer.h
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
QgsRuleBased3DRenderer::Rule
A child rule for a QgsRuleBased3DRenderer.
Definition: qgsrulebased3drenderer.h:74
QgsVectorLayerFeatureSource
Partial snapshot of vector layer's state (only the members necessary for access to features)
Definition: qgsvectorlayerfeatureiterator.h:52
QgsVectorLayer3DTilingSettings
This class defines configuration of how a vector layer gets tiled for 3D rendering.
Definition: qgsabstractvectorlayer3drenderer.h:37