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;
78 void setEnabled(
bool enabled );
93 void setSize(
double size );
131 QColor color()
const;
138 void setColor(
const QColor &color );
146 bool fillBufferInterior()
const;
154 void setFillBufferInterior(
bool fill );
161 double opacity()
const;
169 void setOpacity(
double opacity );
175 Qt::PenJoinStyle joinStyle()
const;
182 void setJoinStyle( Qt::PenJoinStyle style );
188 QPainter::CompositionMode blendMode()
const;
195 void setBlendMode( QPainter::CompositionMode mode );
207 void readXml(
const QDomElement &elem );
213 QDomElement writeXml( QDomDocument &doc )
const;
237 QSharedDataPointer<QgsTextBufferSettingsPrivate> d;
302 bool enabled()
const;
309 void setEnabled(
bool enabled );
328 QString svgFile()
const;
336 void setSvgFile(
const QString &file );
392 void setSize( QSizeF size );
450 double rotation()
const;
457 void setRotation(
double rotation );
465 QPointF offset()
const;
474 void setOffset( QPointF offset );
514 QSizeF radii()
const;
524 void setRadii( QSizeF radii );
563 double opacity()
const;
571 void setOpacity(
double opacity );
577 QPainter::CompositionMode blendMode()
const;
584 void setBlendMode( QPainter::CompositionMode mode );
591 QColor fillColor()
const;
599 void setFillColor(
const QColor &color );
606 QColor strokeColor()
const;
614 void setStrokeColor(
const QColor &color );
622 double strokeWidth()
const;
630 void setStrokeWidth(
double width );
668 Qt::PenJoinStyle joinStyle()
const;
675 void setJoinStyle( Qt::PenJoinStyle style );
717 QSharedDataPointer<QgsTextBackgroundSettingsPrivate> d;
760 bool enabled()
const;
767 void setEnabled(
bool enabled );
791 int offsetAngle()
const;
799 void setOffsetAngle(
int angle );
807 double offsetDistance()
const;
816 void setOffsetDistance(
double distance );
854 bool offsetGlobal()
const;
860 void setOffsetGlobal(
bool global );
867 double blurRadius()
const;
875 void setBlurRadius(
double blurRadius );
913 bool blurAlphaOnly()
const;
921 void setBlurAlphaOnly(
bool alphaOnly );
928 double opacity()
const;
936 void setOpacity(
double opacity );
949 void setScale(
int scale );
955 QColor color()
const;
962 void setColor(
const QColor &color );
968 QPainter::CompositionMode blendMode()
const;
975 void setBlendMode( QPainter::CompositionMode mode );
987 void readXml(
const QDomElement &elem );
993 QDomElement writeXml( QDomDocument &doc )
const;
1003 QSharedDataPointer<QgsTextShadowSettingsPrivate> d;
1127 void setFont(
const QFont &font );
1134 QString namedStyle()
const;
1142 void setNamedStyle(
const QString &style );
1149 double size()
const;
1157 void setSize(
double size );
1196 QColor color()
const;
1203 void setColor(
const QColor &color );
1210 double opacity()
const;
1218 void setOpacity(
double opacity );
1224 QPainter::CompositionMode blendMode()
const;
1231 void setBlendMode( QPainter::CompositionMode mode );
1239 double lineHeight()
const;
1248 void setLineHeight(
double height );
1269 QColor previewBackgroundColor()
const;
1276 void setPreviewBackgroundColor(
const QColor &color );
1319 QFont toQFont()
const;
1332 bool containsAdvancedEffects()
const;
1386 static QPixmap textFormatPreviewPixmap(
const QgsTextFormat &format, QSize size,
const QString &previewText = QString(),
int padding = 0 );
1394 QString mTextFontFamily;
1395 bool mTextFontFound =
true;
1397 QSharedDataPointer<QgsTextSettingsPrivate> d;
1463 static void drawText(
const QRectF &rect,
double rotation,
HAlignment alignment,
const QStringList &textLines,
1465 bool drawAsOutlines =
true );
1480 static void drawText( QPointF point,
double rotation,
HAlignment alignment,
const QStringList &textLines,
1482 bool drawAsOutlines =
true );
1500 static void drawPart(
const QRectF &rect,
double rotation,
HAlignment alignment,
const QStringList &textLines,
1502 TextPart part,
bool drawAsOutlines =
true );
1520 static void drawPart( QPointF origin,
double rotation,
HAlignment alignment,
const QStringList &textLines,
1522 TextPart part,
bool drawAsOutlines =
true );
1540 QFontMetricsF *fontMetrics =
nullptr );
1551 QFontMetricsF *fontMetrics =
nullptr );
1562 bool useOrigin =
false;
1564 double rotation = 0.0;
1566 double rotationOffset = 0.0;
1580 double pictureBuffer = 0.0;
1582 double dpiRatio = 1.0;
1588 const Component &component,
1590 const QFontMetricsF *fontMetrics );
1593 Component component,
1595 const QStringList &textLines,
1599 const Component &component,
1603 const Component &component,
1606 static void drawTextInternal(
TextPart drawType,
1609 const Component &component,
1610 const QStringList &textLines,
1611 const QFontMetricsF *fontMetrics,
1616 friend class QgsLabelPreview;
1671 #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) ...
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.
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.
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.
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...