Skip to content

Commit

Permalink
Merge pull request #1104 from leyan/projectCRS
Browse files Browse the repository at this point in the history
Consistent management of project CRS properties in project file
  • Loading branch information
mhugent committed Jan 28, 2014
2 parents 2dabba4 + 6cd0fa1 commit 00680cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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();
}

Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsprojectproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() )
Expand Down

0 comments on commit 00680cd

Please sign in to comment.