QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QgsSurface Class Reference

Surface geometry type. More...

#include <qgssurface.h>

Inheritance diagram for QgsSurface:
Inheritance graph
[legend]

Public Member Functions

QgsBox3D boundingBox3D () const override
 Returns the 3D bounding box for the geometry.
 
bool isValid (QString &error, Qgis::GeometryValidityFlags flags=Qgis::GeometryValidityFlags()) const override
 Checks validity of the geometry, and returns true if the geometry is valid.
 
- Public Member Functions inherited from QgsAbstractGeometry
 QgsAbstractGeometry ()=default
 
 QgsAbstractGeometry (const QgsAbstractGeometry &geom)
 
virtual ~QgsAbstractGeometry ()=default
 
virtual bool addMValue (double mValue=0)=0
 Adds a measure to the geometry, initialized to a preset value.
 
virtual bool addZValue (double zValue=0)=0
 Adds a z-dimension to the geometry, initialized to a preset value.
 
virtual void adjacentVertices (QgsVertexId vertex, QgsVertexId &previousVertex, QgsVertexId &nextVertex) const =0
 Returns the vertices adjacent to a specified vertex within a geometry.
 
virtual double area () const
 Returns the planar, 2-dimensional area of the geometry.
 
virtual QDomElement asGml2 (QDomDocument &doc, int precision=17, const QString &ns="gml", AxisOrder axisOrder=QgsAbstractGeometry::AxisOrder::XY) const =0
 Returns a GML2 representation of the geometry.
 
virtual QDomElement asGml3 (QDomDocument &doc, int precision=17, const QString &ns="gml", AxisOrder axisOrder=QgsAbstractGeometry::AxisOrder::XY) const =0
 Returns a GML3 representation of the geometry.
 
QString asJson (int precision=17)
 Returns a GeoJSON representation of the geometry as a QString.
 
virtual json asJsonObject (int precision=17) const
 Returns a json object representation of the geometry.
 
virtual QString asKml (int precision=17) const =0
 Returns a KML representation of the geometry.
 
virtual QPainterPath asQPainterPath () const =0
 Returns the geometry represented as a QPainterPath.
 
virtual QByteArray asWkb (WkbFlags flags=QgsAbstractGeometry::WkbFlags()) const =0
 Returns a WKB representation of the geometry.
 
virtual QString asWkt (int precision=17) const =0
 Returns a WKT representation of the geometry.
 
virtual QgsAbstractGeometryboundary () const =0
 Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the geometry).
 
virtual QgsRectangle boundingBox () const
 Returns the minimal bounding box for the geometry.
 
virtual bool boundingBoxIntersects (const QgsBox3D &box3d) const
 Returns true if the bounding box of this geometry intersects with a box3d.
 
virtual bool boundingBoxIntersects (const QgsRectangle &rectangle) const
 Returns true if the bounding box of this geometry intersects with a rectangle.
 
virtual QgsPoint centroid () const
 Returns the centroid of the geometry.
 
virtual void clear ()=0
 Clears the geometry, ie reset it to a null geometry.
 
virtual QgsAbstractGeometryclone () const =0
 Clones the geometry by performing a deep copy.
 
virtual double closestSegment (const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, int *leftOf=nullptr, double epsilon=4 *std::numeric_limits< double >::epsilon()) const =0
 Searches for the closest segment of the geometry to a given point.
 
virtual int compareTo (const QgsAbstractGeometry *other) const
 Comparator for sorting of geometry.
 
const_part_iterator const_parts_begin () const
 Returns STL-style iterator pointing to the const first part of the geometry.
 
const_part_iterator const_parts_end () const
 Returns STL-style iterator pointing to the imaginary const part after the last part of the geometry.
 
virtual bool convertTo (Qgis::WkbType type)
 Converts the geometry to a specified type.
 
virtual QgsCoordinateSequence coordinateSequence () const =0
 Retrieves the sequence of geometries, rings and nodes.
 
virtual QgsAbstractGeometrycreateEmptyWithSameType () const =0
 Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
 
virtual bool deleteVertex (QgsVertexId position)=0
 Deletes a vertex within the geometry.
 
virtual int dimension () const =0
 Returns the inherent dimension of the geometry.
 
virtual void draw (QPainter &p) const =0
 Draws the geometry using the specified QPainter.
 
virtual bool dropMValue ()=0
 Drops any measure values which exist in the geometry.
 
virtual bool dropZValue ()=0
 Drops any z-dimensions which exist in the geometry.
 
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 function check.
 
virtual bool fromWkb (QgsConstWkbPtr &wkb)=0
 Sets the geometry from a WKB string.
 
virtual bool fromWkt (const QString &wkt)=0
 Sets the geometry from a WKT string.
 
virtual bool fuzzyDistanceEqual (const QgsAbstractGeometry &other, double epsilon=1e-8) const =0
 Performs fuzzy distance comparison between this geometry and other using an epsilon.
 
