Skip to content

Commit faf7b0a

Browse files
author
g_j_m
committedJan 6, 2007
Merge r6396 from 0.8 branch to head
git-svn-id: http://svn.osgeo.org/qgis/trunk@6397 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent cd9ca5f commit faf7b0a

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed
 

‎src/gui/qgsmeasure.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ void QgsMeasure::activate()
7878
mRightMouseClicked = false;
7979

8080
// ensure that we have correct settings
81-
mCalc->setDefaultEllipsoid();
82-
mCalc->setProjectAsSourceSRS();
81+
updateProjection();
8382

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

@@ -131,6 +131,7 @@ QgsMeasure::~QgsMeasure()
131131

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

152153
mRightMouseClicked = false;
154+
mWrongProjectProjection = false;
153155
}
154156

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

163+
if (mWrongProjectProjection)
164+
{
165+
updateProjection();
166+
mWrongProjectProjection = false;
167+
}
168+
161169
// don't add points with the same coordinates
162170
if (mPoints.size() > 0 && point == mPoints[0])
163171
return;
@@ -338,6 +346,12 @@ void QgsMeasure::updateUi()
338346

339347
}
340348

349+
void QgsMeasure::updateProjection()
350+
{
351+
mCalc->setDefaultEllipsoid();
352+
mCalc->setProjectAsSourceSRS();
353+
}
354+
341355
//////////////////////////
342356

343357
void QgsMeasure::canvasPressEvent(QMouseEvent * e)

‎src/gui/qgsmeasure.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ public slots:
105105
//! shows/hides table, shows correct units
106106
void updateUi();
107107

108+
//! updates the projections we're using
109+
void updateProjection();
110+
108111
QgsMapCanvas *mMapCanvas;
109112

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

126129
//! indicates whether we've just done a right mouse click
127130
bool mRightMouseClicked;
131+
132+
//! indicates whether we've recently warned the user about having the wrong
133+
// project projection
134+
bool mWrongProjectProjection;
128135
};
129136

130137
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.