Skip to content

Commit

Permalink
Show more user friendly projection name for qgis default project CRS …
Browse files Browse the repository at this point in the history
…(relates to #393)

git-svn-id: http://svn.osgeo.org/qgis/trunk@15345 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Mar 5, 2011
1 parent 79eb19e commit 4712317
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/app/qgsoptions.cpp
Expand Up @@ -188,12 +188,14 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
{
radUseGlobalProjection->setChecked( true );
}

txtGlobalWkt->setText( settings.value( "/Projections/defaultProjectionString", GEOPROJ4 ).toString() );

//on the fly CRS transformation settings
grpOtfTransform->setChecked( settings.value( "/Projections/otfTransformEnabled", 0 ).toBool() );
leGlobalOtfProjString->setText( settings.value( "/Projections/defaultOTFProjectionString", GEOPROJ4 ).toString() );
QString myDefaultSrsString = settings.value( "/Projections/defaultOTFProjectionString", GEOPROJ4 ).toString();
mDefaultCrs.createFromProj4( myDefaultSrsString );
//display the crs as friendly text rather than in wkt
leGlobalOtfProjString->setText( mDefaultCrs.authid() + " - " +
mDefaultCrs.description() );

// populate combo box with ellipsoids
getEllipsoidList();
Expand Down Expand Up @@ -637,7 +639,7 @@ void QgsOptions::saveOptions()

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

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

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

//find out srs id of current proj4 string
QgsCoordinateReferenceSystem refSys;
if ( refSys.createFromProj4( leGlobalOtfProjString->text() ) )
{
mySelector->setSelectedCrsId( refSys.srsid() );
}
mySelector->setSelectedCrsId( mDefaultCrs.srsid() );

if ( mySelector->exec() )
{
leGlobalOtfProjString->setText( mySelector->selectedProj4String() );
mDefaultCrs.createFromProj4( mySelector->selectedProj4String() );
QgsDebugMsg( QString( "Setting default project CRS to : %1").arg( mySelector->selectedProj4String() ) );
leGlobalOtfProjString->setText( mDefaultCrs.authid() + " - " +
mDefaultCrs.description() );
QgsDebugMsg( QString( "------ Global OTF Projection Selection set to ----------\n%1" ).arg( leGlobalOtfProjString->text() ) );
}
else
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgsoptions.h
Expand Up @@ -23,6 +23,8 @@
#include "qgisgui.h"
#include "qgscontexthelp.h"

#include <qgscoordinatereferencesystem.h>


/**
* \class QgsOptions
Expand Down Expand Up @@ -128,6 +130,7 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase

private:
QStringList i18nList();
QgsCoordinateReferenceSystem mDefaultCrs;
};

#endif // #ifndef QGSOPTIONS_H

0 comments on commit 4712317

Please sign in to comment.