17 #ifndef QGSLAYOUTUTILS_H 18 #define QGSLAYOUTUTILS_H 20 #include "qgis_core.h" 30 class QStyleOptionGraphicsItem;
47 static void rotate(
double angle,
double &x,
double &y );
54 static double normalizedAngle(
const double angle,
const bool allowNegative =
false );
60 static double snappedAngle(
double angle );
89 static void relativeResizeRect( QRectF &rectToResize,
const QRectF &boundsBefore,
const QRectF &boundsAfter );
100 static double relativePosition(
const double position,
const double beforeMin,
const double beforeMax,
const double afterMin,
const double afterMax );
107 static QFont scaledFontPixelSize(
const QFont &font );
116 static double fontAscentMM(
const QFont &font );
125 static double fontDescentMM(
const QFont &font );
135 static double fontHeightMM(
const QFont &font );
145 static double fontHeightCharacterMM(
const QFont &font, QChar character );
156 static double textWidthMM(
const QFont &font,
const QString &text );
167 static double textHeightMM(
const QFont &font,
const QString &text,
double multiLineHeight = 1.0 );
176 static void drawText( QPainter *painter, QPointF position,
const QString &text,
const QFont &font,
const QColor &color = QColor() );
190 static void drawText( QPainter *painter,
const QRectF &rectangle,
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 );
200 static QRectF largestRotatedRectWithinBounds(
const QRectF &originalRect,
const QRectF &boundsRect,
const double rotation );
212 static double scaleFactorFromItemStyle(
const QStyleOptionGraphicsItem *style );
223 static double pointsToMM(
const double pointSize );
229 static double mmToPoints(
const double mmSize );
231 friend class TestQgsLayoutUtils;
234 #endif //QGSLAYOUTUTILS_H
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)
Layout graphical items for displaying a map.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Contains information about the context of a rendering operation.
#define FONT_WORKAROUND_SCALE
Orientation
Page orientiation.