QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 "qgsdataprovider.h"
28 
29 #include <QStringList>
30 #include <QPushButton>
31 #include <QNetworkRequest>
32 
33 class QgisApp;
34 class QgsDataProvider;
35 class QButtonGroup;
37 class QDomDocument;
38 class QDomElement;
39 
40 
50 class GUI_EXPORT QgsOWSSourceSelect : public QDialog, public Ui::QgsOWSSourceSelectBase
51 {
52  Q_OBJECT
53 
54  public:
57  {
58  QString format;
59  QString label;
60  };
61 
63  QgsOWSSourceSelect( QString service, QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false );
66 
67  public slots:
68 
70  void on_mNewButton_clicked();
72  void on_mEditButton_clicked();
74  void on_mDeleteButton_clicked();
76  void on_mSaveButton_clicked();
78  void on_mLoadButton_clicked();
79 
83  void on_mConnectButton_clicked();
84 
86  virtual void addClicked();
87 
88  void searchFinished();
89 
91  void on_mChangeCRSButton_clicked();
92 
94  virtual void on_mLayersTreeWidget_itemSelectionChanged();
95 
97  void showStatusMessage( const QString &theMessage );
98 
100  void showError( const QString &theTitle, const QString &theFormat, const QString &theError );
101 
103  void on_mConnectionsComboBox_activated( int );
104 
106  void on_mAddDefaultButton_clicked();
107 
108  void on_mDialogButtonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
109 
110  signals:
111  void addRasterLayer( const QString & rasterLayerPath,
112  const QString & baseName,
113  const QString & providerKey );
114  void connectionsChanged();
115 
116  protected:
121  virtual QList<SupportedFormat> providerFormats();
122 
124  virtual QStringList selectedLayersFormats();
125 
127  virtual QStringList selectedLayersCRSs();
128 
130  virtual QStringList selectedLayersTimes();
131 
132  //virtual QStringList layerCRS( int id );
133 
135  void populateConnectionList();
136 
138  void populateFormats();
139 
141  void clearFormats();
142 
144  void populateCRS();
145 
147  void clearCRS();
148 
150  void populateTimes();
151 
153  void clearTimes();
154 
156  QString connName();
157 
159  QString connectionInfo();
160 
162  void setConnectionListPosition();
163 
165  void addDefaultServers();
166 
168  QString mService;
169 
172 
175 
176 
182  virtual void populateLayerList();
183 
186  QgsNumericSortTreeWidgetItem *createItem( int id,
187  const QStringList &names,
188  QMap<int, QgsNumericSortTreeWidgetItem *> &items,
189  int &layerAndStyleCount,
190  const QMap<int, int> &layerParents,
191  const QMap<int, QStringList> &layerParentNames );
192 
194  QString descriptionForAuthId( QString authId );
195 
197  QString mLastLayerName;
198 
199  QPushButton *mAddButton;
200 
201  QMap<QString, QString> mCrsNames;
202 
203  void addWMSListRow( const QDomElement& item, int row );
204  void addWMSListItem( const QDomElement& el, int row, int column );
205 
206  virtual void enableLayersForCrs( QTreeWidgetItem *item );
207 
209  QString selectedFormat();
210 
212  QString selectedCRS();
213 
215  QString selectedTime();
216 
218  QNetworkRequest::CacheLoadControl selectedCacheLoadControl();
219 
220  QList<QTreeWidgetItem*> mCurrentSelection;
221  QTableWidgetItem* mCurrentTileset;
222 
224  QString mConnName;
225 
228 
231 
232  private:
234  QString mSelectedCRS;
235 
237  QSet<QString> mSelectedLayersCRSs;
238 
240  QList<SupportedFormat> mProviderFormats;
241 
243  QMap<QString, QString> mMimeLabelMap;
244 
245  private slots:
246  void on_mSearchButton_clicked();
247  void on_mSearchTableWidget_itemSelectionChanged();
248  void on_mTilesetsTableWidget_itemClicked( QTableWidgetItem *item );
249  void on_mLayerUpButton_clicked();
250  void on_mLayerDownButton_clicked();
251  virtual void updateButtons();
252 };
253 
254 #endif // QGSOWSSOURCESELECT_H