@@ -319,29 +319,29 @@ static QgsMessageOutput *messageOutputViewer_()
319
319
*/
320
320
static void customSrsValidation_ ( QgsCoordinateReferenceSystem* srs )
321
321
{
322
- QString toProj4 ;
322
+ QString authid ;
323
323
QSettings mySettings;
324
324
QString myDefaultProjectionOption = mySettings.value ( " /Projections/defaultBehaviour" ).toString ();
325
325
if ( myDefaultProjectionOption == " prompt" )
326
326
{
327
327
// @note this class is not a descendent of QWidget so we cant pass
328
328
// it in the ctor of the layer projection selector
329
329
330
- QgsGenericProjectionSelector * mySelector = new QgsGenericProjectionSelector ();
330
+ QgsGenericProjectionSelector *mySelector = new QgsGenericProjectionSelector ();
331
331
mySelector->setMessage ( srs->validationHint () ); // shows a generic message, if not specified
332
- toProj4 = QgsProject::instance ()->readEntry ( " SpatialRefSys" , " //ProjectCRSProj4String " , GEOPROJ4 );
333
- QgsCoordinateReferenceSystem defaultCRS ;
334
- if ( defaultCRS. createFromProj4 ( toProj4 ) )
332
+ authid = QgsProject::instance ()->readEntry ( " SpatialRefSys" , " /ProjectCrs " , GEO_EPSG_CRS_AUTHID );
333
+ QgsCoordinateReferenceSystem defaultCrs ;
334
+ if ( defaultCrs. createFromOgcWmsCrs ( authid ) )
335
335
{
336
- mySelector->setSelectedCrsId ( defaultCRS .srsid () );
336
+ mySelector->setSelectedCrsId ( defaultCrs .srsid () );
337
337
}
338
338
339
339
QApplication::setOverrideCursor ( Qt::ArrowCursor );
340
340
341
341
if ( mySelector->exec () )
342
342
{
343
343
QgsDebugMsg ( " Layer srs set from dialog: " + QString::number ( mySelector->selectedCrsId () ) );
344
- srs->createFromProj4 ( mySelector->selectedProj4String () );
344
+ srs->createFromOgcWmsCrs ( mySelector->selectedAuthId () );
345
345
}
346
346
347
347
QApplication::restoreOverrideCursor ();
@@ -351,14 +351,14 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
351
351
else if ( myDefaultProjectionOption == " useProject" )
352
352
{
353
353
// XXX TODO: Change project to store selected CS as 'projectCRS' not 'selectedWkt'
354
- toProj4 = QgsProject::instance ()->readEntry ( " SpatialRefSys" , " //ProjectCRSProj4String " , GEOPROJ4 );
355
- QgsDebugMsg ( " Layer srs set from project: " + toProj4 );
354
+ authid = QgsProject::instance ()->readEntry ( " SpatialRefSys" , " /ProjectCrs " , GEO_EPSG_CRS_AUTHID );
355
+ QgsDebugMsg ( " Layer srs set from project: " + authid );
356
356
QgisApp::instance ()->statusBar ()->showMessage ( QObject::tr ( " CRS undefined - defaulting to project CRS" ) );
357
- srs->createFromProj4 ( toProj4 );
357
+ srs->createFromOgcWmsCrs ( authid );
358
358
}
359
359
else // /Projections/defaultBehaviour==useGlobal
360
360
{
361
- srs->createFromProj4 ( mySettings.value ( " /Projections/defaultProjectionString " , GEOPROJ4 ).toString () );
361
+ srs->createFromOgcWmsCrs ( mySettings.value ( " /Projections/layerDefaultCrs " , GEO_EPSG_CRS_AUTHID ).toString () );
362
362
QgisApp::instance ()->statusBar ()->showMessage ( QObject::tr ( " CRS undefined - defaulting to default CRS" ) );
363
363
}
364
364
}
@@ -2489,12 +2489,12 @@ void QgisApp::fileNew( bool thePromptToSaveFlag )
2489
2489
2490
2490
// set project CRS
2491
2491
QgsMapRenderer* myRenderer = mMapCanvas ->mapRenderer ();
2492
- QString projString = settings.value ( " /Projections/projectDefaultProjectionString " , GEOPROJ4 ).toString ();
2492
+ QString defCrs = settings.value ( " /Projections/projectDefaultCrs " , GEO_EPSG_CRS_AUTHID ).toString ();
2493
2493
QgsCoordinateReferenceSystem srs;
2494
- srs.createFromProj4 ( projString );
2494
+ srs.createFromOgcWmsCrs ( defCrs );
2495
2495
myRenderer->setDestinationSrs ( srs );
2496
2496
// write the projections _proj string_ to project settings
2497
- prj->writeEntry ( " SpatialRefSys" , " /ProjectCRSProj4String " , projString );
2497
+ prj->writeEntry ( " SpatialRefSys" , " /ProjectCrs " , defCrs );
2498
2498
prj->dirty ( false );
2499
2499
if ( srs.mapUnits () != QGis::UnknownUnit )
2500
2500
{
@@ -4809,12 +4809,12 @@ void QgisApp::options()
4809
4809
4810
4810
// set project CRS
4811
4811
QgsMapRenderer* myRenderer = mMapCanvas ->mapRenderer ();
4812
- QString projString = mySettings.value ( " /Projections/projectDefaultProjectionString " , GEOPROJ4 ).toString ();
4812
+ QString defCrs = mySettings.value ( " /Projections/projectDefaultCrs " , GEO_EPSG_CRS_AUTHID ).toString ();
4813
4813
QgsCoordinateReferenceSystem srs;
4814
- srs.createFromProj4 ( projString );
4814
+ srs.createFromOgcWmsCrs ( defCrs );
4815
4815
myRenderer->setDestinationSrs ( srs );
4816
4816
// write the projections _proj string_ to project settings
4817
- QgsProject::instance ()->writeEntry ( " SpatialRefSys" , " /ProjectCRSProj4String " , projString );
4817
+ QgsProject::instance ()->writeEntry ( " SpatialRefSys" , " /ProjectCrs " , defCrs );
4818
4818
if ( srs.mapUnits () != QGis::UnknownUnit )
4819
4819
{
4820
4820
myRenderer->setMapUnits ( srs.mapUnits () );
0 commit comments