18 #ifndef QGSTRIANGULARMESH_H
19 #define QGSTRIANGULARMESH_H
29 #include "qgis_core.h"
72 const QVector<QgsMeshVertex> &vertices()
const ;
75 const QVector<QgsMeshFace> &triangles()
const ;
78 const QVector<QgsMeshEdge> &edges()
const ;
85 Q_DECL_DEPRECATED
const QVector<QgsMeshVertex> ¢roids()
const ;
91 const QVector<QgsMeshVertex> &faceCentroids()
const ;
97 const QVector<QgsMeshVertex> &edgeCentroids()
const ;
100 const QVector<int> &trianglesToNativeFaces()
const ;
103 const QVector<int> &edgesToNativeEdges()
const ;
114 int faceIndexForPoint(
const QgsPointXY &point )
const ;
125 int faceIndexForPoint_v2(
const QgsPointXY &point )
const;
136 QList<int> faceIndexesForRectangle(
const QgsRectangle &rectangle )
const ;
145 QList<int> edgeIndexesForRectangle(
const QgsRectangle &rectangle )
const ;
155 QVector<QVector3D> vertexNormals(
float vertScale )
const;
172 QVector<QgsTriangularMesh *> simplifyMesh(
double reductionFactor,
int minimumTrianglesCount = 10 )
const;
180 double averageTriangleSize()
const;
192 int levelOfDetail()
const;
221 void triangulate(
const QgsMeshFace &face,
int nativeIndex );
224 void finalizeTriangles();
229 QVector<int> mTrianglesToNativeFaces;
230 QVector<int> mEdgesToNativeEdges;
233 QVector<QgsMeshVertex> mNativeMeshFaceCentroids;
236 QVector<QgsMeshVertex> mNativeMeshEdgeCentroids;
245 double mAverageTriangleSize = 0;
250 friend class TestQgsTriangularMesh;
259 CORE_EXPORT std::unique_ptr< QgsPolygon >
toPolygon(
const QgsMeshFace &face,
const QVector<QgsMeshVertex> &vertices );
265 CORE_EXPORT QSet<int>
nativeFacesFromTriangles(
const QList<int> &triangleIndexes,
const QVector<int> &trianglesToNativeFaces );
271 CORE_EXPORT QSet<int>
nativeEdgesFromEdges(
const QList<int> &edgesIndexes,
const QVector<int> &edgesToNativeEdges );
283 CORE_EXPORT QSet<int>
nativeVerticesFromEdges(
const QList<int> &edgesIndexes,
const QVector<QgsMeshEdge> &edges );
A geometry is the spatial representation of a feature.
A spatial index for QgsMeshFace or QgsMeshEdge objects.
A class to represent a 2D point.
A rectangle specified with double values.
Contains information about the context of a rendering operation.
Triangular/Derived Mesh is mesh with vertices in map coordinates.
~QgsTriangularMesh()
Dtor.
bool isInTriangleFace(const QgsPointXY point, const QgsMeshFace &face, const QVector< QgsMeshVertex > &vertices)
Tests if point p is on the face defined with vertices.
CORE_EXPORT QSet< int > nativeEdgesFromEdges(const QList< int > &edgesIndexes, const QVector< int > &edgesToNativeEdges)
Returns unique native faces indexes from list of triangle indexes.
CORE_EXPORT std::unique_ptr< QgsPolygon > toPolygon(const QgsMeshFace &face, const QVector< QgsMeshVertex > &vertices)
Returns face as polygon geometry, caller is responsible for delete.
CORE_EXPORT QgsGeometry toGeometry(const QgsMeshFace &face, const QVector< QgsMeshVertex > &vertices)
Returns face as polygon geometry.
CORE_EXPORT QSet< int > nativeVerticesFromEdges(const QList< int > &edgesIndexes, const QVector< QgsMeshEdge > &edges)
Returns unique native faces indexes from list of vertices of triangles.
CORE_EXPORT QSet< int > nativeVerticesFromTriangles(const QList< int > &triangleIndexes, const QVector< QgsMeshFace > &triangles)
Returns unique native vertex indexes from list of vertices of triangles.
CORE_EXPORT QSet< int > nativeFacesFromTriangles(const QList< int > &triangleIndexes, const QVector< int > &trianglesToNativeFaces)
Returns unique native faces indexes from list of triangle indexes.
QVector< int > QgsMeshFace
List of vertex indexes.
Mesh - vertices, edges and faces.
ElementType
Defines type of mesh elements.