QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsprojectionselector.h
Go to the documentation of this file.
1 /***************************************************************************
2  * qgsprojectionselector.h *
3  * Copyright (C) 2005 by Tim Sutton *
5  * *
6  * This program is free software; you can redistribute it and/or modify *
7  * it under the terms of the GNU General Public License as published by *
8  * the Free Software Foundation; either version 2 of the License, or *
9  * (at your option) any later version. *
10  ***************************************************************************/
11 #ifndef QGSCRSSELECTOR_H
12 #define QGSCRSSELECTOR_H
13 
14 #include <ui_qgsprojectionselectorbase.h>
15 
16 #include <QSet>
17 #include <QStringList>
18 
19 #include "qgis.h"
20 
21 class QResizeEvent;
22 
28 class GUI_EXPORT QgsProjectionSelector : public QWidget, private Ui::QgsProjectionSelectorBase
29 {
30  Q_OBJECT
31  public:
32  QgsProjectionSelector( QWidget* parent, const char *name = "", Qt::WFlags fl = 0 );
33 
35 
45  void loadUserCrsList( QSet<QString> *crsFilter = 0 );
46 
56  void loadCrsList( QSet<QString> *crsFilter = 0 );
57 
67  const QString sqlSafeString( const QString theSQL );
68 
70  QString selectedAuthId();
71 
72  public slots:
73  void setSelectedCrsName( QString theCRSName );
74 
75  QString selectedName();
76 
77  void setSelectedCrsId( long theCRSID );
78 
79  void setSelectedAuthId( QString authId );
80 
81  QString selectedProj4String();
82 
84  long selectedPostgresSrId();
85 
87  long selectedCrsId();
88 
101  void setOgcWmsCrsFilter( QSet<QString> crsFilter );
102  void on_lstCoordinateSystems_currentItemChanged( QTreeWidgetItem *current, QTreeWidgetItem *prev );
103  void on_lstRecent_currentItemChanged( QTreeWidgetItem *current, QTreeWidgetItem *prev );
104  void on_cbxHideDeprecated_stateChanged();
105  void on_leSearch_textChanged( const QString & );
106 
107  protected:
109  void showEvent( QShowEvent * theEvent );
110 
112  void resizeEvent( QResizeEvent * theEvent );
113 
114  private:
126  QString ogcWmsCrsFilterAsSqlExpression( QSet<QString> * crsFilter );
127 
138  void applySelection( int column = NONE, QString value = QString::null );
139 
145  QString getSelectedExpression( QString e );
146 
148  void showDBMissingWarning( const QString theFileName );
149  // List view nodes for the tree view of projections
151  QTreeWidgetItem *mUserProjList;
153  QTreeWidgetItem *mGeoList;
155  QTreeWidgetItem *mProjList;
156 
158  QString mCustomCsFile;
161 
165  long getLargestCRSIDMatch( QString theSql );
166 
168  void insertRecent( long theCrsId );
169 
172 
175 
176 
179 
180  enum columns { NAME_COLUMN, AUTHID_COLUMN, QGIS_CRS_ID_COLUMN, NONE };
182  QString mSearchValue;
183 
185 
187  QSet<QString> mCrsFilter;
188 
190  QStringList mRecentProjections;
191 
193  void hideDeprecated( QTreeWidgetItem *item );
194 
195  private slots:
197  QStringList authorities();
198 
199  signals:
200  void sridSelected( QString theSRID );
202  void refresh();
204  void searchBoxHasFocus( bool );
205 };
206 
207 #endif