00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef QGSCRSSELECTOR_H
00012 #define QGSCRSSELECTOR_H
00013
00014 #include <ui_qgsprojectionselectorbase.h>
00015
00016 #include <QSet>
00017 #include <QStringList>
00018
00019 #include "qgis.h"
00020
00021 class QResizeEvent;
00022
00028 class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectionSelectorBase
00029 {
00030 Q_OBJECT
00031 public:
00032 QgsProjectionSelector( QWidget* parent, const char *name = "", Qt::WFlags fl = 0 );
00033
00034 ~QgsProjectionSelector();
00035
00045 void loadUserCrsList( QSet<QString> *crsFilter = 0 );
00046
00056 void loadCrsList( QSet<QString> *crsFilter = 0 );
00057
00067 const QString sqlSafeString( const QString theSQL );
00068
00070
00071 Q_DECL_DEPRECATED long selectedEpsg();
00072
00074 long selectedSrsid();
00075
00077 QString selectedAuthId();
00078
00079 public slots:
00080 void setSelectedCrsName( QString theCRSName );
00081
00082 QString selectedName();
00083
00084 void setSelectedCrsId( long theCRSID );
00085
00086 void setSelectedAuthId( QString authId );
00087
00089
00090 Q_DECL_DEPRECATED void setSelectedEpsg( long epsg );
00091
00092 QString selectedProj4String();
00093
00095 long selectedPostgresSrId();
00096
00098 long selectedCrsId();
00099
00112 void setOgcWmsCrsFilter( QSet<QString> crsFilter );
00113 void on_lstCoordinateSystems_currentItemChanged( QTreeWidgetItem *current, QTreeWidgetItem *prev );
00114 void on_lstRecent_currentItemChanged( QTreeWidgetItem *current, QTreeWidgetItem *prev );
00115 void on_cbxHideDeprecated_stateChanged();
00116 void on_leSearch_textChanged( const QString & );
00117
00118 protected:
00120 void showEvent( QShowEvent * theEvent );
00121
00123 void resizeEvent( QResizeEvent * theEvent );
00124
00125 private:
00137 QString ogcWmsCrsFilterAsSqlExpression( QSet<QString> * crsFilter );
00138
00149 void applySelection( int column = NONE, QString value = QString::null );
00150
00156 QString getSelectedExpression( QString e );
00157
00159 void showDBMissingWarning( const QString theFileName );
00160
00162 QTreeWidgetItem *mUserProjList;
00164 QTreeWidgetItem *mGeoList;
00166 QTreeWidgetItem *mProjList;
00167
00169 QString mCustomCsFile;
00171 QString mSrsDatabaseFileName;
00172
00176 long getLargestCRSIDMatch( QString theSql );
00177
00179 void insertRecent( long theCrsId );
00180
00182 bool mProjListDone;
00183
00185 bool mUserProjListDone;
00186
00188 bool mRecentProjListDone;
00189
00190 enum columns { NAME_COLUMN, AUTHID_COLUMN, QGIS_CRS_ID_COLUMN, NONE };
00191 int mSearchColumn;
00192 QString mSearchValue;
00193
00195 QSet<QString> mCrsFilter;
00196
00198 QStringList mRecentProjections;
00199
00201 void hideDeprecated( QTreeWidgetItem *item );
00202
00203 private slots:
00205 QStringList authorities();
00206
00207 signals:
00208 void sridSelected( QString theSRID );
00210 void refresh();
00212 void searchBoxHasFocus( bool );
00213 };
00214
00215 #endif