QGIS API Documentation  2.99.0-Master (7fe5405)
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 #include "qgis_gui.h"
31 
32 class QgsDataProvider;
33 class QButtonGroup;
34 class QgsTreeWidgetItem;
35 class QDomDocument;
36 class QDomElement;
37 
38 
48 class GUI_EXPORT QgsOWSSourceSelect : public QDialog, public Ui::QgsOWSSourceSelectBase
49 {
50  Q_OBJECT
51 
52  public:
55  {
56  QString format;
57  QString label;
58  };
59 
61  QgsOWSSourceSelect( const QString& service, QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false );
62 
64 
65  public slots:
66 
68  void on_mNewButton_clicked();
70  void on_mEditButton_clicked();
72  void on_mDeleteButton_clicked();
74  void on_mSaveButton_clicked();
76  void on_mLoadButton_clicked();
77 
81  void on_mConnectButton_clicked();
82 
84  virtual void addClicked();
85 
86  void searchFinished();
87 
89  void on_mChangeCRSButton_clicked();
90 
92  virtual void on_mLayersTreeWidget_itemSelectionChanged();
93 
95  void showStatusMessage( const QString &theMessage );
96 
98  void showError( const QString &theTitle, const QString &theFormat, const QString &theError );
99 
101  void on_mConnectionsComboBox_activated( int );
102 
104  void on_mAddDefaultButton_clicked();
105 
106  void on_mDialogButtonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
107 
108  signals:
109  void addRasterLayer( const QString & rasterLayerPath,
110  const QString & baseName,
111  const QString & providerKey );
112  void connectionsChanged();
113 
114  protected:
115 
120  virtual QList<SupportedFormat> providerFormats();
121 
123  virtual QStringList selectedLayersFormats();
124 
126  virtual QStringList selectedLayersCrses();
127 
129  virtual QStringList selectedLayersTimes();
130 
131  //virtual QStringList layerCRS( int id );
132 
134  void populateConnectionList();
135 
137  void populateFormats();
138 
140  void clearFormats();
141 
143  void populateCrs();
144 
146  void clearCrs();
147 
149  void populateTimes();
150 
152  void clearTimes();
153 
155  QString connName();
156 
158  QString connectionInfo();
159 
161  void setConnectionListPosition();
162 
164  void addDefaultServers();
165 
167  QString mService;
168 
171 
174 
175 
181  virtual void populateLayerList();
182 
185  QgsTreeWidgetItem *createItem( int id,
186  const QStringList &names,
187  QMap<int, QgsTreeWidgetItem *> &items,
188  int &layerAndStyleCount,
189  const QMap<int, int> &layerParents,
190  const QMap<int, QStringList> &layerParentNames );
191 
193  QString descriptionForAuthId( const QString& authId );
194 
196  QString mLastLayerName;
197 
198  QPushButton *mAddButton;
199 
200  QMap<QString, QString> mCrsNames;
201 
202  void addWmsListRow( const QDomElement& item, int row );
203  void addWmsListItem( const QDomElement& el, int row, int column );
204 
205  virtual void enableLayersForCrs( QTreeWidgetItem *item );
206 
208  QString selectedFormat();
209 
211  QString selectedCrs();
212 
214  QString selectedTime();
215 
217  QNetworkRequest::CacheLoadControl selectedCacheLoadControl();
218 
219  QList<QTreeWidgetItem*> mCurrentSelection;
220  QTableWidgetItem* mCurrentTileset;
221 
223  QString mConnName;
224 
227 
230 
231  private:
233  QString mSelectedCRS;
234 
236  QSet<QString> mSelectedLayersCRSs;
237 
239  QList<SupportedFormat> mProviderFormats;
240 
242  QMap<QString, QString> mMimeLabelMap;
243 
244  private slots:
245  void on_mSearchButton_clicked();
246  void on_mSearchTableWidget_itemSelectionChanged();
247  void on_mTilesetsTableWidget_itemClicked( QTableWidgetItem *item );
248  void on_mLayerUpButton_clicked();
249  void on_mLayerDownButton_clicked();
250  virtual void updateButtons();
251 };
252 
253 #endif // QGSOWSSOURCESELECT_H
static const Qt::WindowFlags ModalDialogFlags
Definition: qgisgui.h:51
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.