QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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 "qgsdatasourceuri.h"
25 #include "qgsguiutils.h"
26 #include "qgsproviderregistry.h"
28 
29 #include <QStringList>
30 #include <QPushButton>
31 #include <QNetworkRequest>
32 #include "qgis_gui.h"
33 
34 class QgsDataProvider;
35 class QButtonGroup;
36 class QgsTreeWidgetItem;
37 class QDomDocument;
38 class QDomElement;
39 
40 
51 class GUI_EXPORT QgsOWSSourceSelect : public QgsAbstractDataSourceWidget, 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 
66  ~QgsOWSSourceSelect() override;
67 
68  public slots:
69 
71  void refresh() override;
72 
73  protected slots:
75  void showError( const QString &title, const QString &format, const QString &error );
76 
78  void showStatusMessage( const QString &message );
79 
80  protected:
81 
86  virtual QList<QgsOWSSourceSelect::SupportedFormat> providerFormats();
87 
89  virtual QStringList selectedLayersFormats();
90 
92  virtual QStringList selectedLayersCrses();
93 
95  virtual QStringList selectedLayersTimes();
96 
97  //virtual QStringList layerCRS( int id );
98 
100  void populateConnectionList();
101 
103  void populateFormats();
104 
106  void clearFormats();
107 
109  void populateCrs();
110 
112  void clearCrs();
113 
115  void populateTimes();
116 
118  void clearTimes();
119 
121  QString connName();
122 
124  QString connectionInfo();
125 
127  void setConnectionListPosition();
128 
130  void addDefaultServers();
131 
133  QString mService;
134 
140  virtual void populateLayerList();
141 
146  QgsTreeWidgetItem *createItem( int id,
147  const QStringList &names,
148  QMap<int, QgsTreeWidgetItem *> &items,
149  int &layerAndStyleCount,
150  const QMap<int, int> &layerParents,
151  const QMap<int, QStringList> &layerParentNames ) SIP_FACTORY SIP_SKIP;
152 
154  QString descriptionForAuthId( const QString &authId );
155 
157  QString mLastLayerName;
158 
159  QMap<QString, QString> mCrsNames;
160 
161  void addWmsListRow( const QDomElement &item, int row );
162  void addWmsListItem( const QDomElement &el, int row, int column );
163 
164  virtual void enableLayersForCrs( QTreeWidgetItem *item );
165 
167  QString selectedFormat();
168 
170  QString selectedCrs();
171 
173  QString selectedTime();
174 
176  QNetworkRequest::CacheLoadControl selectedCacheLoadControl();
177 
178  QList<QTreeWidgetItem *> mCurrentSelection;
179  QTableWidgetItem *mCurrentTileset = nullptr;
180 
182  QString mConnName;
183 
186 
189 
190  private slots:
191 
193  void mNewButton_clicked();
195  void mEditButton_clicked();
197  void mDeleteButton_clicked();
199  void mSaveButton_clicked();
201  void mLoadButton_clicked();
202 
207  void mConnectButton_clicked();
208 
209  void searchFinished();
210 
212  void mChangeCRSButton_clicked();
213 
215  virtual void mLayersTreeWidget_itemSelectionChanged();
216 
218  void mConnectionsComboBox_activated( int );
219 
221  void mAddDefaultButton_clicked();
222 
223 
224  private:
226  QString mSelectedCRS;
227 
229  QSet<QString> mSelectedLayersCRSs;
230 
232  QList<SupportedFormat> mProviderFormats;
233 
235  QMap<QString, QString> mMimeLabelMap;
236 
237  private slots:
238  void mSearchButton_clicked();
239  void mSearchTableWidget_itemSelectionChanged();
240  void mTilesetsTableWidget_itemClicked( QTableWidgetItem *item );
241  void mLayerUpButton_clicked();
242  void mLayerDownButton_clicked();
243  virtual void updateButtons();
244 };
245 
246 #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:46
QMap< QString, QString > mCrsNames
Abstract base Data Source Widget to create connections and add layers This class provides common func...
Abstract base class for spatial data provider implementations.
#define SIP_SKIP
Definition: qgis_sip.h:119
#define SIP_FACTORY
Definition: qgis_sip.h:69
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 WCS etc.
Formats supported by provider.
QString mService
Service name.
Class for storing the component parts of a RDBMS data source URI (e.g.
QList< QTreeWidgetItem * > mCurrentSelection
QgsDataSourceUri mUri
URI for selected connection.
QString mConnName
Name for selected connection.