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 );
214 Q_DECL_DEPRECATED
static double scaleFactorFromItemStyle(
const QStyleOptionGraphicsItem *style )
SIP_DEPRECATED;
221 static double scaleFactorFromItemStyle(
const QStyleOptionGraphicsItem *style, QPainter *painter );
242 static double calculatePrettySize(
double minimumSize,
double maximumSize );
249 static bool itemIsAClippingSource(
const QgsLayoutItem *item );
256 static QVector< double > predefinedScales(
const QgsLayout *layout );
267 static double pointsToMM(
double pointSize );
273 static double mmToPoints(
double mmSize );
275 friend class TestQgsLayoutUtils;
Layout graphical items for displaying a map.
Orientation
Page orientation.
Base class for graphical items within a QgsLayout.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Base class for all map layer types.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Contains information about the context of a rendering operation.
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)
#define FONT_WORKAROUND_SCALE