virtual bool fuzzyEqual (const QgsAbstractGeometry &other, double epsilon=1e-8) const =0
 Performs fuzzy comparison between this geometry and other using an epsilon.
 
virtual QString geometryType () const =0
 Returns a unique string representing the geometry type.
 
virtual bool hasCurvedSegments () const
 Returns true if the geometry contains curved segments.
 
virtual bool insertVertex (QgsVertexId position, const QgsPoint &vertex)=0
 Inserts a vertex into the geometry.
 
bool is3D () const
 Returns true if the geometry is 3D and contains a z-value.
 
virtual bool isEmpty () const
 Returns true if the geometry is empty.
 
bool isMeasure () const
 Returns true if the geometry contains m values.
 
virtual double length () const
 Returns the planar, 2-dimensional length of the geometry.
 
virtual bool moveVertex (QgsVertexId position, const QgsPoint &newPos)=0
 Moves a vertex within the geometry.
 
virtual int nCoordinates () const
 Returns the number of nodes contained in the geometry.
 
virtual bool nextVertex (QgsVertexId &id, QgsPoint &vertex) const =0
 Returns next vertex id and coordinates.
 
virtual void normalize ()=0
 Reorganizes the geometry into a normalized form (or "canonical" form).
 
virtual bool operator!= (const QgsAbstractGeometry &other) const =0
 
QgsAbstractGeometryoperator= (const QgsAbstractGeometry &geom)
 
virtual bool operator== (const QgsAbstractGeometry &other) const =0
 
virtual int partCount () const =0
 Returns count of parts contained in the geometry.
 
QgsGeometryPartIterator parts ()
 Returns Java-style iterator for traversal of parts of the geometry.
 
QgsGeometryConstPartIterator parts () const
 Returns Java-style iterator for traversal of parts of the geometry.
 
part_iterator parts_begin ()
 Returns STL-style iterator pointing to the first part of the geometry.
 
part_iterator parts_end ()
 Returns STL-style iterator pointing to the imaginary part after the last part of the geometry.
 
virtual double perimeter () const
 Returns the planar, 2-dimensional perimeter of the geometry.
 
virtual bool removeDuplicateNodes (double epsilon=4 *std::numeric_limits< double >::epsilon(), bool useZValues=false)=0
 Removes duplicate nodes from the geometry, wherever removing the nodes does not result in a degenerate geometry.
 
virtual int ringCount (int part=0) const =0
 Returns the number of rings of which this geometry is built.
 
virtual QgsAbstractGeometrysegmentize (double tolerance=M_PI/180., SegmentationToleranceType toleranceType=MaximumAngle) const
 Returns a version of the geometry without curves.
 
virtual double segmentLength (QgsVertexId startVertex) const =0
 Returns the length of the segment of the geometry which begins at startVertex.
 
virtual const QgsAbstractGeometrysimplifiedTypeRef () const
 Returns a reference to the simplest lossless representation of this geometry, e.g.
 
virtual QgsAbstractGeometrysimplifyByDistance (double tolerance) const =0
 Simplifies the geometry by applying the Douglas Peucker simplification by distance algorithm.
 
virtual QgsAbstractGeometrysnappedToGrid (double hSpacing, double vSpacing, double dSpacing=0, double mSpacing=0, bool removeRedundantPoints=false) const =0
 Makes a new geometry with all the points or vertices snapped to the closest point of the grid.
 
virtual void swapXy ()=0
 Swaps the x and y coordinates from the geometry.
 
virtual QgsAbstractGeometrytoCurveType () const =0
 Returns the geometry converted to the more generic curve type.
 
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 transform (const QTransform &t, double zTranslate=0.0, double zScale=1.0, double mTranslate=0.0, double mScale=1.0)=0
 Transforms the x and y components of the geometry using a QTransform object t.
 
virtual bool transform (QgsAbstractGeometryTransformer *transformer, QgsFeedback *feedback=nullptr)=0
 Transforms the vertices from the geometry in place, using the specified geometry transformer object.
 
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 double vertexAngle (QgsVertexId vertex) const =0
 Returns approximate angle at a vertex.
 
virtual QgsPoint vertexAt (QgsVertexId id) const =0
 Returns the point corresponding to a specified vertex id.
 
virtual int vertexCount (int part=0, int ring=0) const =0
 Returns the number of vertices of which this geometry is built.
 
virtual int vertexNumberFromVertexId (QgsVertexId id) const =0
 Returns the vertex number corresponding to a vertex id.
 
QgsVertexIterator vertices () const
 Returns a read-only, Java-style iterator for traversal of vertices of all the geometry, including all geometry parts and rings.
 
vertex_iterator vertices_begin () const
 Returns STL-style iterator pointing to the first vertex of the geometry.
 
