QGIS API Documentation  3.11.0-Master (68611307d7)
Public Member Functions | Friends | List of all members
QgsTriangularMesh Class Reference

Triangular/Derived Mesh is mesh with vertices in map coordinates. More...

#include <qgstriangularmesh.h>

Public Member Functions

 QgsTriangularMesh ()
 Ctor. More...
 
 ~QgsTriangularMesh ()
 Dtor. More...
 
const QVector< QgsMeshVertex > & centroids () const
 Returns centroids of the native faces in map CRS. More...
 
QList< int > faceIndexesForRectangle (const QgsRectangle &rectangle) const
 Finds indexes of triangles intersecting given bounding box It uses spatial indexing. More...
 
int faceIndexForPoint (const QgsPointXY &point) const
 Finds index of triangle at given point It uses spatial indexing. More...
 
int faceIndexForPoint_v2 (const QgsPointXY &point) const
 Finds index of triangle at given point It uses spatial indexing and don't use geos to be faster. More...
 
const QVector< QgsMeshFace > & triangles () const
 Returns triangles. More...
 
const QVector< int > & trianglesToNativeFaces () const
 Returns mapping between triangles and original faces. More...
 
void update (QgsMesh *nativeMesh, QgsRenderContext *context)
 Constructs triangular mesh from layer's native mesh and context. More...
 
QVector< QVector3D > vertexNormals (float vertScale) const
 Calculates and returns normale vector on each vertex. More...
 
const QVector< QgsMeshVertex > & vertices () const
 Returns vertices in map coordinate system. More...
 

Friends

class TestQgsTriangularMesh
 

Detailed Description

Triangular/Derived Mesh is mesh with vertices in map coordinates.

It creates spatial index for identification of a triangle that contains a particular point on the map.

Note
The API is considered EXPERIMENTAL and can be changed without a notice
Since
QGIS 3.2

Definition at line 47 of file qgstriangularmesh.h.

Constructor & Destructor Documentation

◆ QgsTriangularMesh()

QgsTriangularMesh::QgsTriangularMesh ( )
default

Ctor.

◆ ~QgsTriangularMesh()

QgsTriangularMesh::~QgsTriangularMesh ( )
default

Dtor.

Member Function Documentation

◆ centroids()

const QVector< QgsMeshVertex > & QgsTriangularMesh::centroids ( ) const

Returns centroids of the native faces in map CRS.

Definition at line 213 of file qgstriangularmesh.cpp.

◆ faceIndexesForRectangle()

QList< int > QgsTriangularMesh::faceIndexesForRectangle ( const QgsRectangle rectangle) const

Finds indexes of triangles intersecting given bounding box It uses spatial indexing.

Parameters
rectanglebounding box in map coordinate system
Returns
triangle indexes that intersect the rectangle
Since
QGIS 3.4

Definition at line 249 of file qgstriangularmesh.cpp.

◆ faceIndexForPoint()

int QgsTriangularMesh::faceIndexForPoint ( const QgsPointXY point) const

Finds index of triangle at given point It uses spatial indexing.

Parameters
pointpoint in map coordinate system
Returns
triangle index that contains the given point, -1 if no such triangle exists
Since
QGIS 3.4

Definition at line 223 of file qgstriangularmesh.cpp.

◆ faceIndexForPoint_v2()

int QgsTriangularMesh::faceIndexForPoint_v2 ( const QgsPointXY point) const

Finds index of triangle at given point It uses spatial indexing and don't use geos to be faster.

Parameters
pointpoint in map coordinate system
Returns
triangle index that contains the given point, -1 if no such triangle exists
Since
QGIS 3.12

Definition at line 236 of file qgstriangularmesh.cpp.

◆ triangles()

const QVector< QgsMeshFace > & QgsTriangularMesh::triangles ( ) const

Returns triangles.

Definition at line 208 of file qgstriangularmesh.cpp.

◆ trianglesToNativeFaces()

const QVector< int > & QgsTriangularMesh::trianglesToNativeFaces ( ) const

Returns mapping between triangles and original faces.

Definition at line 218 of file qgstriangularmesh.cpp.

◆ update()

void QgsTriangularMesh::update ( QgsMesh nativeMesh,
QgsRenderContext context 
)

Constructs triangular mesh from layer's native mesh and context.

Populates spatial index.

Parameters
nativeMeshQgsMesh to access native vertices and faces
contextRendering context to estimate number of triagles to create for an face

Definition at line 120 of file qgstriangularmesh.cpp.

◆ vertexNormals()

QVector< QVector3D > QgsTriangularMesh::vertexNormals ( float  vertScale) const

Calculates and returns normale vector on each vertex.

Returns
all normales at vertices
Since
QGIS 3.12

Definition at line 254 of file qgstriangularmesh.cpp.

◆ vertices()

const QVector< QgsMeshVertex > & QgsTriangularMesh::vertices ( ) const

Returns vertices in map coordinate system.

The list of consist of vertices from native mesh (0-N) and extra vertices needed to create triangles (N+1 - len)

Definition at line 203 of file qgstriangularmesh.cpp.

Friends And Related Function Documentation

◆ TestQgsTriangularMesh

friend class TestQgsTriangularMesh
friend

Definition at line 149 of file qgstriangularmesh.h.


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