Quantum GIS API Documentation
1.8
|
00001 /*************************************************************************** 00002 * qgsprojectionselector.h * 00003 * Copyright (C) 2005 by Tim Sutton * 00004 * [email protected] * 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 // @deprecated there are other authorities - use selectedAuthId() 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 // @deprecated there are other authorities - so not always defined 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 // List view nodes for the tree view of projections 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 00187 00189 bool mRecentProjListDone; 00190 00191 enum columns { NAME_COLUMN, AUTHID_COLUMN, QGIS_CRS_ID_COLUMN, NONE }; 00192 int mSearchColumn; 00193 QString mSearchValue; 00194 00195 bool mSkipFirstRecent; 00196 00198 QSet<QString> mCrsFilter; 00199 00201 QStringList mRecentProjections; 00202 00204 void hideDeprecated( QTreeWidgetItem *item ); 00205 00206 private slots: 00208 QStringList authorities(); 00209 00210 signals: 00211 void sridSelected( QString theSRID ); 00213 void refresh(); 00215 void searchBoxHasFocus( bool ); 00216 }; 00217 00218 #endif