QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
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 "qgschunkloader.h"
31#include "qgschunkedentity.h"
33#include "qgs3drendercontext.h"
34#include <QFutureWatcher>
35
36#define SIP_NO_FILE
37
39class QgsVectorLayer;
42class QgsFeature3DHandler;
43
44namespace Qt3DCore
45{
46 class QTransform;
47}
48
56class QgsRuleBasedChunkLoaderFactory : public QgsQuadtreeChunkLoaderFactory
57{
58 Q_OBJECT
59
60 public:
62 QgsRuleBasedChunkLoaderFactory( const Qgs3DRenderContext &context, 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 Qgs3DRenderContext mRenderContext;
69 QgsVectorLayer *mLayer;
70 std::unique_ptr<QgsRuleBased3DRenderer::Rule> mRootRule;
71 int mLeafLevel;
72};
73
74
83class 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
117class QgsRuleBasedChunkedEntity : public QgsChunkedEntity
118{
119 Q_OBJECT
120 public:
122 explicit QgsRuleBasedChunkedEntity( Qgs3DMapSettings *map, QgsVectorLayer *vl, double zMin, double zMax, const QgsVectorLayer3DTilingSettings &tilingSettings, QgsRuleBased3DRenderer::Rule *rootRule );
123
124 QVector<QgsRayCastingUtils::RayHit> rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QgsRayCastingUtils::RayCastContext &context ) const override;
125
126 ~QgsRuleBasedChunkedEntity();
127 private slots:
128 void onTerrainElevationOffsetChanged( float newOffset );
129 private:
130 Qt3DCore::QTransform *mTransform = nullptr;
131
132 bool applyTerrainOffset() const;
133};
134
136
137#endif // QGSRULEBASEDCHUNKLOADER_H
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 data sets.
Helper struct to store ray casting parameters.