Skip to content
Permalink
Browse files
Force mesh by polylines (#44962)
[mesh] [feature] allow modify mesh frame elevation by force/break lines
  • Loading branch information
vcloarec committed Sep 9, 2021
1 parent a7586e9 commit 46013949fb8f18fcc3bd2194d34a819d77ceb64d
@@ -928,6 +928,7 @@
<file>themes/default/mActionNewMeshLayer.svg</file>
<file>themes/default/mActionMeshTransformByExpression.svg</file>
<file>themes/default/mIconVertexCoordinates.svg</file>
<file>themes/default/mActionMeshEditForceByVectorLines.svg</file>
<file>themes/default/mIconGeometryCollectionLayer.svg</file>
<file>themes/default/mIconGps.svg</file>
<file>themes/default/mActionNewGpx.svg</file>
@@ -0,0 +1 @@
<svg height="24" width="24" xmlns="http://www.w3.org/2000/svg"><g stroke-linecap="round"><g fill="none" stroke="#5b6775" stroke-linejoin="bevel" stroke-width="1.001575" transform="translate(36.080801 -6.377072)"><g transform="translate(1.53601 -4.184115)"><path d="m-35.041811 13.136187-1.269685 20.357015 21.122373-.23733-.772688-19.998685-5.744.022-6.985 15.153z"/><path d="m-36.311496 33.493202 7.620685-5.061015 13.501688 4.823685-6.516688-19.976685"/></g><path d="m-33.505801 8.9520718 13.336.143"/></g><g stroke="#c4a000" stroke-linejoin="round"><path d="m2.575 2.575 6.351 15.296 6.985-15.153 5.744-.022" fill="none" stroke-width="1.5"/><path d="m4.257 2.575a1.681 1.681 0 1 1 -3.363 0 1.681 1.681 0 1 1 3.363 0zm6.372 14.495a1.681 1.681 0 1 1 -3.363 0 1.681 1.681 0 1 1 3.363 0zm6.786-14.388a1.681 1.681 0 1 1 -3.363 0 1.681 1.681 0 1 1 3.363 0zm5.921.014a1.681 1.681 0 1 1 -3.363 0 1.681 1.681 0 1 1 3.363 0z" fill="#eeeeec" fill-rule="evenodd"/></g></g></svg>
@@ -50,6 +50,12 @@ Returns a message that can be provided by the advanced editing when applying is
void clear();
%Docstring
Removes all data provided to the editing or created by the editing
%End

virtual bool isFinished() const;
%Docstring
Returns whether the advanced edit is finished,
if not, tis edit has to be applied again with :py:func:`QgsMeshEditor.advancedEdit()` until is finished returns ``True``
%End

protected:
@@ -189,6 +189,12 @@ Returns whether the vertex with index ``vertexIndex`` is a free vertex
bool checkConsistency() const;
%Docstring
Return ``True`` if the edited mesh is consistent
%End

bool edgeIsClose( QgsPointXY point, double tolerance, int &faceIndex, int &edgePosition );
%Docstring
Returns ``True`` if an edge of face is closest than the tolerance from the ``point`` in triangular mesh coordinate
Returns also the face index and the edge position in ``faceIndex`` and ``edgePosition``
%End

signals:
@@ -0,0 +1,112 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/mesh/qgsmeshforcebypolylines.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/



class QgsMeshEditForceByLine : QgsMeshAdvancedEditing
{
%Docstring(signature="appended")

Class derived from :py:class:`QgsMeshAdvancedEditing` that forces mesh based on a line

Forcing lines consist of line that the faces are forced to follow, that is edges of encountered faces have to be on theses lines.

Caller of this class has to set the line with :py:func:`~setInputLine` before applying the edition with :py:func:`QgsMeshEditor.advancedEdit()`

Other option has also to be set before calling :py:func:`QgsMeshEditor.advancedEdit()`

.. versionadded:: 3.22
%End

%TypeHeaderCode
#include "qgsmeshforcebypolylines.h"
%End
public:

QgsMeshEditForceByLine();
%Docstring
Constructor
%End

void setInputLine( const QgsPoint &pt1, const QgsPoint &pt2, double tolerance, bool newVertexOnIntersection );
%Docstring
Sets the input forcing line in rendering coordinates
%End

void setTolerance( double tolerance );
%Docstring
Sets the tolerance in redering coordinate system unit
%End

void setAddVertexOnIntersection( bool addVertex );
%Docstring
Sets whether vertices will be added when the lines will intersect internal edges of faces, default is ``False``
%End

void setDefaultZValue( double defaultZValue );
%Docstring
Sets the default value of Z coordinate to use for new vertices, this value will be used if the Z value
%End

void setInterpolateZValueOnMesh( bool interpolateZValueOnMesh );
%Docstring
Sets whether the new created vertices will have their value interpolated from the existing mesh.
If not, Z value will be interpolated from the lines,
in case these line are not 3D, the default value will be used (:py:func:`setDefaultZValue`)
%End

};



class QgsMeshEditForceByPolylines : QgsMeshEditForceByLine
{
%Docstring(signature="appended")

Class derived from QgsMeshEditForceByLine that forces mesh based on polyline.

Forcing lines consist of line that the faces are forced to follow, that is edges of encountered faces have to be on theses lines.

Caller of this class has to add the lines from :py:class:`QgsGeometry` instances with :py:func:`~QgsMeshEditForceByLine.addLineFromGeometry` or :py:func:`~QgsMeshEditForceByLine.addLinesFromGeometries`
before applying the edition with :py:func:`QgsMeshEditor.advancedEdit()`

.. versionadded:: 3.22
%End

%TypeHeaderCode
#include "qgsmeshforcebypolylines.h"
%End
public:

QgsMeshEditForceByPolylines();
%Docstring
Constructor
%End

virtual bool isFinished() const;


void addLineFromGeometry( const QgsGeometry &geom );
%Docstring
Adds a input forcing line geometry in rendering coordinates
%End

void addLinesFromGeometries( const QList<QgsGeometry> geometries );
%Docstring
Adds a list of input forcing lines geometry in rendering coordinates
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/mesh/qgsmeshforcebypolylines.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -437,6 +437,7 @@
%Include auto_generated/mesh/qgsmeshtracerenderer.sip
%Include auto_generated/mesh/qgsmeshcalculator.sip
%Include auto_generated/mesh/qgsmeshadvancedediting.sip
%Include auto_generated/mesh/qgsmeshforcebypolylines.sip
%Include auto_generated/pointcloud/qgspointcloudattribute.sip
%Include auto_generated/pointcloud/qgspointcloudattributebyramprenderer.sip
%Include auto_generated/pointcloud/qgspointcloudattributemodel.sip
@@ -433,6 +433,8 @@ QgsTopologicalMesh::Changes QgsMeshEditingDelaunayTriangulation::apply( QgsMeshE
if ( !removedVerticesFromTriangulation.isEmpty() )
mMessage = QObject::tr( "%1 vertices have not been included in the triangulation" ).arg( removedVerticesFromTriangulation.count() );

mIsFinished = true;

if ( triangulationReady && !giveUp )
return meshEditor->topologicalMesh().addFaces( topologicFaces );
else

0 comments on commit 4601394

Please sign in to comment.