Skip to content

Commit

Permalink
Reset digitizing tools when new project is loaded/created
Browse files Browse the repository at this point in the history
  • Loading branch information
SebDieBln authored and m-kuhn committed Aug 13, 2017
1 parent b00a60d commit 479e3cb
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
12 changes: 7 additions & 5 deletions python/gui/qgsmaptoolcapture.sip
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ Removes the last vertex from mRubberBand and mCaptureList
:rtype: bool
%End

void stopCapturing();
%Docstring
Stop capturing
%End

int size();
%Docstring
Number of points digitized
Expand Down Expand Up @@ -146,6 +141,13 @@ Removes the last vertex from mRubberBand and mCaptureList
Close an open polygon
%End

protected slots:

void stopCapturing();
%Docstring
Stop capturing
%End

};

/************************************************************************
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsmaptooladdcircularstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ QgsMapToolAddCircularString::QgsMapToolAddCircularString( QgsMapToolCapture *par
{
connect( mCanvas, &QgsMapCanvas::mapToolSet, this, &QgsMapToolAddCircularString::setParentTool );
}
connect( QgisApp::instance(), SIGNAL( newProject() ), this, SLOT( stopCapturing() ) );
connect( QgisApp::instance(), SIGNAL( projectRead() ), this, SLOT( stopCapturing() ) );
}

QgsMapToolAddCircularString::QgsMapToolAddCircularString( QgsMapCanvas *canvas )
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsmaptooladdfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ QgsMapToolAddFeature::QgsMapToolAddFeature( QgsMapCanvas *canvas, CaptureMode mo
, mCheckGeometryType( true )
{
mToolName = tr( "Add feature" );
connect( QgisApp::instance(), SIGNAL( newProject() ), this, SLOT( stopCapturing() ) );
connect( QgisApp::instance(), SIGNAL( projectRead() ), this, SLOT( stopCapturing() ) );
}

QgsMapToolAddFeature::~QgsMapToolAddFeature()
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsmaptooladdpart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ QgsMapToolAddPart::QgsMapToolAddPart( QgsMapCanvas *canvas )
: QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget() )
{
mToolName = tr( "Add part" );
connect( QgisApp::instance(), SIGNAL( newProject() ), this, SLOT( stopCapturing() ) );
connect( QgisApp::instance(), SIGNAL( projectRead() ), this, SLOT( stopCapturing() ) );
}

QgsMapToolAddPart::~QgsMapToolAddPart()
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsmaptooladdring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ QgsMapToolAddRing::QgsMapToolAddRing( QgsMapCanvas *canvas )
: QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget(), QgsMapToolCapture::CapturePolygon )
{
mToolName = tr( "Add ring" );
connect( QgisApp::instance(), SIGNAL( newProject() ), this, SLOT( stopCapturing() ) );
connect( QgisApp::instance(), SIGNAL( projectRead() ), this, SLOT( stopCapturing() ) );
}

QgsMapToolAddRing::~QgsMapToolAddRing()
Expand Down
12 changes: 7 additions & 5 deletions src/gui/qgsmaptoolcapture.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,6 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
*/
bool isCapturing() const;

/**
* Stop capturing
*/
void stopCapturing();

/**
* Number of points digitized
*
Expand All @@ -177,6 +172,13 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
*/
void closePolygon();

protected slots:

/**
* Stop capturing
*/
void stopCapturing();

private:
//! whether tracing has been requested by the user
bool tracingEnabled();
Expand Down

0 comments on commit 479e3cb

Please sign in to comment.