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(
double angle,
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(
double position,
double beforeMin,
double beforeMax,
double afterMin,
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(), Qt::AlignmentFlag halignment = Qt::AlignLeft, Qt::AlignmentFlag valignment = Qt::AlignTop,
int flags = Qt::TextWordWrap );
200 static QRectF largestRotatedRectWithinBounds(
const QRectF &originalRect,
const QRectF &boundsRect,
double rotation );
212 static double scaleFactorFromItemStyle(
const QStyleOptionGraphicsItem *style );
234 static double pointsToMM(
double pointSize );
240 static double mmToPoints(
double mmSize );
242 friend class TestQgsLayoutUtils;
245 #endif //QGSLAYOUTUTILS_H Base class for all map layer types.
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.
Reads and writes project states.
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.