Skip to content

Commit e5676f4

Browse files
author
timlinux
committed
Show more user friendly projection name for qgis default project CRS (relates to #393)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15345 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent a8d2b09 commit e5676f4

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/app/qgsoptions.cpp

+11-10
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,14 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
188188
{
189189
radUseGlobalProjection->setChecked( true );
190190
}
191-
192191
txtGlobalWkt->setText( settings.value( "/Projections/defaultProjectionString", GEOPROJ4 ).toString() );
193-
194192
//on the fly CRS transformation settings
195193
grpOtfTransform->setChecked( settings.value( "/Projections/otfTransformEnabled", 0 ).toBool() );
196-
leGlobalOtfProjString->setText( settings.value( "/Projections/defaultOTFProjectionString", GEOPROJ4 ).toString() );
194+
QString myDefaultSrsString = settings.value( "/Projections/defaultOTFProjectionString", GEOPROJ4 ).toString();
195+
mDefaultCrs.createFromProj4( myDefaultSrsString );
196+
//display the crs as friendly text rather than in wkt
197+
leGlobalOtfProjString->setText( mDefaultCrs.authid() + " - " +
198+
mDefaultCrs.description() );
197199

198200
// populate combo box with ellipsoids
199201
getEllipsoidList();
@@ -637,7 +639,7 @@ void QgsOptions::saveOptions()
637639

638640
// save 'on the fly' CRS transformation settings
639641
settings.setValue( "/Projections/otfTransformEnabled", grpOtfTransform->isChecked() );
640-
settings.setValue( "/Projections/defaultOTFProjectionString", leGlobalOtfProjString->text() );
642+
settings.setValue( "/Projections/defaultOTFProjectionString", mDefaultCrs.toProj4() );
641643

642644
settings.setValue( "/qgis/measure/ellipsoid", getEllipsoidAcronym( cmbEllipsoid->currentText() ) );
643645

@@ -774,15 +776,14 @@ void QgsOptions::on_pbnSelectOtfProjection_clicked()
774776
QgsGenericProjectionSelector * mySelector = new QgsGenericProjectionSelector( this );
775777

776778
//find out srs id of current proj4 string
777-
QgsCoordinateReferenceSystem refSys;
778-
if ( refSys.createFromProj4( leGlobalOtfProjString->text() ) )
779-
{
780-
mySelector->setSelectedCrsId( refSys.srsid() );
781-
}
779+
mySelector->setSelectedCrsId( mDefaultCrs.srsid() );
782780

783781
if ( mySelector->exec() )
784782
{
785-
leGlobalOtfProjString->setText( mySelector->selectedProj4String() );
783+
mDefaultCrs.createFromProj4( mySelector->selectedProj4String() );
784+
QgsDebugMsg( QString( "Setting default project CRS to : %1").arg( mySelector->selectedProj4String() ) );
785+
leGlobalOtfProjString->setText( mDefaultCrs.authid() + " - " +
786+
mDefaultCrs.description() );
786787
QgsDebugMsg( QString( "------ Global OTF Projection Selection set to ----------\n%1" ).arg( leGlobalOtfProjString->text() ) );
787788
}
788789
else

src/app/qgsoptions.h

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include "qgisgui.h"
2424
#include "qgscontexthelp.h"
2525

26+
#include <qgscoordinatereferencesystem.h>
27+
2628

2729
/**
2830
* \class QgsOptions
@@ -128,6 +130,7 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase
128130

129131
private:
130132
QStringList i18nList();
133+
QgsCoordinateReferenceSystem mDefaultCrs;
131134
};
132135

133136
#endif // #ifndef QGSOPTIONS_H

0 commit comments

Comments
 (0)