mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
New srs.db and code changes to save settings by proj4 string instead of qgis srsid number
git-svn-id: http://svn.osgeo.org/qgis/trunk@8720 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
25895d0269
commit
9eca6b7c93
BIN
resources/srs.db
BIN
resources/srs.db
Binary file not shown.
@ -265,13 +265,17 @@ static void customSrsValidation_(QgsSpatialRefSys* srs)
|
||||
//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 @@ static void customSrsValidation_(QgsSpatialRefSys* srs)
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -84,10 +84,8 @@ QgsOptions::QgsOptions(QWidget *parent, Qt::WFlags fl) :
|
||||
{
|
||||
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();
|
||||
@ -293,7 +291,8 @@ void QgsOptions::saveOptions()
|
||||
//
|
||||
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()));
|
||||
|
||||
@ -367,13 +366,19 @@ void QgsOptions::on_pbnSelectProjection_clicked()
|
||||
{
|
||||
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
|
||||
|
@ -97,7 +97,10 @@ class QgsOptions :public QDialog, private Ui::QgsOptionsBase
|
||||
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;
|
||||
|
||||
};
|
||||
|
||||
|
@ -434,9 +434,12 @@ void QgsServerSourceSelect::on_btnChangeSpatialRefSys_clicked()
|
||||
|
||||
mySelector->setOgcWmsCrsFilter(crsFilter);
|
||||
|
||||
long myDefaultSRS = QgsProject::instance()->readNumEntry("SpatialRefSys", "/ProjectSRSID", GEOSRS_ID);
|
||||
|
||||
mySelector->setSelectedSRSID(myDefaultSRS);
|
||||
QString myDefaultProjString = QgsProject::instance()->readEntry("SpatialRefSys", "/ProjectSRSProj4String", GEOPROJ4);
|
||||
QgsSpatialRefSys defaultSRS;
|
||||
if(defaultSRS.createFromProj4(myDefaultProjString))
|
||||
{
|
||||
mySelector->setSelectedSRSID(defaultSRS.srsid());
|
||||
}
|
||||
|
||||
if (mySelector->exec())
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user