mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-04 00:04:25 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			171 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			171 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
/************************************************************************
 | 
						|
 * This file has been generated automatically from                      *
 | 
						|
 *                                                                      *
 | 
						|
 * src/core/layout/qgslayoutpoint.h                                     *
 | 
						|
 *                                                                      *
 | 
						|
 * Do not edit manually ! Edit header and run scripts/sipify.pl 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.
 | 
						|
 | 
						|
.. versionadded:: 3.0
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgslayoutpoint.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    QgsLayoutPoint( double x, double y, QgsUnitTypes::LayoutUnit units = QgsUnitTypes::LayoutMillimeters );
 | 
						|
%Docstring
 | 
						|
Constructor for QgsLayoutPoint.
 | 
						|
%End
 | 
						|
 | 
						|
    explicit QgsLayoutPoint( QPointF point, QgsUnitTypes::LayoutUnit units = QgsUnitTypes::LayoutMillimeters );
 | 
						|
%Docstring
 | 
						|
Constructor for QgsLayoutPoint.
 | 
						|
%End
 | 
						|
 | 
						|
    explicit QgsLayoutPoint( QgsUnitTypes::LayoutUnit units = QgsUnitTypes::LayoutMillimeters );
 | 
						|
%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
 | 
						|
 | 
						|
    QgsUnitTypes::LayoutUnit units() const;
 | 
						|
%Docstring
 | 
						|
Returns the units for the point.
 | 
						|
 | 
						|
.. seealso:: :py:func:`setUnits`
 | 
						|
%End
 | 
						|
 | 
						|
    void setUnits( const QgsUnitTypes::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.pl again   *
 | 
						|
 ************************************************************************/
 |