QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgslayoutmeasurementconverter.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutmeasurementconverter.h
3 -------------------------------
4 begin : June 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSLAYOUTMEASUREMENTCONVERTER_H
19#define QGSLAYOUTMEASUREMENTCONVERTER_H
20
21#include "qgis.h"
22#include "qgis_core.h"
24#include "qgslayoutpoint.h"
25#include "qgslayoutsize.h"
26
27#include <QPointF>
28#include <QSizeF>
29
42{
43 public:
45
51 void setDpi( const double dpi ) { mDpi = dpi; }
52
58 double dpi() const { return mDpi; }
59
66 QgsLayoutMeasurement convert( QgsLayoutMeasurement measurement, Qgis::LayoutUnit targetUnits ) const;
67
74 QgsLayoutSize convert( const QgsLayoutSize &size, Qgis::LayoutUnit targetUnits ) const;
75
82 QgsLayoutPoint convert( const QgsLayoutPoint &point, Qgis::LayoutUnit targetUnits ) const;
83
84 private:
85 double mDpi = 300.0;
86
87 double convertToMillimeters( QgsLayoutMeasurement measurement ) const;
88 double convertToCentimeters( QgsLayoutMeasurement measurement ) const;
89 double convertToMeters( QgsLayoutMeasurement measurement ) const;
90 double convertToInches( QgsLayoutMeasurement measurement ) const;
91 double convertToFeet( QgsLayoutMeasurement measurement ) const;
92 double convertToPoints( QgsLayoutMeasurement measurement ) const;
93 double convertToPicas( QgsLayoutMeasurement measurement ) const;
94 double convertToPixels( QgsLayoutMeasurement measurement ) const;
95};
96
97#endif // QGSLAYOUTMEASUREMENTCONVERTER_H
LayoutUnit
Layout measurement units.
Definition qgis.h:5360
double dpi() const
Returns the Dots per inch (DPI) of the measurement converter.
void setDpi(const double dpi)
Sets the dots per inch (dpi) for the measurement converter.
Provides a method of storing measurements for use in QGIS layouts using a variety of different measur...
Provides a method of storing points, consisting of an x and y coordinate, for use in QGIS layouts.
Provides a method of storing sizes, consisting of a width and height, for use in QGIS layouts.