[QGIS Commit] r8720 - in trunk/qgis: resources src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon Jul 7 03:40:11 EDT 2008
Author: mhugent
Date: 2008-07-07 03:40:10 -0400 (Mon, 07 Jul 2008)
New Revision: 8720
Modified:
trunk/qgis/resources/srs.db
trunk/qgis/src/app/qgisapp.cpp
trunk/qgis/src/app/qgsoptions.cpp
trunk/qgis/src/app/qgsoptions.h
trunk/qgis/src/app/qgsserversourceselect.cpp
Log:
New srs.db and code changes to save settings by proj4 string instead of qgis srsid number
Modified: trunk/qgis/resources/srs.db
===================================================================
(Binary files differ)
Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp 2008-07-07 02:25:54 UTC (rev 8719)
+++ trunk/qgis/src/app/qgisapp.cpp 2008-07-07 07:40:10 UTC (rev 8720)
@@ -265,13 +265,17 @@
//it in the ctor of the layer projection selector
QgsLayerProjectionSelector * mySelector = new QgsLayerProjectionSelector();
- long myDefaultSRS =
- QgsProject::instance()->readNumEntry("SpatialRefSys","/ProjectSRSID",GEOSRS_ID);
- mySelector->setSelectedSRSID(myDefaultSRS);
+ proj4String = QgsProject::instance()->readEntry("SpatialRefSys","//ProjectSRSProj4String",GEOPROJ4);
+ QgsSpatialRefSys defaultSRS;
+ if(defaultSRS.createFromProj4(proj4String))
+ {
+ mySelector->setSelectedSRSID(defaultSRS.srsid());
+ }
+
if(mySelector->exec())
{
QgsDebugMsg("Layer srs set from dialog: " + QString::number(mySelector->getCurrentSRSID()));
- srs->createFromSrsId(mySelector->getCurrentSRSID());
+ srs->createFromProj4(mySelector->getCurrentProj4String());
srs->debugPrint();
}
else
@@ -290,10 +294,7 @@
}
else ///Projections/defaultBehaviour==useGlobal
{
- // XXX TODO: Change global settings to store default CS as 'defaultSRS' not 'defaultProjectionWKT'
- int srs_id = mySettings.value("/Projections/defaultProjectionSRSID",(int)GEOSRS_ID).toInt();
- QgsDebugMsg("Layer srs set from global: " + proj4String);
- srs->createFromSrsId(srs_id);
+ srs->createFromProj4(mySettings.value("/Projections/defaultProjectionString",GEOPROJ4).toString());
srs->debugPrint();
}
Modified: trunk/qgis/src/app/qgsoptions.cpp
===================================================================
--- trunk/qgis/src/app/qgsoptions.cpp 2008-07-07 02:25:54 UTC (rev 8719)
+++ trunk/qgis/src/app/qgsoptions.cpp 2008-07-07 07:40:10 UTC (rev 8720)
@@ -84,11 +84,9 @@
{
radUseGlobalProjection->setChecked(true);
}
- mGlobalSRSID = settings.value("/Projections/defaultProjectionSRSID",(int)GEOSRS_ID).toInt();
- //! @todo changes this control name in gui to txtGlobalProjString
- QString myProjString = QgsSpatialRefSys::getProj4FromSrsId(mGlobalSRSID);
- txtGlobalWKT->setText(myProjString);
+ txtGlobalWKT->setText(settings.value("/Projections/defaultProjectionString",GEOPROJ4).toString());
+
// populate combo box with ellipsoids
getEllipsoidList();
QString myEllipsoidId = settings.value("/qgis/measure/ellipsoid", "WGS84").toString();
@@ -293,8 +291,9 @@
//
settings.setValue("/Projections/defaultBehaviour", "useGlobal");
}
- settings.setValue("/Projections/defaultProjectionSRSID",(int)mGlobalSRSID);
+ settings.setValue("/Projections/defaultProjectionString", txtGlobalWKT->toPlainText());
+
settings.setValue("/qgis/measure/ellipsoid", getEllipsoidAcronym(cmbEllipsoid->currentText()));
//set the colour for selections
@@ -367,13 +366,19 @@
{
QSettings settings;
QgsLayerProjectionSelector * mySelector = new QgsLayerProjectionSelector(this);
- mySelector->setSelectedSRSID(mGlobalSRSID);
+
+ //find out srs id of current proj4 string
+ QgsSpatialRefSys refSys;
+ if(refSys.createFromProj4(txtGlobalWKT->toPlainText()))
+ {
+ mySelector->setSelectedSRSID(refSys.srsid());
+ }
+
if(mySelector->exec())
{
#ifdef QGISDEBUG
std::cout << "------ Global Default Projection Selection Set ----------" << std::endl;
-#endif
- mGlobalSRSID = mySelector->getCurrentSRSID();
+#endif
//! @todo changes this control name in gui to txtGlobalProjString
txtGlobalWKT->setText(mySelector->getCurrentProj4String());
#ifdef QGISDEBUG
Modified: trunk/qgis/src/app/qgsoptions.h
===================================================================
--- trunk/qgis/src/app/qgsoptions.h 2008-07-07 02:25:54 UTC (rev 8719)
+++ trunk/qgis/src/app/qgsoptions.h 2008-07-07 07:40:10 UTC (rev 8720)
@@ -97,8 +97,11 @@
QWidget *qparent;
//!Global default projection used for new layers added that have no projection
- long mGlobalSRSID;
+ //long mGlobalSRSID;
+ //!Default proj4 string used for new layers added that have no projection
+ QString mGlobalProj4String;
+
};
#endif // #ifndef QGSOPTIONS_H
Modified: trunk/qgis/src/app/qgsserversourceselect.cpp
===================================================================
--- trunk/qgis/src/app/qgsserversourceselect.cpp 2008-07-07 02:25:54 UTC (rev 8719)
+++ trunk/qgis/src/app/qgsserversourceselect.cpp 2008-07-07 07:40:10 UTC (rev 8720)
@@ -434,10 +434,13 @@
mySelector->setOgcWmsCrsFilter(crsFilter);
- long myDefaultSRS = QgsProject::instance()->readNumEntry("SpatialRefSys", "/ProjectSRSID", GEOSRS_ID);
+ QString myDefaultProjString = QgsProject::instance()->readEntry("SpatialRefSys", "/ProjectSRSProj4String", GEOPROJ4);
+ QgsSpatialRefSys defaultSRS;
+ if(defaultSRS.createFromProj4(myDefaultProjString))
+ {
+ mySelector->setSelectedSRSID(defaultSRS.srsid());
+ }
- mySelector->setSelectedSRSID(myDefaultSRS);
-
if (mySelector->exec())
{
m_Epsg = mySelector->getCurrentEpsg();
More information about the QGIS-commit
mailing list