18#ifndef QGSTRIANGULARMESH_H 
   19#define QGSTRIANGULARMESH_H 
   77    bool update( 
QgsMesh *nativeMesh );
 
   85    const QVector<QgsMeshVertex> &vertices() 
const ;
 
   88    const QVector<QgsMeshFace> &triangles() 
const ;
 
   91    const QVector<QgsMeshEdge> &edges() 
const ;
 
   98    Q_DECL_DEPRECATED 
const QVector<QgsMeshVertex> ¢roids() 
const ;
 
  104    const QVector<QgsMeshVertex> &faceCentroids() 
const ;
 
  110    const QVector<QgsMeshVertex> &edgeCentroids() 
const ;
 
  113    const QVector<int> &trianglesToNativeFaces() 
const ;
 
  116    const QVector<int> &edgesToNativeEdges() 
const ;
 
  137    int faceIndexForPoint( 
const QgsPointXY &point ) 
const ;
 
  148    int faceIndexForPoint_v2( 
const QgsPointXY &point ) 
const;
 
  159    int nativeFaceIndexForPoint( 
const QgsPointXY &point ) 
const ;
 
  170    QList<int> nativeFaceIndexForRectangle( 
const QgsRectangle &rectangle ) 
const ;
 
  181    QList<int> faceIndexesForRectangle( 
const QgsRectangle &rectangle ) 
const ;
 
  190    QList<int> edgeIndexesForRectangle( 
const QgsRectangle &rectangle ) 
const ;
 
  200    QVector<QVector3D> vertexNormals( 
float vertScale ) 
const;
 
  217    QVector<QgsTriangularMesh *> simplifyMesh( 
double reductionFactor, 
int minimumTrianglesCount = 10 ) 
const;
 
  225    double averageTriangleSize() 
const;
 
  237    int levelOfDetail() 
const;
 
  277        QVector<QgsMeshVertex> mAddedVertices;
 
  278        QList<int> mVerticesIndexesToRemove;
 
  279        QList<int> mChangedVerticesCoordinates;
 
  280        mutable QList<double> mOldZValue;
 
  281        QList<double> mNewZValue;
 
  282        QList<QgsPointXY> mOldXYValue;
 
  283        QList<QgsPointXY> mNewXYValue;
 
  285        QVector<QgsMeshFace> mNativeFacesToAdd;
 
  286        QList<int> mNativeFaceIndexesToRemove;
 
  287        QVector<QgsMeshFace> mNativeFacesToRemove;
 
  288        QList<int> mNativeFaceIndexesGeometryChanged;
 
  289        QVector<QgsMeshFace> mNativeFacesGeometryChanged;
 
  290        mutable QList<int> mTriangleIndexesGeometryChanged;
 
  292        mutable int mTrianglesAddedStartIndex = 0;  
 
  293        mutable QList<int> mRemovedTriangleIndexes; 
 
  348    void triangulate( 
const QgsMeshFace &face, 
int nativeIndex );
 
  358    void finalizeTriangles();
 
  363    QVector<int> mTrianglesToNativeFaces; 
 
  364    QVector<int> mEdgesToNativeEdges; 
 
  367    QVector<QgsMeshVertex> mNativeMeshFaceCentroids;
 
  370    QVector<QgsMeshVertex> mNativeMeshEdgeCentroids;
 
  377    mutable bool mIsExtentValid = 
false;
 
  380    double mAverageTriangleSize = 0;
 
  385    friend class TestQgsTriangularMesh;
 
  397  CORE_EXPORT std::unique_ptr< QgsPolygon > 
toPolygon( 
const QgsMeshFace &face, 
const QVector<QgsMeshVertex> &vertices );
 
  403  CORE_EXPORT QSet<int> 
nativeFacesFromTriangles( 
const QList<int> &triangleIndexes, 
const QVector<int> &trianglesToNativeFaces );
 
  409  CORE_EXPORT QSet<int> 
nativeEdgesFromEdges( 
const QList<int> &edgesIndexes, 
const QVector<int> &edgesToNativeEdges );
 
  421  CORE_EXPORT QSet<int> 
nativeVerticesFromEdges( 
const QList<int> &edgesIndexes, 
const QVector<QgsMeshEdge> &edges );
 
TransformDirection
Flags for raster layer temporal capabilities.
 
A geometry is the spatial representation of a feature.
 
A spatial index for QgsMeshFace or QgsMeshEdge objects.
 
A class to represent a 2D point.
 
Point geometry type, with support for z-dimension and m-values.
 
A rectangle specified with double values.
 
Contains information about the context of a rendering operation.
 
Class that contains topological differences between two states of a topological mesh,...
 
The Changes class is used to make changes of the triangular and to keep traces of this changes If a C...
 
Changes()=default
Default constructor, no changes.
 
Triangular/Derived Mesh is mesh with vertices in map coordinates.
 
QgsRectangle nativeExtent()
Returns the extent of the mesh in the native mesh coordinates system, returns empty extent if the tra...
 
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)
 
QgsMeshVertex triangularToNativeCoordinates(const QgsMeshVertex &vertex) const
Transforms the vertex from triangular mesh coordinates system to native coordinates system.
 
QgsMeshVertex nativeToTriangularCoordinates(const QgsMeshVertex &vertex) const
Transforms the vertex from native coordinates system to triangular mesh coordinates system.
 
~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.
 
void setCounterClockwise(QgsMeshFace &triangle, const QgsMeshVertex &v0, const QgsMeshVertex &v1, const QgsMeshVertex &v2)
Checks if the triangle is counter clockwise, if not sets it counter clockwise.
 
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 QgsMeshVertex centroid(const QgsMeshFace &face, const QVector< QgsMeshVertex > &vertices)
Returns the centroid of the face.
 
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.