QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
Loading...
Searching...
No Matches
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
24#include "qgis_gui.h"
25#include "qgis_sip.h"
27#include "qgsdatasourceuri.h"
28#include "qgsguiutils.h"
29#include "qgsproviderregistry.h"
30
31#include <QNetworkRequest>
32#include <QPushButton>
33#include <QStringList>
34
35class QgsDataProvider;
36class QButtonGroup;
38class QDomDocument;
39class QDomElement;
41
42
53class GUI_EXPORT QgsOWSSourceSelect : public QgsAbstractDataSourceWidget, public Ui::QgsOWSSourceSelectBase
54{
55 Q_OBJECT
56
57 public:
60 {
61 QString format;
62 QString label;
63 };
64
67 const QString &service,
68 QWidget *parent SIP_TRANSFERTHIS = nullptr,
69 Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags,
71 );
72
74 void refresh() override;
75
76 void reset() override;
77
78 void setMapCanvas( QgsMapCanvas *mapCanvas ) override;
79
80
81 protected slots:
83 void showError( const QString &title, const QString &format, const QString &error );
84
86 void showStatusMessage( const QString &message );
87
88 protected:
93 virtual QList<QgsOWSSourceSelect::SupportedFormat> providerFormats();
94
96 virtual QStringList selectedLayersFormats();
97
99 virtual QStringList selectedLayersCrses();
100
102 virtual QStringList selectedLayersTimes();
103
104 //virtual QStringList layerCRS( int id );
105
108
110 void populateFormats();
111
113 void clearFormats();
114
116 void populateCrs();
117
119 void clearCrs();
120
122 void populateTimes();
123
125 void clearTimes();
126
128 QString connName();
129
131 QString connectionInfo();
132
135
137 void addDefaultServers();
138
140 QString mService;
141
145 virtual void populateLayerList();
146
152 int id, const QStringList &names, QMap<int, QgsTreeWidgetItem *> &items, int &layerAndStyleCount, const QMap<int, int> &layerParents, const QMap<int, QStringList> &layerParentNames
154
156 QString descriptionForAuthId( const QString &authId );
157
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:
232 QString mSelectedCRS;
233
235 QSet<QString> mSelectedLayersCRSs;
236
238 QList<SupportedFormat> mProviderFormats;
239
241 QMap<QString, QString> mMimeLabelMap;
242
243 private slots:
244 void mTilesetsTableWidget_itemClicked( QTableWidgetItem *item );
245 void mLayerUpButton_clicked();
246 void mLayerDownButton_clicked();
247 virtual void updateButtons();
248};
249
250#endif // QGSOWSSOURCESELECT_H
virtual QgsMapCanvas * mapCanvas()
Returns the dialog map canvas.
virtual void setMapCanvas(QgsMapCanvas *mapCanvas)
Sets the dialog map canvas.
QgsAbstractDataSourceWidget(QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode=QgsProviderRegistry::WidgetMode::Standalone)
Constructor.
virtual void refresh()
Triggered when the provider's connections need to be refreshed The default implementation does nothin...
QgsProviderRegistry::WidgetMode widgetMode() const
Returns the widget mode.
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.
Stores the component parts of a data source URI (e.g.
Map canvas is a class for displaying all GIS data types on a canvas.
virtual QStringList selectedLayersCrses()
Server CRS supported for currently selected layer item(s).
virtual QStringList selectedLayersTimes()
List of times (temporalDomain timePosition/timePeriod for currently selected layer item(s).
QString descriptionForAuthId(const QString &authId)
Returns a textual description for the authority id.
QString selectedTime()
Returns currently selected time.
void clearCrs()
Clear CRSs.
void populateCrs()
Sets supported CRSs.
virtual void enableLayersForCrs(QTreeWidgetItem *item)
QString mService
Service name.
virtual QList< QgsOWSSourceSelect::SupportedFormat > providerFormats()
List of image formats (encodings) supported by provider.
QString connectionInfo()
Connection info (uri).
QNetworkRequest::CacheLoadControl selectedCacheLoadControl()
Returns currently selected cache load control.
void populateFormats()
Populate supported formats.
QTableWidgetItem * mCurrentTileset
QString selectedCrs()
Returns currently selected Crs.
void populateTimes()
Populate times.
QgsOWSSourceSelect(const QString &service, QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode=QgsProviderRegistry::WidgetMode::Standalone)
Constructor.
virtual QStringList selectedLayersFormats()
List of formats supported for currently selected layer item(s).
void setConnectionListPosition()
Sets the server connection combo box to that stored in the config file.
void clearTimes()
Clear times.
QString mLastLayerName
layer name derived from latest layer selection (updated as long it's not edited manually)
QgsTreeWidgetItem * createItem(int id, const QStringList &names, QMap< int, QgsTreeWidgetItem * > &items, int &layerAndStyleCount, const QMap< int, int > &layerParents, const QMap< int, QStringList > &layerParentNames)
create an item including possible parents
QString selectedFormat()
Returns currently selected format.
QString mConnName
Name for selected connection.
void showError(const QString &title, const QString &format, const QString &error)
show whatever error is exposed.
void populateConnectionList()
Populate the connection list combo box.
QString connName()
Connection name.
void addDefaultServers()
Add a few example servers to the list.
void showStatusMessage(const QString &message)
Sets status message to theMessage.
QgsDataSourceUri mUri
URI for selected connection.
QString mConnectionInfo
Connection info for selected connection.
void prepareExtent()
Prepares the spatial extent box with the general settings including original crs, destination crs and...
QList< QTreeWidgetItem * > mCurrentSelection
void clearFormats()
Clear previously set formats.
virtual void populateLayerList()
Populate the layer list.
QMap< QString, QString > mCrsNames
This widget sets and updates OWS layers source URI.
WidgetMode
Different ways a source select dialog can be used.
@ Standalone
Basic mode when the widget is used as a standalone dialog.
QTreeWidgetItem subclass with custom handling for item sorting.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_FACTORY
Definition qgis_sip.h:83
Formats supported by provider.