QGIS API Documentation  3.24.2-Tisler (13c1a02865)
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 QgsFillSymbol;
33 class QgsPaintEffect;
34 class QgsVectorLayer;
37 class QgsTextBackgroundSettingsPrivate;
38 
46 class CORE_EXPORT QgsTextBackgroundSettings
47 {
48  public:
49 
53  enum ShapeType
54  {
55  ShapeRectangle = 0,
61  };
62 
66  enum SizeType
67  {
68  SizeBuffer = 0,
70  SizePercent
71  };
72 
77  {
78  RotationSync = 0,
80  RotationFixed
81  };
82 
84 
90 
91  QgsTextBackgroundSettings &operator=( const QgsTextBackgroundSettings &other );
92 
94 
95  bool operator==( const QgsTextBackgroundSettings &other ) const;
96  bool operator!=( const QgsTextBackgroundSettings &other ) const;
97 
102  bool enabled() const;
103 
109  void setEnabled( bool enabled );
110 
115  ShapeType type() const;
116 
122  void setType( ShapeType type );
123 
128  QString svgFile() const;
129 
136  void setSvgFile( const QString &file );
137 
145  QgsMarkerSymbol *markerSymbol() const;
146 
154  void setMarkerSymbol( QgsMarkerSymbol *symbol SIP_TRANSFER );
155 
165  QgsFillSymbol *fillSymbol() const;
166 
176  void setFillSymbol( QgsFillSymbol *symbol SIP_TRANSFER );
177 
184  SizeType sizeType() const;
185 
193  void setSizeType( SizeType type );
194 
203  QSizeF size() const;
204 
214  void setSize( QSizeF size );
215 
223  QgsUnitTypes::RenderUnit sizeUnit() const;
224 
233  void setSizeUnit( QgsUnitTypes::RenderUnit unit );
234 
241  QgsMapUnitScale sizeMapUnitScale() const;
242 
250  void setSizeMapUnitScale( const QgsMapUnitScale &scale );
251 
257  RotationType rotationType() const;
258 
265  void setRotationType( RotationType type );
266 
272  double rotation() const;
273 
279  void setRotation( double rotation );
280 
287  QPointF offset() const;
288 
296  void setOffset( QPointF offset );
297 
303  QgsUnitTypes::RenderUnit offsetUnit() const;
304 
311  void setOffsetUnit( QgsUnitTypes::RenderUnit units );
312 
319  QgsMapUnitScale offsetMapUnitScale() const;
320 
328  void setOffsetMapUnitScale( const QgsMapUnitScale &scale );
329 
336  QSizeF radii() const;
337 
346  void setRadii( QSizeF radii );
347 
353  QgsUnitTypes::RenderUnit radiiUnit() const;
354 
361  void setRadiiUnit( QgsUnitTypes::RenderUnit units );
362 
369  QgsMapUnitScale radiiMapUnitScale() const;
370 
378  void setRadiiMapUnitScale( const QgsMapUnitScale &scale );
379 
385  double opacity() const;
386 
393  void setOpacity( double opacity );
394 
399  QPainter::CompositionMode blendMode() const;
400 
406  void setBlendMode( QPainter::CompositionMode mode );
407 
415  QColor fillColor() const;
416 
425  void setFillColor( const QColor &color );
426 
434  QColor strokeColor() const;
435 
442  void setStrokeColor( const QColor &color );
443 
450  double strokeWidth() const;
451 
460  void setStrokeWidth( double width );
461 
467  QgsUnitTypes::RenderUnit strokeWidthUnit() const;
468 
477  void setStrokeWidthUnit( QgsUnitTypes::RenderUnit units );
478 
485  QgsMapUnitScale strokeWidthMapUnitScale() const;
486 
496  void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale );
497 
502  Qt::PenJoinStyle joinStyle() const;
503 
511  void setJoinStyle( Qt::PenJoinStyle style );
512 
518  const QgsPaintEffect *paintEffect() const;
519 
525  void setPaintEffect( QgsPaintEffect *effect SIP_TRANSFER );
526 
531  void readFromLayer( QgsVectorLayer *layer );
532 
537  void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
538 
543  QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
544 
552  void updateDataDefinedProperties( QgsRenderContext &context, const QgsPropertyCollection &properties );
553 
558  void upgradeDataDefinedProperties( QgsPropertyCollection &properties ) SIP_SKIP;
559 
564  QSet<QString> referencedFields( const QgsRenderContext &context ) const;
565 
566  private:
567 
568  QSharedDataPointer<QgsTextBackgroundSettingsPrivate> d;
569 
570 };
571 
572 #endif // QGSTEXTBACKGROUNDSETTINGS_H
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
Definition: qgsfillsymbol.h:30
Struct for storing maximum and minimum scales for measurements in map units.
A marker symbol type, for rendering Point and MultiPoint geometries.
Base class for visual effects which can be applied to QPicture drawings.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
The class is used as a container of context for various read/write operations on other objects.
Contains information about the context of a rendering operation.
Container for settings relating to a text background object.
SizeType
Methods for determining the background shape size.
ShapeType
Background shape types.
@ ShapeSquare
Square - buffered sizes only.
RotationType
Methods for determining the rotation of the background shape.
@ RotationOffset
Shape rotation is offset from text rotation.
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:168
Represents a vector layer which manages a vector based data sets.
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_TRANSFER
Definition: qgis_sip.h:36
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)