vertex_iterator vertices_end () const
 Returns STL-style iterator pointing to the imaginary vertex after the last vertex of the geometry.
 
virtual int wkbSize (QgsAbstractGeometry::WkbFlags flags=QgsAbstractGeometry::WkbFlags()) const =0
 Returns the length of the QByteArray returned by asWkb()
 
Qgis::WkbType wkbType () const
 Returns the WKB type of the geometry.
 
QString wktTypeStr () const
 Returns the WKT type string of the geometry.
 

Static Public Member Functions

static const QgsSurfacecast (const QgsAbstractGeometry *geom)
 Cast the geom to a QgsSurface.
 

Protected Member Functions

void clearCache () const override
 Clears any cached parameters associated with the geometry, e.g., bounding boxes.
 
- Protected Member Functions inherited from QgsAbstractGeometry
virtual QgsRectangle calculateBoundingBox () const
 Default calculator for the minimal bounding box for the geometry.
 
virtual QgsBox3D calculateBoundingBox3D () const
 Calculates the minimal 3D bounding box for the geometry.
 
virtual int childCount () const
 Returns number of child geometries (for geometries with child geometries) or child points (for geometries without child geometries - i.e.
 
virtual QgsAbstractGeometrychildGeometry (int index) const
 Returns pointer to child geometry (for geometries with child geometries - i.e.
 
virtual QgsPoint childPoint (int index) const
 Returns point at index (for geometries without child geometries - i.e.
 
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 geometries.
 
virtual bool hasChildGeometries () const
 Returns whether the geometry has any child geometries (false for point / curve, true otherwise)
 
void setZMTypeFromSubGeometry (const QgsAbstractGeometry *subggeom, Qgis::WkbType baseGeomType)
 Updates the geometry type based on whether sub geometries contain z or m values.
 
int sortIndex () const
 Returns the sort index for the geometry, used in the compareTo() method to compare geometries of different types.
 

Protected Attributes

QgsBox3D mBoundingBox
 
bool mHasCachedValidity = false
 
QString mValidityFailureReason
 
- Protected Attributes inherited from QgsAbstractGeometry
Qgis::WkbType mWkbType = Qgis::WkbType::Unknown
 

Additional Inherited Members

- Public Types inherited from QgsAbstractGeometry
enum  AxisOrder { XY = 0 , YX }
 Axis order for GML generation. More...
 
enum  SegmentationToleranceType { MaximumAngle = 0 , MaximumDifference }
 Segmentation tolerance as maximum angle or maximum difference between approximation and circle. More...
 
enum  WkbFlag { FlagExportTrianglesAsPolygons = 1 << 0 , FlagExportNanAsDoubleMin = 1 << 1 }
 WKB export flags. More...
 
typedef QFlags< WkbFlagWkbFlags
 

Detailed Description

Surface geometry type.

Definition at line 33 of file qgssurface.h.

Member Function Documentation

◆ boundingBox3D()

QgsBox3D QgsSurface::boundingBox3D ( ) const
inlineoverridevirtual

Returns the 3D bounding box for the geometry.

Since
QGIS 3.34

Implements QgsAbstractGeometry.

Definition at line 37 of file qgssurface.h.

◆ cast()

static const QgsSurface * QgsSurface::cast ( const QgsAbstractGeometry geom)
inlinestatic

Cast the geom to a QgsSurface.

Should be used by qgsgeometry_cast<QgsSurface *>( geometry ).

Note
Not available in Python. Objects will be automatically be converted to the appropriate target type.

Definition at line 57 of file qgssurface.h.

◆ clearCache()

void QgsSurface::clearCache ( ) const
overrideprotectedvirtual

Clears any cached parameters associated with the geometry, e.g., bounding boxes.

Reimplemented from QgsAbstractGeometry.

Definition at line 43 of file qgssurface.cpp.

◆ isValid()

bool QgsSurface::isValid ( QString &  error,
Qgis::GeometryValidityFlags  flags = Qgis::GeometryValidityFlags() 
) const
overridevirtual

Checks validity of the geometry, and returns true if the geometry is valid.

Parameters
errorwill be set to the validity error message
flagsindicates optional flags which control the type of validity checking performed (corresponding to Qgis::GeometryValidityFlags).
Returns
true if geometry is valid
Since
QGIS 3.8

Implements QgsAbstractGeometry.

Definition at line 24 of file qgssurface.cpp.

Member Data Documentation

◆ mBoundingBox

QgsBox3D QgsSurface::mBoundingBox
mutableprotected

Definition at line 74 of file qgssurface.h.

◆ mHasCachedValidity

bool QgsSurface::mHasCachedValidity = false
mutableprotected

Definition at line 75 of file qgssurface.h.

◆ mValidityFailureReason

QString QgsSurface::mValidityFailureReason
mutableprotected

Definition at line 76 of file qgssurface.h.


The documentation for this class was generated from the following files: