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