Skip to content
Permalink
Browse files
change map unit in project dialog when user selects a new crs
git-svn-id: http://svn.osgeo.org/qgis/trunk@13619 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jun 1, 2010
1 parent 46fea0c commit fe0b24d5db4d47c4c6bd73e32583baa58513c3f2
Showing with 34 additions and 0 deletions.
  1. +29 −0 src/app/qgsprojectproperties.cpp
  2. +5 −0 src/app/qgsprojectproperties.h
@@ -49,6 +49,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
connect( this, SIGNAL( accepted() ), this, SLOT( apply() ) );
connect( projectionSelector, SIGNAL( sridSelected( QString ) ), this, SLOT( setMapUnitsToCurrentProjection() ) );

///////////////////////////////////////////////////////////
// Properties stored in map canvas's QgsMapRenderer
@@ -531,6 +532,34 @@ void QgsProjectProperties::on_cbxProjectionEnabled_stateChanged( int state )
btnGrpMapUnits->setEnabled( state == Qt::Unchecked );
}

void QgsProjectProperties::setMapUnitsToCurrentProjection()
{
long myCRSID = projectionSelector->selectedCrsId();
if ( myCRSID )
{
QgsCoordinateReferenceSystem srs( myCRSID, QgsCoordinateReferenceSystem::InternalCrsId );
//set radio button to crs map unit type
QGis::UnitType units = srs.mapUnits();
switch ( units )
{
case QGis::Meters:
radMeters->setChecked( true );
break;
case QGis::Feet:
radFeet->setChecked( true );
break;
case QGis::Degrees:
radDecimalDegrees->setChecked( true );
break;
case QGis::DegreesMinutesSeconds:
radDMS->setChecked( true );
break;
default:
break;
}
}
}

/*!
* Function to save dialog window state
*/
@@ -102,6 +102,11 @@ class QgsProjectProperties : public QDialog, private Ui::QgsProjectPropertiesBas

void on_cbxProjectionEnabled_stateChanged( int state );

/*!
* If user changes the CRS, set the corresponding map units
*/
void setMapUnitsToCurrentProjection();

signals:
//! Signal used to inform listeners that the mouse display precision may have changed
void displayPrecisionChanged();

0 comments on commit fe0b24d

Please sign in to comment.