QGIS API Documentation  2.6.0-Brighton
 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::WindowFlags 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 
108  void pushProjectionToFront();
109 
110  protected:
112  void showEvent( QShowEvent * theEvent );
113 
115  void resizeEvent( QResizeEvent * theEvent );
116 
117  private:
129  QString ogcWmsCrsFilterAsSqlExpression( QSet<QString> * crsFilter );
130 
141  void applySelection( int column = NONE, QString value = QString::null );
142 
148  QString getSelectedExpression( QString e );
149 
151  void showDBMissingWarning( const QString theFileName );
152  // List view nodes for the tree view of projections
154  QTreeWidgetItem *mUserProjList;
156  QTreeWidgetItem *mGeoList;
158  QTreeWidgetItem *mProjList;
159 
161  QString mCustomCsFile;
163  QString mSrsDatabaseFileName;
164 
168  long getLargestCRSIDMatch( QString theSql );
169 
171  void insertRecent( long theCrsId );
172 
174  bool mProjListDone;
175 
177  bool mUserProjListDone;
178 
179 
181  bool mRecentProjListDone;
182 
183  enum columns { NAME_COLUMN, AUTHID_COLUMN, QGIS_CRS_ID_COLUMN, NONE };
184  int mSearchColumn;
185  QString mSearchValue;
186 
187  bool mPushProjectionToFront;
188 
190  QSet<QString> mCrsFilter;
191 
193  QStringList mRecentProjections;
194 
196  void hideDeprecated( QTreeWidgetItem *item );
197 
198  private slots:
200  QStringList authorities();
201 
202  signals:
203  void sridSelected( QString theSRID );
205  void refresh();
207  void searchBoxHasFocus( bool );
210  void initialized();
211 };
212 
213 #endif