QGIS API Documentation  3.12.1-BucureČ™ti (121cc00ff0)
qgstextrenderer_p.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstextrenderer.h
3  -----------------
4  begin : September 2015
5  copyright : (C) Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7 
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifndef QGSTEXTRENDERER_PRIVATE_H
18 #define QGSTEXTRENDERER_PRIVATE_H
19 
20 #define SIP_NO_FILE
21 
22 #include "qgis_core.h"
23 #include "qgstextrenderer.h"
24 #include "qgsmapunitscale.h"
25 #include "qgsunittypes.h"
26 #include "qgsapplication.h"
27 #include "qgspainteffect.h"
29 #include <QSharedData>
30 #include <QPainter>
31 
33 
34 //
35 // W A R N I N G
36 // -------------
37 //
38 // This file is not part of the QGIS API. It exists purely as an
39 // implementation detail. This header file may change from version to
40 // version without notice, or even be removed.
41 //
42 
43 
44 class QgsTextBufferSettingsPrivate : public QSharedData
45 {
46  public:
47 
48  QgsTextBufferSettingsPrivate()
49  : color( Qt::white )
50  {
51  }
52 
53  QgsTextBufferSettingsPrivate( const QgsTextBufferSettingsPrivate &other )
54  : QSharedData( other )
55  , enabled( other.enabled )
56  , size( other.size )
57  , sizeUnit( other.sizeUnit )
58  , sizeMapUnitScale( other.sizeMapUnitScale )
59  , color( other.color )
60  , opacity( other.opacity )
61  , fillBufferInterior( other.fillBufferInterior )
62  , joinStyle( other.joinStyle )
63  , blendMode( other.blendMode )
64  , paintEffect( other.paintEffect ? other.paintEffect->clone() : nullptr )
65  {
66  }
67 
68  bool enabled = false;
69  double size = 1;
71  QgsMapUnitScale sizeMapUnitScale;
72  QColor color;
73  double opacity = 1.0;
74  bool fillBufferInterior = false;
75  Qt::PenJoinStyle joinStyle = Qt::RoundJoin;
76  QPainter::CompositionMode blendMode = QPainter::CompositionMode_SourceOver;
77  std::unique_ptr< QgsPaintEffect > paintEffect;
78 };
79 
80 
81 class QgsTextBackgroundSettingsPrivate : public QSharedData
82 {
83  public:
84 
85  QgsTextBackgroundSettingsPrivate()
86  : size( QSizeF( 0.0, 0.0 ) )
87  , offset( QPointF( 0.0, 0.0 ) )
88  , radii( QSizeF( 0.0, 0.0 ) )
89  , fillColor( Qt::white )
90  , strokeColor( Qt::darkGray )
91  {
92  }
93 
94  QgsTextBackgroundSettingsPrivate( const QgsTextBackgroundSettingsPrivate &other )
95  : QSharedData( other )
96  , enabled( other.enabled )
97  , type( other.type )
98  , svgFile( other.svgFile )
99  , sizeType( other.sizeType )
100  , size( other.size )
101  , sizeUnits( other.sizeUnits )
102  , sizeMapUnitScale( other.sizeMapUnitScale )
103  , rotationType( other.rotationType )
104  , rotation( other.rotation )
105  , offset( other.offset )
106  , offsetUnits( other.offsetUnits )
107  , offsetMapUnitScale( other.offsetMapUnitScale )
108  , radii( other.radii )
109  , radiiUnits( other.radiiUnits )
110  , radiiMapUnitScale( other.radiiMapUnitScale )
111  , blendMode( other.blendMode )
112  , fillColor( other.fillColor )
113  , strokeColor( other.strokeColor )
114  , opacity( other.opacity )
115  , strokeWidth( other.strokeWidth )
116  , strokeWidthUnits( other.strokeWidthUnits )
117  , strokeWidthMapUnitScale( other.strokeWidthMapUnitScale )
118  , joinStyle( other.joinStyle )
119  , paintEffect( other.paintEffect ? other.paintEffect->clone() : nullptr )
120  , markerSymbol( other.markerSymbol ? other.markerSymbol->clone() : nullptr )
121  {
122  }
123 
124  bool enabled = false;
126  QString svgFile;
128  QSizeF size;
130  QgsMapUnitScale sizeMapUnitScale;
132  double rotation = 0.0;
133  QPointF offset;
135  QgsMapUnitScale offsetMapUnitScale;
136  QSizeF radii;
138  QgsMapUnitScale radiiMapUnitScale;
139  QPainter::CompositionMode blendMode = QPainter::CompositionMode_SourceOver;
140  QColor fillColor;
141  QColor strokeColor;
142  double opacity = 1.0;
143  double strokeWidth = 0.0;
145  QgsMapUnitScale strokeWidthMapUnitScale;
146  Qt::PenJoinStyle joinStyle = Qt::BevelJoin;
147  std::unique_ptr< QgsPaintEffect > paintEffect;
148  std::unique_ptr< QgsMarkerSymbol > markerSymbol;
149 };
150 
151 
152 
153 class QgsTextShadowSettingsPrivate : public QSharedData
154 {
155  public:
156 
157  QgsTextShadowSettingsPrivate()
158  : color( QColor( 0, 0, 0 ) )
159  {
160 
161  }
162 
163  QgsTextShadowSettingsPrivate( const QgsTextShadowSettingsPrivate &other )
164  : QSharedData( other )
165  , enabled( other.enabled )
166  , shadowUnder( other.shadowUnder )
167  , offsetAngle( other.offsetAngle )
168  , offsetDist( other.offsetDist )
169  , offsetUnits( other.offsetUnits )
170  , offsetMapUnitScale( other.offsetMapUnitScale )
171  , offsetGlobal( other.offsetGlobal )
172  , radius( other.radius )
173  , radiusUnits( other.radiusUnits )
174  , radiusMapUnitScale( other.radiusMapUnitScale )
175  , radiusAlphaOnly( other.radiusAlphaOnly )
176  , scale( other.scale )
177  , color( other.color )
178  , opacity( other.opacity )
179  , blendMode( other.blendMode )
180  {
181  }
182 
183  bool enabled = false;
185  int offsetAngle = 135;
186  double offsetDist = 1.0;
188  QgsMapUnitScale offsetMapUnitScale;
189  bool offsetGlobal = true;
190  double radius = 1.5;
192  QgsMapUnitScale radiusMapUnitScale;
193  bool radiusAlphaOnly = false;
194  int scale = 100;
195  QColor color;
196  double opacity = 0.7;
197  QPainter::CompositionMode blendMode = QPainter::CompositionMode_Multiply;
198 };
199 
200 
201 class QgsTextMaskSettingsPrivate : public QSharedData
202 {
203  public:
204 
205  QgsTextMaskSettingsPrivate()
206  {
207 
208  }
209 
210  QgsTextMaskSettingsPrivate( const QgsTextMaskSettingsPrivate &other )
211  : QSharedData( other )
212  , enabled( other.enabled )
213  , type( other.type )
214  , size( other.size )
215  , sizeUnit( other.sizeUnit )
216  , sizeMapUnitScale( other.sizeMapUnitScale )
217  , joinStyle( other.joinStyle )
218  , opacity( other.opacity )
219  , paintEffect( other.paintEffect ? other.paintEffect->clone() : nullptr )
220  , maskedSymbolLayers( other.maskedSymbolLayers )
221  {
222  }
223 
224  bool enabled = false;
226  double size = 1.5;
228  QgsMapUnitScale sizeMapUnitScale;
229  Qt::PenJoinStyle joinStyle = Qt::RoundJoin;
230  double opacity = 1.0;
231  std::unique_ptr< QgsPaintEffect > paintEffect;
232  QgsSymbolLayerReferenceList maskedSymbolLayers;
233 };
234 
235 
236 class QgsTextSettingsPrivate : public QSharedData
237 {
238  public:
239 
240  QgsTextSettingsPrivate()
241  : textColor( Qt::black )
242  {
243  }
244 
245  QgsTextSettingsPrivate( const QgsTextSettingsPrivate &other )
246  : QSharedData( other )
247  , textFont( other.textFont )
248  , textNamedStyle( other.textNamedStyle )
249  , fontSizeUnits( other.fontSizeUnits )
250  , fontSizeMapUnitScale( other.fontSizeMapUnitScale )
251  , fontSize( other.fontSize )
252  , textColor( other.textColor )
253  , opacity( other.opacity )
254  , blendMode( other.blendMode )
255  , multilineHeight( other.multilineHeight )
256  , orientation( other.orientation )
257  , previewBackgroundColor( other.previewBackgroundColor )
258  , mDataDefinedProperties( other.mDataDefinedProperties )
259  {
260  }
261 
262  QFont textFont;
263  QString textNamedStyle;
265  QgsMapUnitScale fontSizeMapUnitScale;
266  double fontSize = 10 ; //may differ from size in textFont due to units (e.g., size in map units)
267  QColor textColor;
268  double opacity = 1.0;
269  QPainter::CompositionMode blendMode = QPainter::CompositionMode_SourceOver;
270  double multilineHeight = 1.0 ; //0.0 to 10.0, leading between lines as multiplyer of line height
272  QColor previewBackgroundColor = Qt::white;
273 
275  QgsPropertyCollection mDataDefinedProperties;
276 
277 
278 };
279 
280 
281 
282 
283 
285 
286 #endif // QGSTEXTRENDERER_PRIVATE_H
TextOrientation
Text orientation.
Shape size is determined by adding a buffer margin around text.
RotationType
Methods for determining the rotation of the background shape.
MaskType
Mask shape types.
ShadowPlacement
Placement positions for text shadow.
QList< QgsSymbolLayerReference > QgsSymbolLayerReferenceList
SizeType
Methods for determining the background shape size.
Draw shadow below all text components.
ShapeType
Background shape types.
Points (e.g., for font sizes)
Definition: qgsunittypes.h:151
Struct for storing maximum and minimum scales for measurements in map units.
Shape rotation is synced with text rotation.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:145