QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
34class QgsDataProvider;
35class QButtonGroup;
37class QDomDocument;
38class QDomElement;
40
41
52class 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
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
158
159 QMap<QString, QString> mCrsNames;
160
161 virtual void enableLayersForCrs( QTreeWidgetItem *item );
162
164 QString selectedFormat();
165
167 QString selectedCrs();
168
170 QString selectedTime();
171
173 QNetworkRequest::CacheLoadControl selectedCacheLoadControl();
174
182 void prepareExtent();
183
184 QList<QTreeWidgetItem *> mCurrentSelection;
185 QTableWidgetItem *mCurrentTileset = nullptr;
186
188 QString mConnName;
189
192
195
196 private slots:
197
199 void mNewButton_clicked();
201 void mEditButton_clicked();
203 void mDeleteButton_clicked();
205 void mSaveButton_clicked();
207 void mLoadButton_clicked();
208
213 void mConnectButton_clicked();
214
216 void mChangeCRSButton_clicked();
217
219 virtual void mLayersTreeWidget_itemSelectionChanged();
220
222 void mConnectionsComboBox_activated( int );
223
225 void mAddDefaultButton_clicked();
226
227
228 private:
229
231 QString mSelectedCRS;
232
234 QSet<QString> mSelectedLayersCRSs;
235
237 QList<SupportedFormat> mProviderFormats;
238
240 QMap<QString, QString> mMimeLabelMap;
241
243 QgsOWSSourceWidget *mSourceWidget = nullptr;
244
245 private slots:
246 void mTilesetsTableWidget_itemClicked( QTableWidgetItem *item );
247 void mLayerUpButton_clicked();
248 void mLayerDownButton_clicked();
249 virtual void updateButtons();
250};
251
252#endif // QGSOWSSOURCESELECT_H
Abstract base Data Source Widget to create connections and add layers This class provides common func...
virtual void setMapCanvas(QgsMapCanvas *mapCanvas)
Sets the dialog map canvas.
virtual void refresh()
Triggered when the provider's connections need to be refreshed The default implementation does nothin...
virtual void reset()
Called when this source select widget is being shown in a "new and clean" dialog.
Abstract base class for spatial data provider implementations.
Class for storing the component parts of a RDBMS data source URI (e.g.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:93
Dialog to create connections and add layers WCS etc.
QString mService
Service name.
QString mLastLayerName
layer name derived from latest layer selection (updated as long it's not edited manually)
QString mConnName
Name for selected connection.
QgsDataSourceUri mUri
URI for selected connection.
QString mConnectionInfo
Connection info for selected connection.
QList< QTreeWidgetItem * > mCurrentSelection
QMap< QString, QString > mCrsNames
This widget sets and updates OWS layers source URI.
WidgetMode
Different ways a source select dialog can be used.
QTreeWidgetItem subclass with custom handling for item sorting.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_FACTORY
Definition: qgis_sip.h:76
Formats supported by provider.