61 bool fuzzyHelper(
const QgsAbstractGeometry &other,
double epsilon,
bool useDistance )
const
64 if ( !otherCollection )
67 if ( mWkbType != otherCollection->
mWkbType )
70 if ( mGeometries.count() != otherCollection->
mGeometries.count() )
73 for (
int i = 0; i < mGeometries.count(); ++i )
87 if ( !( *g1 ).fuzzyDistanceEqual( *g2, epsilon ) )
94 if ( !( *g1 ).fuzzyEqual( *g2, epsilon ) )
107 return fuzzyHelper( other, epsilon,
false );
111 return fuzzyHelper( other, epsilon,
true );
131 sipRes = sipCpp->numGeometries();
135 int __bool__()
const;
168 if ( a0 < 0 || a0 >= sipCpp->numGeometries() )
170 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
175 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
185 void clear() override;
186 QgsGeometryCollection *snappedToGrid(
double hSpacing,
double vSpacing,
double dSpacing = 0,
double mSpacing = 0,
bool removeRedundantPoints = false ) const override
SIP_FACTORY;
187 bool removeDuplicateNodes(
double epsilon = 4 * std::numeric_limits<
double>::epsilon(),
bool useZValues = false ) override;
188 QgsAbstractGeometry *boundary() const override
SIP_FACTORY;
189 void adjacentVertices( QgsVertexId vertex, QgsVertexId &previousVertex
SIP_OUT, QgsVertexId &nextVertex
SIP_OUT ) const override;
190 int vertexNumberFromVertexId( QgsVertexId
id ) const override;
192 using QgsAbstractGeometry::boundingBoxIntersects;
193 bool boundingBoxIntersects( const QgsBox3D &box3d ) const override
SIP_HOLDGIL;
206 virtual
bool addGeometry( QgsAbstractGeometry *g
SIP_TRANSFER );
215 virtual
bool addGeometries( const QVector< QgsAbstractGeometry * > &geometries
SIP_TRANSFER );
222 virtual
bool insertGeometry( QgsAbstractGeometry *g
SIP_TRANSFER,
int index );
231 virtual bool removeGeometry(
int nr );
240 virtual bool removeGeometry(
int nr );
242 const int count = sipCpp->numGeometries();
243 if ( a0 < 0 || a0 >= count )
245 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
250 return PyBool_FromLong( sipCpp->removeGeometry( a0 ) );
261 QVector< QgsAbstractGeometry * > takeGeometries()
SIP_TRANSFER;
264 void transform( const QgsCoordinateTransform &ct, Qgis::TransformDirection d = Qgis::TransformDirection::Forward,
bool transformZ = false ) override
SIP_THROW( QgsCsException );
265 void transform( const QTransform &t,
double zTranslate = 0.0,
double zScale = 1.0,
double mTranslate = 0.0,
double mScale = 1.0 ) override;
267 void draw( QPainter &p ) const override;
268 QPainterPath asQPainterPath() const override;
270 bool fromWkb( QgsConstWkbPtr &wkb ) override;
271 bool fromWkt( const QString &wkt ) override;
273 int wkbSize( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const override;
274 QByteArray asWkb( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const override;
275 QString asWkt(
int precision = 17 ) const override;
276 QDomElement asGml2( QDomDocument &doc,
int precision = 17, const QString &ns =
"gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const override;
277 QDomElement asGml3( QDomDocument &doc,
int precision = 17, const QString &ns =
"gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const override;
278 json asJsonObject(
int precision = 17 ) const override
SIP_SKIP;
279 QString asKml(
int precision = 17 ) const override;
281 QgsBox3D boundingBox3D() const override;
284 int nCoordinates() const override;
286 double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt
SIP_OUT, QgsVertexId &vertexAfter
SIP_OUT,
int *leftOf
SIP_OUT =
nullptr,
double epsilon = 4 * std::numeric_limits<
double>::epsilon() ) const override;
287 bool nextVertex( QgsVertexId &
id, QgsPoint &vertex
SIP_OUT ) const override;
290 bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override;
291 bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override;
292 bool deleteVertex( QgsVertexId position ) override;
299 bool hasCurvedSegments() const override
SIP_HOLDGIL;
306 QgsAbstractGeometry *segmentize(
double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const override
SIP_FACTORY;
308 double vertexAngle( QgsVertexId vertex ) const override;
309 double segmentLength( QgsVertexId startVertex ) const override;
310 int vertexCount(
int part = 0,
int ring = 0 ) const override;
311 int ringCount(
int part = 0 ) const override;
312 int partCount() const override;
313 QgsPoint vertexAt( QgsVertexId
id ) const override;
314 bool isValid( QString &error
SIP_OUT, Qgis::GeometryValidityFlags flags = Qgis::GeometryValidityFlags() ) const override;
316 bool addZValue(
double zValue = 0 ) override;
317 bool addMValue(
double mValue = 0 ) override;
318 bool dropZValue() override;
319 bool dropMValue() override;
320 void swapXy() override;
321 QgsGeometryCollection *toCurveType() const override
SIP_FACTORY;
322 const QgsAbstractGeometry *simplifiedTypeRef() const override
SIP_HOLDGIL;
323 QgsGeometryCollection *simplifyByDistance(
double tolerance ) const override
SIP_FACTORY;
325 bool transform( QgsAbstractGeometryTransformer *transformer, QgsFeedback *feedback =
nullptr ) override;
328 void filterVertices(
const std::function<
bool(
const QgsPoint & ) > &filter )
override;
329 void transformVertices(
const std::function< QgsPoint(
const QgsPoint & ) > &transform )
override;
377 const int count = sipCpp->numGeometries();
378 if ( a0 < -count || a0 >= count )
380 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
385 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
389 return sipConvertFromType( sipCpp->geometryN( count + a0 ), sipType_QgsAbstractGeometry, NULL );
403 void __delitem__(
int index );
405 const int count = sipCpp->numGeometries();
406 if ( a0 >= 0 && a0 < count )
407 sipCpp->removeGeometry( a0 );
408 else if ( a0 < 0 && a0 >= -count )
409 sipCpp->removeGeometry( count + a0 );
412 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
422 SIP_PYOBJECT __iter__()
SIP_TYPEHINT( QgsGeometryPartIterator );
424 sipRes = sipConvertFromNewType( new QgsGeometryPartIterator( sipCpp ), sipType_QgsGeometryPartIterator, Py_None );
443 QgsGeometryCollection *createEmptyWithSameType() const override
SIP_FACTORY;
446 int childCount() const override;
447 QgsAbstractGeometry *childGeometry(
int index ) const override;
448 int compareToSameClass( const QgsAbstractGeometry *other ) const final;
461 SIP_SKIP bool fromCollectionWkt( const QString &wkt, const QVector<
Qgis::WkbType> &subtypes, const QString &defaultChildWkbType = QString() );
469 mutable
bool mHasCachedValidity = false;
470 mutable QString mValidityFailureReason;