Skip to content
Permalink
Browse files

Override clean() to remove rubber bands in vertex tool and circular s…

…tring
  • Loading branch information
gacarrillor authored and nyalldawson committed Jun 19, 2020
1 parent a0685c4 commit 45125979b2f38820a9fa2e1737aab00467d94489
@@ -58,12 +58,7 @@ void QgsMapToolAddCircularString::keyPressEvent( QKeyEvent *e )

if ( ( e && e->key() == Qt::Key_Escape ) || ( ( e && e->key() == Qt::Key_Backspace ) && ( mPoints.size() == 1 ) ) )
{
mPoints.clear();
delete mRubberBand;
mRubberBand = nullptr;
delete mTempRubberBand;
mTempRubberBand = nullptr;
removeCenterPointRubberBand();
clean();
if ( mParentTool )
mParentTool->keyPressEvent( e );
}
@@ -125,12 +120,7 @@ void QgsMapToolAddCircularString::deactivate()
QgsCircularString *c = new QgsCircularString();
c->setPoints( mPoints );
mParentTool->addCurve( c );
mPoints.clear();
delete mRubberBand;
mRubberBand = nullptr;
delete mTempRubberBand;
mTempRubberBand = nullptr;
removeCenterPointRubberBand();
clean();
QgsMapToolCapture::deactivate();
}

@@ -253,3 +243,13 @@ void QgsMapToolAddCircularString::release( QgsMapMouseEvent *e )
}
activate();
}

void QgsMapToolAddCircularString::clean()
{
mPoints.clear();
delete mRubberBand;
mRubberBand = nullptr;
delete mTempRubberBand;
mTempRubberBand = nullptr;
removeCenterPointRubberBand();
}
@@ -36,6 +36,9 @@ class APP_EXPORT QgsMapToolAddCircularString: public QgsMapToolCapture

void activate() override;

//! Clean drawings on map canvas
void clean() override;

/*private slots:
void setParentTool( QgsMapTool *newTool, QgsMapTool *oldTool );*/

@@ -2861,3 +2861,16 @@ void QgsVertexTool::cleanEditor( QgsFeatureId id )
cleanupVertexEditor();
};
}

void QgsVertexTool::clean()
{
if ( mDraggingVertex || mDraggingEdge )
{
stopDragging();
}
if ( mSelectionRubberBand )
{
stopSelectionRubberBand();
mSelectionRubberBandStartPos.reset();
}
}
@@ -91,6 +91,9 @@ class APP_EXPORT QgsVertexTool : public QgsMapToolAdvancedDigitizing

void deactivate() override;

//! Clean drawings on map canvas
void clean() override;

void keyPressEvent( QKeyEvent *e ) override;

QgsGeometry cachedGeometry( const QgsVectorLayer *layer, QgsFeatureId fid );

0 comments on commit 4512597

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