16#ifndef QGSTEXTRENDERERUTILS_H
17#define QGSTEXTRENDERERUTILS_H
157 static std::unique_ptr< CurvePlacementProperties > generateCurvedTextPlacement(
159 const QPolygonF &line,
160 double offsetAlongLine,
161 LabelLineDirection direction = RespectPainterOrientation,
162 double maxConcaveAngle = -1,
163 double maxConvexAngle = -1,
186 static std::unique_ptr< CurvePlacementProperties > generateCurvedTextPlacement(
191 const std::vector<
double> &pathDistances,
192 double offsetAlongLine,
193 LabelLineDirection direction = RespectPainterOrientation,
194 double maxConcaveAngle = -1,
195 double maxConvexAngle = -1,
196 Qgis::CurvedTextFlags flags =
Qgis::CurvedTextFlags(),
197 double additionalCharacterSpacing = 0.0,
198 double additionalWordSpacing = 0.0
203 static std::unique_ptr< CurvePlacementProperties > generateCurvedTextPlacementPrivate(
208 const std::vector< double> &pathDistances,
209 double offsetAlongLine,
210 LabelLineDirection direction,
212 double maxConcaveAngle = -1,
213 double maxConvexAngle = -1,
214 bool isSecondAttempt =
false,
215 double additionalCharacterSpacing = 0,
216 double additionalWordSpacing = 0
220 static
bool nextCharPosition(
222 const std::vector<
double > &pathDistances,
227 double ¤tDistanceAlongSegment,
228 double &characterStartX,
229 double &characterStartY,
230 double &characterEndX,
231 double &characterEndY,
232 Qgis::CurvedTextFlags flags,
233 double additionalSpacing
236 static
void findLineCircleIntersection(
double cx,
double cy,
double radius,
double x1,
double y1,
double x2,
double y2,
double &xRes,
double &yRes );
Provides global constants and enumerations for use throughout the application.
TextOrientation
Text orientations.
RenderUnit
Rendering size units.
QFlags< CurvedTextFlag > CurvedTextFlags
Flags controlling behavior of curved text generation.
Contains precalculated properties regarding text metrics for text to be rendered at a later stage.
SizeType
Methods for determining the background shape size.
ShapeType
Background shape types.
RotationType
Methods for determining the rotation of the background shape.
Contains placement information for a curved text layout.
bool flippedCharacterPlacementToGetUprightLabels
true if the character placement had to be reversed in order to obtain upright labels on the segment
int upsideDownCharCount
Total count of upside down characters.
QVector< QgsTextRendererUtils::CurvedGraphemePlacement > graphemePlacement
Placement information for all graphemes in text.
bool labeledLineSegmentIsRightToLeft
true if labeled section of line is calculated to be of right-to-left orientation
Contains placement information for a single grapheme in a curved text layout.
int graphemeIndex
Index of corresponding grapheme.
double angle
Angle for grapheme, in radians.
double height
Height of grapheme.
double x
X coordinate of start of grapheme.
double y
Y coordinate of start of grapheme.
bool isWhitespace
true if grapheme is considered whitespace (eg a tab or space character)
double width
Width of grapheme.
Utility functions for text rendering.
static QgsTextBackgroundSettings::ShapeType decodeShapeType(const QString &string)
Decodes a string representation of a background shape type to a type.
static Qgis::TextOrientation decodeTextOrientation(const QString &name, bool *ok=nullptr)
Attempts to decode a string representation of a text orientation.
LabelLineDirection
Controls behavior of curved text with respect to line directions.
@ FollowLineDirection
Curved text placement will respect the line direction and ignore painter orientation.
@ RespectPainterOrientation
Curved text will be placed respecting the painter orientation, and the actual line direction will be ...
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.
static QgsTextShadowSettings::ShadowPlacement decodeShadowPlacementType(const QString &string)
Decodes a string representation of a shadow placement type to a type.
static QgsTextBackgroundSettings::RotationType decodeBackgroundRotationType(const QString &string)
Decodes a string representation of a background rotation type to a type.
static QString encodeTextOrientation(Qgis::TextOrientation orientation)
Encodes a text orientation.
static QgsTextBackgroundSettings::SizeType decodeBackgroundSizeType(const QString &string)
Decodes a string representation of a background size type to a type.
static Qgis::RenderUnit convertFromOldLabelUnit(int val)
Converts a unit from an old (pre 3.0) label unit.
ShadowPlacement
Placement positions for text shadow.
Represents a vector layer which manages a vector based dataset.