QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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"
28 #include <QSharedData>
29 #include <QPainter>
30 
32 
33 //
34 // W A R N I N G
35 // -------------
36 //
37 // This file is not part of the QGIS API. It exists purely as an
38 // implementation detail. This header file may change from version to
39 // version without notice, or even be removed.
40 //
41 
42 
43 class QgsTextBufferSettingsPrivate : public QSharedData
44 {
45  public:
46 
47  QgsTextBufferSettingsPrivate()
48  : color( Qt::white )
49  {
50  }
51 
52  QgsTextBufferSettingsPrivate( const QgsTextBufferSettingsPrivate &other )
53  : QSharedData( other )
54  , enabled( other.enabled )
55  , size( other.size )
56  , sizeUnit( other.sizeUnit )
57  , sizeMapUnitScale( other.sizeMapUnitScale )
58  , color( other.color )
59  , opacity( other.opacity )
60  , fillBufferInterior( other.fillBufferInterior )
61  , joinStyle( other.joinStyle )
62  , blendMode( other.blendMode )
63  , paintEffect( other.paintEffect ? other.paintEffect->clone() : nullptr )
64  {
65  }
66 
67  bool enabled = false;
68  double size = 1;
70  QgsMapUnitScale sizeMapUnitScale;
71  QColor color;
72  double opacity = 1.0;
73  bool fillBufferInterior = false;
74  Qt::PenJoinStyle joinStyle = Qt::RoundJoin;
75  QPainter::CompositionMode blendMode = QPainter::CompositionMode_SourceOver;
76  std::unique_ptr< QgsPaintEffect > paintEffect;
77 };
78 
79 
80 class QgsTextBackgroundSettingsPrivate : public QSharedData
81 {
82  public:
83 
84  QgsTextBackgroundSettingsPrivate()
85  : size( QSizeF( 0.0, 0.0 ) )
86  , offset( QPointF( 0.0, 0.0 ) )
87  , radii( QSizeF( 0.0, 0.0 ) )
88  , fillColor( Qt::white )
89  , strokeColor( Qt::darkGray )
90  {
91  }
92 
93  QgsTextBackgroundSettingsPrivate( const QgsTextBackgroundSettingsPrivate &other )
94  : QSharedData( other )
95  , enabled( other.enabled )
96  , type( other.type )
97  , svgFile( other.svgFile )
98  , sizeType( other.sizeType )
99  , size( other.size )
100  , sizeUnits( other.sizeUnits )
101  , sizeMapUnitScale( other.sizeMapUnitScale )
102  , rotationType( other.rotationType )
103  , rotation( other.rotation )
104  , offset( other.offset )
105  , offsetUnits( other.offsetUnits )
106  , offsetMapUnitScale( other.offsetMapUnitScale )
107  , radii( other.radii )
108  , radiiUnits( other.radiiUnits )
109  , radiiMapUnitScale( other.radiiMapUnitScale )
110  , blendMode( other.blendMode )
111  , fillColor( other.fillColor )
112  , strokeColor( other.strokeColor )
113  , opacity( other.opacity )
114  , strokeWidth( other.strokeWidth )
115  , strokeWidthUnits( other.strokeWidthUnits )
116  , strokeWidthMapUnitScale( other.strokeWidthMapUnitScale )
117  , joinStyle( other.joinStyle )
118  , paintEffect( other.paintEffect ? other.paintEffect->clone() : nullptr )
119  , markerSymbol( other.markerSymbol ? other.markerSymbol->clone() : nullptr )
120  {
121  }
122 
123  bool enabled = false;
125  QString svgFile;
127  QSizeF size;
129  QgsMapUnitScale sizeMapUnitScale;
131  double rotation = 0.0;
132  QPointF offset;
134  QgsMapUnitScale offsetMapUnitScale;
135  QSizeF radii;
137  QgsMapUnitScale radiiMapUnitScale;
138  QPainter::CompositionMode blendMode = QPainter::CompositionMode_SourceOver;
139  QColor fillColor;
140  QColor strokeColor;
141  double opacity = 1.0;
142  double strokeWidth = 0.0;
144  QgsMapUnitScale strokeWidthMapUnitScale;
145  Qt::PenJoinStyle joinStyle = Qt::BevelJoin;
146  std::unique_ptr< QgsPaintEffect > paintEffect;
147  std::unique_ptr< QgsMarkerSymbol > markerSymbol;
148 };
149 
150 
151 
152 class QgsTextShadowSettingsPrivate : public QSharedData
153 {
154  public:
155 
156  QgsTextShadowSettingsPrivate()
157  : color( QColor( 0, 0, 0 ) )
158  {
159 
160  }
161 
162  QgsTextShadowSettingsPrivate( const QgsTextShadowSettingsPrivate &other )
163  : QSharedData( other )
164  , enabled( other.enabled )
165  , shadowUnder( other.shadowUnder )
166  , offsetAngle( other.offsetAngle )
167  , offsetDist( other.offsetDist )
168  , offsetUnits( other.offsetUnits )
169  , offsetMapUnitScale( other.offsetMapUnitScale )
170  , offsetGlobal( other.offsetGlobal )
171  , radius( other.radius )
172  , radiusUnits( other.radiusUnits )
173  , radiusMapUnitScale( other.radiusMapUnitScale )
174  , radiusAlphaOnly( other.radiusAlphaOnly )
175  , scale( other.scale )
176  , color( other.color )
177  , opacity( other.opacity )
178  , blendMode( other.blendMode )
179  {
180  }
181 
182  bool enabled = false;
184  int offsetAngle = 135;
185  double offsetDist = 1.0;
187  QgsMapUnitScale offsetMapUnitScale;
188  bool offsetGlobal = true;
189  double radius = 1.5;
191  QgsMapUnitScale radiusMapUnitScale;
192  bool radiusAlphaOnly = false;
193  int scale = 100;
194  QColor color;
195  double opacity = 0.7;
196  QPainter::CompositionMode blendMode = QPainter::CompositionMode_Multiply;
197 };
198 
199 
200 class QgsTextSettingsPrivate : public QSharedData
201 {
202  public:
203 
204  QgsTextSettingsPrivate()
205  : textColor( Qt::black )
206  {
207  }
208 
209  QgsTextSettingsPrivate( const QgsTextSettingsPrivate &other )
210  : QSharedData( other )
211  , textFont( other.textFont )
212  , textNamedStyle( other.textNamedStyle )
213  , fontSizeUnits( other.fontSizeUnits )
214  , fontSizeMapUnitScale( other.fontSizeMapUnitScale )
215  , fontSize( other.fontSize )
216  , textColor( other.textColor )
217  , opacity( other.opacity )
218  , blendMode( other.blendMode )
219  , multilineHeight( other.multilineHeight )
220  , orientation( other.orientation )
221  , previewBackgroundColor( other.previewBackgroundColor )
222  , mDataDefinedProperties( other.mDataDefinedProperties )
223  {
224  }
225 
226  QFont textFont;
227  QString textNamedStyle;
229  QgsMapUnitScale fontSizeMapUnitScale;
230  double fontSize = 10 ; //may differ from size in textFont due to units (e.g., size in map units)
231  QColor textColor;
232  double opacity = 1.0;
233  QPainter::CompositionMode blendMode = QPainter::CompositionMode_SourceOver;
234  double multilineHeight = 1.0 ; //0.0 to 10.0, leading between lines as multiplyer of line height
236  QColor previewBackgroundColor = Qt::white;
237 
239  QgsPropertyCollection mDataDefinedProperties;
240 
241 
242 };
243 
244 
245 
246 
247 
249 
250 #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.
ShadowPlacement
Placement positions for text shadow.
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