18#ifndef QGSPOLYHEDRALSURFACE_H 
   19#define QGSPOLYHEDRALSURFACE_H 
   53    bool fuzzyHelper( 
const QgsAbstractGeometry &other, 
double epsilon, 
bool useDistance )
 const 
   55      const QgsPolyhedralSurface *otherPolygon = qgsgeometry_cast< const QgsPolyhedralSurface * >( &other );
 
   60      if ( mWkbType != otherPolygon->
mWkbType )
 
   63      if ( mPatches.count() != otherPolygon->
mPatches.count() )
 
   66      for ( 
int i = 0; i < mPatches.count(); ++i )
 
   68        if ( ( !mPatches.at( i ) && otherPolygon->
mPatches.at( i ) ) ||
 
   69             ( mPatches.at( i ) && !otherPolygon->
mPatches.at( i ) ) )
 
   74          if ( mPatches.at( i ) && otherPolygon->
mPatches.at( i ) &&
 
   75               !( *mPatches.at( i ) ).fuzzyDistanceEqual( *otherPolygon->
mPatches.at( i ), epsilon ) )
 
   80          if ( mPatches.at( i ) && otherPolygon->
mPatches.at( i ) &&
 
   81               !( *mPatches.at( i ) ).fuzzyEqual( *otherPolygon->
mPatches.at( i ), epsilon ) )
 
   93      return fuzzyHelper( other, epsilon, 
false );
 
 
   97      return fuzzyHelper( other, epsilon, 
true );
 
 
  115    void clear() override;
 
  118    bool fromWkt( const QString &wkt ) override;
 
  120    bool isValid( QString &error 
SIP_OUT, 
Qgis::GeometryValidityFlags flags = 
Qgis::GeometryValidityFlags() ) const override;
 
  124    QString asWkt( 
int precision = 17 ) const override;
 
  128    QString asKml( 
int precision = 17 ) const override;
 
  135    QgsPolyhedralSurface *snappedToGrid( 
double hSpacing, 
double vSpacing, 
double dSpacing = 0, 
double mSpacing = 0, 
bool removeRedundantPoints = false ) const override 
SIP_FACTORY;
 
  137    bool removeDuplicateNodes( 
double epsilon = 4 * std::numeric_limits<
double>::epsilon(), 
bool useZValues = false ) override;
 
  147      return mPatches.size();
 
 
  159      if ( i < 0 || i >= mPatches.size() )
 
  163      return mPatches.at( i );
 
 
  173      if ( i < 0 || i >= mPatches.size() )
 
  177      return mPatches.at( i );
 
 
  190    if ( a0 < 0 || a0 >= sipCpp->numPatches() )
 
  192      PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
 
  197      return sipConvertFromType( 
const_cast< QgsPolygon * 
>( sipCpp->patchN( a0 ) ), sipType_QgsPolygon, NULL );
 
  205    virtual void setPatches( 
const QVector<QgsPolygon *> &patches 
SIP_TRANSFER );
 
  220    bool removePatch( 
int patchIndex );
 
  230    bool removePatch( 
int ringIndex );
 
  232    if ( a0 < 0 || a0 >= sipCpp->numPatches() )
 
  234      PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
 
  239      return PyBool_FromLong( sipCpp->removePatch( a0 ) );
 
  245    void draw( QPainter &p ) 
