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