QGIS API Documentation 3.99.0-Master (a5475b57e34)
Loading...
Searching...
No Matches
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
21#include "qgis.h"
22#include "qgis_core.h"
23#include "qgsfillsymbol.h"
24#include "qgsmapunitscale.h"
25#include "qgsmarkersymbol.h"
26#include "qgspainteffect.h"
28#include "qgsstringutils.h"
32
33#include <QPainter>
34#include <QSharedData>
35
36#define SIP_NO_FILE
37
39
40//
41// W A R N I N G
42// -------------
43//
44// This file is not part of the QGIS API. It exists purely as an
45// implementation detail. This header file may change from version to
46// version without notice, or even be removed.
47//
48
49
50class QgsTextBufferSettingsPrivate : public QSharedData
51{
52 public:
53
54 QgsTextBufferSettingsPrivate()
55 : color( Qt::white )
56 {
57 }
58
59 QgsTextBufferSettingsPrivate( const QgsTextBufferSettingsPrivate &other )
60 : QSharedData( other )
61 , enabled( other.enabled )
62 , size( other.size )
63 , sizeUnit( other.sizeUnit )
64 , sizeMapUnitScale( other.sizeMapUnitScale )
65 , color( other.color )
66 , opacity( other.opacity )
67 , fillBufferInterior( other.fillBufferInterior )
68 , joinStyle( other.joinStyle )
69 , blendMode( other.blendMode )
70 , paintEffect( other.paintEffect ? other.paintEffect->clone() : nullptr )
71 {
72 }
73
74 bool enabled = false;
75 double size = 1;
77 QgsMapUnitScale sizeMapUnitScale;
78 QColor color;
79 double opacity = 1.0;
80 bool fillBufferInterior = false;
81 Qt::PenJoinStyle joinStyle = Qt::RoundJoin;
82 QPainter::CompositionMode blendMode = QPainter::CompositionMode_SourceOver;
83 std::unique_ptr< QgsPaintEffect > paintEffect;
84
85 private:
86 QgsTextBufferSettingsPrivate &operator=( const QgsTextBufferSettingsPrivate & ) = delete;
87};
88
89
90class QgsTextBackgroundSettingsPrivate : public QSharedData
91{
92 public:
93
94 QgsTextBackgroundSettingsPrivate()
95 : size( QSizeF( 0.0, 0.0 ) )
96 , offset( QPointF( 0.0, 0.0 ) )
97 , radii( QSizeF( 0.0, 0.0 ) )
98 , fillColor( Qt::white )
99 , strokeColor( Qt::darkGray )
100 {
101 }
102
103 QgsTextBackgroundSettingsPrivate( const QgsTextBackgroundSettingsPrivate &other )
104 : QSharedData( other )
105 , enabled( other.enabled )
106 , type( other.type )
107 , svgFile( other.svgFile )
108 , sizeType( other.sizeType )
109 , size( other.size )
110 , sizeUnits( other.sizeUnits )
111 , sizeMapUnitScale( other.sizeMapUnitScale )
112 , rotationType( other.rotationType )
113 , rotation( other.rotation )
114 , offset( other.offset )
115 , offsetUnits( other.offsetUnits )
116 , offsetMapUnitScale( other.offsetMapUnitScale )
117 , radii( other.radii )
118 , radiiUnits( other.radiiUnits )
119 , radiiMapUnitScale( other.radiiMapUnitScale )
120 , blendMode( other.blendMode )
121 , fillColor( other.fillColor )
122 , strokeColor( other.strokeColor )
123 , opacity( other.opacity )
124 , strokeWidth( other.strokeWidth )
125 , strokeWidthUnits( other.strokeWidthUnits )
126 , strokeWidthMapUnitScale( other.strokeWidthMapUnitScale )
127 , joinStyle( other.joinStyle )
128 , paintEffect( other.paintEffect ? other.paintEffect->clone() : nullptr )
129 , markerSymbol( other.markerSymbol ? other.markerSymbol->clone() : nullptr )
130 , fillSymbol( other.fillSymbol ? other.fillSymbol->clone() : nullptr )
131 {
132 }
133
134 bool enabled = false;
136 QString svgFile;
138 QSizeF size;
140 QgsMapUnitScale sizeMapUnitScale;
142 double rotation = 0.0;
143 QPointF offset;
145 QgsMapUnitScale offsetMapUnitScale;
146 QSizeF radii;
148 QgsMapUnitScale radiiMapUnitScale;
149 QPainter::CompositionMode blendMode = QPainter::CompositionMode_SourceOver;
150 QColor fillColor;
151 QColor strokeColor;
152 double opacity = 1.0;
153 double strokeWidth = 0.0;
155 QgsMapUnitScale strokeWidthMapUnitScale;
156 Qt::PenJoinStyle joinStyle = Qt::BevelJoin;
157 std::unique_ptr< QgsPaintEffect > paintEffect;
158 std::unique_ptr< QgsMarkerSymbol > markerSymbol;
159 std::unique_ptr< QgsFillSymbol > fillSymbol;
160
161 private:
162 QgsTextBackgroundSettingsPrivate &operator=( const QgsTextBackgroundSettingsPrivate & ) = delete;
163};
164
165
166
167class QgsTextShadowSettingsPrivate : public QSharedData
168{
169 public:
170
171 QgsTextShadowSettingsPrivate()
172 : color( QColor( 0, 0, 0 ) )
173 {
174
175 }
176
177 QgsTextShadowSettingsPrivate( const QgsTextShadowSettingsPrivate &other )
178 : QSharedData( other )
179 , enabled( other.enabled )
180 , shadowUnder( other.shadowUnder )
181 , offsetAngle( other.offsetAngle )
182 , offsetDist( other.offsetDist )
183 , offsetUnits( other.offsetUnits )
184 , offsetMapUnitScale( other.offsetMapUnitScale )
185 , offsetGlobal( other.offsetGlobal )
186 , radius( other.radius )
187 , radiusUnits( other.radiusUnits )
188 , radiusMapUnitScale( other.radiusMapUnitScale )
189 , radiusAlphaOnly( other.radiusAlphaOnly )
190 , scale( other.scale )
191 , color( other.color )
192 , opacity( other.opacity )
193 , blendMode( other.blendMode )
194 {
195 }
196
197 bool enabled = false;
199 int offsetAngle = 135;
200 double offsetDist = 1.0;
202 QgsMapUnitScale offsetMapUnitScale;
203 bool offsetGlobal = true;
204 double radius = 1.5;
206 QgsMapUnitScale radiusMapUnitScale;
207 bool radiusAlphaOnly = false;
208 int scale = 100;
209 QColor color;
210 double opacity = 0.7;
211 QPainter::CompositionMode blendMode = QPainter::CompositionMode_Multiply;
212
213 private:
214 QgsTextShadowSettingsPrivate &operator=( const QgsTextShadowSettingsPrivate & ) = delete;
215};
216
217
218class QgsTextMaskSettingsPrivate : public QSharedData
219{
220 public:
221
222 QgsTextMaskSettingsPrivate()
223 {
224
225 }
226
227 QgsTextMaskSettingsPrivate( const QgsTextMaskSettingsPrivate &other )
228 : QSharedData( other )
229 , enabled( other.enabled )
230 , type( other.type )
231 , size( other.size )
232 , sizeUnit( other.sizeUnit )
233 , sizeMapUnitScale( other.sizeMapUnitScale )
234 , joinStyle( other.joinStyle )
235 , opacity( other.opacity )
236 , paintEffect( other.paintEffect ? other.paintEffect->clone() : nullptr )
237 , maskedSymbolLayers( other.maskedSymbolLayers )
238 {
239 }
240
241 bool enabled = false;
243 double size = 1.5;
245 QgsMapUnitScale sizeMapUnitScale;
246 Qt::PenJoinStyle joinStyle = Qt::RoundJoin;
247 double opacity = 1.0;
248 std::unique_ptr< QgsPaintEffect > paintEffect;
249 QgsSymbolLayerReferenceList maskedSymbolLayers;
250
251 private:
252 QgsTextMaskSettingsPrivate &operator=( const QgsTextMaskSettingsPrivate & ) = delete;
253};
254
255
256class QgsTextSettingsPrivate : public QSharedData
257{
258 public:
259
260 QgsTextSettingsPrivate()
261 : textColor( Qt::black )
262 {
263 }
264
265 QgsTextSettingsPrivate( const QgsTextSettingsPrivate &other )
266 : QSharedData( other )
267 , isValid( other.isValid )
268 , originalFontFamily( other.originalFontFamily )
269 , textFont( other.textFont )
270 , families( other.families )
271 , textNamedStyle( other.textNamedStyle )
272 , forcedBold( other.forcedBold )
273 , forcedItalic( other.forcedItalic )
274 , fontSizeUnits( other.fontSizeUnits )
275 , fontSizeMapUnitScale( other.fontSizeMapUnitScale )
276 , fontSize( other.fontSize )
277 , textColor( other.textColor )
278 , opacity( other.opacity )
279 , blendMode( other.blendMode )
280 , multilineHeight( other.multilineHeight )
281 , multilineHeightUnits( other.multilineHeightUnits )
282 , orientation( other.orientation )
283 , previewBackgroundColor( other.previewBackgroundColor )
284 , allowHtmlFormatting( other.allowHtmlFormatting )
285 , capitalization( other.capitalization )
286 , tabStopDistance( other.tabStopDistance )
287 , tabPositions( other.tabPositions )
288 , tabStopDistanceUnits( other.tabStopDistanceUnits )
289 , tabStopDistanceMapUnitScale( other.tabStopDistanceMapUnitScale )
290 , mDataDefinedProperties( other.mDataDefinedProperties )
291 {
292 }
293
294 bool isValid = false;
295
296 QString originalFontFamily;
297 QFont textFont;
298 QStringList families;
299 QString textNamedStyle;
300 bool forcedBold = false;
301 bool forcedItalic = false;
303 QgsMapUnitScale fontSizeMapUnitScale;
304 double fontSize = 10 ; //may differ from size in textFont due to units (e.g., size in map units)
305 QColor textColor;
306 double opacity = 1.0;
307 QPainter::CompositionMode blendMode = QPainter::CompositionMode_SourceOver;
308 double multilineHeight = 1.0;
309 Qgis::RenderUnit multilineHeightUnits = Qgis::RenderUnit::Percentage;
311 QColor previewBackgroundColor = Qt::white;
312 bool allowHtmlFormatting = false;
314
315 double tabStopDistance = 6.0;
316 QList< QgsTextFormat::Tab > tabPositions;
317 Qgis::RenderUnit tabStopDistanceUnits = Qgis::RenderUnit::Percentage;
318 QgsMapUnitScale tabStopDistanceMapUnitScale;
319
321 QgsPropertyCollection mDataDefinedProperties;
322
323 private:
324 QgsTextSettingsPrivate &operator=( const QgsTextSettingsPrivate & ) = delete;
325};
326
328
329#endif // QGSTEXTRENDERER_PRIVATE_H
Capitalization
String capitalization options.
Definition qgis.h:3475
@ MixedCase
Mixed case, ie no change.
Definition qgis.h:3476
TextOrientation
Text orientations.
Definition qgis.h:2959
@ Horizontal
Horizontally oriented text.
Definition qgis.h:2960
RenderUnit
Rendering size units.
Definition qgis.h:5305
@ Percentage
Percentage of another measurement (e.g., canvas size, feature size).
Definition qgis.h:5309
@ Millimeters
Millimeters.
Definition qgis.h:5306
@ Points
Points (e.g., for font sizes).
Definition qgis.h:5310
Struct for storing maximum and minimum scales for measurements in map units.
SizeType
Methods for determining the background shape size.
@ SizeBuffer
Shape size is determined by adding a buffer margin around text.
RotationType
Methods for determining the rotation of the background shape.
@ RotationSync
Shape rotation is synced with text rotation.
MaskType
Mask shape types.
ShadowPlacement
Placement positions for text shadow.
@ ShadowLowest
Draw shadow below all text components.
QList< QgsSymbolLayerReference > QgsSymbolLayerReferenceList