2017-04-27 07:55:22 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/geometry/qgslinestring.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-17 09:31:42 +10:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
class QgsLineString: QgsCurve
|
2015-05-15 15:41:56 +02:00
|
|
|
{
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2018-05-26 14:10:30 +10:00
|
|
|
Line string geometry type, with support for z-dimension and m-values.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
.. versionadded:: 2.10
|
2015-05-15 15:41:56 +02:00
|
|
|
%End
|
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgslinestring.h"
|
|
|
|
%End
|
2015-05-15 15:41:56 +02:00
|
|
|
public:
|
2016-08-06 11:01:42 +02:00
|
|
|
QgsLineString();
|
2017-04-27 07:55:22 +02:00
|
|
|
|
2017-06-08 21:56:21 +02:00
|
|
|
QgsLineString( const QVector<QgsPoint> &points );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Construct a linestring from a vector of points.
|
|
|
|
Z and M type will be set based on the type of the first point
|
|
|
|
in the vector.
|
|
|
|
|
2017-06-08 21:56:21 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-03-25 20:18:11 +10:00
|
|
|
QgsLineString( const QVector<double> &x, const QVector<double> &y,
|
|
|
|
const QVector<double> &z = QVector<double>(),
|
2018-09-27 22:43:45 +10:00
|
|
|
const QVector<double> &m = QVector<double>(), bool is25DType = false );
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Construct a linestring from arrays of coordinates. If the z or m
|
|
|
|
arrays are non-empty then the resultant linestring will have
|
|
|
|
z and m types accordingly.
|
|
|
|
This constructor is more efficient then calling setPoints()
|
|
|
|
or repeatedly calling addVertex()
|
|
|
|
|
2018-09-28 12:27:15 +10:00
|
|
|
If the ``z`` vector is filled, then the geometry type will either
|
2018-09-27 22:43:45 +10:00
|
|
|
be a LineStringZ(M) or LineString25D depending on the ``is25DType``
|
2019-02-26 19:54:09 +10:00
|
|
|
argument. If ``is25DType`` is ``True`` (and the ``m`` vector is unfilled) then
|
2018-09-27 22:43:45 +10:00
|
|
|
the created Linestring will be a LineString25D type. Otherwise, the
|
|
|
|
LineString will be LineStringZ (or LineStringZM) type.
|
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
.. versionadded:: 3.0
|
2018-04-11 07:40:43 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
QgsLineString( const QgsPoint &p1, const QgsPoint &p2 );
|
|
|
|
%Docstring
|
|
|
|
Constructs a linestring with a single segment from ``p1`` to ``p2``.
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
|
|
|
|
2017-11-14 16:07:39 +10:00
|
|
|
QgsLineString( const QVector<QgsPointXY> &points );
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Construct a linestring from list of points.
|
|
|
|
This constructor is more efficient then calling setPoints()
|
|
|
|
or repeatedly calling addVertex()
|
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
.. versionadded:: 3.0
|
2018-04-17 09:31:42 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
explicit QgsLineString( const QgsLineSegment2D &segment );
|
|
|
|
%Docstring
|
|
|
|
Construct a linestring from a single 2d line segment.
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
|
|
|
|
2018-01-04 15:45:00 +10:00
|
|
|
virtual bool equals( const QgsCurve &other ) const;
|
2015-05-15 15:41:56 +02:00
|
|
|
|
2015-12-11 17:47:03 +11:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
|
2018-12-06 10:26:44 +10:00
|
|
|
SIP_PYOBJECT pointN( int i ) const /TypeHint="QgsPoint"/;
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2018-11-27 08:03:12 +10:00
|
|
|
Returns the point at the specified index. An IndexError will be raised if no point with the specified index exists.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
|
|
|
|
corresponds to the last point in the line.
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
%End
|
|
|
|
%MethodCode
|
2018-11-27 08:03:12 +10:00
|
|
|
const int count = sipCpp->numPoints();
|
|
|
|
if ( a0 < -count || a0 >= count )
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
{
|
|
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
|
|
sipIsErr = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-27 08:03:12 +10:00
|
|
|
std::unique_ptr< QgsPoint > p;
|
|
|
|
if ( a0 >= 0 )
|
|
|
|
p = qgis::make_unique< QgsPoint >( sipCpp->pointN( a0 ) );
|
|
|
|
else // negative index, count backwards from end
|
|
|
|
p = qgis::make_unique< QgsPoint >( sipCpp->pointN( count + a0 ) );
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
sipRes = sipConvertFromType( p.release(), sipType_QgsPoint, Py_None );
|
|
|
|
}
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual double xAt( int index ) const;
|
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
%Docstring
|
|
|
|
Returns the x-coordinate of the specified node in the line string.
|
|
|
|
|
|
|
|
An IndexError will be raised if no point with the specified index exists.
|
|
|
|
|
|
|
|
Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
|
|
|
|
corresponds to the last point in the line.
|
|
|
|
%End
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
%MethodCode
|
2018-11-27 08:03:12 +10:00
|
|
|
const int count = sipCpp->numPoints();
|
|
|
|
if ( a0 < -count || a0 >= count )
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
{
|
|
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
|
|
sipIsErr = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-27 08:03:12 +10:00
|
|
|
if ( a0 >= 0 )
|
|
|
|
return PyFloat_FromDouble( sipCpp->xAt( a0 ) );
|
|
|
|
else
|
|
|
|
return PyFloat_FromDouble( sipCpp->xAt( count + a0 ) );
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
}
|
|
|
|
%End
|
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual double yAt( int index ) const;
|
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
%Docstring
|
|
|
|
Returns the y-coordinate of the specified node in the line string.
|
|
|
|
|
|
|
|
An IndexError will be raised if no point with the specified index exists.
|
|
|
|
|
|
|
|
Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
|
|
|
|
corresponds to the last point in the line.
|
|
|
|
%End
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
%MethodCode
|
2018-11-27 08:03:12 +10:00
|
|
|
const int count = sipCpp->numPoints();
|
|
|
|
if ( a0 < -count || a0 >= count )
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
{
|
|
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
|
|
sipIsErr = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-27 08:03:12 +10:00
|
|
|
if ( a0 >= 0 )
|
|
|
|
return PyFloat_FromDouble( sipCpp->yAt( a0 ) );
|
|
|
|
else
|
|
|
|
return PyFloat_FromDouble( sipCpp->yAt( count + a0 ) );
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
}
|
|
|
|
%End
|
2015-11-18 16:24:27 +11:00
|
|
|
|
2018-05-25 12:04:03 +10:00
|
|
|
|
|
|
|
|
2018-05-30 18:52:41 +10:00
|
|
|
|
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
|
2015-11-18 21:48:07 +11:00
|
|
|
double zAt( int index ) const;
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the z-coordinate of the specified node in the line string.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
An IndexError will be raised if no point with the specified index exists.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
If the LineString does not have a z-dimension then ``nan`` will be returned.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
|
|
|
|
corresponds to the last point in the line.
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
%End
|
|
|
|
%MethodCode
|
2018-11-27 08:03:12 +10:00
|
|
|
const int count = sipCpp->numPoints();
|
|
|
|
if ( a0 < -count || a0 >= count )
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
{
|
|
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
|
|
sipIsErr = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-27 08:03:12 +10:00
|
|
|
if ( a0 >= 0 )
|
|
|
|
return PyFloat_FromDouble( sipCpp->zAt( a0 ) );
|
|
|
|
else
|
|
|
|
return PyFloat_FromDouble( sipCpp->zAt( count + a0 ) );
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
}
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2015-11-18 21:48:07 +11:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
|
2015-11-18 21:48:07 +11:00
|
|
|
double mAt( int index ) const;
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2018-11-27 08:03:12 +10:00
|
|
|
Returns the m-coordinate of the specified node in the line string.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
An IndexError will be raised if no point with the specified index exists.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
If the LineString does not have a m-dimension then ``nan`` will be returned.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
|
|
|
|
corresponds to the last point in the line.
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
%End
|
|
|
|
%MethodCode
|
2018-11-27 08:03:12 +10:00
|
|
|
const int count = sipCpp->numPoints();
|
|
|
|
if ( a0 < -count || a0 >= count )
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
{
|
|
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
|
|
sipIsErr = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-27 08:03:12 +10:00
|
|
|
if ( a0 >= 0 )
|
|
|
|
return PyFloat_FromDouble( sipCpp->mAt( a0 ) );
|
|
|
|
else
|
|
|
|
return PyFloat_FromDouble( sipCpp->mAt( count + a0 ) );
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
}
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2015-11-18 21:48:07 +11:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
|
2015-11-18 21:48:07 +11:00
|
|
|
void setXAt( int index, double x );
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the x-coordinate of the specified node in the line string.
|
2018-11-27 08:03:12 +10:00
|
|
|
The corresponding node must already exist in line string.
|
|
|
|
|
|
|
|
An IndexError will be raised if no point with the specified index exists.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
|
|
|
|
corresponds to the last point in the line.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`xAt`
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
%End
|
|
|
|
%MethodCode
|
2018-11-27 08:03:12 +10:00
|
|
|
const int count = sipCpp->numPoints();
|
|
|
|
if ( a0 < -count || a0 >= count )
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
{
|
|
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
|
|
sipIsErr = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-27 08:03:12 +10:00
|
|
|
if ( a0 >= 0 )
|
|
|
|
sipCpp->setXAt( a0, a1 );
|
|
|
|
else
|
|
|
|
sipCpp->setXAt( count + a0, a1 );
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
}
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2015-11-18 21:48:07 +11:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
|
2015-11-18 21:48:07 +11:00
|
|
|
void setYAt( int index, double y );
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the y-coordinate of the specified node in the line string.
|
2018-11-27 08:03:12 +10:00
|
|
|
The corresponding node must already exist in line string.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
An IndexError will be raised if no point with the specified index exists.
|
|
|
|
|
|
|
|
Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
|
|
|
|
corresponds to the last point in the line.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`yAt`
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
%End
|
|
|
|
%MethodCode
|
2018-11-27 08:03:12 +10:00
|
|
|
const int count = sipCpp->numPoints();
|
|
|
|
if ( a0 < -count || a0 >= count )
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
{
|
|
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
|
|
sipIsErr = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-27 08:03:12 +10:00
|
|
|
if ( a0 >= 0 )
|
|
|
|
sipCpp->setYAt( a0, a1 );
|
|
|
|
else
|
|
|
|
sipCpp->setYAt( count + a0, a1 );
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
}
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2015-11-18 21:48:07 +11:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
|
2015-11-18 21:48:07 +11:00
|
|
|
void setZAt( int index, double z );
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the z-coordinate of the specified node in the line string.
|
2018-11-27 08:03:12 +10:00
|
|
|
The corresponding node must already exist in line string and the line string must have z-dimension.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
An IndexError will be raised if no point with the specified index exists.
|
|
|
|
|
|
|
|
Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
|
|
|
|
corresponds to the last point in the line.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`zAt`
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
%End
|
|
|
|
%MethodCode
|
2018-11-27 08:03:12 +10:00
|
|
|
const int count = sipCpp->numPoints();
|
|
|
|
if ( a0 < -count || a0 >= count )
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
{
|
|
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
|
|
sipIsErr = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-27 08:03:12 +10:00
|
|
|
if ( a0 >= 0 )
|
|
|
|
sipCpp->setZAt( a0, a1 );
|
|
|
|
else
|
|
|
|
sipCpp->setZAt( count + a0, a1 );
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
}
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2015-11-18 21:48:07 +11:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
|
2015-11-18 21:48:07 +11:00
|
|
|
void setMAt( int index, double m );
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2018-11-27 08:03:12 +10:00
|
|
|
Sets the m-coordinate of the specified node in the line string.
|
|
|
|
The corresponding node must already exist in line string and the line string must have m-dimension.
|
|
|
|
|
|
|
|
An IndexError will be raised if no point with the specified index exists.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
|
|
|
|
corresponds to the last point in the line.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`mAt`
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
%End
|
|
|
|
%MethodCode
|
2018-11-27 08:03:12 +10:00
|
|
|
const int count = sipCpp->numPoints();
|
|
|
|
if ( a0 < -count || a0 >= count )
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
{
|
|
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
|
|
sipIsErr = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-27 08:03:12 +10:00
|
|
|
if ( a0 >= 0 )
|
|
|
|
sipCpp->setMAt( a0, a1 );
|
|
|
|
else
|
|
|
|
sipCpp->setMAt( count + a0, a1 );
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
}
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2015-11-18 21:48:07 +11:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
void setPoints( const QgsPointSequence &points );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Resets the line string to match the specified list of points. The line string will
|
|
|
|
inherit the dimensionality of the first point in the list.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param points: new points for line string. If empty, line string will be cleared.
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2015-11-18 16:24:27 +11:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
void append( const QgsLineString *line );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Appends the contents of another line string to the end of this line string.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param line: line to append. Ownership is not transferred.
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2015-11-18 16:24:27 +11:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
void addVertex( const QgsPoint &pt );
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Adds a new vertex to the end of the line string.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param pt: vertex to add
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2015-11-18 16:24:27 +11:00
|
|
|
|
|
|
|
void close();
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
|
|
|
Closes the line string by appending the first point to the end of the line, if it is not already closed.
|
|
|
|
%End
|
|
|
|
|
2017-09-18 14:31:19 +10:00
|
|
|
virtual QgsCompoundCurve *toCurveType() const /Factory/;
|
2015-11-18 16:24:27 +11:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-19 11:43:52 -04:00
|
|
|
Returns the geometry converted to the more generic curve type :py:class:`QgsCompoundCurve`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
:return: the converted geometry. Caller takes ownership*
|
|
|
|
%End
|
2016-04-29 11:53:34 +02:00
|
|
|
|
2016-10-29 22:06:28 +10:00
|
|
|
void extend( double startDistance, double endDistance );
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Extends the line geometry by extrapolating out the start or end of the line
|
|
|
|
by a specified distance. Lines are extended using the bearing of the first or last
|
|
|
|
segment in the line.
|
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-10-29 22:06:28 +10:00
|
|
|
|
2015-11-18 16:24:27 +11:00
|
|
|
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual QString geometryType() const;
|
2017-09-19 14:53:02 +10:00
|
|
|
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual int dimension() const;
|
2017-10-27 14:29:31 +10:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual QgsLineString *clone() const /Factory/;
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2016-02-14 03:50:23 +01:00
|
|
|
virtual void clear();
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual bool isEmpty() const;
|
|
|
|
|
2017-10-27 14:29:31 +10:00
|
|
|
virtual QgsLineString *snappedToGrid( double hSpacing, double vSpacing, double dSpacing = 0, double mSpacing = 0 ) const /Factory/;
|
|
|
|
|
2017-12-03 14:54:53 +10:00
|
|
|
virtual bool removeDuplicateNodes( double epsilon = 4 * DBL_EPSILON, bool useZValues = false );
|
|
|
|
|
2018-05-29 16:53:06 +10:00
|
|
|
virtual QPolygonF asQPolygonF() const;
|
2017-04-27 07:55:22 +02:00
|
|
|
|
2018-06-04 21:56:07 +10:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual bool fromWkb( QgsConstWkbPtr &wkb );
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual bool fromWkt( const QString &wkt );
|
|
|
|
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual QByteArray asWkb() const;
|
|
|
|
|
|
|
|
virtual QString asWkt( int precision = 17 ) const;
|
|
|
|
|
2018-04-02 13:53:29 +10:00
|
|
|
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
|
|
|
|
2018-04-02 13:53:29 +10: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
|
|
|
|
2017-11-15 14:43:39 +10:00
|
|
|
virtual QString asJson( int precision = 17 ) const;
|
2015-05-15 15:41:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
virtual double length() const;
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
virtual QgsPoint startPoint() const;
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
virtual QgsPoint endPoint() const;
|
2015-05-15 15:41:56 +02:00
|
|
|
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual QgsLineString *curveToLine( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const /Factory/;
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a new line string geometry corresponding to a segmentized approximation
|
|
|
|
of the curve.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param tolerance: segmentation tolerance
|
|
|
|
:param toleranceType: maximum segmentation angle or maximum difference between approximation and curve*
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
virtual int numPoints() const;
|
|
|
|
|
2016-10-26 17:14:51 +10:00
|
|
|
virtual int nCoordinates() const;
|
2017-09-19 14:53:02 +10:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual void points( QgsPointSequence &pt /Out/ ) const;
|
|
|
|
|
2015-05-15 15:41:56 +02:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual void draw( QPainter &p ) const;
|
|
|
|
|
|
|
|
|
2018-05-23 06:19:52 +10:00
|
|
|
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) throw( QgsCsException );
|
|
|
|
|
2017-11-24 15:34:35 +10:00
|
|
|
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 void addToPainterPath( QPainterPath &path ) const;
|
2015-05-15 15:41:56 +02:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual void drawAsPolygon( QPainter &p ) const;
|
2015-05-15 15:41:56 +02:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex );
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos );
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2016-02-02 19:46:18 +11:00
|
|
|
virtual bool deleteVertex( QgsVertexId position );
|
2015-05-15 15:41:56 +02:00
|
|
|
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual QgsLineString *reversed() const /Factory/;
|
|
|
|
|
2018-08-11 17:12:28 +10:00
|
|
|
virtual QgsPoint *interpolatePoint( double distance ) const /Factory/;
|
|
|
|
|
2018-08-10 15:19:00 +10:00
|
|
|
virtual QgsLineString *curveSubstring( double startDistance, double endDistance ) const /Factory/;
|
|
|
|
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-11-29 10:04:20 +10:00
|
|
|
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, int *leftOf /Out/ = 0, double epsilon = 4 * DBL_EPSILON ) const;
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
virtual bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const;
|
2016-01-28 10:30:06 +01:00
|
|
|
|
2015-05-15 15:41:56 +02:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
virtual QgsPoint centroid() const;
|
2015-11-26 16:56:30 +11:00
|
|
|
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual void sumUpArea( double &sum /Out/ ) const;
|
|
|
|
|
|
|
|
virtual double vertexAngle( QgsVertexId vertex ) const;
|
|
|
|
|
2017-11-14 08:02:42 +10:00
|
|
|
virtual double segmentLength( QgsVertexId startVertex ) const;
|
2015-10-14 08:21:54 +11:00
|
|
|
|
|
|
|
virtual bool addZValue( double zValue = 0 );
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2015-10-14 08:21:54 +11:00
|
|
|
virtual bool addMValue( double mValue = 0 );
|
2015-11-18 16:24:27 +11:00
|
|
|
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2015-12-01 16:33:44 +11:00
|
|
|
virtual bool dropZValue();
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2015-12-01 16:33:44 +11:00
|
|
|
virtual bool dropMValue();
|
|
|
|
|
2018-04-02 13:52:29 +10:00
|
|
|
virtual void swapXy();
|
|
|
|
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2016-08-04 09:10:08 +02:00
|
|
|
virtual bool convertTo( QgsWkbTypes::Type type );
|
2015-12-11 18:37:52 +11:00
|
|
|
|
2016-08-21 18:21:01 +02:00
|
|
|
|
2018-02-09 15:57:19 +10:00
|
|
|
|
2017-10-27 14:29:31 +10:00
|
|
|
virtual QgsLineString *createEmptyWithSameType() const /Factory/;
|
2016-02-21 16:26:45 +11:00
|
|
|
|
2018-02-09 15:57:19 +10:00
|
|
|
|
2018-06-19 07:28:49 -04:00
|
|
|
SIP_PYOBJECT __repr__();
|
|
|
|
%MethodCode
|
2018-12-18 09:42:34 +10:00
|
|
|
QString wkt = sipCpp->asWkt();
|
|
|
|
if ( wkt.length() > 1000 )
|
|
|
|
wkt = wkt.left( 1000 ) + QStringLiteral( "..." );
|
|
|
|
QString str = QStringLiteral( "<QgsLineString: %1>" ).arg( wkt );
|
2018-10-06 15:39:40 +02:00
|
|
|
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
2018-06-19 07:28:49 -04:00
|
|
|
%End
|
2018-06-05 08:54:45 -04:00
|
|
|
|
2018-12-06 10:26:44 +10:00
|
|
|
SIP_PYOBJECT __getitem__( int index ) /TypeHint="QgsPoint"/;
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
%Docstring
|
2018-11-27 08:03:12 +10:00
|
|
|
Returns the point at the specified ``index``. An IndexError will be raised if no point with the specified ``index`` exists.
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
|
|
|
|
corresponds to the last point in the line.
|
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
%End
|
|
|
|
%MethodCode
|
2018-11-27 08:03:12 +10:00
|
|
|
const int count = sipCpp->numPoints();
|
|
|
|
if ( a0 < -count || a0 >= count )
|
|
|
|
{
|
|
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
|
|
sipIsErr = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::unique_ptr< QgsPoint > p;
|
|
|
|
if ( a0 >= 0 )
|
|
|
|
p = qgis::make_unique< QgsPoint >( sipCpp->pointN( a0 ) );
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
else
|
2018-11-27 08:03:12 +10:00
|
|
|
p = qgis::make_unique< QgsPoint >( sipCpp->pointN( count + a0 ) );
|
|
|
|
sipRes = sipConvertFromType( p.release(), sipType_QgsPoint, Py_None );
|
|
|
|
}
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void __setitem__( int index, const QgsPoint &point );
|
|
|
|
%Docstring
|
2018-11-27 08:03:12 +10:00
|
|
|
Sets the point at the specified ``index``. A point at the ``index`` must already exist or an IndexError will be raised.
|
|
|
|
|
|
|
|
Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
|
|
|
|
corresponds to the last point in the line.
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
.. versionadded:: 3.6
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
%End
|
|
|
|
%MethodCode
|
2018-11-27 08:03:12 +10:00
|
|
|
const int count = sipCpp->numPoints();
|
|
|
|
if ( a0 < -count || a0 >= count )
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
{
|
|
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
|
|
sipIsErr = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-27 08:03:12 +10:00
|
|
|
if ( a0 < 0 )
|
|
|
|
a0 = count + a0;
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
sipCpp->setXAt( a0, a1->x() );
|
|
|
|
sipCpp->setYAt( a0, a1->y() );
|
|
|
|
if ( sipCpp->isMeasure() )
|
|
|
|
sipCpp->setMAt( a0, a1->m() );
|
|
|
|
if ( sipCpp->is3D() )
|
|
|
|
sipCpp->setZAt( a0, a1->z() );
|
|
|
|
}
|
|
|
|
%End
|
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
void __delitem__( int index );
|
|
|
|
%Docstring
|
2018-11-27 08:03:12 +10:00
|
|
|
Deletes the vertex at the specified ``index``. A point at the ``index`` must already exist or an IndexError will be raised.
|
|
|
|
|
|
|
|
Indexes can be less than 0, in which case they correspond to positions from the end of the line. E.g. an index of -1
|
|
|
|
corresponds to the last point in the line.
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
|
2018-11-27 08:03:12 +10:00
|
|
|
.. versionadded:: 3.6
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
%End
|
|
|
|
%MethodCode
|
2018-11-27 08:03:12 +10:00
|
|
|
const int count = sipCpp->numPoints();
|
|
|
|
if ( a0 >= 0 && a0 < count )
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
sipCpp->deleteVertex( QgsVertexId( -1, -1, a0 ) );
|
2018-11-27 08:03:12 +10:00
|
|
|
else if ( a0 < 0 && a0 >= -count )
|
|
|
|
sipCpp->deleteVertex( QgsVertexId( -1, -1, count + a0 ) );
|
[FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-26 11:53:03 +10:00
|
|
|
else
|
|
|
|
{
|
|
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
|
|
sipIsErr = 1;
|
|
|
|
}
|
|
|
|
%End
|
|
|
|
|
|
|
|
|
2018-02-09 15:57:19 +10:00
|
|
|
protected:
|
|
|
|
|
2016-02-21 16:26:45 +11:00
|
|
|
virtual QgsRectangle calculateBoundingBox() const;
|
|
|
|
|
2017-09-19 13:53:56 +10:00
|
|
|
|
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 *
|
|
|
|
* *
|
|
|
|
* src/core/geometry/qgslinestring.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|