QGIS API Documentation 3.99.0-Master (357b655ed83)
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, double zMin, double zMax, int maxFeatures );
64 ~QgsRuleBasedChunkLoaderFactory() override;
65
67 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 QgsVectorLayer *mLayer;
73 std::unique_ptr<QgsRuleBased3DRenderer::Rule> mRootRule;
75 mutable QHash< QString, bool > mNodesAreLeafs;
76 int mMaxFeatures;
77};
78
79
88class QgsRuleBasedChunkLoader : public QgsChunkLoader
89{
90 Q_OBJECT
91
92 public:
94 QgsRuleBasedChunkLoader( const QgsRuleBasedChunkLoaderFactory *factory, QgsChunkNode *node );
95 ~QgsRuleBasedChunkLoader() override;
96
97 void start() override;
98 void cancel() override;
99 Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
100
101 private:
102 const QgsRuleBasedChunkLoaderFactory *mFactory;
104 Qgs3DRenderContext mContext;
105 std::unique_ptr<QgsVectorLayerFeatureSource> mSource;
106 bool mCanceled = false;
107 QFutureWatcher<void> *mFutureWatcher = nullptr;
108 std::unique_ptr<QgsRuleBased3DRenderer::Rule> mRootRule;
109 bool mNodeIsLeaf = false;
110};
111
112
124class QgsRuleBasedChunkedEntity : public QgsChunkedEntity
125{
126 Q_OBJECT
127 public:
129 explicit QgsRuleBasedChunkedEntity( Qgs3DMapSettings *map, QgsVectorLayer *vl, double zMin, double zMax, const QgsVectorLayer3DTilingSettings &tilingSettings, QgsRuleBased3DRenderer::Rule *rootRule );
130
131 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
132
133 ~QgsRuleBasedChunkedEntity() override;
134 private slots:
135 void onTerrainElevationOffsetChanged();
136
137 private:
138 Qt3DCore::QTransform *mTransform = nullptr;
139
140 bool applyTerrainOffset() const;
141};
142
144
145#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.