QGIS API Documentation  2.99.0-Master (8ec3eaf)
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 "qgsdatasourceuri.h"
24 #include "qgisgui.h"
25 #include "qgscontexthelp.h"
26 
27 #include <QStringList>
28 #include <QPushButton>
29 #include <QNetworkRequest>
30 
31 class QgsDataProvider;
32 class QButtonGroup;
33 class QgsTreeWidgetItem;
34 class QDomDocument;
35 class QDomElement;
36 
37 
47 class GUI_EXPORT QgsOWSSourceSelect : public QDialog, public Ui::QgsOWSSourceSelectBase
48 {
49  Q_OBJECT
50 
51  public:
54  {
55  QString format;
56  QString label;
57  };
58 
60  QgsOWSSourceSelect( const QString& service, QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false );
63 
64  public slots:
65 
67  void on_mNewButton_clicked();
69  void on_mEditButton_clicked();
71  void on_mDeleteButton_clicked();
73  void on_mSaveButton_clicked();
75  void on_mLoadButton_clicked();
76 
80  void on_mConnectButton_clicked();
81 
83  virtual void addClicked();
84 
85  void searchFinished();
86 
88  void on_mChangeCRSButton_clicked();
89 
91  virtual void on_mLayersTreeWidget_itemSelectionChanged();
92 
94  void showStatusMessage( const QString &theMessage );
95 
97  void showError( const QString &theTitle, const QString &theFormat, const QString &theError );
98 
100  void on_mConnectionsComboBox_activated( int );
101 
103  void on_mAddDefaultButton_clicked();
104 
105  void on_mDialogButtonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
106 
107  signals:
108  void addRasterLayer( const QString & rasterLayerPath,
109  const QString & baseName,
110  const QString & providerKey );
111  void connectionsChanged();
112 
113  protected:
114 
119  virtual QList<SupportedFormat> providerFormats();
120 
122  virtual QStringList selectedLayersFormats();
123 
125  virtual QStringList selectedLayersCrses();
126 
128  virtual QStringList selectedLayersTimes();
129 
130  //virtual QStringList layerCRS( int id );
131 
133  void populateConnectionList();
134 
136  void populateFormats();
137 
139  void clearFormats();
140 
142  void populateCrs();
143 
145  void clearCrs();
146 
148  void populateTimes();
149 
151  void clearTimes();
152 
154  QString connName();
155 
157  QString connectionInfo();
158 
160  void setConnectionListPosition();
161 
163  void addDefaultServers();
164 
166  QString mService;
167 
170 
173 
174 
180  virtual void populateLayerList();
181 
184  QgsTreeWidgetItem *createItem( int id,
185  const QStringList &names,
186  QMap<int, QgsTreeWidgetItem *> &items,
187  int &layerAndStyleCount,
188  const QMap<int, int> &layerParents,
189  const QMap<int, QStringList> &layerParentNames );
190 
192  QString descriptionForAuthId( const QString& authId );
193 
195  QString mLastLayerName;
196 
197  QPushButton *mAddButton;
198 
199  QMap<QString, QString> mCrsNames;
200 
201  void addWmsListRow( const QDomElement& item, int row );
202  void addWmsListItem( const QDomElement& el, int row, int column );
203 
204  virtual void enableLayersForCrs( QTreeWidgetItem *item );
205 
207  QString selectedFormat();
208 
210  QString selectedCrs();
211 
213  QString selectedTime();
214 
216  QNetworkRequest::CacheLoadControl selectedCacheLoadControl();
217 
218  QList<QTreeWidgetItem*> mCurrentSelection;
219  QTableWidgetItem* mCurrentTileset;
220 
222  QString mConnName;
223 
226 
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 on_mSearchButton_clicked();
245  void on_mSearchTableWidget_itemSelectionChanged();
246  void on_mTilesetsTableWidget_itemClicked( QTableWidgetItem *item );
247  void on_mLayerUpButton_clicked();
248  void on_mLayerDownButton_clicked();
249  virtual void updateButtons();
250 };
251 
252 #endif // QGSOWSSOURCESELECT_H
static const Qt::WindowFlags ModalDialogFlags
Definition: qgisgui.h:50
QMap< QString, QString > mCrsNames
bool mManagerMode
Connections manager mode.
QList< QTreeWidgetItem * > mCurrentSelection
Abstract base class for spatial data provider implementations.
static void run(const QString &context)
bool mEmbeddedMode
Embedded mode, without &#39;Close&#39;.
QPushButton * mAddButton
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 from WMS, WFS, WCS etc.
void on_mDialogButtonBox_helpRequested()
Formats supported by provider.
QString mService
Service name.
QTableWidgetItem * mCurrentTileset
Class for storing the component parts of a PostgreSQL/RDBMS datasource URI.
QgsDataSourceUri mUri
URI for selected connection.
QString mConnName
Name for selected connection.