16 #ifndef QGSABSTRACTGEOMETRYV2 17 #define QGSABSTRACTGEOMETRYV2 21 #include "qgis_core.h" 59 if ( qgsgeometry_cast<QgsPoint *>( sipCpp ) !=
nullptr )
60 sipType = sipType_QgsPoint;
61 else if ( qgsgeometry_cast<QgsLineString *>( sipCpp ) !=
nullptr )
62 sipType = sipType_QgsLineString;
63 else if ( qgsgeometry_cast<QgsCircularString *>( sipCpp ) !=
nullptr )
64 sipType = sipType_QgsCircularString;
65 else if ( qgsgeometry_cast<QgsCompoundCurve *>( sipCpp ) !=
nullptr )
66 sipType = sipType_QgsCompoundCurve;
67 else if ( qgsgeometry_cast<QgsTriangle *>( sipCpp ) !=
nullptr )
68 sipType = sipType_QgsTriangle;
69 else if ( qgsgeometry_cast<QgsPolygon *>( sipCpp ) !=
nullptr )
70 sipType = sipType_QgsPolygon;
71 else if ( qgsgeometry_cast<QgsCurvePolygon *>( sipCpp ) !=
nullptr )
72 sipType = sipType_QgsCurvePolygon;
73 else if ( qgsgeometry_cast<QgsMultiPoint *>( sipCpp ) !=
nullptr )
74 sipType = sipType_QgsMultiPoint;
75 else if ( qgsgeometry_cast<QgsMultiLineString *>( sipCpp ) !=
nullptr )
76 sipType = sipType_QgsMultiLineString;
77 else if ( qgsgeometry_cast<QgsMultiPolygon *>( sipCpp ) !=
nullptr )
78 sipType = sipType_QgsMultiPolygon;
79 else if ( qgsgeometry_cast<QgsMultiSurface *>( sipCpp ) !=
nullptr )
80 sipType = sipType_QgsMultiSurface;
81 else if ( qgsgeometry_cast<QgsMultiCurve *>( sipCpp ) !=
nullptr )
82 sipType = sipType_QgsMultiCurve;
83 else if ( qgsgeometry_cast<QgsGeometryCollection *>( sipCpp ) !=
nullptr )
84 sipType = sipType_QgsGeometryCollection;
126 virtual void clear() = 0;
139 virtual int dimension()
const = 0;
146 virtual QString geometryType()
const = 0;
160 QString wktTypeStr()
const;
172 bool isMeasure()
const;
195 virtual bool fromWkt(
const QString &wkt ) = 0;
207 virtual QByteArray asWkb()
const = 0;
217 virtual QString asWkt(
int precision = 17 )
const = 0;
229 virtual QDomElement asGml2( QDomDocument &doc,
int precision = 17,
const QString &ns =
"gml" )
const = 0;
241 virtual QDomElement asGml3( QDomDocument &doc,
int precision = 17,
const QString &ns =
"gml" )
const = 0;
251 virtual QString asJson(
int precision = 17 )
const = 0;
267 bool transformZ =
false ) = 0;
275 virtual void transform(
const QTransform &t,
double zTranslate = 0.0,
double zScale = 1.0,
276 double mTranslate = 0.0,
double mScale = 1.0 ) = 0;
282 virtual void draw( QPainter &p )
const = 0;
294 virtual int vertexNumberFromVertexId(
QgsVertexId id )
const = 0;
320 virtual int nCoordinates()
const;
341 int *
leftOf SIP_OUT =
nullptr,
double epsilon = 4 * DBL_EPSILON )
const = 0;
372 virtual bool deleteVertex(
QgsVertexId position ) = 0;
379 virtual double length()
const;
386 virtual double perimeter()
const;
393 virtual double area()
const;
399 virtual double segmentLength(
QgsVertexId startVertex )
const = 0;
407 virtual bool isEmpty()
const;
412 virtual bool hasCurvedSegments()
const;
471 virtual bool removeDuplicateNodes(
double epsilon = 4 * DBL_EPSILON,
bool useZValues =
false ) = 0;
480 virtual double vertexAngle(
QgsVertexId vertex )
const = 0;
485 virtual int vertexCount(
int part = 0,
int ring = 0 )
const = 0;
490 virtual int ringCount(
int part = 0 )
const = 0;
497 virtual int partCount()
const = 0;
507 virtual bool addZValue(
double zValue = 0 ) = 0;
517 virtual bool addMValue(
double mValue = 0 ) = 0;
526 virtual bool dropZValue() = 0;
535 virtual bool dropMValue() = 0;
638 virtual bool hasChildGeometries()
const;
659 virtual QgsPoint childPoint(
int index )
const;
678 virtual void clearCache()
const;
680 friend class TestQgsGeometry;
708 bool isValid()
const {
return part >= 0 && ring >= 0 && vertex >= 0; }
712 return part == other.
part && ring == other.
ring && vertex == other.
vertex;
716 return part != other.
part || ring != other.
ring || vertex != other.
vertex;
720 return part >= 0 && o.
part == part;
724 return partEqual( o ) && ( ring >= 0 && o.
ring == ring );
728 return ringEqual( o ) && ( vertex >= 0 && o.
ring == ring );
732 return ( part >= 0 && part < geom->partCount() ) &&
734 ( vertex < 0 || vertex < geom->vertexCount( part, ring ) );
748 return const_cast<T
>(
reinterpret_cast<T
>( 0 )->cast( geom ) );
769 , i( g->vertices_begin() )
770 , n( g->vertices_end() )
777 return g && g->vertices_end() != i;
789 SIP_PYOBJECT __next__();
791 if ( sipCpp->hasNext() )
792 sipRes = sipConvertFromType(
new QgsPoint( sipCpp->next() ), sipType_QgsPoint, Py_None );
794 PyErr_SetString( PyExc_StopIteration,
"" );
804 #endif //QGSABSTRACTGEOMETRYV2 A rectangle specified with double values.
QgsVertexId(int _part=-1, int _ring=-1, int _vertex=-1, VertexType _type=SegmentVertex)
virtual int childCount() const
Returns number of child geometries (for geometries with child geometries) or child points (for geomet...
Java-style iterator for traversal of vertices of a geometry.
Multi point geometry collection.
bool isValid() const
Returns true if the vertex id is valid.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
QVector< QgsRingSequence > QgsCoordinateSequence
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
virtual QgsAbstractGeometry * childGeometry(int index) const
Returns pointer to child geometry (for geometries with child geometries - i.e.
SegmentationToleranceType
Segmentation tolerance as maximum angle or maximum difference between approximation and circle...
bool operator!=(const vertex_iterator &other) const
bool vertexEqual(QgsVertexId o) const
bool operator!=(QgsVertexId other) const
QgsVertexIterator(const QgsAbstractGeometry *geometry)
Constructs iterator for the given geometry.
Perform transforms between map coordinates and device coordinates.
Type
The WKB type describes the number of dimensions a geometry has.
Utility class for identifying a unique vertex within a geometry.
vertex_iterator vertices_end() const
Returns STL-style iterator pointing to the imaginary vertex after the last vertex of the geometry...
T qgsgeometry_cast(const QgsAbstractGeometry *geom)
Multi curve geometry collection.
virtual int ringCount(int part=0) const =0
Returns the number of rings of which this geometry is built.
Abstract base class for curved geometry type.
Abstract base class for all geometries.
The vertex_iterator class provides STL-style iterator for vertices.
QgsWkbTypes::Type wkbType() const
Returns the WKB type of the geometry.
Point geometry type, with support for z-dimension and m-values.
double closestSegment(const QgsPolylineXY &pl, const QgsPointXY &pt, int &vertexAfter, double epsilon)
QVector< QgsPoint > QgsPointSequence
bool operator==(QgsVertexId other) const
QVector< QgsPointSequence > QgsRingSequence
bool partEqual(QgsVertexId o) const
bool ringEqual(QgsVertexId o) const
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
QgsMargins operator*(const QgsMargins &margins, double factor)
Returns a QgsMargins object that is formed by multiplying each component of the given margins by fact...
vertex_iterator vertices_begin() const
Returns STL-style iterator pointing to the first vertex of the geometry.
bool hasNext() const
Find out whether there are more vertices.
double ANALYSIS_EXPORT leftOf(const QgsPoint &thepoint, const QgsPoint *p1, const QgsPoint *p2)
Returns whether 'thepoint' is left or right of the line from 'p1' to 'p2'. Negativ values mean left a...
bool isValid(const QgsAbstractGeometry *geom) const