Skip to content

Commit

Permalink
Merge r6396 from 0.8 branch to head
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6397 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Jan 6, 2007
1 parent ff59567 commit 0662477
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/gui/qgsmeasure.cpp
Expand Up @@ -78,8 +78,7 @@ void QgsMeasure::activate()
mRightMouseClicked = false;

// ensure that we have correct settings
mCalc->setDefaultEllipsoid();
mCalc->setProjectAsSourceSRS();
updateProjection();

QSettings settings;
int myRed = settings.value("/qgis/default_measure_color_red", 180).toInt();
Expand All @@ -104,6 +103,7 @@ void QgsMeasure::activate()
"system using the <tt>Settings:Project Properties</tt> menu."),
QMessageBox::Ok,
QMessageBox::NoButton);
mWrongProjectProjection = true;
}
}

Expand Down Expand Up @@ -131,6 +131,7 @@ QgsMeasure::~QgsMeasure()

void QgsMeasure::restart(void )
{
updateProjection();
mPoints.resize(0);
// Set one cell row where to update current distance
// If measuring area, the table doesn't get shown
Expand All @@ -150,6 +151,7 @@ void QgsMeasure::restart(void )
mRubberBand->setColor(QColor(myRed, myGreen, myBlue));

mRightMouseClicked = false;
mWrongProjectProjection = false;
}

void QgsMeasure::addPoint(QgsPoint &point)
Expand All @@ -158,6 +160,12 @@ void QgsMeasure::addPoint(QgsPoint &point)
std::cout << "QgsMeasure::addPoint" << point.x() << ", " << point.y() << std::endl;
#endif

if (mWrongProjectProjection)
{
updateProjection();
mWrongProjectProjection = false;
}

// don't add points with the same coordinates
if (mPoints.size() > 0 && point == mPoints[0])
return;
Expand Down Expand Up @@ -338,6 +346,12 @@ void QgsMeasure::updateUi()

}

void QgsMeasure::updateProjection()
{
mCalc->setDefaultEllipsoid();
mCalc->setProjectAsSourceSRS();
}

//////////////////////////

void QgsMeasure::canvasPressEvent(QMouseEvent * e)
Expand Down
7 changes: 7 additions & 0 deletions src/gui/qgsmeasure.h
Expand Up @@ -105,6 +105,9 @@ public slots:
//! shows/hides table, shows correct units
void updateUi();

//! updates the projections we're using
void updateProjection();

QgsMapCanvas *mMapCanvas;

//! distance/area calculator
Expand All @@ -125,6 +128,10 @@ public slots:

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

//! indicates whether we've recently warned the user about having the wrong
// project projection
bool mWrongProjectProjection;
};

#endif

0 comments on commit 0662477

Please sign in to comment.