QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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 QgsTextBufferSettingsPrivate()
54 : color( Qt::white )
55 {}
56
57 QgsTextBufferSettingsPrivate( const QgsTextBufferSettingsPrivate &other )
58 : QSharedData( other )
59 , enabled( other.enabled )
60 , size( other.size )
61 , sizeUnit( other.sizeUnit )
62 , sizeMapUnitScale( other.sizeMapUnitScale )
63 , color( other.color )
64 , opacity( other.opacity )
65 , fillBufferInterior( other.fillBufferInterior )
66 , joinStyle( other.joinStyle )
67 , blendMode( other.blendMode )
68 , paintEffect( other.paintEffect ? other.paintEffect->clone() : nullptr )
69 {}
70
71 bool enabled = false;
72 double size = 1;
74 QgsMapUnitScale sizeMapUnitScale;
75 QColor color;
76 double opacity = 1.0;
77 bool fillBufferInterior = false;
78 Qt::PenJoinStyle joinStyle = Qt::RoundJoin;
79 QPainter::CompositionMode blendMode = QPainter::CompositionMode_SourceOver;
80 std::unique_ptr< QgsPaintEffect > paintEffect;
81
82 private:
83 QgsTextBufferSettingsPrivate &operator=( const QgsTextBufferSettingsPrivate & ) = delete;
84};
85
86
87class QgsTextBackgroundSettingsPrivate : public QSharedData
88{
89 public:
90 QgsTextBackgroundSettingsPrivate()
91 : size( QSizeF( 0.0, 0.0 ) )
92 , offset( QPointF( 0.0, 0.0 ) )
93 , radii( QSizeF( 0.0, 0.0 ) )
94 , fillColor( Qt::white )
95 , strokeColor( Qt::darkGray )
96 {}
97
98 QgsTextBackgroundSettingsPrivate( const QgsTextBackgroundSettingsPrivate &other )
99 : QSharedData( other )
100 , enabled( other.enabled )
101 , type( other.type )
102 , svgFile( other.svgFile )
103 , sizeType( other.sizeType )
104 , size( other.size )
105 , sizeUnits( other.sizeUnits )
106 , sizeMapUnitScale( other.sizeMapUnitScale )
107 , rotationType( other.rotationType )
108 , rotation( other.rotation )
109 , offset( other.offset )
110 , offsetUnits( other.offsetUnits )
111 , offsetMapUnitScale( other.offsetMapUnitScale )
112 , radii( other.radii )
113 , radiiUnits( other.radiiUnits )
114 , radiiMapUnitScale( other.radiiMapUnitScale )
115 , blendMode( other.blendMode )
116 , fillColor( other.fillColor )
117 , strokeColor( other.strokeColor )
118 , opacity( other.opacity )
119 , strokeWidth( other.strokeWidth )
120 , strokeWidthUnits( other.strokeWidthUnits )
121 , strokeWidthMapUnitScale( other.strokeWidthMapUnitScale )
122 , joinStyle( other.joinStyle )
123 , paintEffect( other.paintEffect ? other.paintEffect->clone() : nullptr )
124 , markerSymbol( other.markerSymbol ? other.markerSymbol->clone() : nullptr )
125 , fillSymbol( other.fillSymbol ? other.fillSymbol->clone() : nullptr )
126 {}
127
128 bool enabled = false;
130 QString svgFile;
132 QSizeF size;
134 QgsMapUnitScale sizeMapUnitScale;
136 double rotation = 0.0;
137 QPointF offset;
139 QgsMapUnitScale offsetMapUnitScale;
140 QSizeF radii;
142 QgsMapUnitScale radiiMapUnitScale;
143 QPainter::CompositionMode blendMode = QPainter::CompositionMode_SourceOver;
144 QColor fillColor;
145 QColor strokeColor;
146 double opacity = 1.0;
147 double strokeWidth = 0.0;
149 QgsMapUnitScale strokeWidthMapUnitScale;
150 Qt::PenJoinStyle joinStyle = Qt::BevelJoin;
151 std::unique_ptr< QgsPaintEffect > paintEffect;
152 std::unique_ptr< QgsMarkerSymbol > markerSymbol;
153 std::unique_ptr< QgsFillSymbol > fillSymbol;
154
155 private:
156 QgsTextBackgroundSettingsPrivate &operator=( const QgsTextBackgroundSettingsPrivate & ) = delete;
157};
158
159
160class QgsTextShadowSettingsPrivate : public QSharedData
161{
162 public:
163 QgsTextShadowSettingsPrivate()
164 : color( QColor( 0, 0, 0 ) )
165 {}
166
167 QgsTextShadowSettingsPrivate( const QgsTextShadowSettingsPrivate &other )
168 : QSharedData( other )
169 , enabled( other.enabled )
170 , shadowUnder( other.shadowUnder )
171 , offsetAngle( other.offsetAngle )
172 , offsetDist( other.offsetDist )
173 , offsetUnits( other.offsetUnits )
174 , offsetMapUnitScale( other.offsetMapUnitScale )
175 , offsetGlobal( other.offsetGlobal )
176 , radius( other.radius )
177 , radiusUnits( other.radiusUnits )
178 , radiusMapUnitScale( other.radiusMapUnitScale )
179 , radiusAlphaOnly( other.radiusAlphaOnly )
180 , scale( other.scale )
181 , color( other.color )
182 , opacity( other.opacity )
183 , blendMode( other.blendMode )
184 {}
185
186 bool enabled = false;
188 int offsetAngle = 135;
189 double offsetDist = 1.0;
191 QgsMapUnitScale offsetMapUnitScale;
192 bool offsetGlobal = true;
193 double radius = 1.5;
195 QgsMapUnitScale radiusMapUnitScale;
196 bool radiusAlphaOnly = false;
197 int scale = 100;
198 QColor color;
199 double opacity = 0.7;
200 QPainter::CompositionMode blendMode = QPainter::CompositionMode_Multiply;
201
202 private:
203 QgsTextShadowSettingsPrivate &operator=( const QgsTextShadowSettingsPrivate & ) = delete;
204};
205
206
207class QgsTextMaskSettingsPrivate : public QSharedData
208{
209 public:
210 QgsTextMaskSettingsPrivate() {}
211
212 QgsTextMaskSettingsPrivate( const QgsTextMaskSettingsPrivate &other )
213 : QSharedData( other )
214 , enabled( other.enabled )
215 , type( other.type )
216 , size( other.size )
217 , sizeUnit( other.sizeUnit )
218 , sizeMapUnitScale( other.sizeMapUnitScale )
219 , joinStyle( other.joinStyle )
220 , opacity( other.opacity )
221 , paintEffect( other.paintEffect ? other.paintEffect->clone() : nullptr )
222 , maskedSymbolLayers( other.maskedSymbolLayers )
223 {}
224
225 bool enabled = false;
227 double size = 1.5;
229 QgsMapUnitScale sizeMapUnitScale;
230 Qt::PenJoinStyle joinStyle = Qt::RoundJoin;
231 double opacity = 1.0;
232 std::unique_ptr< QgsPaintEffect > paintEffect;
233 QgsSymbolLayerReferenceList maskedSymbolLayers;
234
235 private:
236 QgsTextMaskSettingsPrivate &operator=( const QgsTextMaskSettingsPrivate & ) = delete;
237};
238
239
240class QgsTextSettingsPrivate : public QSharedData
241{
242 public:
243 QgsTextSettingsPrivate()
244 : textColor( Qt::black )
245 {}
246
247 QgsTextSettingsPrivate( const QgsTextSettingsPrivate &other )
248 : QSharedData( other )
249 , isValid( other.isValid )
250 , originalFontFamily( other.originalFontFamily )
251 , textFont( other.textFont )
252 , families( other.families )
253 , textNamedStyle( other.textNamedStyle )
254 , forcedBold( other.forcedBold )
255 , forcedItalic( other.forcedItalic )
256 , fontSizeUnits( other.fontSizeUnits )
257 , fontSizeMapUnitScale( other.fontSizeMapUnitScale )
258 , fontSize( other.fontSize )
259 , textColor( other.textColor )
260 , opacity( other.opacity )
261 , blendMode( other.blendMode )
262 , multilineHeight( other.multilineHeight )
263 , multilineHeightUnits( other.multilineHeightUnits )
264 , orientation( other.orientation )
265 , previewBackgroundColor( other.previewBackgroundColor )
266 , allowHtmlFormatting( other.allowHtmlFormatting )
267 , capitalization( other.capitalization )
268 , tabStopDistance( other.tabStopDistance )
269 , tabPositions( other.tabPositions )
270 , tabStopDistanceUnits( other.tabStopDistanceUnits )
271 , tabStopDistanceMapUnitScale( other.tabStopDistanceMapUnitScale )
272 , mDataDefinedProperties( other.mDataDefinedProperties )
273 {}
274
275 bool isValid = false;
276
277 QString originalFontFamily;
278 QFont textFont;
279 QStringList families;
280 QString textNamedStyle;
281 bool forcedBold = false;
282 bool forcedItalic = false;
284 QgsMapUnitScale fontSizeMapUnitScale;
285 double fontSize = 10; //may differ from size in textFont due to units (e.g., size in map units)
286 QColor textColor;
287 double opacity = 1.0;
288 QPainter::CompositionMode blendMode = QPainter::CompositionMode_SourceOver;
289 double multilineHeight = 1.0;
290 Qgis::RenderUnit multilineHeightUnits = Qgis::RenderUnit::Percentage;
292 QColor previewBackgroundColor = Qt::white;
293 bool allowHtmlFormatting = false;
295
296 double tabStopDistance = 6.0;
297 QList< QgsTextFormat::Tab > tabPositions;
298 Qgis::RenderUnit tabStopDistanceUnits = Qgis::RenderUnit::Percentage;
299 QgsMapUnitScale tabStopDistanceMapUnitScale;
300
302 QgsPropertyCollection mDataDefinedProperties;
303
304 private:
305 QgsTextSettingsPrivate &operator=( const QgsTextSettingsPrivate & ) = delete;
306};
307
309
310#endif // QGSTEXTRENDERER_PRIVATE_H
Capitalization
String capitalization options.
Definition qgis.h:3503
@ MixedCase
Mixed case, ie no change.
Definition qgis.h:3504
TextOrientation
Text orientations.
Definition qgis.h:2987
@ Horizontal
Horizontally oriented text.
Definition qgis.h:2988
RenderUnit
Rendering size units.
Definition qgis.h:5340
@ Percentage
Percentage of another measurement (e.g., canvas size, feature size).
Definition qgis.h:5344
@ Millimeters
Millimeters.
Definition qgis.h:5341
@ Points
Points (e.g., for font sizes).
Definition qgis.h:5345
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