QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgstextbackgroundsettings.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstextbackgroundsettings.h
3  -----------------
4  begin : May 2020
5  copyright : (C) Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSTEXTBACKGROUNDSETTINGS_H
17 #define QGSTEXTBACKGROUNDSETTINGS_H
18 
19 #include "qgis_sip.h"
20 #include "qgis_core.h"
21 #include "qgsunittypes.h"
22 #include "qgsmapunitscale.h"
23 
24 #include <QString>
25 #include <QPointF>
26 #include <QSizeF>
27 #include <QPainter>
28 #include <QDomElement>
29 #include <QSharedDataPointer>
30 
31 class QgsMarkerSymbol;
32 class QgsPaintEffect;
33 class QgsVectorLayer;
36 class QgsTextBackgroundSettingsPrivate;
37 
45 class CORE_EXPORT QgsTextBackgroundSettings
46 {
47  public:
48 
52  enum ShapeType
53  {
54  ShapeRectangle = 0,
60  };
61 
65  enum SizeType
66  {
67  SizeBuffer = 0,
69  SizePercent
70  };
71 
76  {
77  RotationSync = 0,
79  RotationFixed
80  };
81 
83 
89 
90  QgsTextBackgroundSettings &operator=( const QgsTextBackgroundSettings &other );
91 
93 
98  bool enabled() const;
99 
105  void setEnabled( bool enabled );
106 
111  ShapeType type() const;
112 
118  void setType( ShapeType type );
119 
124  QString svgFile() const;
125 
132  void setSvgFile( const QString &file );
133 
141  QgsMarkerSymbol *markerSymbol() const;
142 
150  void setMarkerSymbol( QgsMarkerSymbol *symbol SIP_TRANSFER );
151 
158  SizeType sizeType() const;
159 
167  void setSizeType( SizeType type );
168 
177  QSizeF size() const;
178 
188  void setSize( QSizeF size );
189 
197  QgsUnitTypes::RenderUnit sizeUnit() const;
198 
207  void setSizeUnit( QgsUnitTypes::RenderUnit unit );
208 
215  QgsMapUnitScale sizeMapUnitScale() const;
216 
224  void setSizeMapUnitScale( const QgsMapUnitScale &scale );
225 
231  RotationType rotationType() const;
232 
239  void setRotationType( RotationType type );
240 
246  double rotation() const;
247 
253  void setRotation( double rotation );
254 
261  QPointF offset() const;
262 
270  void setOffset( QPointF offset );
271 
277  QgsUnitTypes::RenderUnit offsetUnit() const;
278 
285  void setOffsetUnit( QgsUnitTypes::RenderUnit units );
286 
293  QgsMapUnitScale offsetMapUnitScale() const;
294 
302  void setOffsetMapUnitScale( const QgsMapUnitScale &scale );
303 
310  QSizeF radii() const;
311 
320  void setRadii( QSizeF radii );
321 
327  QgsUnitTypes::RenderUnit radiiUnit() const;
328 
335  void setRadiiUnit( QgsUnitTypes::RenderUnit units );
336 
343  QgsMapUnitScale radiiMapUnitScale() const;
344 
352  void setRadiiMapUnitScale( const QgsMapUnitScale &scale );
353 
359  double opacity() const;
360 
367  void setOpacity( double opacity );
368 
373  QPainter::CompositionMode blendMode() const;
374 
380  void setBlendMode( QPainter::CompositionMode mode );
381 
387  QColor fillColor() const;
388 
395  void setFillColor( const QColor &color );
396 
402  QColor strokeColor() const;
403 
410  void setStrokeColor( const QColor &color );
411 
418  double strokeWidth() const;
419 
426  void setStrokeWidth( double width );
427 
433  QgsUnitTypes::RenderUnit strokeWidthUnit() const;
434 
441  void setStrokeWidthUnit( QgsUnitTypes::RenderUnit units );
442 
449  QgsMapUnitScale strokeWidthMapUnitScale() const;
450 
458  void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale );
459 
464  Qt::PenJoinStyle joinStyle() const;
465 
471  void setJoinStyle( Qt::PenJoinStyle style );
472 
478  QgsPaintEffect *paintEffect() const;
479 
485  void setPaintEffect( QgsPaintEffect *effect SIP_TRANSFER );
486 
491  void readFromLayer( QgsVectorLayer *layer );
492 
497  void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
498 
503  QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
504 
509  void updateDataDefinedProperties( QgsRenderContext &context, const QgsPropertyCollection &properties );
510 
515  QSet<QString> referencedFields( const QgsRenderContext &context ) const;
516 
517  private:
518 
519  QSharedDataPointer<QgsTextBackgroundSettingsPrivate> d;
520 
521 };
522 
523 #endif // QGSTEXTBACKGROUNDSETTINGS_H
QgsUnitTypes::RenderUnit
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:166
QgsReadWriteContext
Definition: qgsreadwritecontext.h:34
QgsTextBackgroundSettings
Definition: qgstextbackgroundsettings.h:45
QgsRenderContext
Definition: qgsrendercontext.h:57
QgsTextBackgroundSettings::SizeType
SizeType
Methods for determining the background shape size.
Definition: qgstextbackgroundsettings.h:65
qgsunittypes.h
QgsTextBackgroundSettings::RotationOffset
@ RotationOffset
Shape rotation is offset from text rotation.
Definition: qgstextbackgroundsettings.h:78
QgsTextBackgroundSettings::ShapeSquare
@ ShapeSquare
Square - buffered sizes only.
Definition: qgstextbackgroundsettings.h:55
QgsTextBackgroundSettings::RotationType
RotationType
Methods for determining the rotation of the background shape.
Definition: qgstextbackgroundsettings.h:75
QgsMarkerSymbol
Definition: qgssymbol.h:917
QgsTextBackgroundSettings::ShapeCircle
@ ShapeCircle
Circle.
Definition: qgstextbackgroundsettings.h:57
qgis_sip.h
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsMapUnitScale
Struct for storing maximum and minimum scales for measurements in map units.
Definition: qgsmapunitscale.h:37
QgsTextBackgroundSettings::ShapeEllipse
@ ShapeEllipse
Ellipse.
Definition: qgstextbackgroundsettings.h:56
QgsPropertyCollection
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
Definition: qgspropertycollection.h:318
QgsTextBackgroundSettings::ShapeSVG
@ ShapeSVG
SVG file.
Definition: qgstextbackgroundsettings.h:58
QgsTextBackgroundSettings::SizeFixed
@ SizeFixed
Fixed size.
Definition: qgstextbackgroundsettings.h:68
QgsVectorLayer
Definition: qgsvectorlayer.h:385
QgsPaintEffect
Base class for visual effects which can be applied to QPicture drawings.
Definition: qgspainteffect.h:53
QgsTextBackgroundSettings::ShapeType
ShapeType
Background shape types.
Definition: qgstextbackgroundsettings.h:52
qgsmapunitscale.h
QgsTextBackgroundSettings::ShapeMarkerSymbol
@ ShapeMarkerSymbol
Marker symbol.
Definition: qgstextbackgroundsettings.h:59