18#ifndef QGSTRIANGULARMESH_H
19#define QGSTRIANGULARMESH_H
86 const QVector<QgsMeshVertex> &
vertices()
const ;
89 const QVector<QgsMeshFace> &
triangles()
const ;
92 const QVector<QgsMeshEdge> &
edges()
const ;
99 Q_DECL_DEPRECATED
const QVector<QgsMeshVertex> &
centroids()
const ;
218 QVector<QgsTriangularMesh *>
simplifyMesh(
double reductionFactor,
int minimumTrianglesCount = 10 )
const;
279 QVector<QgsMeshVertex> mAddedVertices;
280 QList<int> mVerticesIndexesToRemove;
281 QList<int> mChangedVerticesCoordinates;
282 mutable QList<double> mOldZValue;
283 QList<double> mNewZValue;
284 QList<QgsPointXY> mOldXYValue;
285 QList<QgsPointXY> mNewXYValue;
287 QVector<QgsMeshFace> mNativeFacesToAdd;
288 QList<int> mNativeFaceIndexesToRemove;
289 QVector<QgsMeshFace> mNativeFacesToRemove;
290 QList<int> mNativeFaceIndexesGeometryChanged;
291 QVector<QgsMeshFace> mNativeFacesGeometryChanged;
292 mutable QList<int> mTriangleIndexesGeometryChanged;
294 mutable int mTrianglesAddedStartIndex = 0;
295 mutable QList<int> mRemovedTriangleIndexes;
350 void triangulate(
const QgsMeshFace &face,
int nativeIndex );
360 void finalizeTriangles();
365 QVector<int> mTrianglesToNativeFaces;
366 QVector<int> mEdgesToNativeEdges;
369 QVector<QgsMeshVertex> mNativeMeshFaceCentroids;
372 QVector<QgsMeshVertex> mNativeMeshEdgeCentroids;
379 mutable bool mIsExtentValid =
false;
382 double mAverageTriangleSize = 0;
TransformDirection
Indicates the direction (forward or inverse) of a transform.
A spatial index for QgsMeshFace or QgsMeshEdge objects.
A rectangle specified with double values.
Contains information about the context of a rendering operation.
Contains topological differences between two states of a topological mesh, only accessible from the Q...
Makes changes to a triangular mesh and keeps track of these changes.
friend class QgsTriangularMesh
Changes()=default
Default constructor, no changes.
const QVector< QgsMeshVertex > & edgeCentroids() const
Returns centroids of the native edges in map CRS.
friend class TestQgsTriangularMesh
const QVector< QgsMeshFace > & triangles() const
Returns triangles.
QVector< QgsTriangularMesh * > simplifyMesh(double reductionFactor, int minimumTrianglesCount=10) const
Returns simplified meshes.
QgsRectangle nativeExtent()
Returns the extent of the mesh in the native mesh coordinates system, returns empty extent if the tra...
QgsPointXY transformFromLayerToTrianglesCoordinates(const QgsPointXY &point) const
Transforms a point from layer coordinates system to triangular Mesh coordinates system.
int levelOfDetail() const
Returns the corresponding index of level of detail on which this mesh is associated.
QgsRectangle extent() const
Returns the extent of the triangular mesh in map coordinates.
int faceIndexForPoint(const QgsPointXY &point) const
Finds index of triangle at given point It uses spatial indexing.
int nativeFaceIndexForPoint(const QgsPointXY &point) const
Finds index of native face at given point It uses spatial indexing.
double averageTriangleSize() const
Returns the average size of triangles in map unit.
void reverseChanges(const Changes &changes, const QgsMesh &nativeMesh)
Reverses the changes on the triangular mesh (see Changes).
void applyChanges(const Changes &changes)
Applies the changes on the triangular mesh (see Changes).
QList< int > edgeIndexesForRectangle(const QgsRectangle &rectangle) const
Finds indexes of edges intersecting given bounding box It uses spatial indexing.
Q_DECL_DEPRECATED const QVector< QgsMeshVertex > & centroids() const
Returns centroids of the native faces in map CRS.
const QVector< QgsMeshVertex > & vertices() const
Returns vertices in map coordinate system.
const QVector< QgsMeshEdge > & edges() const
Returns edges.
bool contains(const QgsMesh::ElementType &type) const
Returns whether the mesh contains mesh elements of given type.
QgsMeshVertex triangularToNativeCoordinates(const QgsMeshVertex &vertex) const
Transforms the vertex from triangular mesh coordinates system to native coordinates system.
QVector< QVector3D > vertexNormals(float vertScale) const
Calculates and returns normal vector on each vertex that is part of any face.
QgsMeshVertex nativeToTriangularCoordinates(const QgsMeshVertex &vertex) const
Transforms the vertex from native coordinates system to triangular mesh coordinates system.
bool update(QgsMesh *nativeMesh, const QgsCoordinateTransform &transform)
Constructs triangular mesh from layer's native mesh and transform to destination CRS.
const QVector< QgsMeshVertex > & faceCentroids() const
Returns centroids of the native faces in map CRS.
QList< int > nativeFaceIndexForRectangle(const QgsRectangle &rectangle) const
Finds indexes of native faces which bounding boxes intersect given bounding box It uses spatial index...
const QVector< int > & trianglesToNativeFaces() const
Returns mapping between triangles and original faces.
const QVector< int > & edgesToNativeEdges() const
Returns mapping between edges and original edges.
QList< int > faceIndexesForRectangle(const QgsRectangle &rectangle) const
Finds indexes of triangles intersecting given bounding box It uses spatial indexing.
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.
QVector< int > QgsMeshFace
List of vertex indexes.
QgsPoint QgsMeshVertex
xyz coords of vertex
Mesh - vertices, edges and faces.
ElementType
Defines type of mesh elements.