QGIS/python/core/auto_generated/qgspointxy.sip.in

277 lines
6.2 KiB
Plaintext
Raw Normal View History

2017-04-30 21:23:57 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
2017-06-03 10:52:28 +02:00
* src/core/qgspointxy.h *
2017-04-30 21:23:57 +02:00
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsPointXY
{
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
A class to represent a 2D point.
2017-06-03 10:52:28 +02:00
2017-12-15 10:36:55 -04:00
A QgsPointXY represents a position with X and Y coordinates.
In most scenarios it is preferable to use a QgsPoint instead which also
supports Z and M values.
2017-06-03 10:52:28 +02:00
.. versionadded:: 3.0
2017-04-30 21:23:57 +02:00
%End
%TypeHeaderCode
#include "qgspointxy.h"
%End
public:
QgsPointXY();
QgsPointXY( const QgsPointXY &p );
2017-04-30 21:23:57 +02:00
%Docstring
Create a point from another point
%End
QgsPointXY( double x, double y );
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Create a point from x,y coordinates
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param x: x coordinate
:param y: y coordinate
2017-04-30 21:23:57 +02:00
%End
QgsPointXY( QPointF point );
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Create a point from a QPointF
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param point: QPointF source
2017-04-30 21:23:57 +02:00
.. versionadded:: 2.7
%End
QgsPointXY( QPoint point );
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Create a point from a QPoint
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param point: QPoint source
2017-04-30 21:23:57 +02:00
.. versionadded:: 2.7
%End
QgsPointXY( const QgsPoint &point );
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Create a new point.
Z and M values will be dropped.
2017-04-30 21:23:57 +02:00
.. versionadded:: 3.0
%End
~QgsPointXY();
void setX( double x );
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the x value of the point
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param x: x coordinate
2017-04-30 21:23:57 +02:00
%End
void setY( double y );
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the y value of the point
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param y: y coordinate
2017-04-30 21:23:57 +02:00
%End
void set( double x, double y );
2017-04-30 21:23:57 +02:00
%Docstring
Sets the x and y value of the point
%End
double x() const;
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Get the x value of the point
:return: x coordinate
2017-04-30 21:23:57 +02:00
%End
double y() const;
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Get the y value of the point
:return: y coordinate
2017-04-30 21:23:57 +02:00
%End
QPointF toQPointF() const;
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Converts a point to a QPointF
:return: QPointF with same x and y values
2017-04-30 21:23:57 +02:00
.. versionadded:: 2.7
%End
2017-11-15 16:02:11 +10:00
QString toString( int precision = -1 ) const;
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns a string representation of the point (x, y) with a preset ``precision``.
If ``precision`` is -1, then a default precision will be used.
2017-04-30 21:23:57 +02:00
%End
QString asWkt() const;
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Return the well known text representation for the point (e.g. "POINT(x y)").
The wkt is created without an SRID.
2017-04-30 21:23:57 +02:00
%End
double sqrDist( double x, double y ) const;
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the squared distance between this point a specified x, y coordinate.
.. seealso:: :py:func:`distance`
2017-04-30 21:23:57 +02:00
%End
double sqrDist( const QgsPointXY &other ) const;
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the squared distance between this point another point.
.. seealso:: :py:func:`distance`
2017-04-30 21:23:57 +02:00
%End
double distance( double x, double y ) const;
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the distance between this point and a specified x, y coordinate.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param x: x-coordniate
:param y: y-coordinate
.. seealso:: :py:func:`sqrDist`
2017-12-15 10:36:55 -04:00
2017-04-30 21:23:57 +02:00
.. versionadded:: 2.16
%End
double distance( const QgsPointXY &other ) const;
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the distance between this point and another point.
2017-12-15 21:36:08 -04:00
:param other: other point
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`sqrDist`
2017-12-15 10:36:55 -04:00
2017-04-30 21:23:57 +02:00
.. versionadded:: 2.16
%End
double sqrDistToSegment( double x1, double y1, double x2, double y2, QgsPointXY &minDistPoint /Out/, double epsilon = DEFAULT_SEGMENT_EPSILON ) const;
2017-04-30 21:23:57 +02:00
%Docstring
Returns the minimum distance between this point and a segment
%End
double azimuth( const QgsPointXY &other ) const;
2017-04-30 21:23:57 +02:00
%Docstring
Calculates azimuth between this point and other one (clockwise in degree, starting from north)
%End
QgsPointXY project( double distance, double bearing ) const;
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns a new point which corresponds to this point projected by a specified distance
in a specified bearing.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param distance: distance to project
:param bearing: angle to project in, clockwise in degrees starting from north
2017-04-30 21:23:57 +02:00
.. versionadded:: 2.16
%End
bool compare( const QgsPointXY &other, double epsilon = 4 * DBL_EPSILON ) const;
2017-04-30 21:23:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Compares this point with another point with a fuzzy tolerance
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param other: point to compare with
:param epsilon: maximum difference for coordinates between the points
:return: true if points are equal within specified tolerance
2017-04-30 21:23:57 +02:00
.. versionadded:: 2.9
%End
bool operator==( const QgsPointXY &other );
bool operator!=( const QgsPointXY &other ) const;
void multiply( double scalar );
2017-04-30 21:23:57 +02:00
%Docstring
Multiply x and y by the given value
%End
QgsVector operator-( const QgsPointXY &p ) const;
QgsPointXY &operator+=( QgsVector v );
QgsPointXY &operator-=( QgsVector v );
QgsPointXY operator+( QgsVector v ) const;
QgsPointXY operator-( QgsVector v ) const;
QgsPointXY operator*( double scalar ) const;
QgsPointXY operator/( double scalar ) const;
QgsPointXY &operator*=( double scalar );
QgsPointXY &operator/=( double scalar );
2017-08-31 20:54:43 +10:00
operator QVariant() const;
2017-04-30 21:23:57 +02:00
SIP_PYOBJECT __repr__();
%MethodCode
2017-04-30 21:23:57 +02:00
QString str = "(" + QString::number( sipCpp->x() ) + "," + QString::number( sipCpp->y() ) + ")";
//QString str("(%f,%f)").arg(sipCpp->x()).arg(sipCpp->y());
sipRes = PyUnicode_FromString( str.toUtf8().data() );
%End
2017-04-30 21:23:57 +02:00
int __len__();
%MethodCode
sipRes = 2;
%End
2017-04-30 21:23:57 +02:00
SIP_PYOBJECT __getitem__( int );
%MethodCode
2017-04-30 21:23:57 +02:00
if ( a0 == 0 )
{
sipRes = Py_BuildValue( "d", sipCpp->x() );
}
else if ( a0 == 1 )
{
sipRes = Py_BuildValue( "d", sipCpp->y() );
}
else
{
QString msg = QString( "Bad index: %1" ).arg( a0 );
PyErr_SetString( PyExc_IndexError, msg.toAscii().constData() );
}
%End
2017-04-30 21:23:57 +02:00
long __hash__() const;
%MethodCode
2017-04-30 21:23:57 +02:00
sipRes = qHash( *sipCpp );
%End
2017-04-30 23:25:26 +02:00
}; // class QgsPoint
2017-04-30 21:23:57 +02:00
2017-04-30 23:25:26 +02:00
2017-04-30 21:23:57 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
2017-06-03 10:52:28 +02:00
* src/core/qgspointxy.h *
2017-04-30 21:23:57 +02:00
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/