QGIS API Documentation 4.3.0-Master (16649ce5cc6)
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 "qgs3drendercontext.h"
32#include "qgschunkloader.h"
33#include "qgschunknode.h"
35#include "qgsvector3d.h"
36
37#define SIP_NO_FILE
38
39class QgsVectorLayer;
43class QgsFeature3DHandler;
44
45namespace Qt3DCore
46{
47 class QTransform;
48}
49
50#include <QFutureWatcher>
51
52
60class QgsVectorLayerChunkLoaderFactory : public QgsQuadtreeChunkLoaderFactory
61{
62 Q_OBJECT
63
64 public:
66 QgsVectorLayerChunkLoaderFactory( const Qgs3DRenderContext &context, QgsVectorLayer *vl, QgsAbstract3DSymbol *symbol, double zMin, double zMax, int maxFeatures );
67
69 QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
70 QgsChunkNode *createRootNode() const override;
71 bool canCreateChildren( QgsChunkNode *node ) override;
72 QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
73
74 Qgs3DRenderContext mRenderContext;
75 QgsVectorLayer *mLayer;
76 std::unique_ptr<QgsAbstract3DSymbol> mSymbol;
78 mutable QHash< QString, bool > mNodesAreLeafs;
79 int mMaxFeatures;
80
81 bool mIsGeocentric = false;
82
83 // below only used for geocentric case
84 QgsChunkNodeId mRootNodeId;
85 QgsCoordinateTransform mCrsToLatLon;
86
87 QgsVector3D mRadius;
88};
89
90
99class QgsVectorLayerChunkLoader : public QgsChunkLoader
100{
101 Q_OBJECT
102
103 public:
105 QgsVectorLayerChunkLoader( const QgsVectorLayerChunkLoaderFactory *factory, QgsChunkNode *node );
106 ~QgsVectorLayerChunkLoader() override;
107
108 void start() override;
109 void cancel() override;
110 Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
111
112 private:
113 const QgsVectorLayerChunkLoaderFactory *mFactory;
114 std::unique_ptr<QgsFeature3DHandler> mHandler;
115 Qgs3DRenderContext mRenderContext;
116 std::unique_ptr<QgsVectorLayerFeatureSource> mSource;
117 bool mCanceled = false;
118 QFutureWatcher<void> *mFutureWatcher = nullptr;
119 QString mLayerName;
120 bool mNodeIsLeaf = false;
121};
122
123
134class QgsVectorLayerChunkedEntity : public QgsAbstractFeatureBasedChunkedEntity
135{
136 Q_OBJECT
137 public:
139 explicit QgsVectorLayerChunkedEntity( Qgs3DMapSettings *map, QgsVectorLayer *vl, double zMin, double zMax, const QgsVectorLayer3DTilingSettings &tilingSettings, QgsAbstract3DSymbol *symbol );
140
141 ~QgsVectorLayerChunkedEntity() override;
142
143 private:
144 bool applyTerrainOffset() const override;
145};
146
148
149#endif // QGSVECTORLAYERCHUNKLOADER_P_H
Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
Defines configuration of how a vector layer gets tiled for 3D rendering.
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.