Skip to content
Permalink
Browse files

[BUGFIX] Remove Added Vertex with Add Circular String. Fixes #29688

  • Loading branch information
lbartoletti authored and nyalldawson committed Jan 27, 2020
1 parent f16ae2a commit fd493ffd1ddbd6ff41290cde1c4699d34ac84f16
Showing with 33 additions and 2 deletions.
  1. +27 −0 src/app/qgsmaptooladdcircularstring.cpp
  2. +6 −2 src/app/qgsmaptoolcircularstringcurvepoint.cpp
@@ -66,6 +66,33 @@ void QgsMapToolAddCircularString::keyPressEvent( QKeyEvent *e )
if ( mParentTool )
mParentTool->keyPressEvent( e );
}
if ( ( e && e->key() == Qt::Key_Backspace ) && ( ! mPoints.isEmpty() ) )
{
mPoints.removeLast();
std::unique_ptr<QgsCircularString> geomRubberBand( new QgsCircularString() );
std::unique_ptr<QgsLineString> geomTempRubberBand( new QgsLineString() );
const int lastPositionCompleteCircularString = mPoints.size() - 1 - ( mPoints.size() + 1 ) % 2 ;

geomTempRubberBand->setPoints( mPoints.mid( lastPositionCompleteCircularString ) );
mTempRubberBand->setGeometry( geomTempRubberBand.release() );

if ( mRubberBand )
{
geomRubberBand->setPoints( mPoints.mid( 0, lastPositionCompleteCircularString + 1 ) );
mRubberBand->setGeometry( geomRubberBand.release() );
}

QgsVertexId idx( 0, 0, ( mPoints.size() + 1 ) % 2 );
if ( mTempRubberBand )
{
mTempRubberBand->moveVertex( idx, mPoints.last() );
updateCenterPointRubberBand( mPoints.last() );
}

if ( mParentTool )
mParentTool->keyPressEvent( e );

}
}

void QgsMapToolAddCircularString::keyReleaseEvent( QKeyEvent *e )
@@ -87,10 +87,14 @@ void QgsMapToolCircularStringCurvePoint::cadCanvasMoveEvent( QgsMapMouseEvent *e

mSnapIndicator->setMatch( e->mapPointMatch() );

QgsVertexId idx( 0, 0, 1 + ( mPoints.size() + 1 ) % 2 );
if ( mTempRubberBand )
{
mTempRubberBand->moveVertex( idx, mapPoint );
QgsPointSequence mTempPoints = mPoints.mid( mPoints.size() - 1 - ( mPoints.size() + 1 ) % 2 );
mTempPoints.append( mapPoint );
std::unique_ptr<QgsCircularString> geom( new QgsCircularString() );
geom->setPoints( mTempPoints );
mTempRubberBand->setGeometry( geom.release() );

updateCenterPointRubberBand( mapPoint );
}
}

0 comments on commit fd493ff

Please sign in to comment.
You can’t perform that action at this time.