QGIS API Documentation  2.14.0-Essen
qgscurvev2.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscurvev2.h
3  ------------
4  begin : September 2014
5  copyright : (C) 2014 by Marco Hugentobler
6  email : marco at sourcepole dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSCURVEV2_H
19 #define QGSCURVEV2_H
20 
21 #include "qgsabstractgeometryv2.h"
22 #include "qgspointv2.h"
23 
24 class QgsLineStringV2;
25 class QPainterPath;
26 
32 class CORE_EXPORT QgsCurveV2: public QgsAbstractGeometryV2
33 {
34  public:
35  QgsCurveV2();
36  virtual ~QgsCurveV2();
37 
38  virtual bool operator==( const QgsCurveV2& other ) const = 0;
39  virtual bool operator!=( const QgsCurveV2& other ) const = 0;
40 
41  virtual QgsCurveV2* clone() const override = 0;
42 
46  virtual QgsPointV2 startPoint() const = 0;
47 
51  virtual QgsPointV2 endPoint() const = 0;
52 
55  virtual bool isClosed() const;
56 
59  virtual bool isRing() const;
60 
64  virtual QgsLineStringV2* curveToLine() const = 0;
65 
68  virtual void addToPainterPath( QPainterPath& path ) const = 0;
69 
73  virtual void drawAsPolygon( QPainter& p ) const = 0;
74 
77  virtual void points( QgsPointSequenceV2 &pt ) const = 0;
78 
81  virtual int numPoints() const = 0;
82 
86  virtual void sumUpArea( double& sum ) const = 0;
87 
88  virtual QgsCoordinateSequenceV2 coordinateSequence() const override;
89  virtual bool nextVertex( QgsVertexId& id, QgsPointV2& vertex ) const override;
90 
97  virtual bool pointAt( int node, QgsPointV2& point, QgsVertexId::VertexType& type ) const = 0;
98 
102  virtual QgsCurveV2* reversed() const = 0;
103 
105  QgsCurveV2* segmentize() const override;
106 
107  virtual int vertexCount( int part = 0, int ring = 0 ) const override { Q_UNUSED( part ); Q_UNUSED( ring ); return numPoints(); }
108  virtual int ringCount( int part = 0 ) const override { Q_UNUSED( part ); return numPoints() > 0 ? 1 : 0; }
109  virtual int partCount() const override { return numPoints() > 0 ? 1 : 0; }
110  virtual QgsPointV2 vertexAt( QgsVertexId id ) const override;
111 
112  virtual QgsRectangle boundingBox() const override;
113 
114  protected:
115 
116  virtual void clearCache() const override { mBoundingBox = QgsRectangle(); mCoordinateSequence.clear(); QgsAbstractGeometryV2::clearCache(); }
117 
118  private:
119 
120  mutable QgsRectangle mBoundingBox;
121  mutable QgsCoordinateSequenceV2 mCoordinateSequence;
122 };
123 
124 #endif // QGSCURVEV2_H
A rectangle specified with double values.
Definition: qgsrectangle.h:35
virtual int partCount() const override
Returns count of parts contained in the geometry.
Definition: qgscurvev2.h:109
virtual QgsCoordinateSequenceV2 coordinateSequence() const =0
Retrieves the sequence of geometries, rings and nodes.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
static QVariant pointAt(const QVariantList &values, const QgsExpressionContext *context, QgsExpression *parent)
Abstract base class for all geometries.
virtual int ringCount(int part=0) const override
Definition: qgscurvev2.h:108
virtual void clearCache() const override
Clears any cached parameters associated with the geometry, eg bounding boxes.
Definition: qgscurvev2.h:116
Utility class for identifying a unique vertex within a geometry.
Line string geometry type, with support for z-dimension and m-values.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspointv2.h:34
virtual bool nextVertex(QgsVertexId &id, QgsPointV2 &vertex) const =0
Returns next vertex id and coordinates.
virtual QgsRectangle boundingBox() const =0
Returns the minimal bounding box for the geometry.
virtual QgsAbstractGeometryV2 * segmentize() const
Returns a version of the geometry without curves.
virtual void clearCache() const
Clears any cached parameters associated with the geometry, eg bounding boxes.
virtual QgsAbstractGeometryV2 * clone() const =0
Clones the geometry by performing a deep copy.
Abstract base class for curved geometry type.
Definition: qgscurvev2.h:32
virtual int vertexCount(int part=0, int ring=0) const override
Definition: qgscurvev2.h:107
virtual QgsPointV2 vertexAt(QgsVertexId id) const =0
Returns the point corresponding to a specified vertex id.