Class: QgsMeshTriangulation

Handles mesh creation with Delaunay constrained triangulation.

Added in version 3.16.

Class Hierarchy

Inheritance diagram of qgis.analysis.QgsMeshTriangulation

Base classes

QObject

Methods

addBreakLines

Adds break lines from a vector layer, return True if successful.

addVertex

Adds a new vertex in the triangulation and returns the index of the new vertex

addVertices

Adds vertices to the triangulation from a feature iterator, return True if successful.

setCrs

Sets the coordinate reference system used for the triangulation

triangulatedMesh

Returns the triangulated mesh

class qgis.analysis.QgsMeshTriangulation[source]

Bases: QObject

addBreakLines(self, lineFeatureIterator: QgsFeatureIterator, valueAttribute: int, transformContext: QgsCoordinateTransform, feedback: QgsFeedback | None = None, featureCount: int = 1) bool[source]

Adds break lines from a vector layer, return True if successful.

Parameters:
  • lineFeatureIterator (QgsFeatureIterator) – the feature iterator of break lines to insert

  • valueAttribute (int) – the index of the attribute that represents the value of vertices, if -1 uses Z coordinate of vertices

  • transformContext (QgsCoordinateTransform) – the coordinates transform context used to transform coordinates

  • feedback (Optional[QgsFeedback] = None) – feedback argument may be specified to allow cancellation and progress reports

  • featureCount (int = 1) – the count of feature to allow progress report of the feedback

Warning

if the feature iterator contains only point geometries, the vertices will be added only without treating them as breaklines

Return type:

bool

addVertex(self, vertex: QgsPoint) int[source]

Adds a new vertex in the triangulation and returns the index of the new vertex

Added in version 3.22.

Parameters:

vertex (QgsPoint)

Return type:

int

addVertices(self, vertexFeatureIterator: QgsFeatureIterator, valueAttribute: int, transform: QgsCoordinateTransform, feedback: QgsFeedback | None = None, featureCount: int = 1) bool[source]

Adds vertices to the triangulation from a feature iterator, return True if successful.

Parameters:
  • vertexFeatureIterator (QgsFeatureIterator) – the feature iterator of vertices to insert

  • valueAttribute (int) – the index of the attribute that represents the value of vertices, if -1 uses Z coordinate of vertices

  • transform (QgsCoordinateTransform) – the coordinates transform used to transform coordinates

  • feedback (Optional[QgsFeedback] = None) – feedback argument may be specified to allow cancellation and progress reports

  • featureCount (int = 1) – the count of feature to allow progress report of the feedback

Return type:

bool

setCrs(self, crs: QgsCoordinateReferenceSystem)[source]

Sets the coordinate reference system used for the triangulation

Parameters:

crs (QgsCoordinateReferenceSystem)

triangulatedMesh(self, feedback: QgsFeedback | None = None) QgsMesh[source]

Returns the triangulated mesh

Parameters:

feedback (Optional[QgsFeedback] = None)

Return type:

QgsMesh