Quantum GIS API Documentation  1.7.4
src/gui/qgsprojectionselector.h
Go to the documentation of this file.
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,
00033                            const char * name = "",
00034                            Qt::WFlags fl = 0 );
00035 
00036     ~QgsProjectionSelector();
00037 
00047     void loadUserCrsList( QSet<QString> * crsFilter = 0 );
00048 
00058     void loadCrsList( QSet<QString> * crsFilter = 0 );
00059 
00060 
00070     const QString sqlSafeString( const QString theSQL );
00071 
00073     // @deprecated there are other authorities - use selectedAuthId()
00074     Q_DECL_DEPRECATED long selectedEpsg();
00075 
00077     long selectedSrsid();
00078 
00080     QString selectedAuthId();
00081 
00082   public slots:
00083     void setSelectedCrsName( QString theCRSName );
00084 
00085     QString selectedName();
00086 
00087     void setSelectedCrsId( long theCRSID );
00088 
00089     void setSelectedAuthId( QString authId );
00090 
00092     // @deprecated there are other authorities - so not always defined
00093     Q_DECL_DEPRECATED void setSelectedEpsg( long epsg );
00094 
00095     QString selectedProj4String();
00096 
00098     long selectedPostgresSrId();
00099 
00101     long selectedCrsId();
00102 
00115     void setOgcWmsCrsFilter( QSet<QString> crsFilter );
00116 
00117     void on_pbnFind_clicked();
00118     void on_lstRecent_currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * );
00119     void on_cbxHideDeprecated_stateChanged();
00120 
00121   protected:
00123     void showEvent( QShowEvent * theEvent );
00124 
00126     void resizeEvent( QResizeEvent * theEvent );
00127 
00128   private:
00140     QString ogcWmsCrsFilterAsSqlExpression( QSet<QString> * crsFilter );
00141 
00152     void applySelection();
00153 
00159     QString getSelectedExpression( QString e );
00160 
00162     void showDBMissingWarning( const QString theFileName );
00163     // List view nodes for the tree view of projections
00165     QTreeWidgetItem *mUserProjList;
00167     QTreeWidgetItem *mGeoList;
00169     QTreeWidgetItem *mProjList;
00170 
00172     QString mCustomCsFile;
00174     QString mSrsDatabaseFileName;
00175 
00179     long getLargestCRSIDMatch( QString theSql );
00180 
00182     void insertRecent( long theCrsId );
00183 
00185     bool mProjListDone;
00186 
00188     bool mUserProjListDone;
00189 
00191     bool mRecentProjListDone;
00192 
00194     bool mCRSNameSelectionPending;
00195 
00197     bool mCRSIDSelectionPending;
00198 
00200     bool mAuthIDSelectionPending;
00201 
00203     QString mCRSNameSelection;
00204 
00206     long mCRSIDSelection;
00207 
00209     QString mAuthIDSelection;
00210 
00212     QSet<QString> mCrsFilter;
00213 
00215     QStringList mRecentProjections;
00216 
00218     void hideDeprecated( QTreeWidgetItem *item );
00219 
00220   private slots:
00224     void coordinateSystemSelected( QTreeWidgetItem* );
00225 
00227     QStringList authorities();
00228 
00229   signals:
00230     void sridSelected( QString theSRID );
00232     void refresh();
00234     void searchBoxHasFocus( bool );
00235 };
00236 
00237 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines