[QGIS Commit] r13619 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Jun 1 10:28:45 EDT 2010


Author: mhugent
Date: 2010-06-01 10:28:43 -0400 (Tue, 01 Jun 2010)
New Revision: 13619

Modified:
   trunk/qgis/src/app/qgsprojectproperties.cpp
   trunk/qgis/src/app/qgsprojectproperties.h
Log:
change map unit in project dialog when user selects a new crs

Modified: trunk/qgis/src/app/qgsprojectproperties.cpp
===================================================================
--- trunk/qgis/src/app/qgsprojectproperties.cpp	2010-06-01 08:57:44 UTC (rev 13618)
+++ trunk/qgis/src/app/qgsprojectproperties.cpp	2010-06-01 14:28:43 UTC (rev 13619)
@@ -49,6 +49,7 @@
   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 @@
   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
  */

Modified: trunk/qgis/src/app/qgsprojectproperties.h
===================================================================
--- trunk/qgis/src/app/qgsprojectproperties.h	2010-06-01 08:57:44 UTC (rev 13618)
+++ trunk/qgis/src/app/qgsprojectproperties.h	2010-06-01 14:28:43 UTC (rev 13619)
@@ -102,6 +102,11 @@
 
     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();



More information about the QGIS-commit mailing list