QGIS API Documentation 3.99.0-Master (752b475928d)
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"
31#include "qgschunkedentity.h"
32#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 QgsRuleBasedChunkLoaderFactory : public QgsQuadtreeChunkLoaderFactory
58{
59 Q_OBJECT
60
61 public:
63 QgsRuleBasedChunkLoaderFactory( const Qgs3DRenderContext &context, QgsVectorLayer *vl, QgsRuleBased3DRenderer::Rule *rootRule, int leafLevel, double zMin, double zMax );
64 ~QgsRuleBasedChunkLoaderFactory() override;
65
67 QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
68
69 Qgs3DRenderContext mRenderContext;
70 QgsVectorLayer *mLayer;
71 std::unique_ptr<QgsRuleBased3DRenderer::Rule> mRootRule;
72 int mLeafLevel;
73};
74
75
84class QgsRuleBasedChunkLoader : public QgsChunkLoader
85{
86 Q_OBJECT
87
88 public:
90 QgsRuleBasedChunkLoader( const QgsRuleBasedChunkLoaderFactory *factory, QgsChunkNode *node );
91 ~QgsRuleBasedChunkLoader() override;
92
93 void start() override;
94 void cancel() override;
95 Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
96
97 private:
98 const QgsRuleBasedChunkLoaderFactory *mFactory;
100 Qgs3DRenderContext mContext;
101 std::unique_ptr<QgsVectorLayerFeatureSource> mSource;
102 bool mCanceled = false;
103 QFutureWatcher<void> *mFutureWatcher = nullptr;
104 std::unique_ptr<QgsRuleBased3DRenderer::Rule> mRootRule;
105};
106
107
119class QgsRuleBasedChunkedEntity : public QgsChunkedEntity
120{
121 Q_OBJECT
122 public:
124 explicit QgsRuleBasedChunkedEntity( Qgs3DMapSettings *map, QgsVectorLayer *vl, double zMin, double zMax, const QgsVectorLayer3DTilingSettings &tilingSettings, QgsRuleBased3DRenderer::Rule *rootRule );
125
126 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
127
128 ~QgsRuleBasedChunkedEntity() override;
129 private slots:
130 void onTerrainElevationOffsetChanged();
131
132 private:
133 Qt3DCore::QTransform *mTransform = nullptr;
134
135 bool applyTerrainOffset() const;
136};
137
139
140#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.