QGIS API Documentation  3.0.2-Girona (307d082)
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 "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 
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 
67  ~QgsOWSSourceSelect() override;
68 
69  public slots:
70 
72  void refresh() override;
73 
74  protected slots:
76  void showError( const QString &title, const QString &format, const QString &error );
77 
79  void showStatusMessage( const QString &message );
80 
81  protected:
82 
87  virtual QList<QgsOWSSourceSelect::SupportedFormat> providerFormats();
88 
90  virtual QStringList selectedLayersFormats();
91 
93  virtual QStringList selectedLayersCrses();
94 
96  virtual QStringList selectedLayersTimes();
97 
98  //virtual QStringList layerCRS( int id );
99 
101  void populateConnectionList();
102 
104  void populateFormats();
105 
107  void clearFormats();
108 
110  void populateCrs();
111 
113  void clearCrs();
114 
116  void populateTimes();
117 
119  void clearTimes();
120 
122  QString connName();
123 
125  QString connectionInfo();
126 
128  void setConnectionListPosition();
129 
131  void addDefaultServers();
132 
134  QString mService;
135 
141  virtual void populateLayerList();
142 
147  QgsTreeWidgetItem *createItem( int id,
148  const QStringList &names,
149  QMap<int, QgsTreeWidgetItem *> &items,
150  int &layerAndStyleCount,
151  const QMap<int, int> &layerParents,
152  const QMap<int, QStringList> &layerParentNames ) SIP_FACTORY SIP_SKIP;
153 
155  QString descriptionForAuthId( const QString &authId );
156 
158  QString mLastLayerName;
159 
160  QMap<QString, QString> mCrsNames;
161 
162  void addWmsListRow( const QDomElement &item, int row );
163  void addWmsListItem( const QDomElement &el, int row, int column );
164 
165  virtual void enableLayersForCrs( QTreeWidgetItem *item );
166 
168  QString selectedFormat();
169 
171  QString selectedCrs();
172 
174  QString selectedTime();
175 
177  QNetworkRequest::CacheLoadControl selectedCacheLoadControl();
178 
179  QList<QTreeWidgetItem *> mCurrentSelection;
180  QTableWidgetItem *mCurrentTileset = nullptr;
181 
183  QString mConnName;
184 
187 
190 
191  private slots:
192 
194  void mNewButton_clicked();
196  void mEditButton_clicked();
198  void mDeleteButton_clicked();
200  void mSaveButton_clicked();
202  void mLoadButton_clicked();
203 
208  void mConnectButton_clicked();
209 
210  void searchFinished();
211 
213  void mChangeCRSButton_clicked();
214 
216  virtual void mLayersTreeWidget_itemSelectionChanged();
217 
219  void mConnectionsComboBox_activated( int );
220 
222  void mAddDefaultButton_clicked();
223 
224 
225  private:
227  QString mSelectedCRS;
228 
230  QSet<QString> mSelectedLayersCRSs;
231 
233  QList<SupportedFormat> mProviderFormats;
234 
236  QMap<QString, QString> mMimeLabelMap;
237 
238  private slots:
239  void mSearchButton_clicked();
240  void mSearchTableWidget_itemSelectionChanged();
241  void mTilesetsTableWidget_itemClicked( QTableWidgetItem *item );
242  void mLayerUpButton_clicked();
243  void mLayerDownButton_clicked();
244  virtual void updateButtons();
245 };
246 
247 #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.