mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Remove digitising rubberbands if the editing tools have been deactivated or are deleted
git-svn-id: http://svn.osgeo.org/qgis/trunk@5097 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
c3b5476978
commit
d794c382f1
@ -174,7 +174,6 @@ QgsMapLayer* QgsMapCanvas::getZpos(int index)
|
||||
void QgsMapCanvas::setCurrentLayer(QgsMapLayer* layer)
|
||||
{
|
||||
mCurrentLayer = layer;
|
||||
std::cout << "QgsMapCanvas::setCurrentLayer" << std::endl;
|
||||
}
|
||||
|
||||
double QgsMapCanvas::getScale()
|
||||
@ -1026,7 +1025,6 @@ void QgsMapCanvas::panAction(QMouseEvent * e)
|
||||
updateContents();
|
||||
}
|
||||
|
||||
|
||||
void QgsMapCanvas::moveCanvasContents(bool reset)
|
||||
{
|
||||
QPoint pnt(0,0);
|
||||
|
@ -194,7 +194,6 @@ class QgsMapCanvas : public Q3CanvasView
|
||||
void panActionEnd(QPoint releasePoint);
|
||||
//! Called when mouse is moving and pan is activated
|
||||
void panAction(QMouseEvent * event);
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
|
||||
QgsMapToolCapture::QgsMapToolCapture(QgsMapCanvas* canvas, enum CaptureTool tool)
|
||||
: QgsMapTool(canvas), mTool(tool)
|
||||
: QgsMapTool(canvas), mTool(tool), mRubberBand(0)
|
||||
{
|
||||
mCapturing = FALSE;
|
||||
|
||||
@ -38,6 +38,12 @@ QgsMapToolCapture::QgsMapToolCapture(QgsMapCanvas* canvas, enum CaptureTool tool
|
||||
mCursor = QCursor(mySelectQPixmap, 8, 8);
|
||||
}
|
||||
|
||||
QgsMapToolCapture::~QgsMapToolCapture()
|
||||
{
|
||||
delete mRubberBand;
|
||||
mRubberBand = 0;
|
||||
}
|
||||
|
||||
|
||||
QgsPoint QgsMapToolCapture::maybeInversePoint(QgsPoint point, const char whenmsg[])
|
||||
{
|
||||
@ -280,3 +286,9 @@ void QgsMapToolCapture::canvasPressEvent(QMouseEvent * e)
|
||||
void QgsMapToolCapture::renderComplete()
|
||||
{
|
||||
}
|
||||
|
||||
void QgsMapToolCapture::deactivate()
|
||||
{
|
||||
delete mRubberBand;
|
||||
mRubberBand = 0;
|
||||
}
|
||||
|
@ -41,6 +41,9 @@ class QgsMapToolCapture : public QgsMapTool
|
||||
//! constructor
|
||||
QgsMapToolCapture(QgsMapCanvas* canvas, enum CaptureTool tool);
|
||||
|
||||
//! destructor
|
||||
virtual ~QgsMapToolCapture();
|
||||
|
||||
//! Overridden mouse move event
|
||||
virtual void canvasMoveEvent(QMouseEvent * e);
|
||||
|
||||
@ -54,6 +57,8 @@ class QgsMapToolCapture : public QgsMapTool
|
||||
virtual void renderComplete();
|
||||
|
||||
virtual QString toolName() { return MapTool_Capture; }
|
||||
|
||||
virtual void deactivate();
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -29,13 +29,19 @@
|
||||
|
||||
|
||||
QgsMapToolVertexEdit::QgsMapToolVertexEdit(QgsMapCanvas* canvas, enum Tool tool)
|
||||
: QgsMapTool(canvas), mTool(tool)
|
||||
: QgsMapTool(canvas), mTool(tool), mRubberBand(0)
|
||||
{
|
||||
// TODO - select a real cursor
|
||||
QPixmap mySelectQPixmap = QPixmap((const char **) capture_point_cursor);
|
||||
mCursor = QCursor(mySelectQPixmap, 8, 8);
|
||||
}
|
||||
|
||||
QgsMapToolVertexEdit::~QgsMapToolVertexEdit()
|
||||
{
|
||||
delete mRubberBand;
|
||||
mRubberBand = 0;
|
||||
}
|
||||
|
||||
|
||||
void QgsMapToolVertexEdit::canvasMoveEvent(QMouseEvent * e)
|
||||
{
|
||||
@ -239,7 +245,7 @@ void QgsMapToolVertexEdit::canvasReleaseEvent(QMouseEvent * e)
|
||||
return;
|
||||
}
|
||||
|
||||
if (vlayer->getDataProvider()->capabilities() & QgsVectorDataProvider::ChangeGeometries)
|
||||
if (!(vlayer->getDataProvider()->capabilities() & QgsVectorDataProvider::ChangeGeometries))
|
||||
{
|
||||
QMessageBox::information(0,"Change geometry",
|
||||
"Data provider of the current layer doesn't allow changing geometries",
|
||||
@ -311,3 +317,9 @@ void QgsMapToolVertexEdit::createRubberBand()
|
||||
mRubberBand->setWidth(project->readNumEntry("Digitizing", "/LineWidth", 1));
|
||||
}
|
||||
|
||||
void QgsMapToolVertexEdit::deactivate()
|
||||
{
|
||||
delete mRubberBand;
|
||||
mRubberBand = 0;
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,8 @@ class QgsMapToolVertexEdit : public QgsMapTool
|
||||
|
||||
//! constructor
|
||||
QgsMapToolVertexEdit(QgsMapCanvas* canvas, enum Tool tool);
|
||||
|
||||
virtual ~QgsMapToolVertexEdit();
|
||||
|
||||
//! Overridden mouse move event
|
||||
virtual void canvasMoveEvent(QMouseEvent * e);
|
||||
@ -49,7 +51,9 @@ class QgsMapToolVertexEdit : public QgsMapTool
|
||||
virtual void canvasReleaseEvent(QMouseEvent * e);
|
||||
|
||||
virtual QString toolName() { return MapTool_VertexEdit; }
|
||||
|
||||
|
||||
virtual void deactivate();
|
||||
|
||||
private:
|
||||
|
||||
//! create instance of rubber band
|
||||
|
Loading…
x
Reference in New Issue
Block a user