2015-05-15 15:41:56 +02:00
|
|
|
class QgsCurveV2: public QgsAbstractGeometryV2
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgscurvev2.h>
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
QgsCurveV2();
|
|
|
|
virtual ~QgsCurveV2();
|
2015-12-15 22:36:41 +11:00
|
|
|
|
|
|
|
virtual bool operator==( const QgsCurveV2& other ) const = 0;
|
|
|
|
virtual bool operator!=( const QgsCurveV2& other ) const = 0;
|
|
|
|
|
|
|
|
virtual QgsCurveV2* clone() const = 0;
|
|
|
|
|
2016-02-14 03:50:23 +01:00
|
|
|
/** Returns the starting point of the curve.
|
|
|
|
* @see endPoint
|
|
|
|
*/
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual QgsPointV2 startPoint() const = 0;
|
2016-02-14 03:50:23 +01:00
|
|
|
|
|
|
|
/** Returns the end point of the curve.
|
|
|
|
* @see startPoint
|
|
|
|
*/
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual QgsPointV2 endPoint() const = 0;
|
2016-02-14 03:50:23 +01:00
|
|
|
|
|
|
|
/** Returns true if the curve is closed.
|
|
|
|
*/
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual bool isClosed() const;
|
2016-02-14 03:50:23 +01:00
|
|
|
|
|
|
|
/** Returns true if the curve is a ring.
|
|
|
|
*/
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual bool isRing() const;
|
2016-02-14 03:50:23 +01:00
|
|
|
|
|
|
|
/** Returns a new line string geometry corresponding to a segmentized approximation
|
|
|
|
* of the curve.
|
2016-05-17 18:09:16 +02:00
|
|
|
* @param tolerance segmentation tolerance
|
|
|
|
* @param toleranceType maximum segmentation angle or maximum difference between approximation and curve
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2016-05-17 18:09:16 +02:00
|
|
|
virtual QgsLineStringV2* curveToLine( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const = 0;
|
2015-05-15 15:41:56 +02:00
|
|
|
|
2016-02-14 03:50:23 +01:00
|
|
|
/** Adds a curve to a painter path.
|
|
|
|
*/
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual void addToPainterPath( QPainterPath& path ) const = 0;
|
2016-02-14 03:50:23 +01:00
|
|
|
|
|
|
|
/** Draws the curve as a polygon on the specified QPainter.
|
|
|
|
* @param p destination QPainter
|
|
|
|
*/
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual void drawAsPolygon( QPainter& p ) const = 0;
|
2016-02-14 03:50:23 +01:00
|
|
|
|
|
|
|
/** Returns a list of points within the curve.
|
|
|
|
*/
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual void points( QList<QgsPointV2>& pt ) const = 0;
|
2016-02-14 03:50:23 +01:00
|
|
|
|
|
|
|
/** Returns the number of points in the curve.
|
|
|
|
*/
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual int numPoints() const = 0;
|
|
|
|
|
2016-02-14 03:50:23 +01:00
|
|
|
/** Calculates the area of the curve. Derived classes should override this
|
|
|
|
* to return the correct area of the curve.
|
|
|
|
*/
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual void sumUpArea( double& sum ) const = 0;
|
|
|
|
|
2016-02-21 21:49:51 +01:00
|
|
|
virtual QList< QList< QList< QgsPointV2 > > > coordinateSequence() const;
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual bool nextVertex( QgsVertexId& id, QgsPointV2& vertex ) const;
|
2016-02-14 03:50:23 +01:00
|
|
|
|
|
|
|
/** 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
|
|
|
|
* @returns true if node exists within the curve
|
|
|
|
*/
|
|
|
|
virtual bool pointAt( int node, QgsPointV2& point, QgsVertexId::VertexType& type ) const = 0;
|
2015-05-29 17:59:52 +02:00
|
|
|
|
2015-11-18 16:24:27 +11:00
|
|
|
/** Returns a reversed copy of the curve, where the direction of the curve has been flipped.
|
|
|
|
* @note added in QGIS 2.14
|
|
|
|
*/
|
|
|
|
virtual QgsCurveV2* reversed() const = 0 /Factory/;
|
|
|
|
|
2016-05-17 18:09:16 +02:00
|
|
|
/** Returns a geometry without curves. Caller takes ownership
|
|
|
|
* @param tolerance segmentation tolerance
|
|
|
|
* @param toleranceType maximum segmentation angle or maximum difference between approximation and curve*/
|
|
|
|
virtual QgsCurveV2* segmentize( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const /Factory/;
|
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;
|
|
|
|
virtual int ringCount( int part = 0 ) const;
|
2015-09-09 17:45:31 +02:00
|
|
|
virtual int partCount() const;
|
2016-02-02 19:46:18 +11:00
|
|
|
virtual QgsPointV2 vertexAt( QgsVertexId id ) const;
|
2015-12-01 16:33:44 +11:00
|
|
|
|
2016-02-21 16:26:45 +11:00
|
|
|
virtual QgsRectangle boundingBox() const;
|
|
|
|
|
2015-12-01 16:33:44 +11:00
|
|
|
/** Drops any Z dimensions which exist in the geometry.
|
|
|
|
* @returns true if Z values were present and have been removed
|
|
|
|
* @see dropMValue()
|
|
|
|
* @note added in QGIS 2.14
|
|
|
|
*/
|
|
|
|
virtual bool dropZValue() = 0;
|
|
|
|
|
|
|
|
/** Drops any M values which exist in the geometry.
|
|
|
|
* @returns true if M values were present and have been removed
|
|
|
|
* @see dropZValue()
|
|
|
|
* @note added in QGIS 2.14
|
|
|
|
*/
|
|
|
|
virtual bool dropMValue() = 0;
|
2016-02-21 16:26:45 +11:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual void clearCache() const;
|
|
|
|
|
2015-05-15 15:41:56 +02:00
|
|
|
};
|