18 #ifndef QGSTRIANGULARMESH_H
19 #define QGSTRIANGULARMESH_H
29 #include "qgis_core.h"
73 const QVector<QgsMeshVertex> &vertices()
const ;
76 const QVector<QgsMeshFace> &triangles()
const ;
79 const QVector<QgsMeshEdge> &edges()
const ;
86 Q_DECL_DEPRECATED
const QVector<QgsMeshVertex> ¢roids()
const ;
92 const QVector<QgsMeshVertex> &faceCentroids()
const ;
98 const QVector<QgsMeshVertex> &edgeCentroids()
const ;
101 const QVector<int> &trianglesToNativeFaces()
const ;
104 const QVector<int> &edgesToNativeEdges()
const ;
125 int faceIndexForPoint(
const QgsPointXY &point )
const ;
136 int faceIndexForPoint_v2(
const QgsPointXY &point )
const;
147 int nativeFaceIndexForPoint(
const QgsPointXY &point )
const ;
158 QList<int> nativeFaceIndexForRectangle(
const QgsRectangle &rectangle )
const ;
169 QList<int> faceIndexesForRectangle(
const QgsRectangle &rectangle )
const ;
178 QList<int> edgeIndexesForRectangle(
const QgsRectangle &rectangle )
const ;
188 QVector<QVector3D> vertexNormals(
float vertScale )
const;
205 QVector<QgsTriangularMesh *> simplifyMesh(
double reductionFactor,
int minimumTrianglesCount = 10 )
const;
213 double averageTriangleSize()
const;
225 int levelOfDetail()
const;
265 QVector<QgsMeshVertex> mAddedVertices;
266 QList<int> mVerticesIndexesToRemove;
267 QList<int> mChangedVerticesCoordinates;
268 mutable QList<double> mOldZValue;
269 QList<double> mNewZValue;
270 QList<QgsPointXY> mOldXYValue;
271 QList<QgsPointXY> mNewXYValue;
273 QVector<QgsMeshFace> mNativeFacesToAdd;
274 QList<int> mNativeFaceIndexesToRemove;
275 QVector<QgsMeshFace> mNativeFacesToRemove;
276 QList<int> mNativeFaceIndexesGeometryChanged;
277 QVector<QgsMeshFace> mNativeFacesGeometryChanged;
278 mutable QList<int> mTriangleIndexesGeometryChanged;
280 mutable int mTrianglesAddedStartIndex = 0;
281 mutable QList<int> mRemovedTriangleIndexes;
336 void triangulate(
const QgsMeshFace &face,
int nativeIndex );
346 void finalizeTriangles();
351 QVector<int> mTrianglesToNativeFaces;
352 QVector<int> mEdgesToNativeEdges;
355 QVector<QgsMeshVertex> mNativeMeshFaceCentroids;
358 QVector<QgsMeshVertex> mNativeMeshEdgeCentroids;
365 mutable bool mIsExtentValid =
false;
368 double mAverageTriangleSize = 0;
373 friend class TestQgsTriangularMesh;
385 CORE_EXPORT std::unique_ptr< QgsPolygon >
toPolygon(
const QgsMeshFace &face,
const QVector<QgsMeshVertex> &vertices );
391 CORE_EXPORT QSet<int>
nativeFacesFromTriangles(
const QList<int> &triangleIndexes,
const QVector<int> &trianglesToNativeFaces );
397 CORE_EXPORT QSet<int>
nativeEdgesFromEdges(
const QList<int> &edgesIndexes,
const QVector<int> &edgesToNativeEdges );
409 CORE_EXPORT QSet<int>
nativeVerticesFromEdges(
const QList<int> &edgesIndexes,
const QVector<QgsMeshEdge> &edges );
425 #endif // QGSTRIANGULARMESH_H