Skip to content
Permalink
Browse files
fix snapping on 2D and rebase
  • Loading branch information
lbartoletti authored and nyalldawson committed Sep 12, 2021
1 parent 5568bf9 commit a4a50d2cd94dc1a8c16db8f9af1baf19830d6344
Showing with 10 additions and 10 deletions.
  1. +6 −6 src/gui/qgsadvanceddigitizingdockwidget.cpp
  2. +4 −4 src/gui/qgsmaptoolcapture.cpp
@@ -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.
@@ -874,7 +875,6 @@ bool QgsAdvancedDigitizingDockWidget::applyConstraints( QgsMapMouseEvent *e )
}
if ( mLockMButton->isChecked() )
{

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

@@ -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 & )
{

0 comments on commit a4a50d2

Please sign in to comment.