2017-04-27 07:55:22 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/geometry/qgscurve.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QgsCurve: QgsAbstractGeometry
|
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
|
|
|
Abstract base class for curved geometry type
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
.. versionadded:: 2.10
|
|
|
|
%End
|
|
|
|
|
2015-05-15 15:41:56 +02:00
|
|
|
%TypeHeaderCode
|
2017-04-27 07:55:22 +02:00
|
|
|
#include "qgscurve.h"
|
2015-05-15 15:41:56 +02:00
|
|
|
%End
|
2017-04-27 07:55:22 +02:00
|
|
|
public:
|
2017-09-28 08:17:06 +10:00
|
|
|
|
2016-08-06 11:01:42 +02:00
|
|
|
QgsCurve();
|
2017-09-28 08:17:06 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Constructor for QgsCurve.
|
2017-09-28 08:17:06 +10:00
|
|
|
%End
|
2015-12-15 22:36:41 +11:00
|
|
|
|
2018-01-04 15:45:00 +10:00
|
|
|
virtual bool equals( const QgsCurve &other ) const = 0;
|
2018-01-05 10:03:52 +10:00
|
|
|
%Docstring
|
|
|
|
Checks whether this curve exactly equals another curve.
|
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2018-01-04 15:45:00 +10:00
|
|
|
|
|
|
|
virtual bool operator==( const QgsAbstractGeometry &other ) const;
|
|
|
|
|
|
|
|
virtual bool operator!=( const QgsAbstractGeometry &other ) const;
|
|
|
|
|
2015-12-15 22:36:41 +11:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual QgsCurve *clone() const = 0 /Factory/;
|
2015-12-15 22:36:41 +11:00
|
|
|
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
virtual QgsPoint startPoint() const = 0;
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the starting point of the curve.
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`endPoint`
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
virtual QgsPoint endPoint() const = 0;
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the end point of the curve.
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`startPoint`
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual bool isClosed() const;
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns true if the curve is closed.
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual bool isRing() const;
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns true if the curve is a ring.
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual QgsLineString *curveToLine( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const = 0 /Factory/;
|
|
|
|
%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
|
|
|
|
|
|
|
|
Uses a MaximumAngle tolerance of 1 degrees by default (360
|
|
|
|
segments in a full circle)
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2015-05-15 15:41:56 +02:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual void addToPainterPath( QPainterPath &path ) const = 0;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Adds a curve to a painter path.
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual void drawAsPolygon( QPainter &p ) const = 0;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Draws the curve as a polygon on the specified QPainter.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param p: destination QPainter
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual void points( QgsPointSequence &pt /Out/ ) const = 0;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a list of points within the curve.
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual int numPoints() const = 0;
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the number of points in the curve.
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2015-05-15 15:41:56 +02: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
|
|
|
int __len__() const;
|
|
|
|
%Docstring
|
|
|
|
Returns the number of points in the curve.
|
|
|
|
%End
|
|
|
|
%MethodCode
|
|
|
|
sipRes = sipCpp->numPoints();
|
|
|
|
%End
|
|
|
|
|
|
|
|
//! Ensures that bool(obj) returns true (otherwise __len__() would be used)
|
|
|
|
int __bool__() const;
|
|
|
|
%MethodCode
|
|
|
|
sipRes = true;
|
|
|
|
%End
|
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual void sumUpArea( double &sum /Out/ ) const = 0;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sums up the area of the curve by iterating over the vertices (shoelace formula).
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2015-05-15 15:41:56 +02:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual QgsCoordinateSequence coordinateSequence() const;
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex /Out/ ) const;
|
2017-04-27 07:55:22 +02:00
|
|
|
|
2017-10-13 12:17:30 +10:00
|
|
|
virtual void adjacentVertices( QgsVertexId vertex, QgsVertexId &previousVertex /Out/, QgsVertexId &nextVertex /Out/ ) const;
|
2017-10-22 14:00:32 +10:00
|
|
|
|
2017-10-22 16:41:58 +10:00
|
|
|
virtual int vertexNumberFromVertexId( QgsVertexId id ) const;
|
|
|
|
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
virtual bool pointAt( int node, QgsPoint &point /Out/, QgsVertexId::VertexType &type /Out/ ) const = 0;
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the point and vertex id of a point within the curve.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param node: node number, where the first node is 0
|
|
|
|
:param type: will be set to the vertex type of the node
|
|
|
|
|
2018-12-19 08:04:27 -04:00
|
|
|
:return: - true if node exists within the curve
|
2019-02-04 08:26:11 +10:00
|
|
|
- point: will be set to point at corresponding node in the curve
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual QgsCurve *reversed() const = 0 /Factory/;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a reversed copy of the curve, where the direction of the curve has been flipped.
|
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
.. versionadded:: 2.14
|
|
|
|
%End
|
2015-05-29 17:59:52 +02:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual QgsAbstractGeometry *boundary() const /Factory/;
|
2015-11-18 16:24:27 +11:00
|
|
|
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
virtual QgsCurve *segmentize( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const /Factory/;
|
2016-07-27 15:35:00 +10:00
|
|
|
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a geometry without curves. Caller takes ownership
|
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
|
2015-09-09 17:45:31 +02:00
|
|
|
|
2016-02-21 21:49:51 +01:00
|
|
|
virtual int vertexCount( int part = 0, int ring = 0 ) const;
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2016-02-21 21:49:51 +01:00
|
|
|
virtual int ringCount( int part = 0 ) const;
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2015-09-09 17:45:31 +02:00
|
|
|
virtual int partCount() const;
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
virtual QgsPoint vertexAt( QgsVertexId id ) const;
|
2015-12-01 16:33:44 +11:00
|
|
|
|
2017-09-19 13:53:56 +10:00
|
|
|
virtual QgsCurve *toCurveType() const /Factory/;
|
|
|
|
|
|
|
|
|
2016-02-21 16:26:45 +11:00
|
|
|
virtual QgsRectangle boundingBox() const;
|
|
|
|
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2016-08-21 18:21:01 +02:00
|
|
|
virtual double xAt( int index ) const = 0;
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the x-coordinate of the specified node in the line string.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param index: index of node, where the first node in the line is 0
|
|
|
|
|
|
|
|
:return: x-coordinate of node, or 0.0 if index is out of bounds
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2016-08-21 18:21:01 +02:00
|
|
|
|
|
|
|
virtual double yAt( int index ) const = 0;
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the y-coordinate of the specified node in the line string.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param index: index of node, where the first node in the line is 0
|
|
|
|
|
|
|
|
:return: y-coordinate of node, or 0.0 if index is out of bounds
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
2016-08-21 18:21:01 +02:00
|
|
|
|
2018-05-29 16:53:06 +10:00
|
|
|
virtual QPolygonF asQPolygonF() const;
|
2017-04-27 07:55:22 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a QPolygonF representing the points.
|
2018-08-11 17:12:28 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
virtual QgsPoint *interpolatePoint( double distance ) const = 0 /Factory/;
|
|
|
|
%Docstring
|
|
|
|
Returns an interpolated point on the curve at the specified ``distance``.
|
|
|
|
|
|
|
|
If z or m values are present, the output z and m will be interpolated using
|
|
|
|
the existing vertices' z or m values.
|
|
|
|
|
|
|
|
If distance is negative, or is greater than the length of the curve, a None
|
|
|
|
will be returned.
|
|
|
|
|
|
|
|
.. versionadded:: 3.4
|
2018-08-10 15:19:00 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
virtual QgsCurve *curveSubstring( double startDistance, double endDistance ) const = 0 /Factory/;
|
|
|
|
%Docstring
|
|
|
|
Returns a new curve representing a substring of this curve.
|
|
|
|
|
|
|
|
The ``startDistance`` and ``endDistance`` arguments specify the length along the curve
|
|
|
|
which the substring should start and end at. If the ``endDistance`` is greater than the
|
|
|
|
total length of the curve then any "extra" length will be ignored.
|
|
|
|
|
|
|
|
If z or m values are present, the output z and m will be interpolated using
|
|
|
|
the existing vertices' z or m values.
|
|
|
|
|
|
|
|
.. versionadded:: 3.4
|
2017-04-27 07:55:22 +02:00
|
|
|
%End
|
|
|
|
|
2018-03-11 08:16:00 +10:00
|
|
|
double straightDistance2d() const;
|
|
|
|
%Docstring
|
|
|
|
Returns the straight distance of the curve, i.e. the direct/euclidean distance
|
|
|
|
between the first and last vertex of the curve. (Also known as
|
|
|
|
"as the crow flies" distance).
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
%End
|
|
|
|
|
|
|
|
double sinuosity() const;
|
|
|
|
%Docstring
|
|
|
|
Returns the curve sinuosity, which is the ratio of the curve length() to curve
|
|
|
|
straightDistance2d(). Larger numbers indicate a more "sinuous" curve (i.e. more
|
|
|
|
"bendy"). The minimum value returned of 1.0 indicates a perfectly straight curve.
|
|
|
|
|
|
|
|
If a curve isClosed(), it has infinite sinuosity and will return NaN.
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
%End
|
|
|
|
|
2018-11-06 10:40:43 +10:00
|
|
|
enum Orientation
|
|
|
|
{
|
|
|
|
Clockwise,
|
|
|
|
CounterClockwise,
|
|
|
|
};
|
|
|
|
|
|
|
|
Orientation orientation() const;
|
|
|
|
%Docstring
|
|
|
|
Returns the curve's orientation, e.g. clockwise or counter-clockwise.
|
|
|
|
|
|
|
|
.. warning::
|
|
|
|
|
|
|
|
The result is not predictable for non-closed curves.
|
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
|
|
|
%End
|
|
|
|
|
2016-08-21 18:21:01 +02:00
|
|
|
|
2017-05-12 10:31:59 +02:00
|
|
|
|
2016-02-21 16:26:45 +11:00
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual void clearCache() const;
|
|
|
|
|
2017-09-19 13:53:56 +10:00
|
|
|
|
2017-05-07 15:38:42 +08:00
|
|
|
virtual int childCount() const;
|
2017-12-15 08:57:22 +10:00
|
|
|
|
2017-05-07 15:38:42 +08:00
|
|
|
virtual QgsPoint childPoint( int index ) const;
|
|
|
|
|
2017-10-27 14:29:31 +10:00
|
|
|
|
2017-12-15 08:57:22 +10:00
|
|
|
|
2015-05-15 15:41:56 +02:00
|
|
|
};
|
2017-04-27 07:55:22 +02:00
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/geometry/qgscurve.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|