QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
qgsannotationlayer3drenderer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsannotationlayer3drenderer.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 QGSANNOTATIONLAYER3DRENDERER_H
17#define QGSANNOTATIONLAYER3DRENDERER_H
18
19#include "qgis_3d.h"
20#include "qgis_sip.h"
23#include "qgsmaplayerref.h"
24#include "qgstextformat.h"
25
27
28#ifdef SIP_RUN
29// this is needed for the "convert to subclass" code below to compile
30% ModuleHeaderCode
32 % End
33#endif
34
45{
46 public:
48
50 QgsAbstract3DRenderer *createRenderer( QDomElement &elem, const QgsReadWriteContext &context ) override SIP_FACTORY;
51};
52
60{
61#ifdef SIP_RUN
63 if ( dynamic_cast<QgsAnnotationLayer3DRenderer *>( sipCpp ) != nullptr )
64 sipType = sipType_QgsAnnotationLayer3DRenderer;
65 else
66 sipType = nullptr;
68#endif
69
70 public:
72
79
86
87 QString type() const override;
89 Qt3DCore::QEntity *createEntity( Qgs3DMapSettings *map ) const override SIP_SKIP;
90
91 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
92 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
93 void resolveReferences( const QgsProject &project ) override;
94
100 Qgis::AltitudeClamping altitudeClamping() const { return mAltClamping; }
101
107 void setAltitudeClamping( Qgis::AltitudeClamping clamping ) { mAltClamping = clamping; }
108
114 double zOffset() const { return mZOffset; }
115
121 void setZOffset( double offset ) { mZOffset = offset; }
122
128 bool showCalloutLines() const;
129
135 void setShowCalloutLines( bool show );
136
137 // TODO -- consider exposing via QgsSimpleLineMaterialSettings, for now, for testing only
138
145 SIP_SKIP void setCalloutLineColor( const QColor &color );
146
153 SIP_SKIP QColor calloutLineColor() const;
154
161 SIP_SKIP void setCalloutLineWidth( double width );
162
169 SIP_SKIP double calloutLineWidth() const;
170
176 QgsTextFormat textFormat() const;
177
183 void setTextFormat( const QgsTextFormat &format );
184
185 private:
186#ifdef SIP_RUN
188#endif
189
190 static constexpr double DEFAULT_Z_OFFSET = 50;
191
192 QgsMapLayerRef mLayerRef;
194 double mZOffset = DEFAULT_Z_OFFSET;
195 bool mShowCalloutLines = true;
196 QColor mCalloutLineColor { 0, 0, 0 };
197 double mCalloutLineWidth = 2;
198 QgsTextFormat mTextFormat;
199};
200
201#endif // QGSANNOTATIONLAYER3DRENDERER_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
Definition of the world.
virtual QgsAbstract3DRenderer * createRenderer(QDomElement &elem, const QgsReadWriteContext &context)=0
Returns new instance of the renderer given the DOM element.
Qgs3DRendererAbstractMetadata(const QString &type)
Constructor of the base class.
QString type() const
Returns unique identifier of the 3D renderer class.
Base class for all renderers that participate in 3D views.
QgsAbstract3DRenderer()=default
3D renderers for annotation layers.
void setAltitudeClamping(Qgis::AltitudeClamping clamping)
Sets the altitude clamping method, which determines the vertical position of annotations.
Qt3DCore::QEntity * createEntity(Qgs3DMapSettings *map) const override
Returns a 3D entity that will be used to show renderer's data in 3D scene.
void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const override
Writes renderer's properties to given XML element.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context) override
Reads renderer's properties from given XML element.
Qgis::AltitudeClamping altitudeClamping() const
Returns the altitude clamping method, which determines the vertical position of annotations.
void resolveReferences(const QgsProject &project) override
Resolves references to other objects - second phase of loading - after readXml().
QgsAnnotationLayer * layer() const
Returns the annotation layer associated with the renderer.
void setZOffset(double offset)
Sets the z offset, which is a fixed offset amount which will be added to z values for the annotations...
double zOffset() const
Returns the z offset, which is a fixed offset amount which should be added to z values for the annota...
void setLayer(QgsAnnotationLayer *layer)
Sets the annotation layer associated with the renderer.
QgsAnnotationLayer3DRenderer * clone() const override
Returns a cloned instance.
Represents a map layer containing a set of georeferenced annotations, e.g.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:109
A container for the context for various read/write operations on objects.
Container for all settings relating to text rendering.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:199
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_FACTORY
Definition qgis_sip.h:84
#define SIP_END
Definition qgis_sip.h:216
_LayerRef< QgsMapLayer > QgsMapLayerRef