QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
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, const QgsTiledSceneIndex &index, QgsCoordinateReferenceSystem tileCrs, QgsCoordinateReferenceSystem layerCrs, double zValueScale, double zValueOffset
88 );
89
90 QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
91 QgsChunkNode *createRootNode() const override;
92 QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
93
94 bool canCreateChildren( QgsChunkNode *node ) override;
95 void prepareChildren( QgsChunkNode *node ) override;
96
97 QgsChunkNode *nodeForTile( const QgsTiledSceneTile &t, const QgsChunkNodeId &nodeId, QgsChunkNode *parent ) const;
98 void fetchHierarchyForNode( long long nodeId, QgsChunkNode *origNode );
99
100 Qgs3DRenderContext mRenderContext;
101 QString mRelativePathBase;
102 mutable QgsTiledSceneIndex mIndex;
103 double mZValueScale = 1.0;
104 double mZValueOffset = 0;
105 QgsCoordinateTransform mBoundsTransform;
106 QgsCoordinateReferenceSystem mLayerCrs;
107 QSet<long long> mPendingHierarchyFetches;
108 QSet<long long> mFutureHierarchyFetches;
109};
110
111
122class QgsTiledSceneLayerChunkedEntity : public QgsChunkedEntity
123{
124 Q_OBJECT
125 public:
126 explicit QgsTiledSceneLayerChunkedEntity(
127 Qgs3DMapSettings *map,
128 const QgsTiledSceneIndex &index,
129 QgsCoordinateReferenceSystem tileCrs,
130 QgsCoordinateReferenceSystem layerCrs,
131 double maximumScreenError,
132 bool showBoundingBoxes,
133 double zValueScale,
134 double zValueOffset
135 );
136
137 ~QgsTiledSceneLayerChunkedEntity() override;
138
139 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
140
141 int pendingJobsCount() const override;
142
143 private:
144 mutable QgsTiledSceneIndex mIndex;
145};
146
148
149#endif // QGSTILEDSCENECHUNKLOADER_P_H
Definition of the world.