QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
31#include "qgschunkedentity_p.h"
32#include "qgschunkloader_p.h"
33#include "qgschunknode_p.h"
34#include "qgstiledsceneindex.h"
35#include "qgstiledscenetile.h"
36
37#include <QFutureWatcher>
38
39#define SIP_NO_FILE
40
42class QgsTiledSceneChunkLoaderFactory;
43
44
53class QgsTiledSceneChunkLoader : public QgsChunkLoader
54{
55 Q_OBJECT
56 public:
57 QgsTiledSceneChunkLoader( QgsChunkNode *node, const QgsTiledSceneIndex &index, const QgsTiledSceneChunkLoaderFactory &factory, double zValueScale, double zValueOffset );
58
59 ~QgsTiledSceneChunkLoader();
60
61 virtual Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent );
62
63 private:
64 const QgsTiledSceneChunkLoaderFactory &mFactory;
65 QgsTiledSceneIndex mIndex;
66 QFutureWatcher<void> *mFutureWatcher = nullptr;
67 Qt3DCore::QEntity *mEntity = nullptr;
68};
69
70
78class QgsTiledSceneChunkLoaderFactory : public QgsChunkLoaderFactory
79{
80 Q_OBJECT
81 public:
82 QgsTiledSceneChunkLoaderFactory( const Qgs3DMapSettings &map, const QgsTiledSceneIndex &index,
83 double zValueScale, double zValueOffset );
84
85 virtual QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
86 virtual QgsChunkNode *createRootNode() const override;
87 virtual QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
88
89 virtual bool canCreateChildren( QgsChunkNode *node ) override;
90 virtual void prepareChildren( QgsChunkNode *node ) override;
91
92 QgsChunkNode *nodeForTile( const QgsTiledSceneTile &t, const QgsChunkNodeId &nodeId, QgsChunkNode *parent ) const;
93 void fetchHierarchyForNode( long long nodeId, QgsChunkNode *origNode );
94
95 const Qgs3DMapSettings &mMap;
96 QString mRelativePathBase;
97 mutable QgsTiledSceneIndex mIndex;
98 double mZValueScale = 1.0;
99 double mZValueOffset = 0;
100 QgsCoordinateTransform mBoundsTransform;
101 QSet<long long> mPendingHierarchyFetches;
102 QSet<long long> mFutureHierarchyFetches;
103};
104
105
116class QgsTiledSceneLayerChunkedEntity : public QgsChunkedEntity
117{
118 Q_OBJECT
119 public:
120 explicit QgsTiledSceneLayerChunkedEntity( const Qgs3DMapSettings &map, const QgsTiledSceneIndex &index, double maximumScreenError, bool showBoundingBoxes,
121 double zValueScale, double zValueOffset );
122
123 ~QgsTiledSceneLayerChunkedEntity();
124
125 QVector<QgsRayCastingUtils::RayHit> rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QgsRayCastingUtils::RayCastContext &context ) const override;
126
127 int pendingJobsCount() const override;
128
129 private:
130 mutable QgsTiledSceneIndex mIndex;
131};
132
134
135#endif // QGSTILEDSCENECHUNKLOADER_P_H
Class for doing transforms between two map coordinate systems.
An index for tiled scene data providers.
Represents an individual tile from a tiled scene data source.