QGIS API Documentation  master-3f58142
src/gui/qgsowssourceselect.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     qgsowssourceselect.h  -  selector for WMS,WFS,WCS layers
00003                              -------------------
00004     begin                : 3 April 2005
00005     original             : (C) 2005 by Brendan Morley email  : morb at ozemail dot com dot au
00006     wms search           : (C) 2009 Mathias Walker <mwa at sourcepole.ch>, Sourcepole AG
00007     generalized          : (C) 2012 Radim Blazek, based on qgsowsconnection.h
00008 
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *   This program is free software; you can redistribute it and/or modify  *
00014  *   it under the terms of the GNU General Public License as published by  *
00015  *   the Free Software Foundation; either version 2 of the License, or     *
00016  *   (at your option) any later version.                                   *
00017  *                                                                         *
00018  ***************************************************************************/
00019 
00020 #ifndef QGSOWSSOURCESELECT_H
00021 #define QGSOWSSOURCESELECT_H
00022 #include "ui_qgsowssourceselectbase.h"
00023 #include "qgsdatasourceuri.h"
00024 #include "qgisgui.h"
00025 #include "qgscontexthelp.h"
00026 
00027 #include "qgsdataprovider.h"
00028 
00029 #include <QStringList>
00030 #include <QPushButton>
00031 #include <QNetworkRequest>
00032 
00033 class QgisApp;
00034 class QgsDataProvider;
00035 class QButtonGroup;
00036 class QgsNumericSortTreeWidgetItem;
00037 class QDomDocument;
00038 class QDomElement;
00039 
00040 
00050 class GUI_EXPORT QgsOWSSourceSelect : public QDialog, public Ui::QgsOWSSourceSelectBase
00051 {
00052     Q_OBJECT
00053 
00054   public:
00056     struct SupportedFormat
00057     {
00058       QString format;
00059       QString label;
00060     };
00061 
00063     QgsOWSSourceSelect( QString service, QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false );
00065     ~QgsOWSSourceSelect();
00066 
00067   public slots:
00068 
00070     void on_mNewButton_clicked();
00072     void on_mEditButton_clicked();
00074     void on_mDeleteButton_clicked();
00076     void on_mSaveButton_clicked();
00078     void on_mLoadButton_clicked();
00079 
00083     void on_mConnectButton_clicked();
00084 
00086     virtual void addClicked();
00087 
00088     void searchFinished();
00089 
00091     void on_mChangeCRSButton_clicked();
00092 
00094     virtual void on_mLayersTreeWidget_itemSelectionChanged();
00095 
00097     void showStatusMessage( const QString &theMessage );
00098 
00100     void showError( const QString &theTitle, const QString &theFormat, const QString &theError );
00101 
00103     void on_mConnectionsComboBox_activated( int );
00104 
00106     void on_mAddDefaultButton_clicked();
00107 
00108     void on_mDialogButtonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
00109 
00110   signals:
00111     void addRasterLayer( const QString & rasterLayerPath,
00112                          const QString & baseName,
00113                          const QString & providerKey );
00114     void connectionsChanged();
00115 
00116   protected:
00121     virtual QList<SupportedFormat> providerFormats();
00122 
00124     virtual QStringList selectedLayersFormats();
00125 
00127     virtual QStringList selectedLayersCRSs();
00128 
00130     virtual QStringList selectedLayersTimes();
00131 
00132     //virtual QStringList layerCRS( int id );
00133 
00135     void populateConnectionList();
00136 
00138     void populateFormats();
00139 
00141     void clearFormats();
00142 
00144     void populateCRS();
00145 
00147     void clearCRS();
00148 
00150     void populateTimes();
00151 
00153     void clearTimes();
00154 
00156     QString connName();
00157 
00159     QString connectionInfo();
00160 
00162     void setConnectionListPosition();
00163 
00165     void addDefaultServers();
00166 
00168     QString mService;
00169 
00171     bool mManagerMode;
00172 
00174     bool mEmbeddedMode;
00175 
00176 
00182     virtual void populateLayerList( );
00183 
00186     QgsNumericSortTreeWidgetItem *createItem( int id,
00187         const QStringList &names,
00188         QMap<int, QgsNumericSortTreeWidgetItem *> &items,
00189         int &layerAndStyleCount,
00190         const QMap<int, int> &layerParents,
00191         const QMap<int, QStringList> &layerParentNames );
00192 
00194     QString descriptionForAuthId( QString authId );
00195 
00197     QString mLastLayerName;
00198 
00199     QPushButton *mAddButton;
00200 
00201     QMap<QString, QString> mCrsNames;
00202 
00203     void addWMSListRow( const QDomElement& item, int row );
00204     void addWMSListItem( const QDomElement& el, int row, int column );
00205 
00206     virtual void enableLayersForCrs( QTreeWidgetItem *item );
00207 
00209     QString selectedFormat();
00210 
00212     QString selectedCRS();
00213 
00215     QString selectedTime();
00216 
00218     QNetworkRequest::CacheLoadControl selectedCacheLoadControl();
00219 
00220     QList<QTreeWidgetItem*> mCurrentSelection;
00221     QTableWidgetItem* mCurrentTileset;
00222 
00224     QString mConnName;
00225 
00227     QString mConnectionInfo;
00228 
00230     QgsDataSourceURI mUri;
00231 
00232   private:
00234     QString mSelectedCRS;
00235 
00237     QSet<QString> mSelectedLayersCRSs;
00238 
00240     QList<SupportedFormat> mProviderFormats;
00241 
00243     QMap<QString, QString> mMimeLabelMap;
00244 
00245   private slots:
00246     void on_mSearchButton_clicked();
00247     void on_mAddWMSButton_clicked();
00248     void on_mSearchTableWidget_itemSelectionChanged();
00249     void on_mTilesetsTableWidget_itemClicked( QTableWidgetItem *item );
00250     void on_mLayerUpButton_clicked();
00251     void on_mLayerDownButton_clicked();
00252     virtual void updateButtons();
00253 };
00254 
00255 #endif // QGSOWSSOURCESELECT_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines