QGIS API Documentation  2.99.0-Master (7d4f81d)
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"
30 
31 #include <QStringList>
32 #include <QPushButton>
33 #include <QNetworkRequest>
34 #include "qgis_gui.h"
35 
36 class QgsDataProvider;
37 class QButtonGroup;
38 class QgsTreeWidgetItem;
39 class QDomDocument;
40 class QDomElement;
41 
42 
52 class GUI_EXPORT QgsOWSSourceSelect : public QgsAbstractDataSourceWidget, protected Ui::QgsOWSSourceSelectBase
53 {
54  Q_OBJECT
55 
56  public:
59  {
60  QString format;
61  QString label;
62  };
63 
65  QgsOWSSourceSelect( const QString &service, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None );
66 
68 
69  public slots:
70 
72  void refresh() override;
73 
75  void on_mNewButton_clicked();
77  void on_mEditButton_clicked();
79  void on_mDeleteButton_clicked();
81  void on_mSaveButton_clicked();
83  void on_mLoadButton_clicked();
84 
88  void on_mConnectButton_clicked();
89 
90  void searchFinished();
91 
93  void on_mChangeCRSButton_clicked();
94 
96  virtual void on_mLayersTreeWidget_itemSelectionChanged();
97 
99  void showStatusMessage( const QString &message );
100 
102  void showError( const QString &title, const QString &format, const QString &error );
103 
105  void on_mConnectionsComboBox_activated( int );
106 
108  void on_mAddDefaultButton_clicked();
109 
110  protected:
111 
116  virtual QList<QgsOWSSourceSelect::SupportedFormat> providerFormats();
117 
119  virtual QStringList selectedLayersFormats();
120 
122  virtual QStringList selectedLayersCrses();
123 
125  virtual QStringList selectedLayersTimes();
126 
127  //virtual QStringList layerCRS( int id );
128 
130  void populateConnectionList();
131 
133  void populateFormats();
134 
136  void clearFormats();
137 
139  void populateCrs();
140 
142  void clearCrs();
143 
145  void populateTimes();
146 
148  void clearTimes();
149 
151  QString connName();
152 
154  QString connectionInfo();
155 
157  void setConnectionListPosition();
158 
160  void addDefaultServers();
161 
163  QString mService;
164 
170  virtual void populateLayerList();
171 
174  QgsTreeWidgetItem *createItem( int id,
175  const QStringList &names,
176  QMap<int, QgsTreeWidgetItem *> &items,
177  int &layerAndStyleCount,
178  const QMap<int, int> &layerParents,
179  const QMap<int, QStringList> &layerParentNames ) SIP_FACTORY SIP_SKIP;
180 
182  QString descriptionForAuthId( const QString &authId );
183 
185  QString mLastLayerName;
186 
187  QMap<QString, QString> mCrsNames;
188 
189  void addWmsListRow( const QDomElement &item, int row );
190  void addWmsListItem( const QDomElement &el, int row, int column );
191 
192  virtual void enableLayersForCrs( QTreeWidgetItem *item );
193 
195  QString selectedFormat();
196 
198  QString selectedCrs();
199 
201  QString selectedTime();
202 
204  QNetworkRequest::CacheLoadControl selectedCacheLoadControl();
205 
206  QList<QTreeWidgetItem *> mCurrentSelection;
207  QTableWidgetItem *mCurrentTileset = nullptr;
208 
210  QString mConnName;
211 
214 
217 
218 
219  private:
221  QString mSelectedCRS;
222 
224  QSet<QString> mSelectedLayersCRSs;
225 
227  QList<SupportedFormat> mProviderFormats;
228 
230  QMap<QString, QString> mMimeLabelMap;
231 
232  private slots:
233  void on_mSearchButton_clicked();
234  void on_mSearchTableWidget_itemSelectionChanged();
235  void on_mTilesetsTableWidget_itemClicked( QTableWidgetItem *item );
236  void on_mLayerUpButton_clicked();
237  void on_mLayerDownButton_clicked();
238  virtual void updateButtons();
239 };
240 
241 #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 PostgreSQL/RDBMS datasource URI.
QList< QTreeWidgetItem * > mCurrentSelection
QgsDataSourceUri mUri
URI for selected connection.
QString mConnName
Name for selected connection.