QGIS API Documentation 4.3.0-Master (52aa6503bed)
Loading...
Searching...
No Matches
qgstiledscenechunkloader_p.h
Go to the documentation of this file.
1/***************************************************************************
2 qgstiledscenechunkloader_p.h
3 --------------------------------------
4 Date : July 2023
5 Copyright : (C) 2023 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 QGSTILEDSCENECHUNKLOADER_P_H
17#define QGSTILEDSCENECHUNKLOADER_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"
31#include "qgschunkedentity.h"
32#include "qgschunkloader.h"
33#include "qgschunknode.h"
35#include "qgstiledsceneindex.h"
36#include "qgstiledscenetile.h"
37
38#include <QFutureWatcher>
39
40#define SIP_NO_FILE
41
43
44
52class QgsTiledSceneChunkLoader : public QgsChunkLoader
53{
54 Q_OBJECT
55 public:
56 QgsTiledSceneChunkLoader(
57 const Qgs3DRenderContext &context, const QgsTiledSceneIndex &index, QgsCoordinateReferenceSystem tileCrs, QgsCoordinateReferenceSystem layerCrs, double zValueScale, double zValueOffset
58 );
59
60 QFuture<QgsChunkLoaderResult> loadChunk( QgsChunkNode *node ) override;
61 QgsChunkNode *createRootNode() const override;
62 QFuture<QVector<QgsChunkNode *>> createChildren( QgsChunkNode *node ) override;
63
64 QgsChunkNode *nodeForTile( const QgsTiledSceneTile &t, const QgsChunkNodeId &nodeId, QgsChunkNode *parent ) const;
65 QFuture<void> fetchHierarchyForNode( long long nodeId );
66
67 private:
68 QFuture<void> prepareChildren( QgsChunkNode *node );
69
70 QHash<long long, QFuture<void>> mRunningHierarchyFetches;
71
72 // Each worker thread loading a chunk copies this data.
73 struct
74 {
75 Qgs3DRenderContext mRenderContext;
76 QgsTiledSceneIndex mIndex;
77 double mZValueScale = 1.0;
78 double mZValueOffset = 0;
79 QgsCoordinateReferenceSystem mLayerCrs;
80 QgsCoordinateTransform mBoundsTransform;
81 } mData;
82};
83
84
95class QgsTiledSceneLayerChunkedEntity : public QgsChunkedEntity
96{
97 Q_OBJECT
98 public:
99 explicit QgsTiledSceneLayerChunkedEntity(
100 Qgs3DMapSettings *map,
101 const QgsTiledSceneIndex &index,
102 QgsCoordinateReferenceSystem tileCrs,
103 QgsCoordinateReferenceSystem layerCrs,
104 double maximumScreenError,
105 bool showBoundingBoxes,
106 double zValueScale,
107 double zValueOffset
108 );
109
110 ~QgsTiledSceneLayerChunkedEntity() override;
111
112 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
113
114 private:
115 mutable QgsTiledSceneIndex mIndex;
116};
117
119
120#endif // QGSTILEDSCENECHUNKLOADER_P_H
Definition of the world.