16 #ifndef QGSABSTRACTGEOMETRYV2 17 #define QGSABSTRACTGEOMETRYV2 21 #include "qgis_core.h" 58 if ( qgsgeometry_cast<QgsPoint *>( sipCpp ) !=
nullptr )
59 sipType = sipType_QgsPoint;
60 else if ( qgsgeometry_cast<QgsLineString *>( sipCpp ) !=
nullptr )
61 sipType = sipType_QgsLineString;
62 else if ( qgsgeometry_cast<QgsCircularString *>( sipCpp ) !=
nullptr )
63 sipType = sipType_QgsCircularString;
64 else if ( qgsgeometry_cast<QgsCompoundCurve *>( sipCpp ) !=
nullptr )
65 sipType = sipType_QgsCompoundCurve;
66 else if ( qgsgeometry_cast<QgsTriangle *>( sipCpp ) !=
nullptr )
67 sipType = sipType_QgsTriangle;
68 else if ( qgsgeometry_cast<QgsPolygon *>( sipCpp ) !=
nullptr )
69 sipType = sipType_QgsPolygon;
70 else if ( qgsgeometry_cast<QgsCurvePolygon *>( sipCpp ) !=
nullptr )
71 sipType = sipType_QgsCurvePolygon;
72 else if ( qgsgeometry_cast<QgsMultiPoint *>( sipCpp ) !=
nullptr )
73 sipType = sipType_QgsMultiPoint;
74 else if ( qgsgeometry_cast<QgsMultiLineString *>( sipCpp ) !=
nullptr )
75 sipType = sipType_QgsMultiLineString;
76 else if ( qgsgeometry_cast<QgsMultiPolygon *>( sipCpp ) !=
nullptr )
77 sipType = sipType_QgsMultiPolygon;
78 else if ( qgsgeometry_cast<QgsMultiSurface *>( sipCpp ) !=
nullptr )
79 sipType = sipType_QgsMultiSurface;
80 else if ( qgsgeometry_cast<QgsMultiCurve *>( sipCpp ) !=
nullptr )
81 sipType = sipType_QgsMultiCurve;
82 else if ( qgsgeometry_cast<QgsGeometryCollection *>( sipCpp ) !=
nullptr )
83 sipType = sipType_QgsGeometryCollection;
144 virtual void clear() = 0;
157 virtual int dimension()
const = 0;
164 virtual QString geometryType()
const = 0;
178 QString wktTypeStr()
const;
219 virtual bool fromWkt(
const QString &wkt ) = 0;
231 virtual QByteArray asWkb()
const = 0;
241 virtual QString asWkt(
int precision = 17 )
const = 0;
254 virtual QDomElement asGml2( QDomDocument &doc,
int precision = 17,
const QString &ns =
"gml",
AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY )
const = 0;
267 virtual QDomElement asGml3( QDomDocument &doc,
int precision = 17,
const QString &ns =
"gml",
AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY )
const = 0;
277 virtual QString asJson(
int precision = 17 )
const = 0;
299 virtual void transform(
const QTransform &t,
double zTranslate = 0.0,
double zScale = 1.0,
300 double mTranslate = 0.0,
double mScale = 1.0 ) = 0;
306 virtual void draw( QPainter &p )
const = 0;
318 virtual int vertexNumberFromVertexId(
QgsVertexId id )
const = 0;
344 virtual int nCoordinates()
const;
365 int *
leftOf SIP_OUT =
nullptr,
double epsilon = 4 * std::numeric_limits<double>::epsilon() )
const = 0;
396 virtual bool deleteVertex(
QgsVertexId position ) = 0;
403 virtual double length()
const;
410 virtual double perimeter()
const;
417 virtual double area()
const;
423 virtual double segmentLength(
QgsVertexId startVertex )
const = 0;
431 virtual bool isEmpty()
const;
436 virtual bool hasCurvedSegments()
const;
495 virtual bool removeDuplicateNodes(
double epsilon = 4 * std::numeric_limits<double>::epsilon(),
bool useZValues =
false ) = 0;
504 virtual double vertexAngle(
QgsVertexId vertex )
const = 0;
509 virtual int vertexCount(
int part = 0,
int ring = 0 )
const = 0;
514 virtual int ringCount(
int part = 0 )
const = 0;
521 virtual int partCount()
const = 0;
531 virtual bool addZValue(
double zValue = 0 ) = 0;
541 virtual bool addMValue(
double mValue = 0 ) = 0;
550 virtual bool dropZValue() = 0;
559 virtual bool dropMValue() = 0;
567 virtual void swapXy() = 0;
587 virtual void filterVertices(
const std::function<
bool(
const QgsPoint & ) > &filter );
680 virtual bool hasChildGeometries()
const;
701 virtual QgsPoint childPoint(
int index )
const;
720 virtual void clearCache()
const;
722 friend class TestQgsGeometry;
750 bool isValid()
const {
return part >= 0 && ring >= 0 && vertex >= 0; }
754 return part == other.
part && ring == other.
ring && vertex == other.
vertex;
758 return part != other.
part || ring != other.
ring || vertex != other.
vertex;
762 return part >= 0 && o.
part == part;
766 return partEqual( o ) && ( ring >= 0 && o.
ring == ring );
770 return ringEqual( o ) && ( vertex >= 0 && o.
ring == ring );
774 return ( part >= 0 && part < geom->partCount() ) &&
776 ( vertex < 0 || vertex < geom->vertexCount( part, ring ) );
790 return const_cast<T
>(
reinterpret_cast<T
>( 0 )->cast( geom ) );
811 , i( g->vertices_begin() )
812 , n( g->vertices_end() )
819 return g && g->vertices_end() != i;
831 SIP_PYOBJECT __next__();
833 if ( sipCpp->hasNext() )
834 sipRes = sipConvertFromType(
new QgsPoint( sipCpp->next() ), sipType_QgsPoint, Py_None );
836 PyErr_SetString( PyExc_StopIteration,
"" );
846 #endif //QGSABSTRACTGEOMETRYV2 bool isMeasure() const
Returns true if the geometry contains m values.
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
static bool hasZ(Type type)
Tests whether a WKB type contains the z-dimension.
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.
AxisOrder
Axis order for GML generation.
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)
static bool hasM(Type type)
Tests whether a WKB type contains m values.
QgsMargins operator*(const QgsMargins &margins, double factor)
Returns a QgsMargins object that is formed by multiplying each component of the given margins by fact...
Custom exception class for Coordinate Reference System related exceptions.
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.
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
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