56 bool fuzzyHelper(
const QgsAbstractGeometry &other,
double epsilon,
bool useDistance )
const
69 for (
int i = 0; i <
mPatches.count(); ++i )
78 !( *
mPatches.at( i ) ).fuzzyDistanceEqual( *otherPolygon->
mPatches.at( i ), epsilon ) )
84 !( *
mPatches.at( i ) ).fuzzyEqual( *otherPolygon->
mPatches.at( i ), epsilon ) )
96 return fuzzyHelper( other, epsilon,
false );
100 return fuzzyHelper( other, epsilon,
true );
118 void clear() override;
121 bool fromWkt( const QString &wkt ) override;
123 bool isValid( QString &error
SIP_OUT,
Qgis::GeometryValidityFlags flags =
Qgis::GeometryValidityFlags() ) const override;
127 QString asWkt(
int precision = 17 ) const override;
130 json asJsonObject(
int precision = 17 ) const override
SIP_SKIP;
131 QString asKml(
int precision = 17 ) const override;
139 QgsPolyhedralSurface *snappedToGrid(
double hSpacing,
double vSpacing,
double dSpacing = 0,
double mSpacing = 0,
bool removeRedundantPoints = false ) const override
SIP_FACTORY;
141 bool removeDuplicateNodes(
double epsilon = 4 * std::numeric_limits<
double>::epsilon(),
bool useZValues = false ) override;
165 if ( i < 0 || i >=
mPatches.size() )
179 if ( i < 0 || i >=
mPatches.size() )
196 if ( a0 < 0 || a0 >= sipCpp->numPatches() )
198 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
203 return sipConvertFromType(
const_cast< QgsPolygon *
>( sipCpp->patchN( a0 ) ), sipType_QgsPolygon, NULL );
211 virtual void setPatches(
const QVector<QgsPolygon *> &patches
SIP_TRANSFER );
216 virtual void addPatch( QgsPolygon *patch
SIP_TRANSFER );
226 bool removePatch(
int patchIndex );
236 bool removePatch(
int ringIndex );
238 if ( a0 < 0 || a0 >= sipCpp->numPatches() )
240 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
245 return PyBool_FromLong( sipCpp->removePatch( a0 ) );
251 void draw( QPainter &p )
const override;
253 void transform( const QTransform &t,
double zTranslate = 0.0,
double zScale = 1.0,
double mTranslate = 0.0,
double mScale = 1.0 ) override;
255 bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override;
256 bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override;
257 bool deleteVertex( QgsVertexId position ) override;
260 int nCoordinates() const override;
261 int vertexNumberFromVertexId( QgsVertexId
id ) const override;
263 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;
265 bool nextVertex( QgsVertexId &
id, QgsPoint &vertex
SIP_OUT ) const override;
266 void adjacentVertices( QgsVertexId vertex, QgsVertexId &previousVertex
SIP_OUT, QgsVertexId &nextVertex
SIP_OUT ) const override;
267 bool hasCurvedSegments() const final;
274 QgsAbstractGeometry *segmentize(
double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const override
SIP_FACTORY;
281 double vertexAngle( QgsVertexId vertex ) const override;
283 int vertexCount(
int part = 0,
int ring = 0 ) const override;
284 int ringCount(
int part = 0 ) const override
SIP_HOLDGIL;
286 QgsPoint vertexAt( QgsVertexId
id ) const override;
287 double segmentLength( QgsVertexId startVertex ) const override;
289 bool addZValue(
double zValue = 0 ) override;
290 bool addMValue(
double mValue = 0 ) override;
291 bool dropZValue() override;
292 bool dropMValue() override;
293 void swapXy() override;
295 QgsMultiSurface *toCurveType() const override
SIP_FACTORY;
297 bool transform( QgsAbstractGeometryTransformer *transformer, QgsFeedback *feedback =
nullptr ) override;
303 QgsMultiPolygon *toMultiPolygon() const
SIP_FACTORY;
306 void filterVertices(
const std::function<
bool(
const QgsPoint & ) > &filter )
override;
307 void transformVertices(
const std::function< QgsPoint(
const QgsPoint & ) > &transform )
override;
355 SIP_PYOBJECT __repr__();
357 QString wkt = sipCpp->asWkt();
358 if ( wkt.length() > 1000 )
359 wkt = wkt.left( 1000 ) + u
"..."_s;
360 QString str = u
"<QgsPolyhedralSurface: %1>"_s.arg( wkt );
361 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
369 sipRes = sipCpp->numPatches();
382 const int count = sipCpp->numPatches();
383 if ( a0 < -count || a0 >= count )
385 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
390 return sipConvertFromType( sipCpp->patchN( a0 ), sipType_QgsPolygon, NULL );
394 return sipConvertFromType( sipCpp->patchN( count + a0 ), sipType_QgsPolygon, NULL );
402 QgsAbstractGeometry *
childGeometry(
int index )
const override;