QGIS API Documentation 3.39.0-Master (d85f3c2a281)
Loading...
Searching...
No Matches
qgsvectorlayerchunkloader_p.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectorlayerchunkloader_p.h
3 --------------------------------------
4 Date : July 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 QGSVECTORLAYERCHUNKLOADER_P_H
17#define QGSVECTORLAYERCHUNKLOADER_P_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"
32#include "qgschunkedentity_p.h"
33
34#define SIP_NO_FILE
35
36class QgsVectorLayer;
40class QgsFeature3DHandler;
41
42namespace Qt3DCore
43{
44 class QTransform;
45}
46
47#include <QFutureWatcher>
48
49
57class QgsVectorLayerChunkLoaderFactory : public QgsQuadtreeChunkLoaderFactory
58{
59 Q_OBJECT
60
61 public:
63 QgsVectorLayerChunkLoaderFactory( const Qgs3DRenderContext &context, QgsVectorLayer *vl, QgsAbstract3DSymbol *symbol, int leafLevel, double zMin, double zMax );
64
66 virtual QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
67
68 Qgs3DRenderContext mRenderContext;
69 QgsVectorLayer *mLayer;
70 std::unique_ptr<QgsAbstract3DSymbol> mSymbol;
71 int mLeafLevel;
72};
73
74
83class QgsVectorLayerChunkLoader : public QgsChunkLoader
84{
85 Q_OBJECT
86
87 public:
89 QgsVectorLayerChunkLoader( const QgsVectorLayerChunkLoaderFactory *factory, QgsChunkNode *node );
90 ~QgsVectorLayerChunkLoader() override;
91
92 virtual void cancel() override;
93 virtual Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
94
95 private:
96 const QgsVectorLayerChunkLoaderFactory *mFactory;
97 std::unique_ptr<QgsFeature3DHandler> mHandler;
98 Qgs3DRenderContext mRenderContext;
99 std::unique_ptr<QgsVectorLayerFeatureSource> mSource;
100 bool mCanceled = false;
101 QFutureWatcher<void> *mFutureWatcher = nullptr;
102 QString mLayerName;
103};
104
105
116class QgsVectorLayerChunkedEntity : public QgsChunkedEntity
117{
118 Q_OBJECT
119 public:
121 explicit QgsVectorLayerChunkedEntity( Qgs3DMapSettings *map, QgsVectorLayer *vl, double zMin, double zMax, const QgsVectorLayer3DTilingSettings &tilingSettings, QgsAbstract3DSymbol *symbol );
122
123 QVector<QgsRayCastingUtils::RayHit> rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QgsRayCastingUtils::RayCastContext &context ) const override;
124
125 ~QgsVectorLayerChunkedEntity();
126 private slots:
127 void onTerrainElevationOffsetChanged( float newOffset );
128
129 private:
130 friend class QgsRuleBasedChunkedEntity;
132 static QVector<QgsRayCastingUtils::RayHit> rayIntersection( const QList<QgsChunkNode *> &activeNodes, const QMatrix4x4 &transformMatrix, const QgsRayCastingUtils::Ray3D &ray, const QgsRayCastingUtils::RayCastContext &context );
133
134 Qt3DCore::QTransform *mTransform = nullptr;
135
136 bool applyTerrainOffset() const;
137};
138
140
141#endif // QGSVECTORLAYERCHUNKLOADER_P_H
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.