QGIS API Documentation
3.18.1-Zürich (202f1bf7e5)
|
Triangular/Derived Mesh is mesh with vertices in map coordinates. More...
#include <qgstriangularmesh.h>
Public Member Functions | |
QgsTriangularMesh () | |
Ctor. More... | |
~QgsTriangularMesh () | |
Dtor. More... | |
double | averageTriangleSize () const |
Returns the average size of triangles in map unit. More... | |
Q_DECL_DEPRECATED const QVector< QgsMeshVertex > & | centroids () const |
Returns centroids of the native faces in map CRS. More... | |
bool | contains (const QgsMesh::ElementType &type) const |
Returns whether the mesh contains at mesh elements of given type. More... | |
const QVector< QgsMeshVertex > & | edgeCentroids () const |
Returns centroids of the native edges in map CRS. More... | |
QList< int > | edgeIndexesForRectangle (const QgsRectangle &rectangle) const |
Finds indexes of edges intersecting given bounding box It uses spatial indexing. More... | |
const QVector< QgsMeshEdge > & | edges () const |
Returns edges. More... | |
const QVector< int > & | edgesToNativeEdges () const |
Returns mapping between edges and original edges. More... | |
QgsRectangle | extent () const |
Returns the extent of the triangular mesh in map coordinates. More... | |
const QVector< QgsMeshVertex > & | faceCentroids () 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... | |
int | levelOfDetail () const |
Returns the corresponding index of level of detail on which this mesh is associated. More... | |
QVector< QgsTriangularMesh * > | simplifyMesh (double reductionFactor, int minimumTrianglesCount=10) const |
Returns simplified meshes. More... | |
const QVector< QgsMeshFace > & | triangles () const |
Returns triangles. More... | |
const QVector< int > & | trianglesToNativeFaces () const |
Returns mapping between triangles and original faces. More... | |
bool | update (QgsMesh *nativeMesh, const QgsCoordinateTransform &transform=QgsCoordinateTransform()) |
Constructs triangular mesh from layer's native mesh and transform to destination CRS. More... | |
QVector< QVector3D > | vertexNormals (float vertScale) const |
Calculates and returns normale vector on each vertex that is part of any face. More... | |
const QVector< QgsMeshVertex > & | vertices () const |
Returns vertices in map coordinate system. More... | |
Friends | |
class | TestQgsTriangularMesh |
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.
Definition at line 50 of file qgstriangularmesh.h.
|
default |
Ctor.
|
default |
Dtor.
double QgsTriangularMesh::averageTriangleSize | ( | ) | const |
Returns the average size of triangles in map unit.
It is calculated using the maximum of the height/width of the bounding box of each triangles.
Definition at line 114 of file qgstriangularmesh.cpp.
const QVector< QgsMeshVertex > & QgsTriangularMesh::centroids | ( | ) | const |
Returns centroids of the native faces in map CRS.
Definition at line 310 of file qgstriangularmesh.cpp.
bool QgsTriangularMesh::contains | ( | const QgsMesh::ElementType & | type | ) | const |
Returns whether the mesh contains at mesh elements of given type.
Definition at line 280 of file qgstriangularmesh.cpp.
const QVector< QgsMeshVertex > & QgsTriangularMesh::edgeCentroids | ( | ) | const |
Returns centroids of the native edges in map CRS.
Definition at line 320 of file qgstriangularmesh.cpp.
QList< int > QgsTriangularMesh::edgeIndexesForRectangle | ( | const QgsRectangle & | rectangle | ) | const |
Finds indexes of edges intersecting given bounding box It uses spatial indexing.
rectangle | bounding box in map coordinate system |
Definition at line 366 of file qgstriangularmesh.cpp.
const QVector< QgsMeshEdge > & QgsTriangularMesh::edges | ( | ) | const |
Returns edges.
Definition at line 305 of file qgstriangularmesh.cpp.
const QVector< int > & QgsTriangularMesh::edgesToNativeEdges | ( | ) | const |
Returns mapping between edges and original edges.
Definition at line 330 of file qgstriangularmesh.cpp.
QgsRectangle QgsTriangularMesh::extent | ( | ) | const |
Returns the extent of the triangular mesh in map coordinates.
Definition at line 270 of file qgstriangularmesh.cpp.
const QVector< QgsMeshVertex > & QgsTriangularMesh::faceCentroids | ( | ) | const |
Returns centroids of the native faces in map CRS.
Definition at line 315 of file qgstriangularmesh.cpp.
QList< int > QgsTriangularMesh::faceIndexesForRectangle | ( | const QgsRectangle & | rectangle | ) | const |
Finds indexes of triangles intersecting given bounding box It uses spatial indexing.
rectangle | bounding box in map coordinate system |
Definition at line 361 of file qgstriangularmesh.cpp.
int QgsTriangularMesh::faceIndexForPoint | ( | const QgsPointXY & | point | ) | const |
Finds index of triangle at given point It uses spatial indexing.
point | point in map coordinate system |
Definition at line 335 of file qgstriangularmesh.cpp.
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.
point | point in map coordinate system |
Definition at line 348 of file qgstriangularmesh.cpp.
int QgsTriangularMesh::levelOfDetail | ( | ) | const |
Returns the corresponding index of level of detail on which this mesh is associated.
Definition at line 275 of file qgstriangularmesh.cpp.
QVector< QgsTriangularMesh * > QgsTriangularMesh::simplifyMesh | ( | double | reductionFactor, |
int | minimumTrianglesCount = 10 |
||
) | const |
Returns simplified meshes.
The first simplified mesh is simplified with a goal of a number of triangles equals to the number of triangles of the base mesh divised by the reduction factor. For the following mesh the same reduction factor is used with the prededent goal of number of triangles. There are as many simplified meshes as necessary to have a the minimum triangles count on the last simplified mesh.
The caller has to take the ownership of returned meshes.
Not implemented for Edge meshes and Mixed meshes
reductionFactor | is the factor used to reduce the number of triangles of the mesh |
minimumTrianglesCount | is the minimal faces count on simplified mesh |
Definition at line 396 of file qgstriangularmesh.cpp.
const QVector< QgsMeshFace > & QgsTriangularMesh::triangles | ( | ) | const |
Returns triangles.
Definition at line 300 of file qgstriangularmesh.cpp.
const QVector< int > & QgsTriangularMesh::trianglesToNativeFaces | ( | ) | const |
Returns mapping between triangles and original faces.
Definition at line 325 of file qgstriangularmesh.cpp.
bool QgsTriangularMesh::update | ( | QgsMesh * | nativeMesh, |
const QgsCoordinateTransform & | transform = QgsCoordinateTransform() |
||
) |
Constructs triangular mesh from layer's native mesh and transform to destination CRS.
Populates spatial index.
nativeMesh | QgsMesh to access native vertices and faces |
transform | Transformation from layer CRS to destination (e.g. map) CRS. With invalid transform, it keeps the native mesh CRS |
true
if the mesh is effectivly updated, and false
if not Definition at line 122 of file qgstriangularmesh.cpp.
QVector< QVector3D > QgsTriangularMesh::vertexNormals | ( | float | vertScale | ) | const |
Calculates and returns normale vector on each vertex that is part of any face.
Definition at line 371 of file qgstriangularmesh.cpp.
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 295 of file qgstriangularmesh.cpp.
|
friend |
Definition at line 250 of file qgstriangularmesh.h.