16 #ifndef QGSMESHFORCEBYPOLYLINES_H
17 #define QGSMESHFORCEBYPOLYLINES_H
20 #include "qgis_core.h"
47 void setInputLine(
const QgsPoint &pt1,
const QgsPoint &pt2,
double tolerance,
bool newVertexOnIntersection );
50 void setTolerance(
double tolerance );
53 void setAddVertexOnIntersection(
bool addVertex );
56 void setDefaultZValue(
double defaultZValue );
63 void setInterpolateZValueOnMesh(
bool interpolateZValueOnMesh );
68 bool mNewVertexOnIntersection =
false;
69 double mTolerance = 1e-8;
70 double mDefaultZValue = 0;
71 bool mInterpolateZValueOnMesh =
false;
75 virtual void finish();
79 QList<int> mRemovedFaces;
80 QList<int> mHoleOnLeft;
81 QList<int> mNeighborOnLeft;
82 QList<int> mHoleOnRight;
83 QList<int> mNeighborOnRight;
84 QList<int> mNewVerticesIndexesOnLine;
85 bool mEndOnPoint2 =
false;
86 int mPoint2VertexIndex = -1;
87 int mCurrentSnappedVertex = -1;
90 bool mFirstPointChecked =
false;
91 bool mSecondPointChecked =
false;
93 void interpolateZValueOnMesh(
QgsPoint &point )
const;
94 void interpolateZValueOnMesh(
int faceIndex,
QgsPoint &point )
const;
98 bool buildForcedElements();
100 bool edgeIntersection(
int vertex1,
102 int &closestSnappedVertex,
106 bool searchIntersectionEdgeFromSnappedVertex(
107 int &intersectionFaceIndex,
108 int &previousSnappedVertex,
109 int ¤tSnappedVertexIndex,
112 QSet<int> &treatedFaces );
117 bool triangulateHoles(
const QList<int> &holeOnLeft,
118 const QList<int> &neighborOnLeft,
120 QList<std::array<int, 2> > &newFacesOnLine,
121 std::array<int, 2> &extremeFaces );
123 bool finishForcingLine();
125 friend class TestQgsMeshEditor;
151 QString
text()
const override;
160 void addLineFromGeometry(
const QgsGeometry &geom );
168 void addLinesFromGeometries(
const QList<QgsGeometry> geometries );
171 QList<QgsPointSequence> mPolylines;
172 int mCurrentPolyline = 0;
173 int mCurrentSegment = 0;
175 void incrementSegment();
A geometry is the spatial representation of a feature.
Abstract class that can be derived to implement advanced editing on mesh.
virtual QgsTopologicalMesh::Changes apply(QgsMeshEditor *meshEditor)=0
Apply a change to mesh Editor.
virtual bool isFinished() const
Returns whether the advanced edit is finished, if not, this edit has to be applied again with QgsMesh...
virtual QString text() const
Returns a short text string describing what this advanced edit does. Default implementation return a ...
Class derived from QgsMeshAdvancedEditing that forces mesh based on a line.
QgsMeshEditForceByLine()=default
Constructor.
void setInputLine(const QgsPoint &pt1, const QgsPoint &pt2, double tolerance, bool newVertexOnIntersection)
Sets the input forcing line in rendering coordinates.
Class derived from QgsMeshEditForceByLine that forces mesh based on polyline.
QgsMeshEditForceByPolylines()=default
Constructor.
Class that makes edit operation on a mesh.
Point geometry type, with support for z-dimension and m-values.
Class that contains topological differences between two states of a topological mesh,...