[FEATURE] default to last selection when prompting for CRS

git-svn-id: http://svn.osgeo.org/qgis/trunk@15498 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
jef 2011-03-15 14:38:16 +00:00
parent 97dd304361
commit c3690eb4a2

View File

@ -319,7 +319,7 @@ static QgsMessageOutput *messageOutputViewer_()
*/ */
static void customSrsValidation_( QgsCoordinateReferenceSystem* srs ) static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
{ {
QString authid; static QString authid = QString::null;
QSettings mySettings; QSettings mySettings;
QString myDefaultProjectionOption = mySettings.value( "/Projections/defaultBehaviour" ).toString(); QString myDefaultProjectionOption = mySettings.value( "/Projections/defaultBehaviour" ).toString();
if ( myDefaultProjectionOption == "prompt" ) if ( myDefaultProjectionOption == "prompt" )
@ -329,6 +329,7 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
QgsGenericProjectionSelector *mySelector = new QgsGenericProjectionSelector(); QgsGenericProjectionSelector *mySelector = new QgsGenericProjectionSelector();
mySelector->setMessage( srs->validationHint() ); //shows a generic message, if not specified mySelector->setMessage( srs->validationHint() ); //shows a generic message, if not specified
if ( authid.isNull() )
authid = QgsProject::instance()->readEntry( "SpatialRefSys", "/ProjectCrs", GEO_EPSG_CRS_AUTHID ); authid = QgsProject::instance()->readEntry( "SpatialRefSys", "/ProjectCrs", GEO_EPSG_CRS_AUTHID );
QgsCoordinateReferenceSystem defaultCrs; QgsCoordinateReferenceSystem defaultCrs;
if ( defaultCrs.createFromOgcWmsCrs( authid ) ) if ( defaultCrs.createFromOgcWmsCrs( authid ) )
@ -341,6 +342,7 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
if ( mySelector->exec() ) if ( mySelector->exec() )
{ {
QgsDebugMsg( "Layer srs set from dialog: " + QString::number( mySelector->selectedCrsId() ) ); QgsDebugMsg( "Layer srs set from dialog: " + QString::number( mySelector->selectedCrsId() ) );
authid = mySelector->selectedAuthId();
srs->createFromOgcWmsCrs( mySelector->selectedAuthId() ); srs->createFromOgcWmsCrs( mySelector->selectedAuthId() );
} }
@ -358,8 +360,9 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
} }
else ///Projections/defaultBehaviour==useGlobal else ///Projections/defaultBehaviour==useGlobal
{ {
srs->createFromOgcWmsCrs( mySettings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString() ); authid = mySettings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString();
QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to default CRS" ) ); srs->createFromOgcWmsCrs( authid );
QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to default CRS: %1" ).arg( authid ) );
} }
} }