468 lines
14 KiB
Plaintext
Raw Normal View History

2017-04-27 07:55:22 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
2017-06-03 10:52:28 +02:00
* src/core/geometry/qgspoint.h *
2017-04-27 07:55:22 +02:00
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsPoint: QgsAbstractGeometry
2015-05-15 15:41:56 +02:00
{
2017-04-27 07:55:22 +02:00
%Docstring
Point geometry type, with support for z-dimension and m-values.
2017-12-15 10:36:55 -04:00
2017-06-01 15:37:48 +02:00
.. versionadded:: 3.0
2015-05-15 15:41:56 +02:00
%End
2017-04-27 07:55:22 +02:00
%TypeHeaderCode
#include "qgspoint.h"
2017-04-27 07:55:22 +02:00
%End
public:
static const QMetaObject staticMetaObject;
public:
QgsPoint( SIP_PYOBJECT x = Py_None, SIP_PYOBJECT y = Py_None, SIP_PYOBJECT z = Py_None, SIP_PYOBJECT m = Py_None, SIP_PYOBJECT wkbType = Py_None ) [( double x = 0.0, double y = 0.0, double z = 0.0, double m = 0.0, QgsWkbTypes::Type wkbType = QgsWkbTypes::Unknown )];
2017-06-08 11:41:35 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Construct a point with the provided initial coordinate values.
2017-12-15 10:36:55 -04:00
If ``wkbType`` is set to `QgsWkbTypes.Point`, `QgsWkbTypes.PointZ`, `QgsWkbTypes.PointM` or `QgsWkbTypes.PointZM`
the type will be set accordingly. If it is left to the default `QgsWkbTypes.Unknown`, the type will be set
based on the following rules:
- If only x and y are specified, the type will be a 2D point.
- If any or both of the Z and M are specified, the appropriate type will be created.
2017-12-19 16:36:51 -04:00
.. code-block:: python
pt = QgsPoint(43.4, 5.3)
pt.asWkt() # Point(43.4 5.3)
pt_z = QgsPoint(120, 343, 77)
pt.asWkt() # PointZ(120 343 77)
2017-12-19 21:09:15 -04:00
2017-12-19 16:36:51 -04:00
pt_m = QgsPoint(33, 88, m=5)
pt_m.m() # 5
pt_m.wkbType() # QgsWkbTypes.PointM
2017-12-19 21:09:15 -04:00
2017-12-19 16:36:51 -04:00
pt = QgsPoint(30, 40, wkbType=QgsWkbTypes.PointZ)
pt.z() # nan
pt.wkbType() # QgsWkbTypes.PointZ
%End
%MethodCode
if ( sipCanConvertToType( a0, sipType_QgsPointXY, SIP_NOT_NONE ) && a1 == Py_None && a2 == Py_None && a3 == Py_None && a4 == Py_None )
{
int state;
int sipIsErr = 0;
QgsPointXY *p = reinterpret_cast<QgsPointXY *>( sipConvertToType( a0, sipType_QgsPointXY, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
if ( sipIsErr )
{
sipReleaseType( p, sipType_QgsPointXY, state );
}
else
{
sipCpp = new sipQgsPoint( QgsPoint( *p ) );
}
}
else if ( sipCanConvertToType( a0, sipType_QPointF, SIP_NOT_NONE ) && a1 == Py_None && a2 == Py_None && a3 == Py_None && a4 == Py_None )
{
int state;
int sipIsErr = 0;
QPointF *p = reinterpret_cast<QPointF *>( sipConvertToType( a0, sipType_QPointF, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
if ( sipIsErr )
{
sipReleaseType( p, sipType_QPointF, state );
}
else
{
sipCpp = new sipQgsPoint( QgsPoint( *p ) );
}
}
else if (
( a0 == Py_None || PyFloat_AsDouble( a0 ) != -1.0 || !PyErr_Occurred() ) &&
( a1 == Py_None || PyFloat_AsDouble( a1 ) != -1.0 || !PyErr_Occurred() ) &&
( a2 == Py_None || PyFloat_AsDouble( a2 ) != -1.0 || !PyErr_Occurred() ) &&
( a3 == Py_None || PyFloat_AsDouble( a3 ) != -1.0 || !PyErr_Occurred() ) &&
( a4 == Py_None || sipCanConvertToEnum( a4, sipType_QgsWkbTypes_Type ) ) )
{
double x = a0 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a0 );
double y = a1 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a1 );
double z = a2 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a2 );
double m = a3 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a3 );
QgsWkbTypes::Type wkbType = a4 == Py_None ? QgsWkbTypes::Unknown : static_cast<QgsWkbTypes::Type>( sipConvertToEnum( a4, sipType_QgsWkbTypes_Type ) );
sipCpp = new sipQgsPoint( QgsPoint( x, y, z, m, wkbType ) );
}
2017-04-27 07:55:22 +02:00
%End
2017-04-27 07:55:22 +02:00
virtual bool operator==( const QgsAbstractGeometry &other ) const;
virtual bool operator!=( const QgsAbstractGeometry &other ) const;
double x() const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the point's x-coordinate.
.. seealso:: :py:func:`setX`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`rx`
2017-04-27 07:55:22 +02:00
%End
double y() const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the point's y-coordinate.
.. seealso:: :py:func:`setY`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`ry`
2017-04-27 07:55:22 +02:00
%End
double z() const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the point's z-coordinate.
.. seealso:: :py:func:`setZ`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`rz`
2017-04-27 07:55:22 +02:00
%End
double m() const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the point's m value.
.. seealso:: :py:func:`setM`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`rm`
2017-04-27 07:55:22 +02:00
%End
void setX( double x );
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the point's x-coordinate.
.. seealso:: x
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`rx`
2017-04-27 07:55:22 +02:00
%End
void setY( double y );
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the point's y-coordinate.
.. seealso:: y
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`ry`
2017-04-27 07:55:22 +02:00
%End
void setZ( double z );
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the point's z-coordinate.
2017-04-27 07:55:22 +02:00
.. note::
calling this will have no effect if the point does not contain a z-dimension. Use addZValue() to
2018-01-12 20:51:17 -04:00
add a z value and force the point to have a z dimension.
2017-12-15 10:36:55 -04:00
.. seealso:: z
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`rz`
2017-04-27 07:55:22 +02:00
%End
void setM( double m );
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the point's m-value.
2017-04-27 07:55:22 +02:00
.. note::
calling this will have no effect if the point does not contain a m-dimension. Use addMValue() to
2018-01-12 20:51:17 -04:00
add a m value and force the point to have an m dimension.
2017-12-15 10:36:55 -04:00
.. seealso:: m
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`rm`
2017-04-27 07:55:22 +02:00
%End
QPointF toQPointF() const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the point as a QPointF.
2017-04-27 07:55:22 +02:00
.. versionadded:: 2.14
%End
double distance( double x, double y ) const;
2017-04-27 07:55:22 +02:00
%Docstring
Returns the Cartesian 2D distance between this point and a specified x, y coordinate. In certain
2017-12-15 10:36:55 -04:00
cases it may be more appropriate to call the faster distanceSquared() method, e.g.,
when comparing distances.
.. seealso:: :py:func:`distanceSquared`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-04-27 07:55:22 +02:00
%End
double distance( const QgsPoint &other ) const;
2017-04-27 07:55:22 +02:00
%Docstring
Returns the Cartesian 2D distance between this point and another point. In certain
2017-12-15 10:36:55 -04:00
cases it may be more appropriate to call the faster distanceSquared() method, e.g.,
when comparing distances.
2017-04-27 07:55:22 +02:00
.. versionadded:: 3.0
%End
double distanceSquared( double x, double y ) const;
2017-04-27 07:55:22 +02:00
%Docstring
Returns the Cartesian 2D squared distance between this point a specified x, y coordinate. Calling
2017-12-15 10:36:55 -04:00
this is faster than calling distance(), and may be useful in use cases such as comparing
distances where the extra expense of calling distance() is not required.
.. seealso:: :py:func:`distance`
2017-12-15 10:36:55 -04:00
2017-04-27 07:55:22 +02:00
.. versionadded:: 3.0
%End
double distanceSquared( const QgsPoint &other ) const;
2017-04-27 07:55:22 +02:00
%Docstring
Returns the Cartesian 2D squared distance between this point another point. Calling
2017-12-15 10:36:55 -04:00
this is faster than calling distance(), and may be useful in use cases such as comparing
distances where the extra expense of calling distance() is not required.
.. seealso:: :py:func:`distance`
2017-12-15 10:36:55 -04:00
2017-04-27 07:55:22 +02:00
.. versionadded:: 3.0
%End
double distance3D( double x, double y, double z ) const;
2017-04-27 07:55:22 +02:00
%Docstring
Returns the Cartesian 3D distance between this point and a specified x, y, z coordinate. In certain
2017-12-15 10:36:55 -04:00
cases it may be more appropriate to call the faster distanceSquared() method, e.g.,
when comparing distances.
.. seealso:: :py:func:`distanceSquared`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-04-27 07:55:22 +02:00
%End
double distance3D( const QgsPoint &other ) const;
2017-04-27 07:55:22 +02:00
%Docstring
Returns the Cartesian 3D distance between this point and another point. In certain
2017-12-15 10:36:55 -04:00
cases it may be more appropriate to call the faster distanceSquared() method, e.g.,
when comparing distances.
2017-04-27 07:55:22 +02:00
.. versionadded:: 3.0
%End
double distanceSquared3D( double x, double y, double z ) const;
2017-04-27 07:55:22 +02:00
%Docstring
Returns the Cartesian 3D squared distance between this point a specified x, y, z coordinate. Calling
2017-12-15 10:36:55 -04:00
this is faster than calling distance(), and may be useful in use cases such as comparing
distances where the extra expense of calling distance() is not required.
.. seealso:: :py:func:`distance`
2017-12-15 10:36:55 -04:00
2017-04-27 07:55:22 +02:00
.. versionadded:: 3.0
%End
double distanceSquared3D( const QgsPoint &other ) const;
2017-04-27 07:55:22 +02:00
%Docstring
Returns the Cartesian 3D squared distance between this point another point. Calling
2017-12-15 10:36:55 -04:00
this is faster than calling distance(), and may be useful in use cases such as comparing
distances where the extra expense of calling distance() is not required.
.. seealso:: :py:func:`distance`
2017-12-15 10:36:55 -04:00
2017-04-27 07:55:22 +02:00
.. versionadded:: 3.0
%End
double azimuth( const QgsPoint &other ) const;
2017-04-27 07:55:22 +02:00
%Docstring
Calculates Cartesian azimuth between this point and other one (clockwise in degree, starting from north)
2017-12-15 10:36:55 -04:00
2017-04-27 07:55:22 +02:00
.. versionadded:: 3.0
%End
double inclination( const QgsPoint &other ) const;
%Docstring
Calculates Cartesian inclination between this point and other one (starting from zenith = 0 to nadir = 180. Horizon = 90)
2017-12-15 10:36:55 -04:00
Returns 90.0 if the distance between this point and other one is equal to 0 (same point).
.. versionadded:: 3.0
%End
QgsPoint project( double distance, double azimuth, double inclination = 90.0 ) const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns a new point which correspond to this point projected by a specified distance
with specified angles (azimuth and inclination), using Cartesian mathematics.
2017-12-15 10:36:55 -04:00
M value is preserved.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param distance: distance to project
:param azimuth: angle to project in X Y, clockwise in degrees starting from north
:param inclination: angle to project in Z (3D). If the point is 2D, the Z value is assumed to be 0.
:return: The point projected. If a 2D point is projected a 3D point will be returned except if
2018-05-27 16:33:02 +10:00
inclination is 90. A 3D point is always returned if a 3D point is projected.
Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
p = QgsPoint( 1, 2 ) # 2D point
pr = p.project ( 1, 0 )
# pr is a 2D point: 'Point (1 3)'
pr = p.project ( 1, 0, 90 )
# pr is a 2D point: 'Point (1 3)'
pr = p.project (1, 0, 0 )
# pr is a 3D point: 'PointZ (1 2 1)'
p = QgsPoint( QgsWkbTypes.PointZ, 1, 2, 2 ) # 3D point
pr = p.project ( 1, 0 )
# pr is a 3D point: 'PointZ (1 3 2)'
pr = p.project ( 1, 0, 90 )
# pr is a 3D point: 'PointZ (1 3 2)'
pr = p.project (1, 0, 0 )
# pr is a 3D point: 'PointZ (1 2 3)'
2017-12-15 10:36:55 -04:00
2017-04-27 07:55:22 +02:00
.. versionadded:: 3.0
%End
QgsVector operator-( const QgsPoint &p ) const;
QgsPoint &operator+=( QgsVector v );
QgsPoint &operator-=( QgsVector v );
QgsPoint operator+( QgsVector v ) const;
QgsPoint operator-( QgsVector v ) const;
2017-04-27 07:55:22 +02:00
virtual bool isEmpty() const;
virtual QgsRectangle boundingBox() const;
virtual QString geometryType() const;
virtual int dimension() const;
virtual QgsPoint *clone() const /Factory/;
virtual QgsPoint *snappedToGrid( double hSpacing, double vSpacing, double dSpacing = 0, double mSpacing = 0 ) const /Factory/;
virtual bool removeDuplicateNodes( double epsilon = 4 * DBL_EPSILON, bool useZValues = false );
2017-04-27 07:55:22 +02:00
virtual void clear();
virtual bool fromWkb( QgsConstWkbPtr &wkb );
2017-04-27 07:55:22 +02:00
virtual bool fromWkt( const QString &wkt );
2017-04-27 07:55:22 +02:00
virtual QByteArray asWkb() const;
virtual QString asWkt( int precision = 17 ) const;
virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const;
2017-04-27 07:55:22 +02:00
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const;
2017-04-27 07:55:22 +02:00
2019-10-08 14:27:38 +02:00
virtual QString asKml( int precision = 17 ) const;
2017-04-27 07:55:22 +02:00
virtual void draw( QPainter &p ) const;
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) throw( QgsCsException );
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
2017-04-27 07:55:22 +02:00
virtual QgsCoordinateSequence coordinateSequence() const;
virtual int nCoordinates() const;
virtual int vertexNumberFromVertexId( QgsVertexId id ) const;
2017-04-27 07:55:22 +02:00
virtual QgsAbstractGeometry *boundary() const /Factory/;
virtual bool isValid( QString &error /Out/, int flags = 0 ) const;
virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex );
virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos );
virtual bool deleteVertex( QgsVertexId position );
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, int *leftOf /Out/ = 0, double epsilon = 4 * DBL_EPSILON ) const;
virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex /Out/ ) const;
virtual void adjacentVertices( QgsVertexId vertex, QgsVertexId &previousVertex /Out/, QgsVertexId &nextVertex /Out/ ) const;
2017-04-27 07:55:22 +02:00
virtual double vertexAngle( QgsVertexId vertex ) const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Angle undefined. Always returns 0.0
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param vertex: the vertex id
2017-04-27 07:55:22 +02:00
:return: 0.0*
%End
virtual int vertexCount( int /*part*/ = 0, int /*ring*/ = 0 ) const;
2016-01-28 10:30:06 +01:00
virtual int ringCount( int /*part*/ = 0 ) const;
virtual int partCount() const;
virtual QgsPoint vertexAt( QgsVertexId /*id*/ ) const;
virtual QgsPoint *toCurveType() const /Factory/;
virtual double segmentLength( QgsVertexId startVertex ) const;
virtual bool addZValue( double zValue = 0 );
virtual bool addMValue( double mValue = 0 );
virtual bool dropZValue();
virtual bool dropMValue();
virtual void swapXy();
virtual bool convertTo( QgsWkbTypes::Type type );
2017-04-27 07:55:22 +02:00
virtual QgsPoint *createEmptyWithSameType() const /Factory/;
SIP_PYOBJECT __repr__();
%MethodCode
2018-06-19 09:06:54 -04:00
QString str = QStringLiteral( "<QgsPoint: %1>" ).arg( sipCpp->asWkt() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End
protected:
virtual int childCount() const;
virtual QgsPoint childPoint( int index ) const;
2015-05-15 15:41:56 +02:00
};
2017-04-27 07:55:22 +02:00
2017-09-25 14:20:39 +10:00
2017-04-27 07:55:22 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
2017-06-03 10:52:28 +02:00
* src/core/geometry/qgspoint.h *
2017-04-27 07:55:22 +02:00
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/