QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 
94  bool operator==( const QgsTextBackgroundSettings &other ) const;
95  bool operator!=( const QgsTextBackgroundSettings &other ) const;
96 
101  bool enabled() const;
102 
108  void setEnabled( bool enabled );
109 
114  ShapeType type() const;
115 
121  void setType( ShapeType type );
122 
127  QString svgFile() const;
128 
135  void setSvgFile( const QString &file );
136 
144  QgsMarkerSymbol *markerSymbol() const;
145 
153  void setMarkerSymbol( QgsMarkerSymbol *symbol SIP_TRANSFER );
154 
161  SizeType sizeType() const;
162 
170  void setSizeType( SizeType type );
171 
180  QSizeF size() const;
181 
191  void setSize( QSizeF size );
192 
200  QgsUnitTypes::RenderUnit sizeUnit() const;
201 
210  void setSizeUnit( QgsUnitTypes::RenderUnit unit );
211 
218  QgsMapUnitScale sizeMapUnitScale() const;
219 
227  void setSizeMapUnitScale( const QgsMapUnitScale &scale );
228 
234  RotationType rotationType() const;
235 
242  void setRotationType( RotationType type );
243 
249  double rotation() const;
250 
256  void setRotation( double rotation );
257 
264  QPointF offset() const;
265 
273  void setOffset( QPointF offset );
274 
280  QgsUnitTypes::RenderUnit offsetUnit() const;
281 
288  void setOffsetUnit( QgsUnitTypes::RenderUnit units );
289 
296  QgsMapUnitScale offsetMapUnitScale() const;
297 
305  void setOffsetMapUnitScale( const QgsMapUnitScale &scale );
306 
313  QSizeF radii() const;
314 
323  void setRadii( QSizeF radii );
324 
330  QgsUnitTypes::RenderUnit radiiUnit() const;
331 
338  void setRadiiUnit( QgsUnitTypes::RenderUnit units );
339 
346  QgsMapUnitScale radiiMapUnitScale() const;
347 
355  void setRadiiMapUnitScale( const QgsMapUnitScale &scale );
356 
362  double opacity() const;
363 
370  void setOpacity( double opacity );
371 
376  QPainter::CompositionMode blendMode() const;
377 
383  void setBlendMode( QPainter::CompositionMode mode );
384 
390  QColor fillColor() const;
391 
398  void setFillColor( const QColor &color );
399 
405  QColor strokeColor() const;
406 
413  void setStrokeColor( const QColor &color );
414 
421  double strokeWidth() const;
422 
429  void setStrokeWidth( double width );
430 
436  QgsUnitTypes::RenderUnit strokeWidthUnit() const;
437 
444  void setStrokeWidthUnit( QgsUnitTypes::RenderUnit units );
445 
452  QgsMapUnitScale strokeWidthMapUnitScale() const;
453 
461  void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale );
462 
467  Qt::PenJoinStyle joinStyle() const;
468 
474  void setJoinStyle( Qt::PenJoinStyle style );
475 
481  const QgsPaintEffect *paintEffect() const;
482 
488  void setPaintEffect( QgsPaintEffect *effect SIP_TRANSFER );
489 
494  void readFromLayer( QgsVectorLayer *layer );
495 
500  void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
501 
506  QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
507 
512  void updateDataDefinedProperties( QgsRenderContext &context, const QgsPropertyCollection &properties );
513 
518  QSet<QString> referencedFields( const QgsRenderContext &context ) const;
519 
520  private:
521 
522  QSharedDataPointer<QgsTextBackgroundSettingsPrivate> d;
523 
524 };
525 
526 #endif // QGSTEXTBACKGROUNDSETTINGS_H
QgsUnitTypes::RenderUnit
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:167
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:35
operator==
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Definition: qgsfeatureiterator.h:400
QgsTextBackgroundSettings
Container for settings relating to a text background object.
Definition: qgstextbackgroundsettings.h:46
QgsRenderContext
Contains information about the context of a rendering operation.
Definition: qgsrendercontext.h:58
QgsTextBackgroundSettings::SizeType
SizeType
Methods for determining the background shape size.
Definition: qgstextbackgroundsettings.h:66
qgsunittypes.h
QgsTextBackgroundSettings::RotationOffset
@ RotationOffset
Shape rotation is offset from text rotation.
Definition: qgstextbackgroundsettings.h:78
operator!=
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Definition: qgsfeatureiterator.h:405
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:76
QgsMarkerSymbol
A marker symbol type, for rendering Point and MultiPoint geometries.
Definition: qgssymbol.h:931
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:38
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:319
QgsTextBackgroundSettings::ShapeSVG
@ ShapeSVG
SVG file.
Definition: qgstextbackgroundsettings.h:58
QgsTextBackgroundSettings::SizeFixed
@ SizeFixed
Fixed size.
Definition: qgstextbackgroundsettings.h:68
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:387
QgsPaintEffect
Base class for visual effects which can be applied to QPicture drawings.
Definition: qgspainteffect.h:54
QgsTextBackgroundSettings::ShapeType
ShapeType
Background shape types.
Definition: qgstextbackgroundsettings.h:53
qgsmapunitscale.h
QgsTextBackgroundSettings::ShapeMarkerSymbol
@ ShapeMarkerSymbol
Marker symbol.
Definition: qgstextbackgroundsettings.h:59