Skip to content

Commit

Permalink
fix snapping on 2D and rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti authored and nyalldawson committed Sep 12, 2021
1 parent 5568bf9 commit a4a50d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/gui/qgsadvanceddigitizingdockwidget.cpp
Expand Up @@ -859,11 +859,12 @@ bool QgsAdvancedDigitizingDockWidget::applyConstraints( QgsMapMouseEvent *e )
e->snapPoint();
point = mSnapMatch.interpolatedPoint();
}
else
{
point.setZ( QgsMapToolEdit( mMapCanvas ).defaultZValue() );
point.setM( QgsMapToolEdit( mMapCanvas ).defaultMValue() );
}
/*
* Ensure that Z and M are passed
* It will be dropped as needed later.
*/
point.addZValue( QgsMapToolEdit( mMapCanvas ).defaultZValue() );
point.addMValue( QgsMapToolEdit( mMapCanvas ).defaultMValue() );

/*
* And if M or Z lock button is activated get the value of the input.
Expand All @@ -874,7 +875,6 @@ bool QgsAdvancedDigitizingDockWidget::applyConstraints( QgsMapMouseEvent *e )
}
if ( mLockMButton->isChecked() )
{

point.setM( mMLineEdit->text().toFloat() );
}

Expand Down
8 changes: 4 additions & 4 deletions src/gui/qgsmaptoolcapture.cpp
Expand Up @@ -457,10 +457,10 @@ int QgsMapToolCapture::nextPoint( const QgsPoint &mapPoint, QgsPoint &layerPoint
{
const QgsPointXY mapP( mapPoint.x(), mapPoint.y() ); //#spellok
layerPoint = QgsPoint( toLayerCoordinates( vlayer, mapP ) ); //transform snapped point back to layer crs //#spellok
if ( QgsWkbTypes::hasZ( vlayer->wkbType() ) )
layerPoint.addZValue( defaultZValue() );
if ( QgsWkbTypes::hasM( vlayer->wkbType() ) )
layerPoint.addMValue( defaultMValue() );
if ( QgsWkbTypes::hasZ( vlayer->wkbType() ) && !layerPoint.is3D() )
layerPoint.addZValue( mCadDockWidget && mCadDockWidget->cadEnabled() ? mCadDockWidget->currentPoint().z() : defaultZValue() );
if ( QgsWkbTypes::hasM( vlayer->wkbType() ) && !layerPoint.isMeasure() )
layerPoint.addMValue( mCadDockWidget && mCadDockWidget->cadEnabled() ? mCadDockWidget->currentPoint().m() : defaultMValue() );
}
catch ( QgsCsException & )
{
Expand Down

0 comments on commit a4a50d2

Please sign in to comment.