17 #ifndef QGSTEXTRENDERER_H 18 #define QGSTEXTRENDERER_H 21 #include "qgis_core.h" 26 #include <QSharedData> 29 #include <QDomElement> 32 class QgsTextBufferSettingsPrivate;
33 class QgsTextBackgroundSettingsPrivate;
34 class QgsTextShadowSettingsPrivate;
35 class QgsTextMaskSettingsPrivate;
36 class QgsTextSettingsPrivate;
80 void setEnabled(
bool enabled );
95 void setSize(
double size );
133 QColor color()
const;
140 void setColor(
const QColor &color );
148 bool fillBufferInterior()
const;
156 void setFillBufferInterior(
bool fill );
163 double opacity()
const;
171 void setOpacity(
double opacity );
177 Qt::PenJoinStyle joinStyle()
const;
184 void setJoinStyle( Qt::PenJoinStyle style );
190 QPainter::CompositionMode blendMode()
const;
197 void setBlendMode( QPainter::CompositionMode mode );
209 void readXml(
const QDomElement &elem );
215 QDomElement writeXml( QDomDocument &doc )
const;
239 QSharedDataPointer<QgsTextBufferSettingsPrivate> d;
304 bool enabled()
const;
311 void setEnabled(
bool enabled );
330 QString svgFile()
const;
338 void setSvgFile(
const QString &file );
394 void setSize( QSizeF size );
452 double rotation()
const;
459 void setRotation(
double rotation );
467 QPointF offset()
const;
476 void setOffset( QPointF offset );
516 QSizeF radii()
const;
526 void setRadii( QSizeF radii );
565 double opacity()
const;
573 void setOpacity(
double opacity );
579 QPainter::CompositionMode blendMode()
const;
586 void setBlendMode( QPainter::CompositionMode mode );
593 QColor fillColor()
const;
601 void setFillColor(
const QColor &color );
608 QColor strokeColor()
const;
616 void setStrokeColor(
const QColor &color );
624 double strokeWidth()
const;
632 void setStrokeWidth(
double width );
670 Qt::PenJoinStyle joinStyle()
const;
677 void setJoinStyle( Qt::PenJoinStyle style );
719 QSharedDataPointer<QgsTextBackgroundSettingsPrivate> d;
762 bool enabled()
const;
769 void setEnabled(
bool enabled );
793 int offsetAngle()
const;
801 void setOffsetAngle(
int angle );
809 double offsetDistance()
const;
818 void setOffsetDistance(
double distance );
856 bool offsetGlobal()
const;
862 void setOffsetGlobal(
bool global );
869 double blurRadius()
const;
877 void setBlurRadius(
double blurRadius );
915 bool blurAlphaOnly()
const;
923 void setBlurAlphaOnly(
bool alphaOnly );
930 double opacity()
const;
938 void setOpacity(
double opacity );
951 void setScale(
int scale );
957 QColor color()
const;
964 void setColor(
const QColor &color );
970 QPainter::CompositionMode blendMode()
const;
977 void setBlendMode( QPainter::CompositionMode mode );
989 void readXml(
const QDomElement &elem );
995 QDomElement writeXml( QDomDocument &doc )
const;
1005 QSharedDataPointer<QgsTextShadowSettingsPrivate> d;
1050 bool enabled()
const;
1055 void setEnabled(
bool );
1075 double size()
const;
1083 void setSize(
double size );
1121 Qt::PenJoinStyle joinStyle()
const;
1128 void setJoinStyle( Qt::PenJoinStyle style );
1135 double opacity()
const;
1143 void setOpacity(
double opacity );
1163 void readXml(
const QDomElement &elem );
1169 QDomElement writeXml( QDomDocument &doc )
const;
1192 QSharedDataPointer<QgsTextMaskSettingsPrivate> d;
1337 void setFont(
const QFont &font );
1344 QString namedStyle()
const;
1352 void setNamedStyle(
const QString &style );
1359 double size()
const;
1367 void setSize(
double size );
1406 QColor color()
const;
1413 void setColor(
const QColor &color );
1420 double opacity()
const;
1428 void setOpacity(
double opacity );
1434 QPainter::CompositionMode blendMode()
const;
1441 void setBlendMode( QPainter::CompositionMode mode );
1449 double lineHeight()
const;
1458 void setLineHeight(
double height );
1479 QColor previewBackgroundColor()
const;
1486 void setPreviewBackgroundColor(
const QColor &color );
1529 QFont toQFont()
const;
1542 bool containsAdvancedEffects()
const;
1596 static QPixmap textFormatPreviewPixmap(
const QgsTextFormat &format, QSize size,
const QString &previewText = QString(),
int padding = 0 );
1605 QString mTextFontFamily;
1606 bool mTextFontFound =
true;
1608 QSharedDataPointer<QgsTextSettingsPrivate> d;
1674 static void drawText(
const QRectF &rect,
double rotation,
HAlignment alignment,
const QStringList &textLines,
1676 bool drawAsOutlines =
true );
1691 static void drawText( QPointF point,
double rotation,
HAlignment alignment,
const QStringList &textLines,
1693 bool drawAsOutlines =
true );
1711 static void drawPart(
const QRectF &rect,
double rotation,
HAlignment alignment,
const QStringList &textLines,
1713 TextPart part,
bool drawAsOutlines =
true );
1731 static void drawPart( QPointF origin,
double rotation,
HAlignment alignment,
const QStringList &textLines,
1733 TextPart part,
bool drawAsOutlines =
true );
1751 QFontMetricsF *fontMetrics =
nullptr );
1762 QFontMetricsF *fontMetrics =
nullptr );
1773 bool useOrigin =
false;
1775 double rotation = 0.0;
1777 double rotationOffset = 0.0;
1791 double pictureBuffer = 0.0;
1793 double dpiRatio = 1.0;
1799 const Component &component,
1801 const QFontMetricsF *fontMetrics );
1804 Component component,
1806 const QStringList &textLines,
1810 const Component &component,
1814 const Component &component,
1818 const Component &component,
1821 static void drawTextInternal(
TextPart drawType,
1824 const Component &component,
1825 const QStringList &textLines,
1826 const QFontMetricsF *fontMetrics,
1831 friend class QgsLabelPreview;
1886 #endif // QGSTEXTRENDERER_H TextOrientation
Text orientation.
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.
Horizontally or vertically oriented text based on rotation (only available for map labeling) ...
void setMask(const QgsTextMaskSettings &maskSettings)
Sets the text's masking settings.
MaskType
Mask shape types.
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 ...
Utility functions for text rendering.
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)
A marker symbol type, for rendering Point and MultiPoint geometries.
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
Vertically oriented text.
QList< QgsSymbolLayerReference > QgsSymbolLayerReferenceList
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.
QgsTextMaskSettings & mask()
Returns a reference to the masking settings.
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.
QgsTextMaskSettings mask() const
Returns a reference to the masking settings.
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.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
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.
Container for settings relating to a selective masking around a text.
RenderUnit
Rendering size units.
Horizontally oriented text.
QString resolvedFontFamily() const
Returns the family for the resolved font, ie if the specified font was not found on the system this w...