QGIS API Documentation 4.3.0-Master (52aa6503bed)
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 "qgsfeaturerequest.h"
36#include "qgsvector3d.h"
37
38#define SIP_NO_FILE
39
40class QgsVectorLayer;
44class QgsFeature3DHandler;
45
46namespace Qt3DCore
47{
48 class QTransform;
49}
50
51#include <QFutureWatcher>
52#include <QMutex>
53
54
62class QgsVectorLayerChunkLoader : public QgsQuadtreeChunkLoader
63{
64 Q_OBJECT
65
66 public:
68 QgsVectorLayerChunkLoader( const Qgs3DRenderContext &context, QgsVectorLayer *vl, QgsAbstract3DSymbol *symbol, double zMin, double zMax, int maxFeatures );
69
70 QFuture<QgsChunkLoaderResult> loadChunk( QgsChunkNode *node ) override;
71 QgsChunkNode *createRootNode() const override;
72 QFuture<QVector<QgsChunkNode *>> createChildren( QgsChunkNode *node ) override;
73
74 private:
75 struct NodeIsLeafMap
76 {
77 QHash< QString, bool > map;
78 QMutex mutex;
79 };
80
81 struct ChunkData
82 {
83 std::shared_ptr<QgsFeature3DHandler> handler;
84 Qgs3DRenderContext renderCtx;
85 };
86
87 static void loadChunkInWorker(
88 QPromise<ChunkData> &promise,
89 std::shared_ptr<QgsFeature3DHandler> handler,
90 Qgs3DRenderContext renderCtx,
91 const std::unique_ptr<QgsVectorLayerFeatureSource> &source,
92 const QgsFeatureRequest &req,
93 QgsChunkNode *node,
94 int maxFeatures,
95 const std::shared_ptr<NodeIsLeafMap> &nodesAreLeafs,
96 QgsCoordinateTransform layerToRenderCrs,
97 bool isGeocentric
98 );
99
100 Qt3DCore::QEntity *createEntity( QgsChunkNode *node, ChunkData data, Qt3DCore::QEntity *parent );
101
102 Qgs3DRenderContext mRenderContext;
103 QgsVectorLayer *mLayer;
104 std::unique_ptr<QgsAbstract3DSymbol> mSymbol;
105 std::shared_ptr<NodeIsLeafMap> mNodesAreLeafs;
106 int mMaxFeatures;
107
108 bool mIsGeocentric = false;
109
110 // below only used for geocentric case
111 QgsChunkNodeId mRootNodeId;
112 QgsCoordinateTransform mCrsToLatLon;
113
114 QgsVector3D mRadius;
115
116 friend class QgsVectorLayerChunkedEntity;
117};
118
119
130class QgsVectorLayerChunkedEntity : public QgsAbstractFeatureBasedChunkedEntity
131{
132 Q_OBJECT
133 public:
135 explicit QgsVectorLayerChunkedEntity( Qgs3DMapSettings *map, QgsVectorLayer *vl, double zMin, double zMax, const QgsVectorLayer3DTilingSettings &tilingSettings, QgsAbstract3DSymbol *symbol );
136
137 ~QgsVectorLayerChunkedEntity() override;
138
139 private:
140 bool applyTerrainOffset() const override;
141};
142
144
145#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.