Skip to content

Commit efdd9dd

Browse files
author
g_j_m
committedMar 3, 2007
Tweak to r6747 to allow the user to enter non-integer scale values, and
to have scales larger than 1:2^31 git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6754 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,8 +1172,8 @@ void QgisApp::setupConnections()
11721172
connect(mMapCanvas->mapRender(), SIGNAL(projectionsEnabled(bool)), this, SLOT(projectionsEnabled(bool)));
11731173
connect(mMapCanvas->mapRender(), SIGNAL(destinationSrsChanged()), this, SLOT(destinationSrsChanged()));
11741174
connect(mMapCanvas, SIGNAL(extentsChanged()),this,SLOT(showExtents()));
1175-
connect(mMapCanvas, SIGNAL(scaleChanged(long)), this, SLOT(showScale(long)));
1176-
connect(mMapCanvas, SIGNAL(scaleChanged(long)), this, SLOT(updateMouseCoordinatePrecision()));
1175+
connect(mMapCanvas, SIGNAL(scaleChanged(double)), this, SLOT(showScale(double)));
1176+
connect(mMapCanvas, SIGNAL(scaleChanged(double)), this, SLOT(updateMouseCoordinatePrecision()));
11771177

11781178
connect(mRenderSuppressionCBox, SIGNAL(toggled(bool )), mMapCanvas, SLOT(setRenderFlag(bool)));
11791179
}
@@ -3535,10 +3535,14 @@ void QgisApp::showMouseCoordinate(QgsPoint & p)
35353535
}
35363536
}
35373537

3538-
void QgisApp::showScale(long theScale)
3538+
void QgisApp::showScale(double theScale)
35393539
{
35403540
mScaleLabel->setText(tr("Scale 1: "));
3541-
mScaleEdit->setText(QString::number(theScale));
3541+
3542+
if (theScale >= 1.0)
3543+
mScaleEdit->setText(QString::number(theScale, 'f', 0));
3544+
else
3545+
mScaleEdit->setText(QString::number(theScale));
35423546
// Set minimum necessary width
35433547
if ( mScaleEdit->width() > mScaleEdit->minimumWidth() )
35443548
{

‎src/app/qgisapp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public slots:
175175
//copy the click coord to clipboard and let the user know its there
176176
void showCapturePointCoordinate(QgsPoint &);
177177
//! Slot to show current map scale;
178-
void showScale(long theScale);
178+
void showScale(double theScale);
179179
//! Slot to handle user scale input;
180180
void userScale();
181181
//! Remove a layer from the map and legend

‎src/gui/qgsmapcanvas.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,7 @@ void QgsMapCanvas::updateScale()
432432
{
433433
double scale = mMapRender->scale();
434434

435-
if (scale < 1)
436-
emit scaleChanged(lround(-1.0/scale));
437-
else
438-
emit scaleChanged(lround(scale));
435+
emit scaleChanged(scale);
439436
}
440437

441438

‎src/gui/qgsmapcanvas.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
277277
void xyCoordinates(QgsPoint & p);
278278

279279
//! Emitted when the scale of the map changes
280-
void scaleChanged(long);
280+
void scaleChanged(double);
281281

282282
//! Emitted when the extents of the map change
283283
void extentsChanged();

0 commit comments

Comments
 (0)
Please sign in to comment.