52 bool fuzzyHelper(
const QgsAbstractGeometry &other,
double epsilon,
bool useDistance )
const
65 for (
int i = 0; i <
mPatches.count(); ++i )
74 !( *
mPatches.at( i ) ).fuzzyDistanceEqual( *otherPolygon->
mPatches.at( i ), epsilon ) )
80 !( *
mPatches.at( i ) ).fuzzyEqual( *otherPolygon->
mPatches.at( i ), epsilon ) )
92 return fuzzyHelper( other, epsilon,
false );
96 return fuzzyHelper( other, epsilon,
true );
114 void clear() override;
117 bool fromWkt( const QString &wkt ) override;
119 bool isValid( QString &error
SIP_OUT,
Qgis::GeometryValidityFlags flags =
Qgis::GeometryValidityFlags() ) const override;
123 QString asWkt(
int precision = 17 ) const override;
126 json asJsonObject(
int precision = 17 ) const override
SIP_SKIP;
127 QString asKml(
int precision = 17 ) const override;
134 QgsPolyhedralSurface *snappedToGrid(
double hSpacing,
double vSpacing,
double dSpacing = 0,
double mSpacing = 0,
bool removeRedundantPoints = false ) const override
SIP_FACTORY;
136 bool removeDuplicateNodes(
double epsilon = 4 * std::numeric_limits<
double>::epsilon(),
bool useZValues = false ) override;
160 if ( i < 0 || i >=
mPatches.size() )
174 if ( i < 0 || i >=
mPatches.size() )
191 if ( a0 < 0 || a0 >= sipCpp->numPatches() )
193 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
198 return sipConvertFromType(
const_cast< QgsPolygon *
>( sipCpp->patchN( a0 ) ), sipType_QgsPolygon, NULL );
206 virtual void setPatches(
const QVector<QgsPolygon *> &patches
SIP_TRANSFER );
211 virtual void addPatch( QgsPolygon *patch
SIP_TRANSFER );
221 bool removePatch(
int patchIndex );
231 bool removePatch(
int ringIndex );
233 if ( a0 < 0 || a0 >= sipCpp->numPatches() )
235 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
240 return PyBool_FromLong( sipCpp->removePatch( a0 ) );
246 void draw( QPainter &p )
const override;
248 void transform( const QTransform &t,
double zTranslate = 0.0,
double zScale = 1.0,
double mTranslate = 0.0,
double mScale = 1.0 ) override;
250 bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override;
251 bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override;
252 bool deleteVertex( QgsVertexId position ) override;
255 int nCoordinates() const override;
256 int vertexNumberFromVertexId( QgsVertexId
id ) const override;
258 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;
260 bool nextVertex( QgsVertexId &
id, QgsPoint &vertex
SIP_OUT ) const override;
261 void adjacentVertices( QgsVertexId vertex, QgsVertexId &previousVertex
SIP_OUT, QgsVertexId &nextVertex
SIP_OUT ) const override;
262 bool hasCurvedSegments() const final;
269 QgsAbstractGeometry *segmentize(
double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const override
SIP_FACTORY;
276 double vertexAngle( QgsVertexId vertex ) const override;
278 int vertexCount(
int part = 0,
int ring = 0 ) const override;
279 int ringCount(
int part = 0 ) const override
SIP_HOLDGIL;
281 QgsPoint vertexAt( QgsVertexId
id ) const override;
282 double segmentLength( QgsVertexId startVertex ) const override;
284 bool addZValue(
double zValue = 0 ) override;
285 bool addMValue(
double mValue = 0 ) override;
286 bool dropZValue() override;
287 bool dropMValue() override;
288 void swapXy() override;
290 QgsMultiSurface *toCurveType() const override
SIP_FACTORY;
292 bool transform( QgsAbstractGeometryTransformer *transformer, QgsFeedback *feedback =
nullptr ) override;
298 QgsMultiPolygon *toMultiPolygon() const
SIP_FACTORY;
301 void filterVertices(
const std::function<
bool(
const QgsPoint & ) > &filter )
override;
302 void transformVertices(
const std::function< QgsPoint(
const QgsPoint & ) > &transform )
override;
350 SIP_PYOBJECT __repr__();
352 QString wkt = sipCpp->asWkt();
353 if ( wkt.length() > 1000 )
354 wkt = wkt.left( 1000 ) + QStringLiteral(
"..." );
355 QString str = QStringLiteral(
"<QgsPolyhedralSurface: %1>" ).arg( wkt );
356 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
364 sipRes = sipCpp->numPatches();
377 const int count = sipCpp->numPatches();
378 if ( a0 < -count || a0 >= count )
380 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
385 return sipConvertFromType( sipCpp->patchN( a0 ), sipType_QgsPolygon, NULL );
389 return sipConvertFromType( sipCpp->patchN( count + a0 ), sipType_QgsPolygon, NULL );
397 QgsAbstractGeometry *
childGeometry(
int index )
const override;