QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
QgsMeshUtils Class Reference

Provides utility functions for working with mesh data. More...

#include <qgsmeshutils.h>

Static Public Member Functions

static QgsMeshVertex centroid (const QgsMeshFace &face, const QVector< QgsMeshVertex > &vertices)
 Returns the centroid of the face.
static QgsRasterBlockexportRasterBlock (const QgsMeshLayer &layer, const QgsMeshDatasetIndex &datasetIndex, const QgsCoordinateReferenceSystem &destinationCrs, const QgsCoordinateTransformContext &transformContext, double mapUnitsPerPixel, const QgsRectangle &extent, QgsRasterBlockFeedback *feedback=nullptr)
 Exports mesh layer's dataset values as raster block.
static QgsRasterBlockexportRasterBlock (const QgsTriangularMesh &triangularMesh, const QgsMeshDataBlock &datasetValues, const QgsMeshDataBlock &activeFlags, const QgsMeshDatasetGroupMetadata::DataType dataType, const QgsCoordinateTransform &transform, double mapUnitsPerPixel, const QgsRectangle &extent, QgsRasterBlockFeedback *feedback=nullptr)
 Exports mesh layer's dataset values as raster block.
static bool isInTriangleFace (const QgsPointXY point, const QgsMeshFace &face, const QVector< QgsMeshVertex > &vertices)
 Tests if point p is on the face defined with vertices.
static QSet< int > nativeEdgesFromEdges (const QList< int > &edgesIndexes, const QVector< int > &edgesToNativeEdges)
 Returns unique native faces indexes from list of triangle indexes.
static QSet< int > nativeFacesFromTriangles (const QList< int > &triangleIndexes, const QVector< int > &trianglesToNativeFaces)
 Returns unique native faces indexes from list of triangle indexes.
static QSet< int > nativeVerticesFromEdges (const QList< int > &edgesIndexes, const QVector< QgsMeshEdge > &edges)
 Returns unique native faces indexes from list of vertices of triangles.
static QSet< int > nativeVerticesFromTriangles (const QList< int > &triangleIndexes, const QVector< QgsMeshFace > &triangles)
 Returns unique native vertex indexes from list of vertices of triangles.
static void setCounterClockwise (QgsMeshFace &triangle, const QgsMeshVertex &v0, const QgsMeshVertex &v1, const QgsMeshVertex &v2)
 Checks if the triangle is counter clockwise, if not sets it counter clockwise.
static QgsGeometry toGeometry (const QgsMeshFace &face, const QVector< QgsMeshVertex > &vertices)
 Returns face as polygon geometry.
static std::unique_ptr< QgsPolygontoPolygon (const QgsMeshFace &face, const QVector< QgsMeshVertex > &vertices)
 Returns face as polygon geometry, caller is responsible for delete.

Detailed Description

Provides utility functions for working with mesh data.

Since
QGIS 3.0

Definition at line 59 of file qgsmeshutils.h.

Member Function Documentation

◆ centroid()

QgsMeshVertex QgsMeshUtils::centroid ( const QgsMeshFace & face,
const QVector< QgsMeshVertex > & vertices )
static

Returns the centroid of the face.

Note
Not available in Python bindings

Definition at line 291 of file qgsmeshutils.cpp.

◆ exportRasterBlock() [1/2]

QgsRasterBlock * QgsMeshUtils::exportRasterBlock ( const QgsMeshLayer & layer,
const QgsMeshDatasetIndex & datasetIndex,
const QgsCoordinateReferenceSystem & destinationCrs,
const QgsCoordinateTransformContext & transformContext,
double mapUnitsPerPixel,
const QgsRectangle & extent,
QgsRasterBlockFeedback * feedback = nullptr )
static

Exports mesh layer's dataset values as raster block.

The function always fetches native mesh and dataset data from data provider and calculates triangular mesh

Parameters
layermesh layer
datasetIndexindex from layer defining group and dataset (time) to export
destinationCrsdestination/map CRS. Used to create triangular mesh from native mesh
transformContextTransform context to transform layer CRS to destination CRS
mapUnitsPerPixelmap units per pixel for block
extentextent of block in destination CRS
feedbackoptional raster feedback object for cancellation/preview
Returns
raster block with Float::64 values. nullptr on error
Since
QGIS 3.6

