Skip to content
Permalink
Browse files
fix snapping with mesh editing map tool
  • Loading branch information
vcloarec authored and nyalldawson committed Oct 28, 2021
1 parent d3c2564 commit 811c3d12d46e3a16fa75de7d3a9ca0eb1b91888d
Showing with 15 additions and 3 deletions.
  1. +15 −3 src/app/mesh/qgsmaptooleditmeshframe.cpp
@@ -901,8 +901,9 @@ void QgsMapToolEditMeshFrame::cadCanvasMoveEvent( QgsMapMouseEvent *e )
}
else if ( matchPoint.isValid() && matchPoint.layer() && QgsWkbTypes::hasZ( matchPoint.layer()->wkbType() ) )
{
mForceByLineRubberBand->movePoint( mapPoint );
if ( mZValueWidget )
mZValueWidget->setZValue( e->mapPointMatch().interpolatedPoint().z() );
mZValueWidget->setZValue( e->mapPointMatch().interpolatedPoint( mCanvas->mapSettings().destinationCrs() ).z() );
}
else
{
@@ -1052,8 +1053,11 @@ void QgsMapToolEditMeshFrame::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
if ( e->mapPointMatch().isValid() &&
QgsWkbTypes::hasZ( e->mapPointMatch().layer()->wkbType() ) )
{
const QgsMeshVertex mapPointInMapCoordinate =
QgsMeshVertex( mapPoint.x(), mapPoint.y(), e->mapPointMatch().interpolatedPoint( mCanvas->mapSettings().destinationCrs() ).z() );

const QgsMeshVertex &mapPointInNativeCoordinate =
mCurrentLayer->triangularMesh()->triangularToNativeCoordinates( QgsMeshVertex( mapPoint.x(), mapPoint.y(), e->mapPointMatch().interpolatedPoint().z() ) );
mCurrentLayer->triangularMesh()->triangularToNativeCoordinates( mapPointInMapCoordinate ) ;
mCurrentEditor->changeCoordinates( verticesIndexes,
QList<QgsPoint>()
<< mapPointInNativeCoordinate ) ;
@@ -2285,6 +2289,8 @@ void QgsMapToolEditMeshFrame::forceByLineReleaseEvent( QgsMapMouseEvent *e )

if ( e->button() == Qt::LeftButton )
{
double zValue = currentZValue();

if ( mCurrentVertexIndex != -1 )
{
const QgsPointXY currentPoint = mapVertexXY( mCurrentVertexIndex );
@@ -2294,10 +2300,16 @@ void QgsMapToolEditMeshFrame::forceByLineReleaseEvent( QgsMapMouseEvent *e )
}
else
{
if ( e->mapPointMatch().isValid() )
{
QgsPoint layerPoint = e->mapPointMatch().interpolatedPoint( mCanvas->mapSettings().destinationCrs() );
zValue = layerPoint.z();
}

mForceByLineRubberBand->addPoint( mapPoint );
}

mForcingLineZValue.append( currentZValue() );
mForcingLineZValue.append( zValue );
}
else if ( e->button() == Qt::RightButton )
{

0 comments on commit 811c3d1

Please sign in to comment.