17 #ifndef QGSTEXTRENDERER_H 18 #define QGSTEXTRENDERER_H 21 #include "qgis_core.h" 25 #include <QSharedData> 28 #include <QDomElement> 31 class QgsTextBufferSettingsPrivate;
32 class QgsTextBackgroundSettingsPrivate;
33 class QgsTextShadowSettingsPrivate;
34 class QgsTextSettingsPrivate;
77 void setEnabled(
bool enabled );
92 void setSize(
double size );
130 QColor color()
const;
137 void setColor(
const QColor &color );
145 bool fillBufferInterior()
const;
153 void setFillBufferInterior(
bool fill );
160 double opacity()
const;
168 void setOpacity(
double opacity );
174 Qt::PenJoinStyle joinStyle()
const;
181 void setJoinStyle( Qt::PenJoinStyle style );
187 QPainter::CompositionMode blendMode()
const;
194 void setBlendMode( QPainter::CompositionMode mode );
206 void readXml(
const QDomElement &elem );
212 QDomElement writeXml( QDomDocument &doc )
const;
230 QSharedDataPointer<QgsTextBufferSettingsPrivate> d;
294 bool enabled()
const;
301 void setEnabled(
bool enabled );
320 QString svgFile()
const;
328 void setSvgFile(
const QString &file );
366 void setSize( QSizeF size );
424 double rotation()
const;
431 void setRotation(
double rotation );
439 QPointF offset()
const;
448 void setOffset( QPointF offset );
488 QSizeF radii()
const;
498 void setRadii( QSizeF radii );
537 double opacity()
const;
545 void setOpacity(
double opacity );
551 QPainter::CompositionMode blendMode()
const;
558 void setBlendMode( QPainter::CompositionMode mode );
565 QColor fillColor()
const;
573 void setFillColor(
const QColor &color );
580 QColor strokeColor()
const;
588 void setStrokeColor(
const QColor &color );
596 double strokeWidth()
const;
604 void setStrokeWidth(
double width );
642 Qt::PenJoinStyle joinStyle()
const;
649 void setJoinStyle( Qt::PenJoinStyle style );
685 QSharedDataPointer<QgsTextBackgroundSettingsPrivate> d;
728 bool enabled()
const;
735 void setEnabled(
bool enabled );
759 int offsetAngle()
const;
767 void setOffsetAngle(
int angle );
775 double offsetDistance()
const;
784 void setOffsetDistance(
double distance );
822 bool offsetGlobal()
const;
828 void setOffsetGlobal(
bool global );
835 double blurRadius()
const;
843 void setBlurRadius(
double blurRadius );
881 bool blurAlphaOnly()
const;
889 void setBlurAlphaOnly(
bool alphaOnly );
896 double opacity()
const;
904 void setOpacity(
double opacity );
917 void setScale(
int scale );
923 QColor color()
const;
930 void setColor(
const QColor &color );
936 QPainter::CompositionMode blendMode()
const;
943 void setBlendMode( QPainter::CompositionMode mode );
955 void readXml(
const QDomElement &elem );
961 QDomElement writeXml( QDomDocument &doc )
const;
965 QSharedDataPointer<QgsTextShadowSettingsPrivate> d;
1081 void setFont(
const QFont &font );
1088 QString namedStyle()
const;
1096 void setNamedStyle(
const QString &style );
1103 double size()
const;
1111 void setSize(
double size );
1150 QColor color()
const;
1157 void setColor(
const QColor &color );
1164 double opacity()
const;
1172 void setOpacity(
double opacity );
1178 QPainter::CompositionMode blendMode()
const;
1185 void setBlendMode( QPainter::CompositionMode mode );
1193 double lineHeight()
const;
1202 void setLineHeight(
double height );
1245 QFont toQFont()
const;
1258 bool containsAdvancedEffects()
const;
1281 QString mTextFontFamily;
1282 bool mTextFontFound =
true;
1284 QSharedDataPointer<QgsTextSettingsPrivate> d;
1347 static void drawText(
const QRectF &rect,
double rotation,
HAlignment alignment,
const QStringList &textLines,
1349 bool drawAsOutlines =
true );
1363 static void drawText( QPointF point,
double rotation,
HAlignment alignment,
const QStringList &textLines,
1365 bool drawAsOutlines =
true );
1382 static void drawPart(
const QRectF &rect,
double rotation,
HAlignment alignment,
const QStringList &textLines,
1384 TextPart part,
bool drawAsOutlines =
true );
1401 static void drawPart( QPointF origin,
double rotation,
HAlignment alignment,
const QStringList &textLines,
1403 TextPart part,
bool drawAsOutlines =
true );
1421 QFontMetricsF *fontMetrics =
nullptr );
1432 QFontMetricsF *fontMetrics =
nullptr );
1443 bool useOrigin =
false;
1445 double rotation = 0.0;
1447 double rotationOffset = 0.0;
1461 double pictureBuffer = 0.0;
1463 double dpiRatio = 1.0;
1469 const Component &component,
1473 Component component,
1475 const QStringList &textLines,
1479 const Component &component,
1483 const Component &component,
1486 static void drawTextInternal(
TextPart drawType,
1489 const Component &component,
1490 const QStringList &textLines,
1491 const QFontMetricsF *fontMetrics,
1493 bool drawAsOutlines,
1497 friend class QgsLabelPreview;
1504 #endif // QGSTEXTRENDERER_H The class is used as a container of context for various read/write operations on other objects...
RotationType
Methods for determining the rotation of the background shape.
Text at point of origin draw mode.
bool fontFound() const
Returns true if the specified font was found on the system, or false if the font was not found and a ...
QgsTextBackgroundSettings background() const
Returns a reference to the text background settings.
Draw shadow under buffer.
ShadowPlacement
Placement positions for text shadow.
QgsTextShadowSettings & shadow()
Returns a reference to the text drop shadow settings.
HAlignment
Horizontal alignment.
Base class for visual effects which can be applied to QPicture drawings.
The QgsVectorLayerLabelProvider class implements a label provider for vector layers.
void setBackground(const QgsTextBackgroundSettings &backgroundSettings)
Sets the text's background settings.q.
Label-specific draw mode.
Container for settings relating to a text background object.
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
QgsTextBackgroundSettings & background()
Returns a reference to the text background settings.
QgsTextBufferSettings & buffer()
Returns a reference to the text buffer settings.
SizeType
Methods for determining the background shape size.
QgsTextShadowSettings shadow() const
Returns a reference to the text drop shadow settings.
Handles rendering text using rich formatting options, including drop shadows, buffers and background ...
ShapeType
Background shape types.
TextPart
Components of text.
Contains information about the context of a rendering operation.
Shape rotation is offset from text rotation.
Struct for storing maximum and minimum scales for measurements in map units.
Container for settings relating to a text shadow.
Container for settings relating to a text buffer.
void setBuffer(const QgsTextBufferSettings &bufferSettings)
Sets the text's buffer settings.
void setShadow(const QgsTextShadowSettings &shadowSettings)
Sets the text's drop shadow settings.
Container for all settings relating to text rendering.
DrawMode
Draw mode to calculate width and height.
Represents a vector layer which manages a vector based data sets.
Square - buffered sizes only.
QgsTextBufferSettings buffer() const
Returns a reference to the text buffer settings.
RenderUnit
Rendering size units.
QString resolvedFontFamily() const
Returns the family for the resolved font, ie if the specified font was not found on the system this w...