17 #ifndef QGSCOMPOSERUTILS_H 18 #define QGSCOMPOSERUTILS_H 41 static void drawArrowHead(
QPainter* p,
const double x,
const double y,
const double angle,
const double arrowHeadWidth );
56 static void rotate(
const double angle,
double& x,
double& y );
63 static double normalizedAngle(
const double angle );
69 static double snappedAngle(
const double angle );
78 static QRectF largestRotatedRectWithinBounds(
const QRectF &originalRect,
const QRectF &boundsRect,
const double rotation );
84 static double pointsToMM(
const double pointSize );
90 static double mmToPoints(
const double mmSize );
99 static void relativeResizeRect(
QRectF &rectToResize,
const QRectF &boundsBefore,
const QRectF &boundsAfter );
109 static double relativePosition(
const double position,
const double beforeMin,
const double beforeMax,
const double afterMin,
const double afterMax );
124 static bool decodePresetPaperSize(
const QString& presetString,
double &width,
double &height );
134 static void readDataDefinedPropertyMap(
const QDomElement &itemElem,
167 static QFont scaledFontPixelSize(
const QFont& font );
178 static double fontAscentMM(
const QFont& font );
189 static double fontDescentMM(
const QFont& font );
201 static double fontHeightMM(
const QFont& font );
214 static double fontHeightCharacterMM(
const QFont& font,
QChar character );
228 static double textWidthMM(
const QFont& font,
const QString& text );
240 static double textHeightMM(
const QFont& font,
const QString& text,
double multiLineHeight = 1.0 );
265 static void drawText(
QPainter* painter,
const QRectF& rect,
const QString& text,
const QFont& font,
const QColor& color =
QColor(),
const Qt::AlignmentFlag halignment = Qt::AlignLeft,
const Qt::AlignmentFlag valignment = Qt::AlignTop,
const int flags = Qt::TextWordWrap );
DataDefinedProperty
Data defined properties for different item types.
double ANALYSIS_EXPORT angle(Point3D *p1, Point3D *p2, Point3D *p3, Point3D *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
Utilities for compositions.