Utility functions for text rendering.
More...
#include <qgstextrendererutils.h>
|
static QgsUnitTypes::RenderUnit | convertFromOldLabelUnit (int val) |
| Converts a unit from an old (pre 3.0) label unit. More...
|
|
static QgsTextBackgroundSettings::RotationType | decodeBackgroundRotationType (const QString &string) |
| Decodes a string representation of a background rotation type to a type. More...
|
|
static QgsTextBackgroundSettings::SizeType | decodeBackgroundSizeType (const QString &string) |
| Decodes a string representation of a background size type to a type. More...
|
|
static QgsTextShadowSettings::ShadowPlacement | decodeShadowPlacementType (const QString &string) |
| Decodes a string representation of a shadow placement type to a type. More...
|
|
static QgsTextBackgroundSettings::ShapeType | decodeShapeType (const QString &string) |
| Decodes a string representation of a background shape type to a type. More...
|
|
static Qgis::TextOrientation | decodeTextOrientation (const QString &name, bool *ok=nullptr) |
| Attempts to decode a string representation of a text orientation. More...
|
|
static QString | encodeTextOrientation (Qgis::TextOrientation orientation) |
| Encodes a text orientation. More...
|
|
static CurvePlacementProperties * | generateCurvedTextPlacement (const QgsPrecalculatedTextMetrics &metrics, const double *x, const double *y, int numPoints, const std::vector< double > &pathDistances, double offsetAlongLine, LabelLineDirection direction=RespectPainterOrientation, double maxConcaveAngle=-1, double maxConvexAngle=-1, bool uprightOnly=true) |
| Calculates curved text placement properties. More...
|
|
static QColor | readColor (QgsVectorLayer *layer, const QString &property, const QColor &defaultColor=Qt::black, bool withAlpha=true) |
| Converts an encoded color value from a layer property. More...
|
|
Utility functions for text rendering.
- Since
- QGIS 3.10
Definition at line 31 of file qgstextrendererutils.h.
◆ LabelLineDirection
Controls behavior of curved text with respect to line directions.
Enumerator |
---|
RespectPainterOrientation | Curved text will be placed respecting the painter orientation, and the actual line direction will be ignored.
|
FollowLineDirection | Curved text placement will respect the line direction and ignore painter orientation.
|
Definition at line 138 of file qgstextrendererutils.h.
◆ convertFromOldLabelUnit()
Converts a unit from an old (pre 3.0) label unit.
- Note
- Not available in Python bindings.
- Since
- QGIS 3.14
Definition at line 131 of file qgstextrendererutils.cpp.
◆ decodeBackgroundRotationType()
◆ decodeBackgroundSizeType()
◆ decodeShadowPlacementType()
◆ decodeShapeType()
◆ decodeTextOrientation()
Qgis::TextOrientation QgsTextRendererUtils::decodeTextOrientation |
( |
const QString & |
name, |
|
|
bool * |
ok = nullptr |
|
) |
| |
|
static |
Attempts to decode a string representation of a text orientation.
- Parameters
-
name | encoded text orientation name |
ok | if specified, will be set to true if the name was successfully decoded |
- Returns
- decoded text orientation
- See also
- encodeTextOrientation()
Definition at line 112 of file qgstextrendererutils.cpp.
◆ encodeTextOrientation()
◆ generateCurvedTextPlacement()
Calculates curved text placement properties.
- Parameters
-
metrics | precalculated text metrics for text to render |
x | array of linestring x coordinates |
y | array of linestring y coordinates |
numPoints | number of points in x, y arrays |
pathDistances | vector of precalculated distances between vertices in x, y arrays |
offsetAlongLine | offset along line at which to start the curved text placement |
direction | controls placement of text with respect to painter orientation or line direction |
maxConcaveAngle | maximum angle between characters for concave text, or -1 if not set |
maxConvexAngle | maximum angle between characters for convex text, or -1 if not set |
uprightOnly | set to true if text should be placed in an upright orientation only, or false to allow upside down text placement |
- Returns
- calculated placement properties, or
nullptr
if placement could not be calculated. Caller takes ownership of the returned placement.
- Since
- QGIS 3.20
Definition at line 182 of file qgstextrendererutils.cpp.
◆ readColor()
QColor QgsTextRendererUtils::readColor |
( |
QgsVectorLayer * |
layer, |
|
|
const QString & |
property, |
|
|
const QColor & |
defaultColor = Qt::black , |
|
|
bool |
withAlpha = true |
|
) |
| |
|
static |
Converts an encoded color value from a layer property.
- Note
- Not available in Python bindings.
- Since
- QGIS 3.14
Definition at line 145 of file qgstextrendererutils.cpp.
The documentation for this class was generated from the following files: