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 class QResizeEvent;
00020
00026 class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectionSelectorBase
00027 {
00028 Q_OBJECT
00029 public:
00030 QgsProjectionSelector( QWidget* parent,
00031 const char * name = "",
00032 Qt::WFlags fl = 0 );
00033
00034 ~QgsProjectionSelector();
00035
00045 void loadUserCrsList( QSet<QString> * crsFilter = 0 );
00046
00056 void loadCrsList( QSet<QString> * crsFilter = 0 );
00057
00058
00068 const QString sqlSafeString( const QString theSQL );
00069
00071 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
00088 void setSelectedEpsg( long epsg );
00089
00090 QString selectedProj4String();
00091
00093 long selectedPostgresSrId();
00094
00096 long selectedCrsId();
00097
00110 void setOgcWmsCrsFilter( QSet<QString> crsFilter );
00111
00112 void on_pbnFind_clicked();
00113 void on_lstRecent_currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * );
00114 void on_cbxHideDeprecated_stateChanged();
00115
00116 protected:
00118 void showEvent( QShowEvent * theEvent );
00119
00121 void resizeEvent( QResizeEvent * theEvent );
00122
00123 private:
00135 QString ogcWmsCrsFilterAsSqlExpression( QSet<QString> * crsFilter );
00136
00147 void applyCRSNameSelection();
00148
00159 void applyCRSIDSelection();
00160
00171 void applyAuthIDSelection();
00172
00178 QString getSelectedExpression( QString e );
00179
00181 void showDBMissingWarning( const QString theFileName );
00182
00184 QTreeWidgetItem *mUserProjList;
00186 QTreeWidgetItem *mGeoList;
00188 QTreeWidgetItem *mProjList;
00189
00191 QString mCustomCsFile;
00193 QString mSrsDatabaseFileName;
00194
00198 long getLargestCRSIDMatch( QString theSql );
00199
00201 void insertRecent( long theCrsId );
00202
00204 bool mProjListDone;
00205
00207 bool mUserProjListDone;
00208
00210 bool mCRSNameSelectionPending;
00211
00213 bool mCRSIDSelectionPending;
00214
00216 bool mAuthIDSelectionPending;
00217
00219 QString mCRSNameSelection;
00220
00222 long mCRSIDSelection;
00223
00225 QString mAuthIDSelection;
00226
00228 QSet<QString> mCrsFilter;
00229
00231 QStringList mRecentProjections;
00232
00234 void hideDeprecated( QTreeWidgetItem *item );
00235
00236 private slots:
00240 void coordinateSystemSelected( QTreeWidgetItem* );
00241
00243 QStringList authorities();
00244
00245 signals:
00246 void sridSelected( QString theSRID );
00248 void refresh();
00250 void searchBoxHasFocus( bool );
00251 };
00252
00253 #endif