Skip to content

Commit 00680cd

Browse files
committedJan 28, 2014
Merge pull request #1104 from leyan/projectCRS
Consistent management of project CRS properties in project file
2 parents 2dabba4 + 6cd0fa1 commit 00680cd

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3299,7 +3299,9 @@ void QgisApp::fileNew( bool thePromptToSaveFlag, bool forceBlank )
32993299
srs.createFromOgcWmsCrs( defCrs );
33003300
myRenderer->setDestinationCrs( srs );
33013301
// write the projections _proj string_ to project settings
3302-
prj->writeEntry( "SpatialRefSys", "/ProjectCrs", defCrs );
3302+
prj->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", srs.toProj4() );
3303+
prj->writeEntry( "SpatialRefSys", "/ProjectCrs", srs.authid() );
3304+
prj->writeEntry( "SpatialRefSys", "/ProjectCRSID", (int) srs.srsid() );
33033305
prj->dirty( false );
33043306
if ( srs.mapUnits() != QGis::UnknownUnit )
33053307
{
@@ -8086,9 +8088,6 @@ void QgisApp::updateCRSStatusBar()
80868088

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

‎src/app/qgsprojectproperties.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,8 @@ void QgsProjectProperties::apply()
589589
// write the currently selected projections _proj string_ to project settings
590590
QgsDebugMsg( QString( "SpatialRefSys/ProjectCRSProj4String: %1" ).arg( projectionSelector->selectedProj4String() ) );
591591
QgsProject::instance()->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", projectionSelector->selectedProj4String() );
592+
QgsProject::instance()->writeEntry( "SpatialRefSys", "/ProjectCRSID", (int) projectionSelector->selectedCrsId() );
593+
QgsProject::instance()->writeEntry( "SpatialRefSys", "/ProjectCrs", projectionSelector->selectedAuthId() );
592594

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

0 commit comments

Comments
 (0)
Please sign in to comment.