Definition at line 32 of file qgsmeshutils.cpp.

◆ exportRasterBlock() [2/2]

QgsRasterBlock * QgsMeshUtils::exportRasterBlock ( const QgsTriangularMesh & triangularMesh,
const QgsMeshDataBlock & datasetValues,
const QgsMeshDataBlock & activeFlags,
const QgsMeshDatasetGroupMetadata::DataType dataType,
const QgsCoordinateTransform & transform,
double mapUnitsPerPixel,
const QgsRectangle & extent,
QgsRasterBlockFeedback * feedback = nullptr )
static

Exports mesh layer's dataset values as raster block.

Parameters
triangularMeshthe triangular mesh of the mesh layer
datasetValuesdataset values used to build the raster block
activeFlagsactive flag values
dataTypethe data type iof the dataset values
transformthe coordinate transform used to export the raster block
mapUnitsPerPixelmap units per pixel for block
extentextent of block in destination CRS
feedbackoptional raster feedback object for cancellation/preview
Returns
raster block with Float::64 values. nullptr on error
Since
QGIS 3.18

Definition at line 98 of file qgsmeshutils.cpp.

◆ isInTriangleFace()

bool QgsMeshUtils::isInTriangleFace ( const QgsPointXY point,
const QgsMeshFace & face,
const QVector< QgsMeshVertex > & vertices )
static

Tests if point p is on the face defined with vertices.

Note
Not available in Python bindings
Since
QGIS 3.12

Definition at line 195 of file qgsmeshutils.cpp.

◆ nativeEdgesFromEdges()

QSet< int > QgsMeshUtils::nativeEdgesFromEdges ( const QList< int > & edgesIndexes,
const QVector< int > & edgesToNativeEdges )
static

Returns unique native faces indexes from list of triangle indexes.

Note
Not available in Python bindings
Since
QGIS 3.14

Definition at line 178 of file qgsmeshutils.cpp.

◆ nativeFacesFromTriangles()

QSet< int > QgsMeshUtils::nativeFacesFromTriangles ( const QList< int > & triangleIndexes,
const QVector< int > & trianglesToNativeFaces )
static

Returns unique native faces indexes from list of triangle indexes.

Note
Not available in Python bindings
Since
QGIS 3.4

Definition at line 173 of file qgsmeshutils.cpp.

◆ nativeVerticesFromEdges()

QSet< int > QgsMeshUtils::nativeVerticesFromEdges ( const QList< int > & edgesIndexes,
const QVector< QgsMeshEdge > & edges )
static

Returns unique native faces indexes from list of vertices of triangles.

Note
Not available in Python bindings
Since
QGIS 3.14

Definition at line 227 of file qgsmeshutils.cpp.

◆ nativeVerticesFromTriangles()

QSet< int > QgsMeshUtils::nativeVerticesFromTriangles ( const QList< int > & triangleIndexes,
const QVector< QgsMeshFace > & triangles )
static

Returns unique native vertex indexes from list of vertices of triangles.

Note
Not available in Python bindings
Since
QGIS 3.14

Definition at line 213 of file qgsmeshutils.cpp.

◆ setCounterClockwise()

void QgsMeshUtils::setCounterClockwise ( QgsMeshFace & triangle,
const QgsMeshVertex & v0,
const QgsMeshVertex & v1,
const QgsMeshVertex & v2 )
static

Checks if the triangle is counter clockwise, if not sets it counter clockwise.

Note
Not available in Python bindings
Since
QGIS 3.22

Definition at line 306 of file qgsmeshutils.cpp.

◆ toGeometry()

QgsGeometry QgsMeshUtils::toGeometry ( const QgsMeshFace & face,
const QVector< QgsMeshVertex > & vertices )
static

Returns face as polygon geometry.

Note
Not available in Python bindings

Definition at line 154 of file qgsmeshutils.cpp.

◆ toPolygon()

std::unique_ptr< QgsPolygon > QgsMeshUtils::toPolygon ( const QgsMeshFace & face,
const QVector< QgsMeshVertex > & vertices )
static

Returns face as polygon geometry, caller is responsible for delete.

Note
Not available in Python bindings

Definition at line 139 of file qgsmeshutils.cpp.


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