QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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 
67  void refresh() override;
68 
69  void reset() override;
70 
71  protected slots:
73  void showError( const QString &title, const QString &format, const QString &error );
74 
76  void showStatusMessage( const QString &message );
77 
78  protected:
79 
84  virtual QList<QgsOWSSourceSelect::SupportedFormat> providerFormats();
85 
87  virtual QStringList selectedLayersFormats();
88 
90  virtual QStringList selectedLayersCrses();
91 
93  virtual QStringList selectedLayersTimes();
94 
95  //virtual QStringList layerCRS( int id );
96 
98  void populateConnectionList();
99 
101  void populateFormats();
102 
104  void clearFormats();
105 
107  void populateCrs();
108 
110  void clearCrs();
111 
113  void populateTimes();
114 
116  void clearTimes();
117 
119  QString connName();
120 
122  QString connectionInfo();
123 
125  void setConnectionListPosition();
126 
128  void addDefaultServers();
129 
131  QString mService;
132 
138  virtual void populateLayerList();
139 
144  QgsTreeWidgetItem *createItem( int id,
145  const QStringList &names,
146  QMap<int, QgsTreeWidgetItem *> &items,
147  int &layerAndStyleCount,
148  const QMap<int, int> &layerParents,
149  const QMap<int, QStringList> &layerParentNames ) SIP_FACTORY SIP_SKIP;
150 
152  QString descriptionForAuthId( const QString &authId );
153 
155  QString mLastLayerName;
156 
157  QMap<QString, QString> mCrsNames;
158 
159  void addWmsListRow( const QDomElement &item, int row );
160  void addWmsListItem( const QDomElement &el, int row, int column );
161 
162  virtual void enableLayersForCrs( QTreeWidgetItem *item );
163 
165  QString selectedFormat();
166 
168  QString selectedCrs();
169 
171  QString selectedTime();
172 
174  QNetworkRequest::CacheLoadControl selectedCacheLoadControl();
175 
176  QList<QTreeWidgetItem *> mCurrentSelection;
177  QTableWidgetItem *mCurrentTileset = nullptr;
178 
180  QString mConnName;
181 
184 
187 
188  private slots:
189 
191  void mNewButton_clicked();
193  void mEditButton_clicked();
195  void mDeleteButton_clicked();
197  void mSaveButton_clicked();
199  void mLoadButton_clicked();
200 
205  void mConnectButton_clicked();
206 
207  void searchFinished();
208 
210  void mChangeCRSButton_clicked();
211 
213  virtual void mLayersTreeWidget_itemSelectionChanged();
214 
216  void mConnectionsComboBox_activated( int );
217 
219  void mAddDefaultButton_clicked();
220 
221 
222  private:
224  QString mSelectedCRS;
225 
227  QSet<QString> mSelectedLayersCRSs;
228 
230  QList<SupportedFormat> mProviderFormats;
231 
233  QMap<QString, QString> mMimeLabelMap;
234 
235  private slots:
236  void mSearchButton_clicked();
237  void mSearchTableWidget_itemSelectionChanged();
238  void mTilesetsTableWidget_itemClicked( QTableWidgetItem *item );
239  void mLayerUpButton_clicked();
240  void mLayerDownButton_clicked();
241  virtual void updateButtons();
242 };
243 
244 #endif // QGSOWSSOURCESELECT_H
WidgetMode
Different ways a source select dialog can be used.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
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:126
#define SIP_FACTORY
Definition: qgis_sip.h:76
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.