const override;
 
  247    void transform( const QTransform &t, 
double zTranslate = 0.0, 
double zScale = 1.0, 
double mTranslate = 0.0, 
double mScale = 1.0 ) override;
 
  251    bool deleteVertex( 
QgsVertexId position ) override;
 
  254    int nCoordinates() const override;
 
  255    int vertexNumberFromVertexId( 
QgsVertexId id ) const override;
 
  261    bool hasCurvedSegments() const final;
 
  268    QgsAbstractGeometry *segmentize( 
double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const override 
SIP_FACTORY;
 
  275    double vertexAngle( 
QgsVertexId vertex ) const override;
 
  277    int vertexCount( 
int part = 0, 
int ring = 0 ) const override;
 
  278    int ringCount( 
int part = 0 ) const override 
SIP_HOLDGIL;
 
  281    double segmentLength( 
QgsVertexId startVertex ) const override;
 
  283    bool addZValue( 
double zValue = 0 ) override;
 
  284    bool addMValue( 
double mValue = 0 ) override;
 
  285    bool dropZValue() override;
 
  286    bool dropMValue() override;
 
  287    void swapXy() override;
 
  349    SIP_PYOBJECT __repr__();
 
  351    QString wkt = sipCpp->asWkt();
 
  352    if ( wkt.length() > 1000 )
 
  353      wkt = wkt.left( 1000 ) + QStringLiteral( 
"..." );
 
  354    QString str = QStringLiteral( 
"<QgsPolyhedralSurface: %1>" ).arg( wkt );
 
  355    sipRes = PyUnicode_FromString( str.toUtf8().constData() );
 
  363    sipRes = sipCpp->numPatches();
 
  376    const int count = sipCpp->numPatches();
 
  377    if ( a0 < -count || a0 >= count )
 
  379      PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
 
  384      return sipConvertFromType( sipCpp->patchN( a0 ), sipType_QgsPolygon, NULL );
 
  388      return sipConvertFromType( sipCpp->patchN( count + a0 ), sipType_QgsPolygon, NULL );
 
 
Provides global constants and enumerations for use throughout the application.
 
WkbType
The WKB type describes the number of dimensions a geometry has.
 
@ PolyhedralSurface
PolyhedralSurface.
 
TransformDirection
Indicates the direction (forward or inverse) of a transform.
 
@ Forward
Forward transform (from source to destination)
 
Abstract base class for all geometries.
 
virtual QgsBox3D calculateBoundingBox3D() const
Calculates the minimal 3D bounding box for the geometry.
 
virtual void draw(QPainter &p) const =0
Draws the geometry using the specified QPainter.
 
virtual int childCount() const
Returns number of child geometries (for geometries with child geometries) or child points (for geomet...
 
virtual void transformVertices(const std::function< QgsPoint(const QgsPoint &) > &transform)
Transforms the vertices from the geometry in place, applying the transform function to every vertex.
 
virtual QString geometryType() const =0
Returns a unique string representing the geometry type.
 
virtual QgsAbstractGeometry * createEmptyWithSameType() const =0
Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
 
QgsAbstractGeometry & operator=(const QgsAbstractGeometry &geom)
 
Qgis::WkbType wkbType() const
Returns the WKB type of the geometry.
 
virtual bool fuzzyEqual(const QgsAbstractGeometry &other, double epsilon=1e-8) const =0
Performs fuzzy comparison between this geometry and other using an epsilon.
 
virtual QPainterPath asQPainterPath() const =0
Returns the geometry represented as a QPainterPath.
 
virtual void transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection d=Qgis::TransformDirection::Forward, bool transformZ=false)=0
Transforms the geometry using a coordinate transform.
 
virtual void filterVertices(const std::function< bool(const QgsPoint &) > &filter)
Filters the vertices from the geometry in place, removing any which do not return true for the filter...
 
virtual QgsAbstractGeometry * childGeometry(int index) const
Returns pointer to child geometry (for geometries with child geometries - i.e.
 
virtual bool operator==(const QgsAbstractGeometry &other) const =0
 
virtual int compareToSameClass(const QgsAbstractGeometry *other) const =0
Compares to an other geometry of the same class, and returns a integer for sorting of the two geometr...
 
A 3-dimensional box composed of x, y, z coordinates.
 
Custom exception class for Coordinate Reference System related exceptions.
 
Base class for feedback objects to be used for cancellation of something running in a worker thread.
 
Multi polygon geometry collection.
 
Multi surface geometry collection.
 
Point geometry type, with support for z-dimension and m-values.
 
Polyhedral surface geometry type.
 
bool operator!=(const QgsAbstractGeometry &other) const override
 
QVector< QgsPolygon * > mPatches
 
bool fuzzyDistanceEqual(const QgsAbstractGeometry &other, double epsilon=1e-8) const override
Performs fuzzy distance comparison between this geometry and other using an epsilon.
 
static QgsPolyhedralSurface * cast(QgsAbstractGeometry *geom)
Cast the geom to a QgsPolyhedralSurface.
 
static const QgsPolyhedralSurface * cast(const QgsAbstractGeometry *geom)
Cast the geom to a QgsPolyhedralSurface.
 
QgsPolygon * patchN(int i)
Retrieves a patch from the polyhedral surface.
 
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
 
const QgsPolygon * patchN(int i) const
Retrieves a patch from the polyhedral surface.
 
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
 
#define SIP_TYPEHINT(type)
 
#define SIP_THROW(name,...)
 
QVector< QgsRingSequence > QgsCoordinateSequence
 
double closestSegment(const QgsPolylineXY &pl, const QgsPointXY &pt, int &vertexAfter, double epsilon)
 
Utility class for identifying a unique vertex within a geometry.