Skip to content

Commit

Permalink
Tweak to r6747 to allow the user to enter non-integer scale values, and
Browse files Browse the repository at this point in the history
to have scales larger than 1:2^31


git-svn-id: http://svn.osgeo.org/qgis/trunk@6754 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Mar 3, 2007
1 parent d98dcff commit f96509c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
12 changes: 8 additions & 4 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1172,8 +1172,8 @@ void QgisApp::setupConnections()
connect(mMapCanvas->mapRender(), SIGNAL(projectionsEnabled(bool)), this, SLOT(projectionsEnabled(bool)));
connect(mMapCanvas->mapRender(), SIGNAL(destinationSrsChanged()), this, SLOT(destinationSrsChanged()));
connect(mMapCanvas, SIGNAL(extentsChanged()),this,SLOT(showExtents()));
connect(mMapCanvas, SIGNAL(scaleChanged(long)), this, SLOT(showScale(long)));
connect(mMapCanvas, SIGNAL(scaleChanged(long)), this, SLOT(updateMouseCoordinatePrecision()));
connect(mMapCanvas, SIGNAL(scaleChanged(double)), this, SLOT(showScale(double)));
connect(mMapCanvas, SIGNAL(scaleChanged(double)), this, SLOT(updateMouseCoordinatePrecision()));

connect(mRenderSuppressionCBox, SIGNAL(toggled(bool )), mMapCanvas, SLOT(setRenderFlag(bool)));
}
Expand Down Expand Up @@ -3535,10 +3535,14 @@ void QgisApp::showMouseCoordinate(QgsPoint & p)
}
}

void QgisApp::showScale(long theScale)
void QgisApp::showScale(double theScale)
{
mScaleLabel->setText(tr("Scale 1: "));
mScaleEdit->setText(QString::number(theScale));

if (theScale >= 1.0)
mScaleEdit->setText(QString::number(theScale, 'f', 0));
else
mScaleEdit->setText(QString::number(theScale));
// Set minimum necessary width
if ( mScaleEdit->width() > mScaleEdit->minimumWidth() )
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public slots:
//copy the click coord to clipboard and let the user know its there
void showCapturePointCoordinate(QgsPoint &);
//! Slot to show current map scale;
void showScale(long theScale);
void showScale(double theScale);
//! Slot to handle user scale input;
void userScale();
//! Remove a layer from the map and legend
Expand Down
5 changes: 1 addition & 4 deletions src/gui/qgsmapcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,7 @@ void QgsMapCanvas::updateScale()
{
double scale = mMapRender->scale();

if (scale < 1)
emit scaleChanged(lround(-1.0/scale));
else
emit scaleChanged(lround(scale));
emit scaleChanged(scale);
}


Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmapcanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
void xyCoordinates(QgsPoint & p);

//! Emitted when the scale of the map changes
void scaleChanged(long);
void scaleChanged(double);

//! Emitted when the extents of the map change
void extentsChanged();
Expand Down

0 comments on commit f96509c

Please sign in to comment.