|
Quantum GIS API Documentation
master-ce49b66
|
00001 /*************************************************************************** 00002 * qgsprojectionselector.h * 00003 * Copyright (C) 2005 by Tim Sutton * 00004 * tim@linfiniti.com * 00005 * * 00006 * This program is free software; you can redistribute it and/or modify * 00007 * it under the terms of the GNU General Public License as published by * 00008 * the Free Software Foundation; either version 2 of the License, or * 00009 * (at your option) any later version. * 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 QString selectedAuthId(); 00071 00072 public slots: 00073 void setSelectedCrsName( QString theCRSName ); 00074 00075 QString selectedName(); 00076 00077 void setSelectedCrsId( long theCRSID ); 00078 00079 void setSelectedAuthId( QString authId ); 00080 00081 QString selectedProj4String(); 00082 00084 long selectedPostgresSrId(); 00085 00087 long selectedCrsId(); 00088 00101 void setOgcWmsCrsFilter( QSet<QString> crsFilter ); 00102 void on_lstCoordinateSystems_currentItemChanged( QTreeWidgetItem *current, QTreeWidgetItem *prev ); 00103 void on_lstRecent_currentItemChanged( QTreeWidgetItem *current, QTreeWidgetItem *prev ); 00104 void on_cbxHideDeprecated_stateChanged(); 00105 void on_leSearch_textChanged( const QString & ); 00106 00107 protected: 00109 void showEvent( QShowEvent * theEvent ); 00110 00112 void resizeEvent( QResizeEvent * theEvent ); 00113 00114 private: 00126 QString ogcWmsCrsFilterAsSqlExpression( QSet<QString> * crsFilter ); 00127 00138 void applySelection( int column = NONE, QString value = QString::null ); 00139 00145 QString getSelectedExpression( QString e ); 00146 00148 void showDBMissingWarning( const QString theFileName ); 00149 // List view nodes for the tree view of projections 00151 QTreeWidgetItem *mUserProjList; 00153 QTreeWidgetItem *mGeoList; 00155 QTreeWidgetItem *mProjList; 00156 00158 QString mCustomCsFile; 00160 QString mSrsDatabaseFileName; 00161 00165 long getLargestCRSIDMatch( QString theSql ); 00166 00168 void insertRecent( long theCrsId ); 00169 00171 bool mProjListDone; 00172 00174 bool mUserProjListDone; 00175 00176 00178 bool mRecentProjListDone; 00179 00180 enum columns { NAME_COLUMN, AUTHID_COLUMN, QGIS_CRS_ID_COLUMN, NONE }; 00181 int mSearchColumn; 00182 QString mSearchValue; 00183 00184 bool mSkipFirstRecent; 00185 00187 QSet<QString> mCrsFilter; 00188 00190 QStringList mRecentProjections; 00191 00193 void hideDeprecated( QTreeWidgetItem *item ); 00194 00195 private slots: 00197 QStringList authorities(); 00198 00199 signals: 00200 void sridSelected( QString theSRID ); 00202 void refresh(); 00204 void searchBoxHasFocus( bool ); 00205 }; 00206 00207 #endif