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;
299 bool deleteVertices( const QSet<QgsVertexId> &positions ) override;
300 bool hasVertex( QgsVertexId position ) const override;
307 bool hasCurvedSegments() const override
SIP_HOLDGIL;
314 QgsAbstractGeometry *segmentize(
double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const override
SIP_FACTORY;
316 double vertexAngle( QgsVertexId vertex ) const override;
317 double segmentLength( QgsVertexId startVertex ) const override;
318 int vertexCount(
int part = 0,
int ring = 0 ) const override;
319 int ringCount(
int part = 0 ) const override;
320 int partCount() const override;
321 QgsPoint vertexAt( QgsVertexId
id ) const override;
322 bool isValid( QString &error
SIP_OUT, Qgis::GeometryValidityFlags flags = Qgis::GeometryValidityFlags() ) const override;
324 bool addZValue(
double zValue = 0 ) override;
325 bool addMValue(
double mValue = 0 ) override;
326 bool dropZValue() override;
327 bool dropMValue() override;
328 void swapXy() override;
329 QgsGeometryCollection *toCurveType() const override
SIP_FACTORY;
330 const QgsAbstractGeometry *simplifiedTypeRef() const override
SIP_HOLDGIL;
331 QgsGeometryCollection *simplifyByDistance(
double tolerance ) const override
SIP_FACTORY;
333 bool transform( QgsAbstractGeometryTransformer *transformer, QgsFeedback *feedback =
nullptr ) override;
336 void filterVertices(
const std::function<
bool(
const QgsPoint & ) > &filter )
override;
337 void transformVertices(
const std::function< QgsPoint(
const QgsPoint & ) > &transform )
override;
386 const int count = sipCpp->numGeometries();
387 if ( a0 < -count || a0 >= count )
389 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
394 return sipConvertFromType( sipCpp->geometryN( a0 ), sipType_QgsAbstractGeometry, NULL );
398 return sipConvertFromType( sipCpp->geometryN( count + a0 ), sipType_QgsAbstractGeometry, NULL );
412 void __delitem__(
int index );
414 const int count = sipCpp->numGeometries();
415 if ( a0 >= 0 && a0 < count )
416 sipCpp->removeGeometry( a0 );
417 else if ( a0 < 0 && a0 >= -count )
418 sipCpp->removeGeometry( count + a0 );
421 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
431 SIP_PYOBJECT __iter__()
SIP_TYPEHINT( QgsGeometryPartIterator );
433 sipRes = sipConvertFromNewType( new QgsGeometryPartIterator( sipCpp ), sipType_QgsGeometryPartIterator, Py_None );
453 QgsGeometryCollection *createEmptyWithSameType() const override
SIP_FACTORY;
456 int childCount() const override;
457 QgsAbstractGeometry *childGeometry(
int index ) const override;
458 int compareToSameClass( const QgsAbstractGeometry *other ) const final;
471 SIP_SKIP bool fromCollectionWkt( const QString &wkt, const QVector<
Qgis::WkbType> &subtypes, const QString &defaultChildWkbType = QString() );
479 mutable
bool mHasCachedValidity = false;
480 mutable QString mValidityFailureReason;