QGIS API Documentation  2.99.0-Master (e077efd)
qgsprojectionselector.h
Go to the documentation of this file.
1 /***************************************************************************
2  * qgsprojectionselector.h *
3  * Copyright (C) 2005 by Tim Sutton *
4  * [email protected] *
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 = nullptr );
46 
56  void loadCrsList( QSet<QString> *crsFilter = nullptr );
57 
67  const QString sqlSafeString( const QString& theSQL );
68 
70  QString selectedAuthId();
71 
72  public slots:
73  void setSelectedCrsName( const QString& theCRSName );
74 
75  QString selectedName();
76 
77  void setSelectedCrsId( long theCRSID );
78 
79  void setSelectedAuthId( const QString& authId );
80 
81  QString selectedProj4String();
82 
84  long selectedPostgresSrId();
85 
87  long selectedCrsId();
88 
101  void setOgcWmsCrsFilter( const 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 ) override;
113 
115  void resizeEvent( QResizeEvent * theEvent ) override;
116 
117  private:
118 
130  QString ogcWmsCrsFilterAsSqlExpression( QSet<QString> * crsFilter );
131 
142  void applySelection( int column = NONE, QString value = QString::null );
143 
149  QString getSelectedExpression( const QString& e );
150 
152  void showDBMissingWarning( const QString& theFileName );
153  // List view nodes for the tree view of projections
155  QTreeWidgetItem *mUserProjList;
157  QTreeWidgetItem *mGeoList;
159  QTreeWidgetItem *mProjList;
160 
162  QString mCustomCsFile;
164  QString mSrsDatabaseFileName;
165 
169  long getLargestCrsIdMatch( const QString& theSql );
170 
172  void insertRecent( long theCrsId );
173 
175  bool mProjListDone;
176 
178  bool mUserProjListDone;
179 
180 
182  bool mRecentProjListDone;
183 
184  enum columns { NAME_COLUMN, AUTHID_COLUMN, QGIS_CRS_ID_COLUMN, NONE };
185  int mSearchColumn;
186  QString mSearchValue;
187 
188  bool mPushProjectionToFront;
189 
191  QSet<QString> mCrsFilter;
192 
194  QStringList mRecentProjections;
195 
197  void hideDeprecated( QTreeWidgetItem *item );
198 
199  private slots:
201  QStringList authorities();
202 
204  void on_lstCoordinateSystems_itemDoubleClicked( QTreeWidgetItem *current, int column );
205  void on_lstRecent_itemDoubleClicked( QTreeWidgetItem *current, int column );
206 
207  signals:
208  void sridSelected( const QString& theSRID );
210  void refresh();
212  void searchBoxHasFocus( bool );
215  void initialized();
218  void projectionDoubleClicked();
219 };
220 
221 #endif
A widget for selecting a Coordinate reference system from a tree.