Nyall Dawson c6a91dab09 [FEATURE] Use native interpolate point method instead of GEOS method
Because:
- Exactly follows curves and doesn't require segmentizing input geometry
- Also interpolates z/m values if they are present in input geometry
- Is faster
2018-08-15 14:01:59 +10:00

254 lines
7.1 KiB
Plaintext

/************************************************************************
* 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
{
%Docstring
Abstract base class for curved geometry type
.. versionadded:: 2.10
%End
%TypeHeaderCode
#include "qgscurve.h"
%End
public:
QgsCurve();
%Docstring
Constructor for QgsCurve.
%End
virtual bool equals( const QgsCurve &other ) const = 0;
%Docstring
Checks whether this curve exactly equals another curve.
.. versionadded:: 3.0
%End
virtual bool operator==( const QgsAbstractGeometry &other ) const;
virtual bool operator!=( const QgsAbstractGeometry &other ) const;
virtual QgsCurve *clone() const = 0 /Factory/;
virtual QgsPoint startPoint() const = 0;
%Docstring
Returns the starting point of the curve.
.. seealso:: :py:func:`endPoint`
%End
virtual QgsPoint endPoint() const = 0;
%Docstring
Returns the end point of the curve.
.. seealso:: :py:func:`startPoint`
%End
virtual bool isClosed() const;
%Docstring
Returns true if the curve is closed.
%End
virtual bool isRing() const;
%Docstring
Returns true if the curve is a ring.
%End
virtual QgsLineString *curveToLine( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const = 0 /Factory/;
%Docstring
Returns a new line string geometry corresponding to a segmentized approximation
of the curve.
: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)
%End
virtual void addToPainterPath( QPainterPath &path ) const = 0;
%Docstring
Adds a curve to a painter path.
%End
virtual void drawAsPolygon( QPainter &p ) const = 0;
%Docstring
Draws the curve as a polygon on the specified QPainter.
:param p: destination QPainter
%End
virtual void points( QgsPointSequence &pt /Out/ ) const = 0;
%Docstring
Returns a list of points within the curve.
%End
virtual int numPoints() const = 0;
%Docstring
Returns the number of points in the curve.
%End
virtual void sumUpArea( double &sum /Out/ ) const = 0;
%Docstring
Sums up the area of the curve by iterating over the vertices (shoelace formula).
%End
virtual QgsCoordinateSequence coordinateSequence() const;
virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex /Out/ ) const;
virtual void adjacentVertices( QgsVertexId vertex, QgsVertexId &previousVertex /Out/, QgsVertexId &nextVertex /Out/ ) const;
virtual int vertexNumberFromVertexId( QgsVertexId id ) const;
virtual bool pointAt( int node, QgsPoint &point /Out/, QgsVertexId::VertexType &type /Out/ ) const = 0;
%Docstring
Returns the point and vertex id of a point within the curve.
:param node: node number, where the first node is 0
:param point: will be set to point at corresponding node in the curve
:param type: will be set to the vertex type of the node
:return: true if node exists within the curve
%End
virtual QgsCurve *reversed() const = 0 /Factory/;
%Docstring
Returns a reversed copy of the curve, where the direction of the curve has been flipped.
.. versionadded:: 2.14
%End
virtual QgsAbstractGeometry *boundary() const /Factory/;
virtual QgsCurve *segmentize( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const /Factory/;
%Docstring
Returns a geometry without curves. Caller takes ownership
:param tolerance: segmentation tolerance
:param toleranceType: maximum segmentation angle or maximum difference between approximation and curve*
%End
virtual int vertexCount( int part = 0, int ring = 0 ) const;
virtual int ringCount( int part = 0 ) const;
virtual int partCount() const;
virtual QgsPoint vertexAt( QgsVertexId id ) const;
virtual QgsCurve *toCurveType() const /Factory/;
virtual QgsRectangle boundingBox() const;
virtual double xAt( int index ) const = 0;
%Docstring
Returns the x-coordinate of the specified node in the line string.
: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
%End
virtual double yAt( int index ) const = 0;
%Docstring
Returns the y-coordinate of the specified node in the line string.
: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
%End
virtual QPolygonF asQPolygonF() const;
%Docstring
Returns a QPolygonF representing the points.
%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
%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
%End
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
protected:
virtual void clearCache() const;
virtual int childCount() const;
virtual QgsPoint childPoint( int index ) const;
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgscurve.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/