QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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
43class QgsTiledSceneChunkLoaderFactory;
44
45
54class QgsTiledSceneChunkLoader : public QgsChunkLoader
55{
56 Q_OBJECT
57 public:
58 QgsTiledSceneChunkLoader( QgsChunkNode *node, const QgsTiledSceneIndex &index, const QgsTiledSceneChunkLoaderFactory &factory, double zValueScale, double zValueOffset );
59 void start() override;
60
61 ~QgsTiledSceneChunkLoader() override;
62
63 Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
64
65 private:
66 const QgsTiledSceneChunkLoaderFactory &mFactory;
67 double mZValueScale;
68 double mZValueOffset;
69 QgsTiledSceneIndex mIndex;
70 QFutureWatcher<void> *mFutureWatcher = nullptr;
71 Qt3DCore::QEntity *mEntity = nullptr;
72};
73
74
82class QgsTiledSceneChunkLoaderFactory : public QgsChunkLoaderFactory
83{
84 Q_OBJECT
85 public:
86 QgsTiledSceneChunkLoaderFactory(
87 const Qgs3DRenderContext &context,
88 const QgsTiledSceneIndex &index,
89 QgsCoordinateReferenceSystem tileCrs,
90 QgsCoordinateReferenceSystem layerCrs,
91 double zValueScale,
92 double zValueOffset
93 );
94
95 QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
96 QgsChunkNode *createRootNode() const override;
97 QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
98
99 bool canCreateChildren( QgsChunkNode *node ) override;
100 void prepareChildren( QgsChunkNode *node ) override;
101
102 QgsChunkNode *nodeForTile( const QgsTiledSceneTile &t, const QgsChunkNodeId &nodeId, QgsChunkNode *parent ) const;
103 void fetchHierarchyForNode( long long nodeId, QgsChunkNode *origNode );
104
105 Qgs3DRenderContext mRenderContext;
106 QString mRelativePathBase;
107 mutable QgsTiledSceneIndex mIndex;
108 double mZValueScale = 1.0;
109 double mZValueOffset = 0;
110 QgsCoordinateTransform mBoundsTransform;
111 QgsCoordinateReferenceSystem mLayerCrs;
112 QSet<long long> mPendingHierarchyFetches;
113 QSet<long long> mFutureHierarchyFetches;
114};
115
116
127class QgsTiledSceneLayerChunkedEntity : public QgsChunkedEntity
128{
129 Q_OBJECT
130 public:
131 explicit QgsTiledSceneLayerChunkedEntity( Qgs3DMapSettings *map, const QgsTiledSceneIndex &index, QgsCoordinateReferenceSystem tileCrs, QgsCoordinateReferenceSystem layerCrs, double maximumScreenError, bool showBoundingBoxes, double zValueScale, double zValueOffset );
132
133 ~QgsTiledSceneLayerChunkedEntity() override;
134
135 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
136
137 int pendingJobsCount() const override;
138
139 private:
140 mutable QgsTiledSceneIndex mIndex;
141};
142
144
145#endif // QGSTILEDSCENECHUNKLOADER_P_H
Definition of the world.