Fix a bug where the scale bar units weren't being correctly updated after

a change in map units caused by turning on on-the-fly-reprojection.


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4127 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
g_j_m 2005-10-24 00:29:36 +00:00
parent 9be2522de3
commit a71e95abcb
5 changed files with 16 additions and 8 deletions

View File

@ -4698,6 +4698,7 @@ void QgisApp::projectProperties()
QApplication::restoreOverrideCursor();
//pass any refresg signals off to canvases
connect (pp,SIGNAL(refresh()), mMapCanvas, SLOT(refresh()));
connect (pp,SIGNAL(mapUnitsChanged()), mMapCanvas, SLOT(mapUnitsChanged()));
connect (pp,SIGNAL(refresh()), mOverviewCanvas, SLOT(refresh()));
bool wasProjected = pp->isProjected();
@ -4705,20 +4706,13 @@ void QgisApp::projectProperties()
// Display the modal dialog box.
pp->exec();
// set the map units for the project if they have changed
if (mMapCanvas->mapUnits() != pp->mapUnits())
{
mMapCanvas->setMapUnits(pp->mapUnits());
}
// If the canvas projection settings changed, we need to recalculate the extents in the
// new coordinate system
if(pp->isProjected() != wasProjected)
{
mMapCanvas->recalculateExtents();
}
// Set the window title. No way to do a comparison like for the map
// units above, so redo it everytime.
// Set the window title.
setTitleBarText_( *this );
// delete the property sheet object
delete pp;

View File

@ -955,6 +955,13 @@ bool QgsMapCanvas::projectionsEnabled()
}
}
void QgsMapCanvas::mapUnitsChanged()
{
// We assume that if the map units have changed, the changed value
// will be accessible from QgsProject.
setMapUnits(QgsProject::instance()->mapUnits());
}
void QgsMapCanvas::zoomToSelected()
{
QgsVectorLayer *lyr =

View File

@ -259,6 +259,9 @@ public slots:
/** A simple helper method to find out if on the fly projections are enabled or not */
bool projectionsEnabled();
/** The map units may have changed, so cope with that */
void mapUnitsChanged();
signals:
/** Let the owner know how far we are with render operations */

View File

@ -228,6 +228,7 @@ void QgsProjectProperties::apply()
QgsProject::instance()->mapUnits(srs.mapUnits());
}
}
emit mapUnitsChanged();
// set the mouse display precision method and the
// number of decimal places for the manual option

View File

@ -89,6 +89,9 @@ signals:
void setDestSRSID(long theSRSID);
//! Signal used to inform listeners that the mouse display precision may have changed
void displayPrecisionChanged();
//! Signal used to inform listeners that the map units may of
//changed (and that the new value can be found in QgsProject.
void mapUnitsChanged();
//! let listening canvases know to refresh
void refresh();
//! notification of when on the fly projections are enabled / disabled