QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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, protected Ui::QgsOWSSourceSelectBase
54{
55 Q_OBJECT
56
57 public:
60 {
61 QString format;
62 QString label;
63 };
64
66 QgsOWSSourceSelect( const QString &service, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Standalone );
67
69 void refresh() override;
70
71 void reset() override;
72
73 void setMapCanvas( QgsMapCanvas *mapCanvas ) override;
74
75
76 protected slots:
78 void showError( const QString &title, const QString &format, const QString &error );
79
81 void showStatusMessage( const QString &message );
82
83 protected:
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
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
130
132 void addDefaultServers();
133
135 QString mService;
136
140 virtual void populateLayerList();
141
146 QgsTreeWidgetItem *createItem( int id, const QStringList &names, QMap<int, QgsTreeWidgetItem *> &items, int &layerAndStyleCount, const QMap<int, int> &layerParents, const QMap<int, QStringList> &layerParentNames ) SIP_FACTORY SIP_SKIP;
147
149 QString descriptionForAuthId( const QString &authId );
150
153
154 QMap<QString, QString> mCrsNames;
155
156 virtual void enableLayersForCrs( QTreeWidgetItem *item );
157
159 QString selectedFormat();
160
162 QString selectedCrs();
163
165 QString selectedTime();
166
168 QNetworkRequest::CacheLoadControl selectedCacheLoadControl();
169
177 void prepareExtent();
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
211 void mChangeCRSButton_clicked();
212
214 virtual void mLayersTreeWidget_itemSelectionChanged();
215
217 void mConnectionsComboBox_activated( int );
218
220 void mAddDefaultButton_clicked();
221
222
223 private:
225 QString mSelectedCRS;
226
228 QSet<QString> mSelectedLayersCRSs;
229
231 QList<SupportedFormat> mProviderFormats;
232
234 QMap<QString, QString> mMimeLabelMap;
235
236 private slots:
237 void mTilesetsTableWidget_itemClicked( QTableWidgetItem *item );
238 void mLayerUpButton_clicked();
239 void mLayerDownButton_clicked();
240 virtual void updateButtons();
241};
242
243#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:53
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_FACTORY
Definition qgis_sip.h:84
Formats supported by provider.