QGIS API Documentation 3.41.0-Master (cea29feecf2)
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
31#include "qgschunkedentity.h"
32#include "qgschunkloader.h"
33#include "qgschunknode.h"
34#include "qgstiledsceneindex.h"
35#include "qgstiledscenetile.h"
36#include "qgs3drendercontext.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
60 ~QgsTiledSceneChunkLoader();
61
62 virtual Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent );
63
64 private:
65 const QgsTiledSceneChunkLoaderFactory &mFactory;
66 QgsTiledSceneIndex mIndex;
67 QFutureWatcher<void> *mFutureWatcher = nullptr;
68 Qt3DCore::QEntity *mEntity = nullptr;
69};
70
71
79class QgsTiledSceneChunkLoaderFactory : public QgsChunkLoaderFactory
80{
81 Q_OBJECT
82 public:
83 QgsTiledSceneChunkLoaderFactory(
84 const Qgs3DRenderContext &context, const QgsTiledSceneIndex &index, QgsCoordinateReferenceSystem tileCrs,
85 double zValueScale, double zValueOffset
86 );
87
88 virtual QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
89 virtual QgsChunkNode *createRootNode() const override;
90 virtual QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
91
92 virtual bool canCreateChildren( QgsChunkNode *node ) override;
93 virtual void prepareChildren( QgsChunkNode *node ) override;
94
95 QgsChunkNode *nodeForTile( const QgsTiledSceneTile &t, const QgsChunkNodeId &nodeId, QgsChunkNode *parent ) const;
96 void fetchHierarchyForNode( long long nodeId, QgsChunkNode *origNode );
97
98 Qgs3DRenderContext mRenderContext;
99 QString mRelativePathBase;
100 mutable QgsTiledSceneIndex mIndex;
101 double mZValueScale = 1.0;
102 double mZValueOffset = 0;
103 QgsCoordinateTransform mBoundsTransform;
104 QSet<long long> mPendingHierarchyFetches;
105 QSet<long long> mFutureHierarchyFetches;
106};
107
108
119class QgsTiledSceneLayerChunkedEntity : public QgsChunkedEntity
120{
121 Q_OBJECT
122 public:
123 explicit QgsTiledSceneLayerChunkedEntity( Qgs3DMapSettings *map, const QgsTiledSceneIndex &index, QgsCoordinateReferenceSystem tileCrs, double maximumScreenError, bool showBoundingBoxes, double zValueScale, double zValueOffset );
124
125 ~QgsTiledSceneLayerChunkedEntity();
126
127 QVector<QgsRayCastingUtils::RayHit> rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QgsRayCastingUtils::RayCastContext &context ) const override;
128
129 int pendingJobsCount() const override;
130
131 private:
132 mutable QgsTiledSceneIndex mIndex;
133};
134
136
137#endif // QGSTILEDSCENECHUNKLOADER_P_H
This class represents a coordinate reference system (CRS).
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.
Helper struct to store ray casting parameters.