Skip to content

Commit

Permalink
[FEATURE] default to last selection when prompting for CRS
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@15498 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Mar 15, 2011
1 parent 97dd304 commit c3690eb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
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 c3690eb

Please sign in to comment.