18#ifndef QGSTRIANGULATEDSURFACE_H
19#define QGSTRIANGULATEDSURFACE_H
46 bool fuzzyHelper(
const QgsAbstractGeometry &other,
double epsilon,
bool useDistance )
const
48 const QgsTriangulatedSurface *otherTriangulatedSurface = qgsgeometry_cast< const QgsTriangulatedSurface * >( &other );
49 if ( !otherTriangulatedSurface )
53 if ( mWkbType != otherTriangulatedSurface->
mWkbType )
56 if ( mPatches.count() != otherTriangulatedSurface->
mPatches.count() )
59 for (
int i = 0; i < mPatches.count(); ++i )
61 if ( ( !mPatches.at( i ) && otherTriangulatedSurface->
mPatches.at( i ) ) ||
62 ( mPatches.at( i ) && !otherTriangulatedSurface->
mPatches.at( i ) ) )
67 if ( mPatches.at( i ) && otherTriangulatedSurface->
mPatches.at( i ) &&
68 !( *mPatches.at( i ) ).fuzzyDistanceEqual( *otherTriangulatedSurface->
mPatches.at( i ), epsilon ) )
73 if ( mPatches.at( i ) && otherTriangulatedSurface->
mPatches.at( i ) &&
74 !( *mPatches.at( i ) ).fuzzyEqual( *otherTriangulatedSurface->
mPatches.at( i ), epsilon ) )
86 return fuzzyHelper( other, epsilon,
false );
90 return fuzzyHelper( other, epsilon,
true );
107 void clear() override;
110 bool fromWkt( const QString &wkt ) override;
114 QString asKml(
int precision = 17 ) const override;
118 QgsTriangulatedSurface *snappedToGrid(
double hSpacing,
double vSpacing,
double dSpacing = 0,
double mSpacing = 0,
bool removeRedundantPoints = false ) const override
SIP_FACTORY;
121 bool deleteVertex(
QgsVertexId position ) override;
153 if ( a0 < 0 || a0 >= sipCpp->numPatches() )
155 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
160 return sipConvertFromType( sipCpp->triangleN( a0 ), sipType_QgsTriangle, NULL );
195 SIP_PYOBJECT __repr__();
197 QString wkt = sipCpp->asWkt();
198 if ( wkt.length() > 1000 )
199 wkt = wkt.left( 1000 ) + QStringLiteral(
"..." );
200 QString
str = QStringLiteral(
"<QgsTriangulatedSurface: %1>" ).arg( wkt );
201 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
Abstract base class for all geometries.
Qgis::WkbType wkbType() const
Returns the WKB type of the geometry.
Point geometry type, with support for z-dimension and m-values.
Polyhedral surface geometry type.
QVector< QgsPolygon * > mPatches
QString geometryType() const override
Returns a unique string representing the geometry type.
int compareToSameClass(const QgsAbstractGeometry *other) const override
Compares to an other geometry of the same class, and returns a integer for sorting of the two geometr...
QgsPolyhedralSurface * createEmptyWithSameType() const override
Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
bool fuzzyEqual(const QgsAbstractGeometry &other, double epsilon=1e-8) const override
Performs fuzzy comparison between this geometry and other using an epsilon.
bool operator==(const QgsAbstractGeometry &other) const override
QgsPolyhedralSurface & operator=(const QgsPolyhedralSurface &p)
Triangulated surface geometry type.
bool operator!=(const QgsAbstractGeometry &other) const override
bool fuzzyEqual(const QgsAbstractGeometry &other, double epsilon=1e-8) const override
Performs fuzzy comparison between this geometry and other using an epsilon.
bool fuzzyDistanceEqual(const QgsAbstractGeometry &other, double epsilon=1e-8) const override
Performs fuzzy distance comparison between this geometry and other using an epsilon.
static const QgsTriangulatedSurface * cast(const QgsAbstractGeometry *geom)
Cast the geom to a QgsTriangulatedSurface.
bool operator==(const QgsAbstractGeometry &other) const override
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
#define SIP_TYPEHINT(type)
Utility class for identifying a unique vertex within a geometry.