Skip to content
Permalink
Browse files
Merge pull request #1104 from leyan/projectCRS
Consistent management of project CRS properties in project file
  • Loading branch information
mhugent committed Jan 28, 2014
2 parents 2dabba4 + 6cd0fa1 commit 00680cd78b45da0df2f9d49992770db6491b10e5
Showing with 5 additions and 4 deletions.
  1. +3 −4 src/app/qgisapp.cpp
  2. +2 −0 src/app/qgsprojectproperties.cpp
@@ -3299,7 +3299,9 @@ void QgisApp::fileNew( bool thePromptToSaveFlag, bool forceBlank )
srs.createFromOgcWmsCrs( defCrs );
myRenderer->setDestinationCrs( srs );
// write the projections _proj string_ to project settings
prj->writeEntry( "SpatialRefSys", "/ProjectCrs", defCrs );
prj->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", srs.toProj4() );
prj->writeEntry( "SpatialRefSys", "/ProjectCrs", srs.authid() );
prj->writeEntry( "SpatialRefSys", "/ProjectCRSID", (int) srs.srsid() );
prj->dirty( false );
if ( srs.mapUnits() != QGis::UnknownUnit )
{
@@ -8086,9 +8088,6 @@ void QgisApp::updateCRSStatusBar()

void QgisApp::destinationSrsChanged()
{
// save this information to project
long srsid = mMapCanvas->mapRenderer()->destinationCrs().srsid();
QgsProject::instance()->writeEntry( "SpatialRefSys", "/ProjectCRSID", ( int )srsid );
updateCRSStatusBar();
}

@@ -589,6 +589,8 @@ void QgsProjectProperties::apply()
// write the currently selected projections _proj string_ to project settings
QgsDebugMsg( QString( "SpatialRefSys/ProjectCRSProj4String: %1" ).arg( projectionSelector->selectedProj4String() ) );
QgsProject::instance()->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", projectionSelector->selectedProj4String() );
QgsProject::instance()->writeEntry( "SpatialRefSys", "/ProjectCRSID", (int) projectionSelector->selectedCrsId() );
QgsProject::instance()->writeEntry( "SpatialRefSys", "/ProjectCrs", projectionSelector->selectedAuthId() );

// Set the map units to the projected coordinates if we are projecting
if ( isProjected() )

0 comments on commit 00680cd

Please sign in to comment.