Skip to content

Commit

Permalink
apply martin's review
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Mar 12, 2019
1 parent 3a360ac commit 859f30f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 11 additions & 1 deletion src/gui/qgsadvanceddigitizingdockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,17 @@ bool QgsAdvancedDigitizingDockWidget::applyConstraints( QgsMapMouseEvent *e )
e->setMapPoint( point );

mSnapMatch = context.snappingUtils->snapToMap( point );

/*
* Constraints are applied in 2D, they are always called when using the tool
* but they do not take into account if when you snap on a vertex it has
* a Z value.
* To get the value we use the snapPoint method. However, we only apply it
* when the snapped point corresponds to the constrained point.
*/
if ( mSnapMatch.hasVertex() && ( point == mSnapMatch.point() ) )
{
e->snapPoint();
}
// update the point list
updateCurrentPoint( point );

Expand Down
10 changes: 0 additions & 10 deletions src/gui/qgsmaptooladvanceddigitizing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ void QgsMapToolAdvancedDigitizing::canvasPressEvent( QgsMapMouseEvent *e )
{
mCadDockWidget->applyConstraints( e ); // updates event's map point

if ( mCadDockWidget->mapPointMatch().hasVertex() )
{
e->snapPoint();
}

if ( mCadDockWidget->constructionMode() )
return; // decided to eat the event and not pass it to the map tool (construction mode)
}
Expand Down Expand Up @@ -78,11 +73,6 @@ void QgsMapToolAdvancedDigitizing::canvasReleaseEvent( QgsMapMouseEvent *e )

mCadDockWidget->releaseLocks( false );

if ( mCadDockWidget->mapPointMatch().hasVertex() )
{
e->snapPoint();
}

if ( mCadDockWidget->constructionMode() )
return; // decided to eat the event and not pass it to the map tool (construction mode)
}
Expand Down

0 comments on commit 859f30f

Please sign in to comment.