QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
qgsannotationlayerchunkloader_p.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsannotationlayerchunkloader_p.h
3 --------------------------------------
4 Date : September 2025
5 Copyright : (C) 2025 by Nyall Dawson
6 Email : nyall dot dawson 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 QGSANNOTATIONLAYERCHUNKLOADER_P_H
17#define QGSANNOTATIONLAYERCHUNKLOADER_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"
32#include "qgschunkedentity.h"
33#include "qgschunkloader.h"
34#include "qgstextformat.h"
35
36#include <QImage>
37
38#define SIP_NO_FILE
39
42
43namespace Qt3DCore
44{
45 class QTransform;
46}
47
48#include <QFutureWatcher>
49
50
57class QgsAnnotationLayerChunkLoaderFactory : public QgsQuadtreeChunkLoaderFactory
58{
59 Q_OBJECT
60
61 public:
63 QgsAnnotationLayerChunkLoaderFactory( const Qgs3DRenderContext &context, QgsAnnotationLayer *layer, int leafLevel, Qgis::AltitudeClamping clamping, double zOffset, bool showCallouts, const QColor &calloutLineColor, double calloutLineWidth, const QgsTextFormat &textFormat, double zMin, double zMax );
64
66 QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
67
68 Qgs3DRenderContext mRenderContext;
69 QgsAnnotationLayer *mLayer = nullptr;
70 int mLeafLevel = 0;
72 double mZOffset = 0;
73 bool mShowCallouts = false;
74 QColor mCalloutLineColor;
75 double mCalloutLineWidth = 2;
76 QgsTextFormat mTextFormat;
77};
78
79
87class QgsAnnotationLayerChunkLoader : public QgsChunkLoader
88{
89 Q_OBJECT
90
91 public:
93 QgsAnnotationLayerChunkLoader( const QgsAnnotationLayerChunkLoaderFactory *factory, QgsChunkNode *node );
94 ~QgsAnnotationLayerChunkLoader() override;
95
96 void start() override;
97 void cancel() override;
98 Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
99
100 private:
101 const QgsAnnotationLayerChunkLoaderFactory *mFactory = nullptr;
102 Qgs3DRenderContext mRenderContext;
103 bool mCanceled = false;
104 QFutureWatcher<void> *mFutureWatcher = nullptr;
105 QString mLayerName;
106 QgsVector3D mChunkOrigin;
107
108 std::vector< std::unique_ptr< QgsAnnotationItem > > mItemsToRender;
109
110 QVector< QgsBillboardGeometry::BillboardAtlasData > mBillboardPositions;
111 QVector< QgsBillboardGeometry::BillboardAtlasData > mTextBillboardPositions;
112 QVector< QgsLineString > mCalloutLines;
113 QImage mBillboardAtlas;
114 QImage mTextBillboardAtlas;
115 double mZMin = std::numeric_limits< double >::max();
116 double mZMax = std::numeric_limits< double >::lowest();
117};
118
119
130class QgsAnnotationLayerChunkedEntity : public QgsChunkedEntity
131{
132 Q_OBJECT
133 public:
135 explicit QgsAnnotationLayerChunkedEntity( Qgs3DMapSettings *map, QgsAnnotationLayer *layer, Qgis::AltitudeClamping clamping, double zOffset, bool showCallouts, const QColor &calloutLineColor, double calloutLineWidth, const QgsTextFormat &textFormat, double zMin, double zMax );
136 ~QgsAnnotationLayerChunkedEntity() override;
137
138 private slots:
139 void onTerrainElevationOffsetChanged();
140
141 private:
142 Qt3DCore::QTransform *mTransform = nullptr;
143
144 bool applyTerrainOffset() const;
145
146 friend class TestQgsChunkedEntity;
147};
148
150
151#endif // QGSANNOTATIONLAYERCHUNKLOADER_P_H
AltitudeClamping
Altitude clamping.
Definition qgis.h:3982
@ Relative
Elevation is relative to terrain height (final elevation = terrain elevation + feature elevation).
Definition qgis.h:3984
Abstract base class for annotation items which are drawn with QgsAnnotationLayers.
Represents a map layer containing a set of georeferenced annotations, e.g.