Skip to content

Commit

Permalink
Mesh editing fixes (#44881)
Browse files Browse the repository at this point in the history
[mesh]
* fix Delaunay triangulation
* fix free vertices updating
  • Loading branch information
vcloarec committed Sep 1, 2021
1 parent 5cf1b7a commit f19f554
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/analysis/mesh/qgsmeshtriangulation.cpp
Expand Up @@ -430,7 +430,8 @@ QgsTopologicalMesh::Changes QgsMeshEditingDelaunayTriangulation::apply( QgsMeshE

Q_ASSERT( meshEditor->topologicalMesh().checkConsistency() == QgsMeshEditingError() );

mMessage = QObject::tr( "%1 vertices have not been included in the triangulation" ).arg( removedVerticesFromTriangulation.count() );
if ( !removedVerticesFromTriangulation.isEmpty() )
mMessage = QObject::tr( "%1 vertices have not been included in the triangulation" ).arg( removedVerticesFromTriangulation.count() );

if ( triangulationReady && !giveUp )
return meshEditor->topologicalMesh().addFaces( topologicFaces );
Expand Down
14 changes: 7 additions & 7 deletions src/app/mesh/qgsmaptooleditmeshframe.cpp
Expand Up @@ -123,7 +123,7 @@ QgsMapToolEditMeshFrame::QgsMapToolEditMeshFrame( QgsMapCanvas *canvas )

connect( mActionDelaunayTriangulation, &QAction::triggered, this, [this]
{
if ( mCurrentEditor && mSelectedVertices.count() > 3 )
if ( mCurrentEditor && mSelectedVertices.count() >= 3 )
{
QgsMeshEditingDelaunayTriangulation triangulation;
triangulation.setInputVertices( mSelectedVertices.keys() );
Expand Down Expand Up @@ -363,6 +363,7 @@ void QgsMapToolEditMeshFrame::activate()
QgsMapToolAdvancedDigitizing::activate();
if ( mZValueWidget )
mZValueWidget->show();
updateFreeVertices();
}

bool QgsMapToolEditMeshFrame::populateContextMenuWithEvent( QMenu *menu, QgsMapMouseEvent *event )
Expand Down Expand Up @@ -1091,16 +1092,15 @@ void QgsMapToolEditMeshFrame::setCurrentLayer( QgsMapLayer *layer )
}
}

if ( mCurrentEditor && !mZValueWidget )
if ( mCurrentEditor )
{
createZValueWidget();
if ( !mZValueWidget )
createZValueWidget();
updateFreeVertices();
}

if ( !mCurrentEditor )
{
else
deactivate();
}

}

void QgsMapToolEditMeshFrame::onEdit()
Expand Down

0 comments on commit f19f554

Please sign in to comment.