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 );
132 sipRes = sipCpp->numGeometries();
136 int __bool__()
const;
171 if ( a0 < 0 || a0 >= sipCpp->numGeometries() )
173 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
178 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
189 void clear() override;
190 QgsGeometryCollection *snappedToGrid(
double hSpacing,
double vSpacing,
double dSpacing = 0,
double mSpacing = 0,
bool removeRedundantPoints = false ) const override
SIP_FACTORY;
191 bool removeDuplicateNodes(
double epsilon = 4 * std::numeric_limits<
double>::epsilon(),
bool useZValues = false ) override;
192 QgsAbstractGeometry *boundary() const override
SIP_FACTORY;
193 void adjacentVertices( QgsVertexId vertex, QgsVertexId &previousVertex
SIP_OUT, QgsVertexId &nextVertex
SIP_OUT ) const override;
194 int vertexNumberFromVertexId( QgsVertexId
id ) const override;
196 using QgsAbstractGeometry::boundingBoxIntersects;
197 bool boundingBoxIntersects( const QgsBox3D &box3d ) const override
SIP_HOLDGIL;
210 virtual
bool addGeometry( QgsAbstractGeometry *g
SIP_TRANSFER );
219 virtual
bool addGeometries( const QVector< QgsAbstractGeometry * > &geometries
SIP_TRANSFER );
226 virtual
bool insertGeometry( QgsAbstractGeometry *g
SIP_TRANSFER,
int index );
235 virtual bool removeGeometry(
int nr );
245 virtual bool removeGeometry(
int nr );
247 const int count = sipCpp->numGeometries();
248 if ( a0 < 0 || a0 >= count )
250 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
255 return PyBool_FromLong( sipCpp->removeGeometry( a0 ) );
267 QVector< QgsAbstractGeometry * > takeGeometries()
SIP_TRANSFER;
270 void transform( const QgsCoordinateTransform &ct, Qgis::TransformDirection d = Qgis::TransformDirection::Forward,
bool transformZ = false ) override
SIP_THROW( QgsCsException );
271 void transform( const QTransform &t,
double zTranslate = 0.0,
double zScale = 1.0,
double mTranslate = 0.0,
double mScale = 1.0 ) override;
273 void draw( QPainter &p ) const override;
274 QPainterPath asQPainterPath() const override;
276 bool fromWkb( QgsConstWkbPtr &wkb ) override;
277 bool fromWkt( const QString &wkt ) override;
279 int wkbSize( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const override;
280 QByteArray asWkb( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const override;
281 QString asWkt(
int precision = 17 ) const override;
282 QDomElement asGml2( QDomDocument &doc,
int precision = 17, const QString &ns =
"gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const override;
283 QDomElement asGml3( QDomDocument &doc,
int precision = 17, const QString &ns =
"gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const override;
284 json asJsonObject(
int precision = 17 ) const override
SIP_SKIP;
285 QString asKml(
int precision = 17 ) const override;
287 QgsBox3D boundingBox3D() const override;
290 int nCoordinates() const override;
292 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;
293 bool nextVertex( QgsVertexId &
id, QgsPoint &vertex
SIP_OUT ) const override;
296 bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override;
297 bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override;
298 bool deleteVertex( QgsVertexId position ) override;
305 bool hasCurvedSegments() const override
SIP_HOLDGIL;
312 QgsAbstractGeometry *segmentize(
double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const override
SIP_FACTORY;
314 double vertexAngle( QgsVertexId vertex ) const override;
315 double segmentLength( QgsVertexId startVertex ) const override;
316 int vertexCount(
int part = 0,
int ring = 0 ) const override;
317 int ringCount(
int part = 0 ) const override;
318 int partCount() const override;
319 QgsPoint vertexAt( QgsVertexId
id ) const override;
320 bool isValid( QString &error
SIP_OUT, Qgis::GeometryValidityFlags flags = Qgis::GeometryValidityFlags() ) const override;
322 bool addZValue(
double zValue = 0 ) override;
323 bool addMValue(
double mValue = 0 ) override;
324 bool dropZValue() override;
325 bool dropMValue() override;
326 void swapXy() override;
327 QgsGeometryCollection *toCurveType() const override
SIP_FACTORY;
328 const QgsAbstractGeometry *simplifiedTypeRef() const override
SIP_HOLDGIL;
329 QgsGeometryCollection *simplifyByDistance(
double tolerance ) const override
SIP_FACTORY;
331 bool transform( QgsAbstractGeometryTransformer *transformer, QgsFeedback *feedback =
nullptr ) override;
334 void filterVertices(
const std::function<
bool(
const QgsPoint & ) > &filter )
override;
335 void transformVertices(
const std::function< QgsPoint(
const QgsPoint & ) > &transform )
override;
384 const int count = sipCpp->numGeometries();
385 if ( a0 < -count || a0 >= count )
387 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
392 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
396 return sipConvertFromType( sipCpp->geometryN( count + a0 ), sipType_QgsAbstractGeometry, NULL );
410 void __delitem__(
int index );
412 const int count = sipCpp->numGeometries();
413 if ( a0 >= 0 && a0 < count )
414 sipCpp->removeGeometry( a0 );
415 else if ( a0 < 0 && a0 >= -count )
416 sipCpp->removeGeometry( count + a0 );
419 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
429 SIP_PYOBJECT __iter__()
SIP_TYPEHINT( QgsGeometryPartIterator );
431 sipRes = sipConvertFromNewType( new QgsGeometryPartIterator( sipCpp ), sipType_QgsGeometryPartIterator, Py_None );
451 QgsGeometryCollection *createEmptyWithSameType() const override
SIP_FACTORY;
454 int childCount() const override;
455 QgsAbstractGeometry *childGeometry(
int index ) const override;
456 int compareToSameClass( const QgsAbstractGeometry *other ) const final;
469 SIP_SKIP bool fromCollectionWkt( const QString &wkt, const QVector<
Qgis::WkbType> &subtypes, const QString &defaultChildWkbType = QString() );
477 mutable
bool mHasCachedValidity = false;
478 mutable QString mValidityFailureReason;