Various changes relating to projection selector: Renamed QgsLayerProjectionSelector to QgsGenericProjectionSelector so that it can be used in other contexts too. Added setSelectedEpsg call to projection selector. Added setMessage() call to generic projection selector. Updated python bindings accordingly.

git-svn-id: http://svn.osgeo.org/qgis/trunk@9011 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
timlinux 2008-08-07 00:16:37 +00:00
parent 4f015a3271
commit aa896df17a
20 changed files with 230 additions and 179 deletions

View File

@ -10,7 +10,7 @@
%Include qgisinterface.sip
%Include qgsencodingfiledialog.sip
%Include qgslayerprojectionselector.sip
%Include qgsgenericprojectionselector.sip
%Include qgsmapcanvas.sip
%Include qgsmapcanvasitem.sip
%Include qgsmapcanvasmap.sip

View File

@ -1,32 +1,37 @@
/**
* \class QgsLayerProjectionSelector
* \brief Set Projection system for a layer
* \class QgsGenericProjectionSelector
* \brief A generic dialog to prompt the user for a Coordinate Reference System
*/
class QgsLayerProjectionSelector : QDialog //, private Ui::QgsLayerProjectionSelectorBase
class QgsGenericProjectionSelector : QDialog //, private Ui::QgsGenericProjectionSelectorBase
{
%TypeHeaderCode
#include <qgslayerprojectionselector.h>
#include <qgsgenericprojectionselector.h>
%End
public:
/**
* Constructor
*/
QgsLayerProjectionSelector(QWidget *parent = 0,
QgsGenericProjectionSelector(QWidget *parent = 0,
Qt::WFlags fl = QgisGui::ModalDialogFlags);
//! Destructor
~QgsLayerProjectionSelector();
~QgsGenericProjectionSelector();
public slots:
QString getCurrentProj4String();
long getCurrentSRSID();
long getCurrentEpsg();
/** If no paramter is passed, the message will be a generic
* 'define the CRS for this layer'.
*/
void setMessage(QString theMessage="");
QString getSelectedProj4String();
long getSelectedSRSID();
long getSelectedEpsg();
void setSelectedSRSName(QString theName);
void setSelectedSRSID(long theID);
void setSelectedEpsg(long theID);
/**
* \brief filters this dialog by the given CRSs

View File

@ -54,7 +54,7 @@ class QgsProjectionSelector: QWidget //, private Ui::QgsProjectionSelectorBase
const QString stringSQLSafe(const QString theSQL);
//! Gets the current EPSG-style projection identifier
long getCurrentEpsg();
long getSelectedEpsg();
public slots:
void setSelectedSRSName(QString theSRSName);
@ -62,14 +62,16 @@ class QgsProjectionSelector: QWidget //, private Ui::QgsProjectionSelectorBase
QString getSelectedName();
void setSelectedSRSID(long theSRSID);
void setSelectedEpsg(long epsg);
QString getCurrentProj4String();
QString getSelectedProj4String();
//! Gets the current PostGIS-style projection identifier
long getCurrentSRID();
long getSelectedSRID();
//! Gets the current QGIS projection identfier
long getCurrentSRSID();
long getSelectedSRSID();
/**
* \brief filters this widget by the given CRSs

View File

@ -96,7 +96,7 @@
#include "qgsfeature.h"
#include "qgsgeomtypedialog.h"
#include "qgshelpviewer.h"
#include "qgslayerprojectionselector.h"
#include "qgsgenericprojectionselector.h"
#include "qgslegend.h"
#include "qgslegendlayerfile.h"
#include "qgslegendlayer.h"
@ -264,7 +264,8 @@ static void customSrsValidation_(QgsSpatialRefSys* srs)
//@note this class is not a descendent of QWidget so we cant pass
//it in the ctor of the layer projection selector
QgsLayerProjectionSelector * mySelector = new QgsLayerProjectionSelector();
QgsGenericProjectionSelector * mySelector = new QgsGenericProjectionSelector();
mySelector->setMessage(); //shows a generic message
proj4String = QgsProject::instance()->readEntry("SpatialRefSys","//ProjectSRSProj4String",GEOPROJ4);
QgsSpatialRefSys defaultSRS;
if(defaultSRS.createFromProj4(proj4String))
@ -274,8 +275,8 @@ static void customSrsValidation_(QgsSpatialRefSys* srs)
if(mySelector->exec())
{
QgsDebugMsg("Layer srs set from dialog: " + QString::number(mySelector->getCurrentSRSID()));
srs->createFromProj4(mySelector->getCurrentProj4String());
QgsDebugMsg("Layer srs set from dialog: " + QString::number(mySelector->getSelectedSRSID()));
srs->createFromProj4(mySelector->getSelectedProj4String());
srs->debugPrint();
}
else

View File

@ -20,7 +20,7 @@
#include "qgsoptions.h"
#include "qgis.h"
#include "qgisapp.h"
#include "qgslayerprojectionselector.h"
#include "qgsgenericprojectionselector.h"
#include "qgsspatialrefsys.h"
#include <QFileDialog>
@ -365,7 +365,7 @@ void QgsOptions::saveOptions()
void QgsOptions::on_pbnSelectProjection_clicked()
{
QSettings settings;
QgsLayerProjectionSelector * mySelector = new QgsLayerProjectionSelector(this);
QgsGenericProjectionSelector * mySelector = new QgsGenericProjectionSelector(this);
//find out srs id of current proj4 string
QgsSpatialRefSys refSys;
@ -380,7 +380,7 @@ void QgsOptions::on_pbnSelectProjection_clicked()
std::cout << "------ Global Default Projection Selection Set ----------" << std::endl;
#endif
//! @todo changes this control name in gui to txtGlobalProjString
txtGlobalWKT->setText(mySelector->getCurrentProj4String());
txtGlobalWKT->setText(mySelector->getSelectedProj4String());
#ifdef QGISDEBUG
std::cout << "------ Global Default Projection now set to ----------\n" << mGlobalSRSID << std::endl;
#endif

View File

@ -245,15 +245,15 @@ void QgsProjectProperties::apply()
// selected that has an srid. This prevents error if the user
// selects a top-level node rather than an actual coordinate
// system
long mySRSID = projectionSelector->getCurrentSRSID();
long mySRSID = projectionSelector->getSelectedSRSID();
if (mySRSID)
{
QgsSpatialRefSys srs(mySRSID, QgsSpatialRefSys::QGIS_SRSID);
myRender->setDestinationSrs(srs);
// write the currently selected projections _proj string_ to project settings
std::cout << "SpatialRefSys/ProjectSRSProj4String: " << projectionSelector->getCurrentProj4String().toLocal8Bit().data() << std::endl;
QgsProject::instance()->writeEntry("SpatialRefSys","/ProjectSRSProj4String",projectionSelector->getCurrentProj4String());
std::cout << "SpatialRefSys/ProjectSRSProj4String: " << projectionSelector->getSelectedProj4String().toLocal8Bit().data() << std::endl;
QgsProject::instance()->writeEntry("SpatialRefSys","/ProjectSRSProj4String",projectionSelector->getSelectedProj4String());
// Set the map units to the projected coordinates if we are projecting
if (isProjected())

View File

@ -20,7 +20,7 @@
#include "qgisapp.h"
#include "qgscoordinatetransform.h"
#include "qgsrasterlayerproperties.h"
#include "qgslayerprojectionselector.h"
#include "qgsgenericprojectionselector.h"
#include "qgsproject.h"
#include "qgsrasterbandstats.h"
#include "qgsrasterlayer.h"
@ -1704,11 +1704,11 @@ void QgsRasterLayerProperties::on_pbnAddValuesManually_clicked()
void QgsRasterLayerProperties::on_pbnChangeSpatialRefSys_clicked()
{
QgsLayerProjectionSelector * mySelector = new QgsLayerProjectionSelector(this);
QgsGenericProjectionSelector * mySelector = new QgsGenericProjectionSelector(this);
mySelector->setSelectedSRSID(mRasterLayer->srs().srsid());
if(mySelector->exec())
{
QgsSpatialRefSys srs(mySelector->getCurrentSRSID(), QgsSpatialRefSys::QGIS_SRSID);
QgsSpatialRefSys srs(mySelector->getSelectedSRSID(), QgsSpatialRefSys::QGIS_SRSID);
mRasterLayer->setSrs(srs);
}
else

View File

@ -18,7 +18,7 @@
#include "qgsserversourceselect.h"
#include "qgslayerprojectionselector.h"
#include "qgsgenericprojectionselector.h"
#include "qgsnewhttpconnection.h"
#include "qgsnumericsortlistviewitem.h"
@ -429,8 +429,9 @@ void QgsServerSourceSelect::on_btnChangeSpatialRefSys_clicked()
QSet<QString> crsFilter = mWmsProvider->supportedCrsForLayers(m_selectedLayers);
QgsLayerProjectionSelector * mySelector =
new QgsLayerProjectionSelector(this);
QgsGenericProjectionSelector * mySelector =
new QgsGenericProjectionSelector(this);
mySelector->setMessage();
mySelector->setOgcWmsCrsFilter(crsFilter);
@ -443,7 +444,7 @@ void QgsServerSourceSelect::on_btnChangeSpatialRefSys_clicked()
if (mySelector->exec())
{
m_Epsg = mySelector->getCurrentEpsg();
m_Epsg = mySelector->getSelectedEpsg();
}
else
{
@ -451,7 +452,7 @@ void QgsServerSourceSelect::on_btnChangeSpatialRefSys_clicked()
}
labelCoordRefSys->setText( descriptionForEpsg(m_Epsg) );
// labelCoordRefSys->setText( mySelector->getCurrentProj4String() );
// labelCoordRefSys->setText( mySelector->getSelectedProj4String() );
delete mySelector;

View File

@ -27,7 +27,7 @@
#include "qgsgraduatedsymboldialog.h"
#include "qgslabeldialog.h"
#include "qgslabel.h"
#include "qgslayerprojectionselector.h"
#include "qgsgenericprojectionselector.h"
#include "qgslogger.h"
#include "qgsproject.h"
#include "qgssinglesymboldialog.h"
@ -609,11 +609,12 @@ QString QgsVectorLayerProperties::getMetadata()
void QgsVectorLayerProperties::on_pbnChangeSpatialRefSys_clicked()
{
QgsLayerProjectionSelector * mySelector = new QgsLayerProjectionSelector(this);
QgsGenericProjectionSelector * mySelector = new QgsGenericProjectionSelector(this);
mySelector->setMessage();
mySelector->setSelectedSRSID(layer->srs().srsid());
if(mySelector->exec())
{
QgsSpatialRefSys srs(mySelector->getCurrentSRSID(), QgsSpatialRefSys::QGIS_SRSID);
QgsSpatialRefSys srs(mySelector->getSelectedSRSID(), QgsSpatialRefSys::QGIS_SRSID);
layer->setSrs(srs);
}
else

View File

@ -9,7 +9,7 @@ qgsdetaileditemwidget.cpp
qgsdetaileditemdata.cpp
qgsencodingfiledialog.cpp
qgsfiledropedit.cpp
qgslayerprojectionselector.cpp
qgsgenericprojectionselector.cpp
qgsmapcanvas.cpp
qgsmapcanvasitem.cpp
qgsmapcanvasmap.cpp
@ -32,7 +32,7 @@ qgsdetaileditemdelegate.h
qgsdetaileditemwidget.h
qgisinterface.h
qgsencodingfiledialog.h
qgslayerprojectionselector.h
qgsgenericprojectionselector.h
qgsmapcanvas.h
qgsmapoverviewcanvas.h
qgsmaptoolemitpoint.h
@ -101,7 +101,7 @@ qgscolorbutton.h
qgscursors.h
qgsencodingfiledialog.h
qgsfiledropedit.h
qgslayerprojectionselector.h
qgsgenericprojectionselector.h
qgsmapcanvas.h
qgsmapcanvasitem.h
qgsmapcanvasmap.h

View File

@ -0,0 +1,101 @@
/***************************************************************************
qgsgenericprojectionselector.cpp
Set user defined CRS using projection selector widget
-------------------
begin : May 28, 2004
copyright : (C) 2004 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id$ */
#include "qgsgenericprojectionselector.h"
#include <QApplication>
/**
* \class QgsGenericProjectionSelector
* \brief A generic dialog to prompt the user for a Coordinate Reference System
*/
QgsGenericProjectionSelector::QgsGenericProjectionSelector(QWidget *parent,
Qt::WFlags fl)
: QDialog(parent, fl)
{
setupUi(this);
connect(pbnOK, SIGNAL(clicked()), this, SLOT( accept()));
//we will show this only when a message is set
textEdit->hide();
QApplication::restoreOverrideCursor();
}
void QgsGenericProjectionSelector::setMessage(QString theMessage)
{
//short term kludge to make the layer selector default to showing
//a layer projection selection message. If you want the selector
if (theMessage.isEmpty())
{
// Set up text edit pane
QString format("<h2>%1</h2>%2 %3");
QString header = tr("Define this layer's projection:");
QString sentence1 = tr("This layer appears to have no projection specification.");
QString sentence2 = tr("By default, this layer will now have its projection set to that of the project"
", but you may override this by selecting a different projection below.");
textEdit->setHtml(format.arg(header).arg(sentence1)
.arg(sentence2));
}
else
{
textEdit->setHtml(theMessage);
}
textEdit->show();
}
//! Destructor
QgsGenericProjectionSelector::~QgsGenericProjectionSelector()
{}
void QgsGenericProjectionSelector::setSelectedSRSName(QString theName)
{
projectionSelector->setSelectedSRSName(theName);
}
void QgsGenericProjectionSelector::setSelectedSRSID(long theID)
{
projectionSelector->setSelectedSRSID(theID);
}
void QgsGenericProjectionSelector::setSelectedEpsg(long theID)
{
projectionSelector->setSelectedEpsg(theID);
}
QString QgsGenericProjectionSelector::getSelectedProj4String()
{
//@NOTE dont use getSelectedWKT as that just returns the name part!
return projectionSelector->getSelectedProj4String();
}
long QgsGenericProjectionSelector::getSelectedSRSID()
{
//@NOTE dont use getSelectedWKT as that just returns the name part!
return projectionSelector->getSelectedSRSID();
}
long QgsGenericProjectionSelector::getSelectedEpsg()
{
return projectionSelector->getSelectedEpsg();
}
void QgsGenericProjectionSelector::setOgcWmsCrsFilter(QSet<QString> crsFilter)
{
projectionSelector->setOgcWmsCrsFilter(crsFilter);
}

View File

@ -1,6 +1,6 @@
/***************************************************************************
qgslayerprojectionselector.h
Set user layerprojectionselector and preferences
qgsgenericprojectionselector.h
Set user defined projection using projection selector widget
-------------------
begin : May 28, 2004
copyright : (C) 2004 by Gary E.Sherman
@ -16,38 +16,43 @@
* *
***************************************************************************/
/* $Id$ */
#ifndef QGSLAYERPROJECTIONSELECTOR_H
#define QGSLAYERPROJECTIONSELECTOR_H
#include "ui_qgslayerprojectionselectorbase.h"
#ifndef QGSGENERICPROJECTIONSELECTOR_H
#define QGSGENERICPROJECTIONSELECTOR_H
#include "ui_qgsgenericprojectionselectorbase.h"
#include "qgisgui.h"
#include <QSet>
/**
* \class QgsLayerProjectionSelector
* \brief Set Projection system for a layer
* \class QgsGenericProjectionSelector
* \brief A generic dialog to prompt the user for a Coordinate Reference System
*/
class GUI_EXPORT QgsLayerProjectionSelector : public QDialog, private Ui::QgsLayerProjectionSelectorBase
class GUI_EXPORT QgsGenericProjectionSelector : public QDialog, private Ui::QgsGenericProjectionSelectorBase
{
Q_OBJECT;
public:
/**
* Constructor
*/
QgsLayerProjectionSelector(QWidget *parent = 0,
QgsGenericProjectionSelector(QWidget *parent = 0,
Qt::WFlags fl = QgisGui::ModalDialogFlags);
//! Destructor
~QgsLayerProjectionSelector();
~QgsGenericProjectionSelector();
public slots:
QString getCurrentProj4String();
long getCurrentSRSID();
long getCurrentEpsg();
/** If no paramter is passed, the message will be a generic
* 'define the CRS for this layer'.
*/
void setMessage(QString theMessage="");
QString getSelectedProj4String();
long getSelectedSRSID();
long getSelectedEpsg();
void setSelectedSRSName(QString theName);
void setSelectedSRSID(long theID);
void setSelectedEpsg(long theID);
/**
* \brief filters this dialog by the given CRSs

View File

@ -1,81 +0,0 @@
/***************************************************************************
qgslayerprojectionselector.cpp
Set user layerprojectionselector and preferences
-------------------
begin : May 28, 2004
copyright : (C) 2004 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id$ */
#include "qgslayerprojectionselector.h"
#include <QApplication>
/**
* \class QgsLayerProjectionSelector - Set user layerprojectionselector and preferences
* Constructor
*/
QgsLayerProjectionSelector::QgsLayerProjectionSelector(QWidget *parent,
Qt::WFlags fl)
: QDialog(parent, fl)
{
setupUi(this);
// Set up text edit pane
QString format("<h2>%1</h2>%2 %3");
QString header = tr("Define this layer's projection:");
QString sentence1 = tr("This layer appears to have no projection specification.");
QString sentence2 = tr("By default, this layer will now have its projection set to that of the project"
", but you may override this by selecting a different projection below.");
textEdit->setHtml(format.arg(header).arg(sentence1)
.arg(sentence2));
connect(pbnOK, SIGNAL(clicked()), this, SLOT( accept()));
QApplication::restoreOverrideCursor();
}
//! Destructor
QgsLayerProjectionSelector::~QgsLayerProjectionSelector()
{}
void QgsLayerProjectionSelector::setSelectedSRSName(QString theName)
{
projectionSelector->setSelectedSRSName(theName);
}
void QgsLayerProjectionSelector::setSelectedSRSID(long theID)
{
projectionSelector->setSelectedSRSID(theID);
}
QString QgsLayerProjectionSelector::getCurrentProj4String()
{
//@NOTE dont use getSelectedWKT as that just returns the name part!
return projectionSelector->getCurrentProj4String();
}
long QgsLayerProjectionSelector::getCurrentSRSID()
{
//@NOTE dont use getSelectedWKT as that just returns the name part!
return projectionSelector->getCurrentSRSID();
}
long QgsLayerProjectionSelector::getCurrentEpsg()
{
return projectionSelector->getCurrentEpsg();
}
void QgsLayerProjectionSelector::setOgcWmsCrsFilter(QSet<QString> crsFilter)
{
projectionSelector->setOgcWmsCrsFilter(crsFilter);
}

View File

@ -20,6 +20,7 @@
#include "qgis.h" //magick numbers here
#include "qgsapplication.h"
#include "qgslogger.h"
#include <qgsspatialrefsys.h>
//qt includes
#include <QDir>
@ -193,6 +194,10 @@ void QgsProjectionSelector::setSelectedSRSID(long theSRSID)
// selection there
}
void QgsProjectionSelector::setSelectedEpsg(long epsg)
{
//QgsSpatial
}
void QgsProjectionSelector::applySRSNameSelection()
{
@ -264,7 +269,7 @@ QString QgsProjectionSelector::getSelectedName()
}
}
// Returns the whole proj4 string for the selected projection node
QString QgsProjectionSelector::getCurrentProj4String()
QString QgsProjectionSelector::getSelectedProj4String()
{
// Only return the projection if there is a node in the tree
// selected that has an srid. This prevents error if the user
@ -356,7 +361,7 @@ QString QgsProjectionSelector::getCurrentProj4String()
}
long QgsProjectionSelector::getCurrentLongAttribute(QString attributeName)
long QgsProjectionSelector::getSelectedLongAttribute(QString attributeName)
{
// Only return the attribute if there is a node in the tree
// selected that has an srs_id. This prevents error if the user
@ -382,7 +387,7 @@ long QgsProjectionSelector::getCurrentLongAttribute(QString attributeName)
myFileInfo.setFile(myDatabaseFileName);
if ( !myFileInfo.exists( ) )
{
std::cout << " QgsSpatialRefSys::createFromSrid failed : users qgis.db not found" << std::endl;
std::cout << " Projection selector : users qgis.db not found" << std::endl;
return 0;
}
}
@ -416,14 +421,14 @@ long QgsProjectionSelector::getCurrentLongAttribute(QString attributeName)
#endif
rc = sqlite3_prepare(db, sql.toUtf8(), sql.length(), &ppStmt, &pzTail);
// XXX Need to free memory from the error msg if one is set
QString mySrid;
QString myAttributeValue;
if(rc == SQLITE_OK)
{
// get the first row of the result set
if(sqlite3_step(ppStmt) == SQLITE_ROW)
{
// get the wkt
mySrid = QString::fromUtf8((char *)sqlite3_column_text(ppStmt, 0));
// get the attribute
myAttributeValue = QString::fromUtf8((char *)sqlite3_column_text(ppStmt, 0));
}
}
// close the statement
@ -431,7 +436,7 @@ long QgsProjectionSelector::getCurrentLongAttribute(QString attributeName)
// close the database
sqlite3_close(db);
// return the srs wkt
return mySrid.toLong();
return myAttributeValue.toLong();
}
}
@ -440,19 +445,19 @@ long QgsProjectionSelector::getCurrentLongAttribute(QString attributeName)
}
long QgsProjectionSelector::getCurrentSRID()
long QgsProjectionSelector::getSelectedSRID()
{
return getCurrentLongAttribute("srid");
return getSelectedLongAttribute("srid");
}
long QgsProjectionSelector::getCurrentEpsg()
long QgsProjectionSelector::getSelectedEpsg()
{
return getCurrentLongAttribute("epsg");
return getSelectedLongAttribute("epsg");
}
long QgsProjectionSelector::getCurrentSRSID()
long QgsProjectionSelector::getSelectedSRSID()
{
QTreeWidgetItem* item = lstCoordinateSystems->currentItem();
@ -705,8 +710,8 @@ void QgsProjectionSelector::coordinateSystemSelected( QTreeWidgetItem * theItem)
{
// Found a real SRS
QString myDescription;
emit sridSelected(QString::number(getCurrentSRSID()));
QString myProjString = getCurrentProj4String();
emit sridSelected(QString::number(getSelectedSRSID()));
QString myProjString = getSelectedProj4String();
lstCoordinateSystems->scrollToItem(theItem);
teProjection->setText(myProjString);
}
@ -744,7 +749,7 @@ void QgsProjectionSelector::on_pbnFind_clicked()
#endif
//a name search is ambiguous, so we find the first srsid after the current seelcted srsid
// each time the find button is pressed. This means we can loop through all matches.
if (myLargestSrsId <= getCurrentSRSID())
if (myLargestSrsId <= getSelectedSRSID())
{
//roll search around to the beginning
mySql= "select srs_id from tbl_srs where description like '%" + mySearchString +"%'" +
@ -754,7 +759,7 @@ void QgsProjectionSelector::on_pbnFind_clicked()
{
// search ahead of the current postion
mySql= "select srs_id from tbl_srs where description like '%" + mySearchString +"%'" +
" and srs_id > " + QString::number(getCurrentSRSID()) + " order by srs_id limit 1";
" and srs_id > " + QString::number(getSelectedSRSID()) + " order by srs_id limit 1";
}
}
#ifdef QGISDEBUG

View File

@ -65,7 +65,7 @@ class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectio
const QString stringSQLSafe(const QString theSQL);
//! Gets the current EPSG-style projection identifier
long getCurrentEpsg();
long getSelectedEpsg();
public slots:
void setSelectedSRSName(QString theSRSName);
@ -74,15 +74,15 @@ class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectio
void setSelectedSRSID(long theSRSID);
//void setSelectedEPSG(long epsg);
void setSelectedEpsg(long epsg);
QString getCurrentProj4String();
QString getSelectedProj4String();
//! Gets the current PostGIS-style projection identifier
long getCurrentSRID();
long getSelectedSRID();
//! Gets the current QGIS projection identfier
long getCurrentSRSID();
long getSelectedSRSID();
/**
* \brief filters this widget by the given CRSs
@ -153,7 +153,7 @@ class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectio
*
* \param attributeName The sqlite3 column name, typically "srid" or "epsg"
*/
long getCurrentLongAttribute(QString attributeName);
long getSelectedLongAttribute(QString attributeName);
/** Show the user a warning if the srs database could not be found */
const void showDBMissingWarning(const QString theFileName);

View File

@ -449,7 +449,7 @@ void QgsGrassNewMapset::setGrassProjection()
#endif
setError ( mProjErrorLabel, "");
QString proj4 = mProjectionSelector->getCurrentProj4String();
QString proj4 = mProjectionSelector->getSelectedProj4String();
// Not defined
if ( mNoProjRadioButton->isChecked() )
@ -568,12 +568,12 @@ void QgsGrassNewMapset::setRegionPage()
if ( mProjRadioButton->isChecked() )
{
#ifdef QGISDEBUG
std::cerr << "getCurrentSRSID() = " << mProjectionSelector->getCurrentSRSID() << std::endl;
std::cerr << "getSelectedSRSID() = " << mProjectionSelector->getSelectedSRSID() << std::endl;
#endif
if ( mProjectionSelector->getCurrentSRSID() > 0 )
if ( mProjectionSelector->getSelectedSRSID() > 0 )
{
newSrs.createFromSrsId ( mProjectionSelector->getCurrentSRSID() );
newSrs.createFromSrsId ( mProjectionSelector->getSelectedSRSID() );
if ( ! newSrs.isValid() )
{
QMessageBox::warning( 0, tr("Warning"),
@ -691,7 +691,7 @@ void QgsGrassNewMapset::setGrassRegionDefaults()
if ( extSet &&
( mNoProjRadioButton->isChecked() ||
( mProjRadioButton->isChecked()
&& srsid == mProjectionSelector->getCurrentSRSID() )
&& srsid == mProjectionSelector->getSelectedSRSID() )
)
)
{
@ -915,7 +915,7 @@ void QgsGrassNewMapset::setSelectedRegion()
// Warning: seems that crashes if source == dest
if ( mProjectionSelector->getCurrentSRSID() != 2585 )
if ( mProjectionSelector->getSelectedSRSID() != 2585 )
{
// Warning: QgsSpatialRefSys::EPSG is broken (using epsg_id)
//QgsSpatialRefSys source ( 4326, QgsSpatialRefSys::EPSG );
@ -928,7 +928,7 @@ void QgsGrassNewMapset::setSelectedRegion()
return;
}
QgsSpatialRefSys dest ( mProjectionSelector->getCurrentSRSID(),
QgsSpatialRefSys dest ( mProjectionSelector->getSelectedSRSID(),
QgsSpatialRefSys::QGIS_SRSID );
if ( !dest.isValid() )
@ -1141,9 +1141,9 @@ void QgsGrassNewMapset::drawRegion()
points.push_back( QgsPoint( points[0] ) ); // close polygon
// Warning: seems that crashes if source == dest
if ( mProjectionSelector->getCurrentSRSID() != 2585 )
if ( mProjectionSelector->getSelectedSRSID() != 2585 )
{
QgsSpatialRefSys source ( mProjectionSelector->getCurrentSRSID(),
QgsSpatialRefSys source ( mProjectionSelector->getSelectedSRSID(),
QgsSpatialRefSys::QGIS_SRSID );
if ( !source.isValid() )

View File

@ -18,7 +18,7 @@
#include "qgisinterface.h"
#include "qgswfssourceselect.h"
#include "qgsnewhttpconnection.h"
#include "qgslayerprojectionselector.h"
#include "qgsgenericprojectionselector.h"
#include "qgshttptransaction.h"
#include "qgscontexthelp.h"
#include "qgsproject.h"
@ -47,7 +47,8 @@ QgsWFSSourceSelect::QgsWFSSourceSelect(QWidget* parent, QgisInterface* iface): Q
connect(treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(changeCRSFilter()));
populateConnectionList();
mProjectionSelector = new QgsLayerProjectionSelector(this);
mProjectionSelector = new QgsGenericProjectionSelector(this);
mProjectionSelector->setMessage();
}
QgsWFSSourceSelect::~QgsWFSSourceSelect()
@ -354,7 +355,7 @@ void QgsWFSSourceSelect::addLayer()
QString crsString;
if(mProjectionSelector)
{
long epsgNr = mProjectionSelector->getCurrentEpsg();
long epsgNr = mProjectionSelector->getSelectedEpsg();
if(epsgNr != 0)
{
crsString = "&SRSNAME=EPSG:"+QString::number(epsgNr);
@ -372,7 +373,7 @@ void QgsWFSSourceSelect::changeCRS()
{
if(mProjectionSelector->exec())
{
QString crsString = "EPSG: " + QString::number(mProjectionSelector->getCurrentEpsg());
QString crsString = "EPSG: " + QString::number(mProjectionSelector->getSelectedEpsg());
labelCoordRefSys->setText(crsString);
}
}

View File

@ -21,7 +21,7 @@
#include "ui_qgswfssourceselectbase.h"
class QgisInterface;
class QgsLayerProjectionSelector;
class QgsGenericProjectionSelector;
class QgsWFSSourceSelect: public QDialog, private Ui::QgsWFSSourceSelectBase
{
@ -42,7 +42,7 @@ class QgsWFSSourceSelect: public QDialog, private Ui::QgsWFSSourceSelectBase
QgsWFSSourceSelect(); //default constructor is forbidden
QgisInterface* mIface; //pointer to the QGIS interface object (needed to add WFS layers)
QString mUri; //uri of the currently connected server
QgsLayerProjectionSelector* mProjectionSelector;
QgsGenericProjectionSelector* mProjectionSelector;
/**Stores the available CRS for a server connections.
The first string is the typename, the corresponding list
stores the CRS for the typename in the form 'EPSG:XXXX'*/

View File

@ -23,7 +23,7 @@ SET(QGIS_UIS
qgshelpviewerbase.ui
qgsidentifyresultsbase.ui
qgslabeldialogbase.ui
qgslayerprojectionselectorbase.ui
qgsgenericprojectionselectorbase.ui
qgsludialogbase.ui
qgsmeasurebase.ui
qgsmessageviewer.ui

View File

@ -1,6 +1,6 @@
<ui version="4.0" >
<class>QgsLayerProjectionSelectorBase</class>
<widget class="QDialog" name="QgsLayerProjectionSelectorBase" >
<class>QgsGenericProjectionSelectorBase</class>
<widget class="QDialog" name="QgsGenericProjectionSelectorBase" >
<property name="geometry" >
<rect>
<x>0</x>
@ -10,7 +10,7 @@
</rect>
</property>
<property name="windowTitle" >
<string>Layer Projection Selector</string>
<string>Projection Selector</string>
</property>
<property name="windowIcon" >
<iconset/>
@ -19,10 +19,22 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>9</number>
</property>
<property name="spacing" >
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="1" column="0" colspan="2" >
@ -31,9 +43,7 @@
<item row="0" column="0" colspan="2" >
<widget class="QTextEdit" name="textEdit" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>