QGIS API Documentation  3.2.0-Bonn (bc43194)
qgstriangularmesh.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstriangularmesh.h
3  -------------------
4  begin : April 2018
5  copyright : (C) 2018 by Peter Petrik
6  email : zilolv at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSTRIANGULARMESH_H
19 #define QGSTRIANGULARMESH_H
20 
21 
22 #define SIP_NO_FILE
23 
24 #include <QVector>
25 
26 #include "qgis_core.h"
27 #include "qgsmeshdataprovider.h"
28 
29 class QgsRenderContext;
30 
32 struct CORE_EXPORT QgsMesh
33 {
35  QVector<QgsMeshVertex> vertices;
37  QVector<QgsMeshFace> faces;
38 };
39 
49 class CORE_EXPORT QgsTriangularMesh
50 {
51  public:
53  QgsTriangularMesh() = default;
55  ~QgsTriangularMesh() = default;
56 
62  void update( QgsMesh *nativeMesh, QgsRenderContext *context );
63 
70  const QVector<QgsMeshVertex> &vertices() const ;
72  const QVector<QgsMeshFace> &triangles() const ;
73 
75  const QVector<QgsMeshVertex> &centroids() const ;
76 
78  const QVector<int> &trianglesToNativeFaces() const ;
79 
80  private:
81  // vertices: map CRS; 0-N ... native vertices, N+1 - len ... extra vertices
82  // faces are derived triangles
83  QgsMesh mTriangularMesh;
84  QVector<int> mTrianglesToNativeFaces; //len(mTrianglesToNativeFaces) == len(mTriangles). Mapping derived -> native
85 
86  // centroids of the native faces in map CRS
87  QVector<QgsMeshVertex> mNativeMeshFaceCentroids;
88 };
89 
90 
91 #endif // QGSTRIANGULARMESH_H
Triangular/Derived Mesh.
QVector< QgsMeshVertex > vertices
vertices
Contains information about the context of a rendering operation.
Mesh - vertices and faces.
QVector< QgsMeshFace > faces
faces