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;
158 if ( i < 0 || i >=
mPatches.size() )
172 if ( i < 0 || i >=
mPatches.size() )
189 if ( a0 < 0 || a0 >= sipCpp->numPatches() )
191 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
196 return sipConvertFromType(
const_cast< QgsPolygon *
>( sipCpp->patchN( a0 ) ), sipType_QgsPolygon, NULL );
204 virtual void setPatches(
const QVector<QgsPolygon *> &patches
SIP_TRANSFER );
209 virtual void addPatch( QgsPolygon *patch
SIP_TRANSFER );
219 bool removePatch(
int patchIndex );
229 bool removePatch(
int ringIndex );
231 if ( a0 < 0 || a0 >= sipCpp->numPatches() )
233 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
238 return PyBool_FromLong( sipCpp->removePatch( a0 ) );
244 void draw( QPainter &p )
const override;
246 void transform( const QTransform &t,
double zTranslate = 0.0,
double zScale = 1.0,
double mTranslate = 0.0,
double mScale = 1.0 ) override;
248 bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override;
249 bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override;
250 bool deleteVertex( QgsVertexId position ) override;
253 int nCoordinates() const override;
254 int vertexNumberFromVertexId( QgsVertexId
id ) const override;
256 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;
258 bool nextVertex( QgsVertexId &
id, QgsPoint &vertex
SIP_OUT ) const override;
259 void adjacentVertices( QgsVertexId vertex, QgsVertexId &previousVertex
SIP_OUT, QgsVertexId &nextVertex
SIP_OUT ) const override;
260 bool hasCurvedSegments() const final;
267 QgsAbstractGeometry *segmentize(
double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const override
SIP_FACTORY;
274 double vertexAngle( QgsVertexId vertex ) const override;
276 int vertexCount(
int part = 0,
int ring = 0 ) const override;
277 int ringCount(
int part = 0 ) const override
SIP_HOLDGIL;
279 QgsPoint vertexAt( QgsVertexId
id ) const override;
280 double segmentLength( QgsVertexId startVertex ) const override;
282 bool addZValue(
double zValue = 0 ) override;
283 bool addMValue(
double mValue = 0 ) override;
284 bool dropZValue() override;
285 bool dropMValue() override;
286 void swapXy() override;
288 QgsMultiSurface *toCurveType() const override
SIP_FACTORY;
290 bool transform( QgsAbstractGeometryTransformer *transformer, QgsFeedback *feedback =
nullptr ) override;
296 QgsMultiPolygon *toMultiPolygon() const
SIP_FACTORY;
299 void filterVertices(
const std::function<
bool(
const QgsPoint & ) > &filter )
override;
300 void transformVertices(
const std::function< QgsPoint(
const QgsPoint & ) > &transform )
override;
348 SIP_PYOBJECT __repr__();
350 QString wkt = sipCpp->asWkt();
351 if ( wkt.length() > 1000 )
352 wkt = wkt.left( 1000 ) + QStringLiteral(
"..." );
353 QString str = QStringLiteral(
"<QgsPolyhedralSurface: %1>" ).arg( wkt );
354 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
362 sipRes = sipCpp->numPatches();
375 const int count = sipCpp->numPatches();
376 if ( a0 < -count || a0 >= count )
378 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
383 return sipConvertFromType( sipCpp->patchN( a0 ), sipType_QgsPolygon, NULL );
387 return sipConvertFromType( sipCpp->patchN( count + a0 ), sipType_QgsPolygon, NULL );
395 QgsAbstractGeometry *
childGeometry(
int index )
const override;