QGIS API Documentation  2.99.0-Master (009e47e)
qgsowssourceselect.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsowssourceselect.h - selector for WMS,WFS,WCS layers
3  -------------------
4  begin : 3 April 2005
5  original : (C) 2005 by Brendan Morley email : morb at ozemail dot com dot au
6  wms search : (C) 2009 Mathias Walker <mwa at sourcepole.ch>, Sourcepole AG
7  generalized : (C) 2012 Radim Blazek, based on qgsowsconnection.h
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  ***************************************************************************/
19 
20 #ifndef QGSOWSSOURCESELECT_H
21 #define QGSOWSSOURCESELECT_H
22 #include "ui_qgsowssourceselectbase.h"
23 #include "qgis_sip.h"
24 #include "qgis.h"
25 #include "qgsdatasourceuri.h"
26 #include "qgsguiutils.h"
27 #include "qgscontexthelp.h"
28 #include "qgsproviderregistry.h"
29 
30 #include <QStringList>
31 #include <QPushButton>
32 #include <QNetworkRequest>
33 #include "qgis_gui.h"
34 
35 class QgsDataProvider;
36 class QButtonGroup;
37 class QgsTreeWidgetItem;
38 class QDomDocument;
39 class QDomElement;
40 
41 
51 class GUI_EXPORT QgsOWSSourceSelect : public QDialog, protected Ui::QgsOWSSourceSelectBase
52 {
53  Q_OBJECT
54 
55  public:
58  {
59  QString format;
60  QString label;
61  };
62 
64  QgsOWSSourceSelect( const QString &service, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None );
65 
67 
68  public slots:
69 
71  void on_mNewButton_clicked();
73  void on_mEditButton_clicked();
75  void on_mDeleteButton_clicked();
77  void on_mSaveButton_clicked();
79  void on_mLoadButton_clicked();
80 
84  void on_mConnectButton_clicked();
85 
87  virtual void addClicked();
88 
89  void searchFinished();
90 
92  void on_mChangeCRSButton_clicked();
93 
95  virtual void on_mLayersTreeWidget_itemSelectionChanged();
96 
98  void showStatusMessage( const QString &message );
99 
101  void showError( const QString &title, const QString &format, const QString &error );
102 
104  void on_mConnectionsComboBox_activated( int );
105 
107  void on_mAddDefaultButton_clicked();
108 
109  void on_mDialogButtonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
110 
111  signals:
112  void addRasterLayer( const QString &rasterLayerPath,
113  const QString &baseName,
114  const QString &providerKey );
115  void connectionsChanged();
116 
117  protected:
118 
123  virtual QList<QgsOWSSourceSelect::SupportedFormat> providerFormats();
124 
126  virtual QStringList selectedLayersFormats();
127 
129  virtual QStringList selectedLayersCrses();
130 
132  virtual QStringList selectedLayersTimes();
133 
134  //virtual QStringList layerCRS( int id );
135 
137  void populateConnectionList();
138 
140  void populateFormats();
141 
143  void clearFormats();
144 
146  void populateCrs();
147 
149  void clearCrs();
150 
152  void populateTimes();
153 
155  void clearTimes();
156 
158  QString connName();
159 
161  QString connectionInfo();
162 
164  void setConnectionListPosition();
165 
167  void addDefaultServers();
168 
170  QString mService;
171 
173  QgsProviderRegistry::WidgetMode mWidgetMode = QgsProviderRegistry::WidgetMode::None;
174 
175 
181  virtual void populateLayerList();
182 
185  QgsTreeWidgetItem *createItem( int id,
186  const QStringList &names,
187  QMap<int, QgsTreeWidgetItem *> &items,
188  int &layerAndStyleCount,
189  const QMap<int, int> &layerParents,
190  const QMap<int, QStringList> &layerParentNames ) SIP_FACTORY SIP_SKIP;
191 
193  QString descriptionForAuthId( const QString &authId );
194 
196  QString mLastLayerName;
197 
198  QPushButton *mAddButton = nullptr;
199 
200  QMap<QString, QString> mCrsNames;
201 
202  void addWmsListRow( const QDomElement &item, int row );
203  void addWmsListItem( const QDomElement &el, int row, int column );
204 
205  virtual void enableLayersForCrs( QTreeWidgetItem *item );
206 
208  QString selectedFormat();
209 
211  QString selectedCrs();
212 
214  QString selectedTime();
215 
217  QNetworkRequest::CacheLoadControl selectedCacheLoadControl();
218 
219  QList<QTreeWidgetItem *> mCurrentSelection;
220  QTableWidgetItem *mCurrentTileset = nullptr;
221 
223  QString mConnName;
224 
227 
230 
231  private:
233  QString mSelectedCRS;
234 
236  QSet<QString> mSelectedLayersCRSs;
237 
239  QList<SupportedFormat> mProviderFormats;
240 
242  QMap<QString, QString> mMimeLabelMap;
243 
244  private slots:
245  void on_mSearchButton_clicked();
246  void on_mSearchTableWidget_itemSelectionChanged();
247  void on_mTilesetsTableWidget_itemClicked( QTableWidgetItem *item );
248  void on_mLayerUpButton_clicked();
249  void on_mLayerDownButton_clicked();
250  virtual void updateButtons();
251 };
252 
253 #endif // QGSOWSSOURCESELECT_H
WidgetMode
Different ways a source select dialog can be used (embedded is for the data source manager dialog) ...
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:34
QMap< QString, QString > mCrsNames
Abstract base class for spatial data provider implementations.
static void run(const QString &context)
#define SIP_SKIP
Definition: qgis_sip.h:107
#define SIP_FACTORY
Definition: qgis_sip.h:57
QString mLastLayerName
layer name derived from latest layer selection (updated as long it&#39;s not edited manually) ...
QString mConnectionInfo
Connection info for selected connection.
QTreeWidgetItem subclass with custom handling for item sorting.
Dialog to create connections and add layers from WMS, WFS, WCS etc.
void on_mDialogButtonBox_helpRequested()
Formats supported by provider.
QString mService
Service name.
Class for storing the component parts of a PostgreSQL/RDBMS datasource URI.
QList< QTreeWidgetItem * > mCurrentSelection
QgsDataSourceUri mUri
URI for selected connection.
QString mConnName
Name for selected connection.