@@ -49,6 +49,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
4949 connect ( buttonBox, SIGNAL ( rejected () ), this , SLOT ( reject () ) );
5050 connect ( buttonBox->button ( QDialogButtonBox::Apply ), SIGNAL ( clicked () ), this , SLOT ( apply () ) );
5151 connect ( this , SIGNAL ( accepted () ), this , SLOT ( apply () ) );
52+ connect ( projectionSelector, SIGNAL ( sridSelected ( QString ) ), this , SLOT ( setMapUnitsToCurrentProjection () ) );
5253
5354 // /////////////////////////////////////////////////////////
5455 // Properties stored in map canvas's QgsMapRenderer
@@ -531,6 +532,34 @@ void QgsProjectProperties::on_cbxProjectionEnabled_stateChanged( int state )
531532 btnGrpMapUnits->setEnabled ( state == Qt::Unchecked );
532533}
533534
535+ void QgsProjectProperties::setMapUnitsToCurrentProjection ()
536+ {
537+ long myCRSID = projectionSelector->selectedCrsId ();
538+ if ( myCRSID )
539+ {
540+ QgsCoordinateReferenceSystem srs ( myCRSID, QgsCoordinateReferenceSystem::InternalCrsId );
541+ // set radio button to crs map unit type
542+ QGis::UnitType units = srs.mapUnits ();
543+ switch ( units )
544+ {
545+ case QGis::Meters:
546+ radMeters->setChecked ( true );
547+ break ;
548+ case QGis::Feet:
549+ radFeet->setChecked ( true );
550+ break ;
551+ case QGis::Degrees:
552+ radDecimalDegrees->setChecked ( true );
553+ break ;
554+ case QGis::DegreesMinutesSeconds:
555+ radDMS->setChecked ( true );
556+ break ;
557+ default :
558+ break ;
559+ }
560+ }
561+ }
562+
534563/* !
535564 * Function to save dialog window state
536565 */
0 commit comments