Skip to content

Commit

Permalink
change map unit in project dialog when user selects a new crs
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13619 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jun 1, 2010
1 parent 86963c3 commit e6e0eed
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/app/qgsprojectproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
*/
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgsprojectproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit e6e0eed

Please sign in to comment.