Skip to content
Permalink
Browse files

Fix for ticket #398 (measuring needs a way to stop measuring without

immediately starting again)


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6153 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m
g_j_m committed Nov 30, 2006
1 parent 78fc31a commit 16d90f2fa148ab644e50b247f8fee4ba34297953
Showing with 18 additions and 3 deletions.
  1. +15 −3 src/gui/qgsmeasure.cpp
  2. +3 −0 src/gui/qgsmeasure.h
@@ -61,12 +61,15 @@ QgsMeasure::QgsMeasure(bool measureArea, QgsMapCanvas *mc, Qt::WFlags f)
mRubberBand = new QgsRubberBand(mMapCanvas, mMeasureArea);

mCanvas->setCursor(Qt::CrossCursor);

mRightMouseClicked = false;
}

void QgsMeasure::activate()
{
restorePosition();
QgsMapTool::activate();
mRightMouseClicked = false;
}

void QgsMeasure::deactivate()
@@ -100,6 +103,8 @@ void QgsMeasure::restart(void )
updateUi();

mRubberBand->reset(mMeasureArea);

mRightMouseClicked = false;
}

void QgsMeasure::addPoint(QgsPoint &point)
@@ -307,8 +312,11 @@ void QgsMeasure::canvasPressEvent(QMouseEvent * e)

void QgsMeasure::canvasMoveEvent(QMouseEvent * e)
{
QgsPoint point = mCanvas->getCoordinateTransform()->toMapCoordinates(e->pos().x(), e->pos().y());
mouseMove(point);
if (!mRightMouseClicked)
{
QgsPoint point = mCanvas->getCoordinateTransform()->toMapCoordinates(e->pos().x(), e->pos().y());
mouseMove(point);
}
}


@@ -318,11 +326,15 @@ void QgsMeasure::canvasReleaseEvent(QMouseEvent * e)

if(e->button() == Qt::RightButton && (e->state() & Qt::LeftButton) == 0) // restart
{
restart();
if (mRightMouseClicked)
restart();
else
mRightMouseClicked = true;
}
else if (e->button() == Qt::LeftButton)
{
addPoint(point);
show();
}

}
@@ -122,6 +122,9 @@ public slots:

//! indicates whether we're measuring distances or areas
bool mMeasureArea;

//! indicates whether we've just done a right mouse click
bool mRightMouseClicked;
};

#endif

0 comments on commit 16d90f2

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