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;
298 bool hasCurvedSegments() const override
SIP_HOLDGIL;
305 QgsAbstractGeometry *segmentize(
double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const override
SIP_FACTORY;
307 double vertexAngle( QgsVertexId vertex ) const override;
308 double segmentLength( QgsVertexId startVertex ) const override;
309 int vertexCount(
int part = 0,
int ring = 0 ) const override;
310 int ringCount(
int part = 0 ) const override;
311 int partCount() const override;
312 QgsPoint vertexAt( QgsVertexId
id ) const override;
313 bool isValid( QString &error
SIP_OUT, Qgis::GeometryValidityFlags flags = Qgis::GeometryValidityFlags() ) const override;
315 bool addZValue(
double zValue = 0 ) override;
316 bool addMValue(
double mValue = 0 ) override;
317 bool dropZValue() override;
318 bool dropMValue() override;
319 void swapXy() override;
320 QgsGeometryCollection *toCurveType() const override
SIP_FACTORY;
321 const QgsAbstractGeometry *simplifiedTypeRef() const override
SIP_HOLDGIL;
322 QgsGeometryCollection *simplifyByDistance(
double tolerance ) const override
SIP_FACTORY;
324 bool transform( QgsAbstractGeometryTransformer *transformer, QgsFeedback *feedback =
nullptr ) override;
327 void filterVertices(
const std::function<
bool(
const QgsPoint & ) > &filter )
override;
328 void transformVertices(
const std::function< QgsPoint(
const QgsPoint & ) > &transform )
override;
376 const int count = sipCpp->numGeometries();
377 if ( a0 < -count || a0 >= count )
379 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
384 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
388 return sipConvertFromType( sipCpp->geometryN( count + a0 ), sipType_QgsAbstractGeometry, NULL );
402 void __delitem__(
int index );
404 const int count = sipCpp->numGeometries();
405 if ( a0 >= 0 && a0 < count )
406 sipCpp->removeGeometry( a0 );
407 else if ( a0 < 0 && a0 >= -count )
408 sipCpp->removeGeometry( count + a0 );
411 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
421 SIP_PYOBJECT __iter__()
SIP_TYPEHINT( QgsGeometryPartIterator );
423 sipRes = sipConvertFromNewType( new QgsGeometryPartIterator( sipCpp ), sipType_QgsGeometryPartIterator, Py_None );
442 QgsGeometryCollection *createEmptyWithSameType() const override
SIP_FACTORY;
445 int childCount() const override;
446 QgsAbstractGeometry *childGeometry(
int index ) const override;
447 int compareToSameClass( const QgsAbstractGeometry *other ) const final;
460 SIP_SKIP bool fromCollectionWkt( const QString &wkt, const QVector<
Qgis::WkbType> &subtypes, const QString &defaultChildWkbType = QString() );
468 mutable
bool mHasCachedValidity = false;
469 mutable QString mValidityFailureReason;