|
| 1 | +/************************************************************************ |
| 2 | + * This file has been generated automatically from * |
| 3 | + * * |
| 4 | + * src/core/layout/qgslayoutpoint.h * |
| 5 | + * * |
| 6 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 7 | + ************************************************************************/ |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +class QgsLayoutPoint |
| 13 | +{ |
| 14 | +%Docstring |
| 15 | + This class provides a method of storing points, consisting of an x and y coordinate, |
| 16 | + for use in QGIS layouts. Measurement units are stored alongside the position. |
| 17 | + |
| 18 | +.. seealso:: QgsLayoutMeasurementConverter |
| 19 | +.. versionadded:: 3.0 |
| 20 | +.. note:: |
| 21 | + |
| 22 | + This class does not inherit from QPointF since QPointF includes methods which should not apply |
| 23 | + to positions with with units. For instance, the + and - operators would mislead users of this class |
| 24 | + to believe that addition of two QgsLayoutPoints with different unit types would automatically convert |
| 25 | + units. Instead, all unit conversion must be handled by a QgsLayoutMeasurementConverter so that |
| 26 | + conversion between paper and screen units can be correctly performed. |
| 27 | +%End |
| 28 | + |
| 29 | +%TypeHeaderCode |
| 30 | +#include "qgslayoutpoint.h" |
| 31 | +%End |
| 32 | + public: |
| 33 | + |
| 34 | + QgsLayoutPoint( const double x, const double y, const QgsUnitTypes::LayoutUnit units = QgsUnitTypes::LayoutMillimeters ); |
| 35 | +%Docstring |
| 36 | + Constructor for QgsLayoutPoint. |
| 37 | + \param x x coordinate |
| 38 | + \param x y coordinate |
| 39 | + \param units units for x and y |
| 40 | +%End |
| 41 | + |
| 42 | + explicit QgsLayoutPoint( const QgsUnitTypes::LayoutUnit units = QgsUnitTypes::LayoutMillimeters ); |
| 43 | +%Docstring |
| 44 | + Constructor for an empty point, where both x and y are set to 0. |
| 45 | + \param units units for measurement |
| 46 | +%End |
| 47 | + |
| 48 | + ~QgsLayoutPoint(); |
| 49 | + |
| 50 | + void setPoint( const double x, const double y ); |
| 51 | +%Docstring |
| 52 | + Sets new x and y coordinates for the point. |
| 53 | +.. seealso:: setX() |
| 54 | +.. seealso:: setY() |
| 55 | +.. seealso:: setUnits() |
| 56 | +%End |
| 57 | + |
| 58 | + double x() const; |
| 59 | +%Docstring |
| 60 | + Returns x coordinate of point. |
| 61 | +.. seealso:: setX() |
| 62 | +.. seealso:: y() |
| 63 | + :rtype: float |
| 64 | +%End |
| 65 | + |
| 66 | + void setX( const double x ); |
| 67 | +%Docstring |
| 68 | + Sets the x coordinate of point. |
| 69 | +.. seealso:: x() |
| 70 | +.. seealso:: setY() |
| 71 | +%End |
| 72 | + |
| 73 | + double y() const; |
| 74 | +%Docstring |
| 75 | + Returns y coordinate of point. |
| 76 | +.. seealso:: setY() |
| 77 | +.. seealso:: x() |
| 78 | + :rtype: float |
| 79 | +%End |
| 80 | + |
| 81 | + void setY( const double y ); |
| 82 | +%Docstring |
| 83 | + Sets y coordinate of point. |
| 84 | +.. seealso:: y() |
| 85 | +.. seealso:: setX() |
| 86 | +%End |
| 87 | + |
| 88 | + QgsUnitTypes::LayoutUnit units() const; |
| 89 | +%Docstring |
| 90 | + Returns the units for the point. |
| 91 | +.. seealso:: setUnits() |
| 92 | + :rtype: QgsUnitTypes.LayoutUnit |
| 93 | +%End |
| 94 | + |
| 95 | + void setUnits( const QgsUnitTypes::LayoutUnit units ); |
| 96 | +%Docstring |
| 97 | + Sets the ``units`` for the point. Does not alter the stored coordinates, |
| 98 | + ie. no conversion is done. |
| 99 | +.. seealso:: units() |
| 100 | +%End |
| 101 | + |
| 102 | + bool isNull() const; |
| 103 | +%Docstring |
| 104 | + Tests whether the position is null, ie both its x and y coordinates |
| 105 | + are zero. |
| 106 | + :return: true if point is null |
| 107 | + :rtype: bool |
| 108 | +%End |
| 109 | + |
| 110 | + QPointF toQPointF() const; |
| 111 | +%Docstring |
| 112 | + Converts the layout point to a QPointF. The unit information is discarded |
| 113 | + during this operation. |
| 114 | + :return: QPointF with same x and y coordinates as layout point |
| 115 | + :rtype: QPointF |
| 116 | +%End |
| 117 | + |
| 118 | + QString encodePoint() const; |
| 119 | +%Docstring |
| 120 | + Encodes the layout point to a string |
| 121 | +.. seealso:: decodePoint() |
| 122 | + :rtype: str |
| 123 | +%End |
| 124 | + |
| 125 | + static QgsLayoutPoint decodePoint( const QString &string ); |
| 126 | +%Docstring |
| 127 | + Decodes a point from a ``string``. |
| 128 | +.. seealso:: encodePoint() |
| 129 | + :rtype: QgsLayoutPoint |
| 130 | +%End |
| 131 | + |
| 132 | + bool operator==( const QgsLayoutPoint &other ) const; |
| 133 | + bool operator!=( const QgsLayoutPoint &other ) const; |
| 134 | +%Docstring |
| 135 | + :rtype: bool |
| 136 | +%End |
| 137 | + QgsLayoutPoint operator*( const double v ) const; |
| 138 | +%Docstring |
| 139 | + :rtype: QgsLayoutPoint |
| 140 | +%End |
| 141 | + QgsLayoutPoint operator*=( const double v ); |
| 142 | +%Docstring |
| 143 | + :rtype: QgsLayoutPoint |
| 144 | +%End |
| 145 | + QgsLayoutPoint operator/( const double v ) const; |
| 146 | +%Docstring |
| 147 | + :rtype: QgsLayoutPoint |
| 148 | +%End |
| 149 | + QgsLayoutPoint operator/=( const double v ); |
| 150 | +%Docstring |
| 151 | + :rtype: QgsLayoutPoint |
| 152 | +%End |
| 153 | + |
| 154 | +}; |
| 155 | + |
| 156 | +/************************************************************************ |
| 157 | + * This file has been generated automatically from * |
| 158 | + * * |
| 159 | + * src/core/layout/qgslayoutpoint.h * |
| 160 | + * * |
| 161 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 162 | + ************************************************************************/ |
0 commit comments