1/************************************************************************ 2 * This file has been generated automatically from * 3 * * 4 * src/core/geometry/qgsgeometrycollection.h * 5 * * 6 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 7 ************************************************************************/ 8 9 10 11 12 13 14 15class QgsGeometryCollection: QgsAbstractGeometry 16{ 17%Docstring(signature="appended") 18Geometry collection 19 20.. versionadded:: 2.10 21%End 22 23%TypeHeaderCode 24#include "qgsgeometrycollection.h" 25%End 26 public: 27 28 29 QgsGeometryCollection() /HoldGIL/; 30%Docstring 31Constructor for an empty geometry collection. 32%End 33 34 QgsGeometryCollection( const QgsGeometryCollection &c ); 35 ~QgsGeometryCollection(); 36 37 virtual bool operator==( const QgsAbstractGeometry &other ) const; 38 39 virtual bool operator!=( const QgsAbstractGeometry &other ) const; 40 41 42 virtual QgsGeometryCollection *clone() const /Factory/; 43 44 45 int numGeometries() const /HoldGIL/; 46%Docstring 47Returns the number of geometries within the collection. 48%End 49 50 51 int __len__() const; 52%Docstring 53Returns the number of geometries within the collection. 54%End 55%MethodCode 56 sipRes = sipCpp->numGeometries(); 57%End 58 59 //! Ensures that bool(obj) returns ``True`` (otherwise __len__() would be used) 60 int __bool__() const; 61%MethodCode 62 sipRes = true; 63%End 64 65 66 67 68 SIP_PYOBJECT geometryN( int n ) /TypeHint="QgsAbstractGeometry"/; 69%Docstring 70Returns a geometry from within the collection. 71 72:param n: index of geometry to return. 73 74:raises IndexError: if no geometry with the specified index exists. 75%End 76%MethodCode 77 if ( a0 < 0 || a0 >= sipCpp->numGeometries() ) 78 { 79 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) ); 80 sipIsErr = 1; 81 } 82 else 83 { 84 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL ); 85 } 86%End 87 88 89 virtual bool isEmpty() const /HoldGIL/; 90 91 virtual int dimension() const /HoldGIL/; 92 93 virtual QString geometryType() const /HoldGIL/; 94 95 virtual void clear(); 96 97 virtual QgsGeometryCollection *snappedToGrid( double hSpacing, double vSpacing, double dSpacing = 0, double mSpacing = 0 ) const /Factory/; 98 99 virtual bool removeDuplicateNodes( double epsilon = 4 * DBL_EPSILON, bool useZValues = false ); 100 101 virtual QgsAbstractGeometry *boundary() const /Factory/; 102 103 virtual void adjacentVertices( QgsVertexId vertex, QgsVertexId &previousVertex /Out/, QgsVertexId &nextVertex /Out/ ) const; 104 105 virtual int vertexNumberFromVertexId( QgsVertexId id ) const; 106 107 virtual bool boundingBoxIntersects( const QgsRectangle &rectangle ) const /HoldGIL/; 108 109 110 void reserve( int size ) /HoldGIL/; 111%Docstring 112Attempts to allocate memory for at least ``size`` geometries. 113 114If the number of geometries is known in advance, calling this function prior to adding geometries will prevent 115reallocations and memory fragmentation. 116 117.. versionadded:: 3.10 118%End 119 120 virtual bool addGeometry( QgsAbstractGeometry *g /Transfer/ ); 121%Docstring 122Adds a geometry and takes ownership. Returns ``True`` in case of success. 123%End 124 125 virtual bool insertGeometry( QgsAbstractGeometry *g /Transfer/, int index ); 126%Docstring 127Inserts a geometry before a specified index and takes ownership. Returns ``True`` in case of success. 128 129:param g: geometry to insert. Ownership is transferred to the collection. 130:param index: position to insert geometry before 131%End 132 133 134 virtual bool removeGeometry( int nr ); 135%Docstring 136Removes a geometry from the collection by index. 137 138:return: ``True`` if removal was successful. 139 140:raises IndexError: if no geometry with the specified index exists. 141%End 142%MethodCode 143 const int count = sipCpp->numGeometries(); 144 if ( a0 < 0 || a0 >= count ) 145 { 146 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) ); 147 sipIsErr = 1; 148 } 149 else 150 { 151 return PyBool_FromLong( sipCpp->removeGeometry( a0 ) ); 152 } 153%End 154 155 void normalize() final /HoldGIL/; 156 virtual void transform( const QgsCoordinateTransform &ct, Qgis::TransformDirection d = Qgis::TransformDirection::Forward, bool transformZ = false ) throw( QgsCsException ); 157 158 virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 ); 159 160 161 virtual void draw( QPainter &p ) const; 162 163 virtual QPainterPath asQPainterPath() const; 164 165 166 virtual bool fromWkb( QgsConstWkbPtr &wkb ); 167 168 virtual bool fromWkt( const QString &wkt ); 169 170 171 virtual int wkbSize( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const; 172 173 virtual QByteArray asWkb( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const; 174 175 virtual QString asWkt( int precision = 17 ) const; 176 177 virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const; 178 179 virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const; 180 181 virtual QString asKml( int precision = 17 ) const; 182 183 184 virtual QgsRectangle boundingBox() const; 185 186 187 virtual QgsCoordinateSequence coordinateSequence() const; 188 189 virtual int nCoordinates() const; 190 191 192 virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, int *leftOf /Out/ = 0, double epsilon = 4 * DBL_EPSILON ) const; 193 194 virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex /Out/ ) const; 195 196 197 virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ); 198 199 virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ); 200 201 virtual bool deleteVertex( QgsVertexId position ); 202 203 204 virtual double length() const /HoldGIL/; 205 206 virtual double area() const /HoldGIL/; 207 208 virtual double perimeter() const /HoldGIL/; 209 210 211 virtual bool hasCurvedSegments() const /HoldGIL/; 212 213 214 virtual QgsAbstractGeometry *segmentize( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const /Factory/; 215 216%Docstring 217Returns a geometry without curves. Caller takes ownership 218 219:param tolerance: segmentation tolerance 220:param toleranceType: maximum segmentation angle or maximum difference between approximation and curve 221%End 222 223 virtual double vertexAngle( QgsVertexId vertex ) const; 224 225 virtual double segmentLength( QgsVertexId startVertex ) const; 226 227 virtual int vertexCount( int part = 0, int ring = 0 ) const; 228 229 virtual int ringCount( int part = 0 ) const; 230 231 virtual int partCount() const; 232 233 virtual QgsPoint vertexAt( QgsVertexId id ) const; 234 235 virtual bool isValid( QString &error /Out/, Qgis::GeometryValidityFlags flags = Qgis::GeometryValidityFlags() ) const; 236 237 238 virtual bool addZValue( double zValue = 0 ); 239 240 virtual bool addMValue( double mValue = 0 ); 241 242 virtual bool dropZValue(); 243 244 virtual bool dropMValue(); 245 246 virtual void swapXy(); 247 248 virtual QgsGeometryCollection *toCurveType() const /Factory/; 249 250 virtual const QgsAbstractGeometry *simplifiedTypeRef() const /HoldGIL/; 251 252 253 virtual bool transform( QgsAbstractGeometryTransformer *transformer, QgsFeedback *feedback = 0 ); 254 255 256 257 258 259 SIP_PYOBJECT __getitem__( int index ) /TypeHint="QgsAbstractGeometry"/; 260%Docstring 261Returns the geometry at the specified ``index``. 262 263Indexes can be less than 0, in which case they correspond to geometries from the end of the collect. E.g. an index of -1 264corresponds to the last geometry in the collection. 265 266:raises IndexError: if no geometry with the specified ``index`` exists. 267 268.. versionadded:: 3.6 269%End 270%MethodCode 271 const int count = sipCpp->numGeometries(); 272 if ( a0 < -count || a0 >= count ) 273 { 274 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) ); 275 sipIsErr = 1; 276 } 277 else if ( a0 >= 0 ) 278 { 279 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL ); 280 } 281 else 282 { 283 return sipConvertFromType( sipCpp->geometryN( count + a0 ), sipType_QgsAbstractGeometry, NULL ); 284 } 285%End 286 287 void __delitem__( int index ); 288%Docstring 289Deletes the geometry at the specified ``index``. 290 291Indexes can be less than 0, in which case they correspond to geometries from the end of the collection. E.g. an index of -1 292corresponds to the last geometry in the collection. 293 294:raises IndexError: if no geometry at the ``index`` exists 295 296.. versionadded:: 3.6 297%End 298%MethodCode 299 const int count = sipCpp->numGeometries(); 300 if ( a0 >= 0 && a0 < count ) 301 sipCpp->removeGeometry( a0 ); 302 else if ( a0 < 0 && a0 >= -count ) 303 sipCpp->removeGeometry( count + a0 ); 304 else 305 { 306 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) ); 307 sipIsErr = 1; 308 } 309%End 310 311 SIP_PYOBJECT __iter__() /TypeHint="QgsGeometryPartIterator"/; 312%Docstring 313Iterates through all geometries in the collection. 314 315.. versionadded:: 3.6 316%End 317%MethodCode 318 sipRes = sipConvertFromNewType( new QgsGeometryPartIterator( sipCpp ), sipType_QgsGeometryPartIterator, Py_None ); 319%End 320 321 virtual QgsGeometryCollection *createEmptyWithSameType() const /Factory/; 322 323 324 protected: 325 virtual int childCount() const; 326 327 virtual QgsAbstractGeometry *childGeometry( int index ) const; 328 329 int compareToSameClass( const QgsAbstractGeometry *other ) const final; 330 331 protected: 332 333 virtual bool wktOmitChildType() const; 334%Docstring 335Returns whether child type names are omitted from Wkt representations of the collection 336 337.. versionadded:: 2.12 338%End 339 340 bool fromCollectionWkt( const QString &wkt, const QVector<QgsAbstractGeometry *> &subtypes, const QString &defaultChildWkbType = QString() ); 341%Docstring 342Reads a collection from a WKT string. 343%End 344 345 virtual QgsRectangle calculateBoundingBox() const; 346 347 virtual void clearCache() const; 348 349 350}; 351 352 353/************************************************************************ 354 * This file has been generated automatically from * 355 * * 356 * src/core/geometry/qgsgeometrycollection.h * 357 * * 358 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 359 ************************************************************************/ 360