Class: QgsMeshDataSourceInterface

Interface for mesh data sources.

Mesh is a collection of vertices, edges and faces in 2D or 3D space

  • vertex - XY(Z) point (in the mesh’s coordinate reference system)

  • edge - two XY(Z) points (in the mesh’s coordinate reference system) representing straight seqment

  • faces - sets of vertices forming a closed shape - typically triangles or quadrilaterals

Base on the underlying data provider/format, whole mesh is either stored in memory or read on demand

Note

The API is considered EXPERIMENTAL and can be changed without a notice

Added in version 3.2.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: edgeCount(), faceCount(), populateMesh(), saveMeshFrame(), vertexCount()

Class Hierarchy

Inheritance diagram of qgis.core.QgsMeshDataSourceInterface

Subclasses

QgsMeshDataProvider

Base class for providing data for QgsMeshLayer.

Abstract Methods

edgeCount

Returns number of edges in the native mesh

faceCount

Returns number of faces in the native mesh

populateMesh

Populates the mesh vertices, edges and faces

saveMeshFrame

Saves the mesh frame to the source.

vertexCount

Returns number of vertices in the native mesh

Methods

contains

Returns whether the mesh contains at mesh elements of given type

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsMeshDataSourceInterface. See the FAQ for more details.

maximumVerticesCountPerFace

Returns the maximum number of vertices per face supported by the current mesh, if returns 0, the number of vertices is unlimited

class qgis.core.QgsMeshDataSourceInterface[source]

Bases: object

contains(self, type: QgsMesh.ElementType) bool[source]

Returns whether the mesh contains at mesh elements of given type

Added in version 3.14.

Parameters:

type (QgsMesh.ElementType)

Return type:

bool

abstract edgeCount(self) int[source]

Returns number of edges in the native mesh

Return type:

int

Returns:

Number of edges in the mesh

Added in version 3.14.

abstract faceCount(self) int[source]

Returns number of faces in the native mesh

Return type:

int

Returns:

Number of faces in the mesh

virtual maximumVerticesCountPerFace(self) int[source]

Returns the maximum number of vertices per face supported by the current mesh, if returns 0, the number of vertices is unlimited

Return type:

int

Returns:

Maximum number of vertices per face

Added in version 3.22.

abstract populateMesh(self, mesh: QgsMesh | None)[source]

Populates the mesh vertices, edges and faces

Added in version 3.6.

Parameters:

mesh (Optional[QgsMesh])

abstract saveMeshFrame(self, mesh: QgsMesh) bool[source]

Saves the mesh frame to the source.

Parameters:

mesh (QgsMesh) – the mesh to save

Return type:

bool

Returns:

True on success

Added in version 3.22.

abstract vertexCount(self) int[source]

Returns number of vertices in the native mesh

Return type:

int

Returns:

Number of vertices in the mesh