Skip to content
Permalink
Browse files

Remove digitising rubberbands if the editing tools have been deactiva…

…ted or are deleted

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5097 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Mar 24, 2006
1 parent 56ad17d commit da982f047dbac864ed897e4f557c0f0fd2a251f8
@@ -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,14 +30,20 @@


QgsMapToolCapture::QgsMapToolCapture(QgsMapCanvas* canvas, enum CaptureTool tool)
: QgsMapTool(canvas), mTool(tool)
: QgsMapTool(canvas), mTool(tool), mRubberBand(0)
{
mCapturing = FALSE;

QPixmap mySelectQPixmap = QPixmap((const char **) capture_point_cursor);
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

0 comments on commit da982f0

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