QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 = "", const Qt::WindowFlags& fl = nullptr );
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:
129  QString ogcWmsCrsFilterAsSqlExpression( QSet<QString> * crsFilter );
130 
141  void applySelection( int column = NONE, QString value = QString::null );
142 
148  QString getSelectedExpression( const 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( const 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 
203  void on_lstCoordinateSystems_itemDoubleClicked( QTreeWidgetItem *current, int column );
204  void on_lstRecent_itemDoubleClicked( QTreeWidgetItem *current, int column );
205 
206  signals:
207  void sridSelected( const QString& theSRID );
209  void refresh();
211  void searchBoxHasFocus( bool );
214  void initialized();
217  void projectionDoubleClicked();
218 };
219 
220 #endif
virtual void showEvent(QShowEvent *event)
A widget for selecting a Coordinate reference system from a tree.
typedef WindowFlags
virtual void resizeEvent(QResizeEvent *event)