QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 class QgsOWSSourceWidget;
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 
68  void refresh() override;
69 
70  void reset() override;
71 
72  void setMapCanvas( QgsMapCanvas *mapCanvas ) override;
73 
74 
75  protected slots:
77  void showError( const QString &title, const QString &format, const QString &error );
78 
80  void showStatusMessage( const QString &message );
81 
82  protected:
83 
88  virtual QList<QgsOWSSourceSelect::SupportedFormat> providerFormats();
89 
91  virtual QStringList selectedLayersFormats();
92 
94  virtual QStringList selectedLayersCrses();
95 
97  virtual QStringList selectedLayersTimes();
98 
99  //virtual QStringList layerCRS( int id );
100 
102  void populateConnectionList();
103 
105  void populateFormats();
106 
108  void clearFormats();
109 
111  void populateCrs();
112 
114  void clearCrs();
115 
117  void populateTimes();
118 
120  void clearTimes();
121 
123  QString connName();
124 
126  QString connectionInfo();
127 
129  void setConnectionListPosition();
130 
132  void addDefaultServers();
133 
135  QString mService;
136 
142  virtual void populateLayerList();
143 
148  QgsTreeWidgetItem *createItem( int id,
149  const QStringList &names,
150  QMap<int, QgsTreeWidgetItem *> &items,
151  int &layerAndStyleCount,
152  const QMap<int, int> &layerParents,
153  const QMap<int, QStringList> &layerParentNames ) SIP_FACTORY SIP_SKIP;
154 
156  QString descriptionForAuthId( const QString &authId );
157 
159  QString mLastLayerName;
160 
161  QMap<QString, QString> mCrsNames;
162 
163  virtual void enableLayersForCrs( QTreeWidgetItem *item );
164 
166  QString selectedFormat();
167 
169  QString selectedCrs();
170 
172  QString selectedTime();
173 
175  QNetworkRequest::CacheLoadControl selectedCacheLoadControl();
176 
184  void prepareExtent();
185 
186  QList<QTreeWidgetItem *> mCurrentSelection;
187  QTableWidgetItem *mCurrentTileset = nullptr;
188 
190  QString mConnName;
191 
194 
197 
198  private slots:
199 
201  void mNewButton_clicked();
203  void mEditButton_clicked();
205  void mDeleteButton_clicked();
207  void mSaveButton_clicked();
209  void mLoadButton_clicked();
210 
215  void mConnectButton_clicked();
216 
218  void mChangeCRSButton_clicked();
219 
221  virtual void mLayersTreeWidget_itemSelectionChanged();
222 
224  void mConnectionsComboBox_activated( int );
225 
227  void mAddDefaultButton_clicked();
228 
229 
230  private:
231 
233  QString mSelectedCRS;
234 
236  QSet<QString> mSelectedLayersCRSs;
237 
239  QList<SupportedFormat> mProviderFormats;
240 
242  QMap<QString, QString> mMimeLabelMap;
243 
245  QgsOWSSourceWidget *mSourceWidget = nullptr;
246 
247  private slots:
248  void mTilesetsTableWidget_itemClicked( QTableWidgetItem *item );
249  void mLayerUpButton_clicked();
250  void mLayerDownButton_clicked();
251  virtual void updateButtons();
252 };
253 
254 #endif // QGSOWSSOURCESELECT_H
QgsOWSSourceSelect::mService
QString mService
Service name.
Definition: qgsowssourceselect.h:135
QgsDataSourceUri
Class for storing the component parts of a RDBMS data source URI (e.g. a Postgres data source).
Definition: qgsdatasourceuri.h:37
QgsAbstractDataSourceWidget
Abstract base Data Source Widget to create connections and add layers This class provides common func...
Definition: qgsabstractdatasourcewidget.h:43
QgsOWSSourceSelect::SupportedFormat
Formats supported by provider.
Definition: qgsowssourceselect.h:58
QgsDataProvider
Abstract base class for spatial data provider implementations.
Definition: qgsdataprovider.h:40
QgsOWSSourceSelect::mCurrentSelection
QList< QTreeWidgetItem * > mCurrentSelection
Definition: qgsowssourceselect.h:186
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:89
QgsOWSSourceSelect::mCrsNames
QMap< QString, QString > mCrsNames
Definition: qgsowssourceselect.h:161
QgsTreeWidgetItem
QTreeWidgetItem subclass with custom handling for item sorting.
Definition: qgstreewidgetitem.h:36
qgsabstractdatasourcewidget.h
QgsOWSSourceSelect::SupportedFormat::format
QString format
Definition: qgsowssourceselect.h:60
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsOWSSourceSelect::SupportedFormat::label
QString label
Definition: qgsowssourceselect.h:61
QgsProviderRegistry::WidgetMode
WidgetMode
Different ways a source select dialog can be used.
Definition: qgsproviderregistry.h:70
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
qgsproviderregistry.h
qgsdatasourceuri.h
qgis_sip.h
QgsOWSSourceSelect::mConnectionInfo
QString mConnectionInfo
Connection info for selected connection.
Definition: qgsowssourceselect.h:193
QgsOWSSourceWidget
This widget sets and updates OWS layers source URI.
Definition: qgsowssourcewidget.h:34
QgsOWSSourceSelect::mUri
QgsDataSourceUri mUri
URI for selected connection.
Definition: qgsowssourceselect.h:196
QgsOWSSourceSelect::mConnName
QString mConnName
Name for selected connection.
Definition: qgsowssourceselect.h:190
QgsAbstractDataSourceWidget::setMapCanvas
virtual void setMapCanvas(QgsMapCanvas *mapCanvas)
Sets the dialog map canvas.
Definition: qgsabstractdatasourcewidget.h:68
QgsOWSSourceSelect::mLastLayerName
QString mLastLayerName
layer name derived from latest layer selection (updated as long it's not edited manually)
Definition: qgsowssourceselect.h:159
qgsguiutils.h
QgsOWSSourceSelect
Dialog to create connections and add layers WCS etc.
Definition: qgsowssourceselect.h:52
QgsAbstractDataSourceWidget::refresh
virtual void refresh()
Triggered when the provider's connections need to be refreshed The default implementation does nothin...
Definition: qgsabstractdatasourcewidget.h:76
QgsAbstractDataSourceWidget::reset
virtual void reset()
Called when this source select widget is being shown in a "new and clean" dialog.
Definition: qgsabstractdatasourcewidget.cpp:65
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53