QGIS API Documentation 4.3.0-Master (90cb4ecf9ef)
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"
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(
64 const Qgs3DRenderContext &context,
65 QgsAnnotationLayer *layer,
66 int leafLevel,
68 double zOffset,
69 bool showCallouts,
70 const QColor &calloutLineColor,
71 double calloutLineWidth,
72 const QgsTextFormat &textFormat,
73 double zMin,
74 double zMax
75 );
76
78 QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
79
80 Qgs3DRenderContext mRenderContext;
81 QgsAnnotationLayer *mLayer = nullptr;
82 int mLeafLevel = 0;
84 double mZOffset = 0;
85 bool mShowCallouts = false;
86 QColor mCalloutLineColor;
87 double mCalloutLineWidth = 2;
88 QgsTextFormat mTextFormat;
89};
90
91
99class QgsAnnotationLayerChunkLoader : public QgsChunkLoader
100{
101 Q_OBJECT
102
103 public:
105 QgsAnnotationLayerChunkLoader( const QgsAnnotationLayerChunkLoaderFactory *factory, QgsChunkNode *node );
106 ~QgsAnnotationLayerChunkLoader() override;
107
108 void start() override;
109 void cancel() override;
110 Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
111
112 private:
113 const QgsAnnotationLayerChunkLoaderFactory *mFactory = nullptr;
114 Qgs3DRenderContext mRenderContext;
115 bool mCanceled = false;
116 QFutureWatcher<void> *mFutureWatcher = nullptr;
117 QString mLayerName;
118 QgsVector3D mChunkOrigin;
119
120 std::vector< std::unique_ptr< QgsAnnotationItem > > mItemsToRender;
121
122 QVector< QgsBillboardGeometry::BillboardAtlasData > mBillboardPositions;
123 QVector< QgsBillboardGeometry::BillboardAtlasData > mTextBillboardPositions;
124
125 struct PictureBillboards
126 {
127 QImage image;
128 QVector< QVector3D > positions;
129 QVector< QSizeF > sizes;
131 };
132 QVector< PictureBillboards > mPictureBillboards;
133
134 QVector< QgsLineString > mCalloutLines;
135 QImage mBillboardAtlas;
136 QImage mTextBillboardAtlas;
137 double mZMin = std::numeric_limits< double >::max();
138 double mZMax = std::numeric_limits< double >::lowest();
139};
140
141
152class QgsAnnotationLayerChunkedEntity : public QgsAbstractFeatureBasedChunkedEntity
153{
154 Q_OBJECT
155 public:
157 explicit QgsAnnotationLayerChunkedEntity(
158 Qgs3DMapSettings *map,
159 QgsAnnotationLayer *layer,
160 Qgis::AltitudeClamping clamping,
161 double zOffset,
162 bool showCallouts,
163 const QColor &calloutLineColor,
164 double calloutLineWidth,
165 const QgsTextFormat &textFormat,
166 double zMin,
167 double zMax
168 );
169 ~QgsAnnotationLayerChunkedEntity() override;
170
171 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
172
173 private:
174 bool applyTerrainOffset() const override;
175};
176
178
179#endif // QGSANNOTATIONLAYERCHUNKLOADER_P_H
AltitudeClamping
Altitude clamping.
Definition qgis.h:4201
@ Relative
Elevation is relative to terrain height (final elevation = terrain elevation + feature elevation).
Definition qgis.h:4203
BillboardScaleMode
3D billboard scaling modes.
Definition qgis.h:4441
@ ViewIndependent
Billboard has a fixed pixel size on the screen, regardless of the camera distance.
Definition qgis.h:4442
Abstract base class for annotation items which are drawn with QgsAnnotationLayers.
Represents a map layer containing a set of georeferenced annotations, e.g.