Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FEATURE] default to last selection when prompting for CRS
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15498 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Mar 15, 2011
1 parent c806aa1 commit 904213d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/app/qgisapp.cpp
Expand Up @@ -319,7 +319,7 @@ static QgsMessageOutput *messageOutputViewer_()
*/
static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
{
QString authid;
static QString authid = QString::null;
QSettings mySettings;
QString myDefaultProjectionOption = mySettings.value( "/Projections/defaultBehaviour" ).toString();
if ( myDefaultProjectionOption == "prompt" )
Expand All @@ -329,7 +329,8 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )

QgsGenericProjectionSelector *mySelector = new QgsGenericProjectionSelector();
mySelector->setMessage( srs->validationHint() ); //shows a generic message, if not specified
authid = QgsProject::instance()->readEntry( "SpatialRefSys", "/ProjectCrs", GEO_EPSG_CRS_AUTHID );
if ( authid.isNull() )
authid = QgsProject::instance()->readEntry( "SpatialRefSys", "/ProjectCrs", GEO_EPSG_CRS_AUTHID );
QgsCoordinateReferenceSystem defaultCrs;
if ( defaultCrs.createFromOgcWmsCrs( authid ) )
{
Expand All @@ -341,6 +342,7 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
if ( mySelector->exec() )
{
QgsDebugMsg( "Layer srs set from dialog: " + QString::number( mySelector->selectedCrsId() ) );
authid = mySelector->selectedAuthId();
srs->createFromOgcWmsCrs( mySelector->selectedAuthId() );
}

Expand All @@ -358,8 +360,9 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
}
else ///Projections/defaultBehaviour==useGlobal
{
srs->createFromOgcWmsCrs( mySettings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString() );
QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to default CRS" ) );
authid = mySettings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString();
srs->createFromOgcWmsCrs( authid );
QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to default CRS: %1" ).arg( authid ) );
}
}

Expand Down

0 comments on commit 904213d

Please sign in to comment.