QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgssourceselectdialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssourceselectdialog.h
3  ---------------------
4  begin : Nov 26, 2015
5  copyright : (C) 2015 by Sandro Mani
6  email : smani at sourcepole dot ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSSOURCESELECTDIALOG_H
17 #define QGSSOURCESELECTDIALOG_H
18 
19 #include "ui_qgssourceselectdialogbase.h"
20 #include "qgsrectangle.h"
22 
23 class QStandardItemModel;
26 class QgsOWSConnection;
27 
31 class GUI_EXPORT QgsSourceSelectDialog : public QDialog, protected Ui::QgsSourceSelectBase
32 {
33  Q_OBJECT
34 
35  public:
37  enum ServiceType { MapService, FeatureService };
38 
40  QgsSourceSelectDialog( const QString& serviceName, ServiceType serviceType, QWidget* parent, Qt::WindowFlags fl );
44  void setCurrentExtentAndCrs( const QgsRectangle& canvasExtent, const QgsCoordinateReferenceSystem& canvasCrs );
45 
46  signals:
48  void addLayer( QString uri, QString typeName );
50  void connectionsChanged();
51 
52  protected:
56  // Available CRS for a server connection, key=typename, value=list("EPSG:XXXX")
65 
67  virtual bool connectToService( const QgsOWSConnection& connection ) = 0;
69  virtual void buildQuery( const QgsOWSConnection&, const QModelIndex& ) {}
71  virtual QString getLayerURI( const QgsOWSConnection& connection,
72  const QString& layerTitle,
73  const QString& layerName,
74  const QString& crs = QString(),
75  const QString& filter = QString(),
76  const QgsRectangle& bBox = QgsRectangle() ) const = 0;
78  void populateImageEncodings( const QStringList& availableEncodings );
80  QString getSelectedImageEncoding() const;
81 
82  private:
83  void populateConnectionList();
84 
90  QString getPreferredCrs( const QSet<QString>& crsSet ) const;
91 
92  private slots:
93  void addEntryToServerList();
94  void deleteEntryOfServerList();
95  void modifyEntryOfServerList();
96  void addButtonClicked();
97  void buildQueryButtonClicked();
98  void changeCRS();
99  void changeCRSFilter();
100  void connectToServer();
101  void filterChanged( QString text );
102  void on_cmbConnections_activated( int index );
103  void on_buttonBox_helpRequested() const;
104  void treeWidgetItemDoubleClicked( const QModelIndex & index );
105  void treeWidgetCurrentRowChanged( const QModelIndex & current, const QModelIndex & previous );
106 };
107 
108 
109 #endif // QGSSOURCESELECTDIALOG_H
Connections management.
static unsigned index
A rectangle specified with double values.
Definition: qgsrectangle.h:35
QStandardItemModel * mModel
A generic dialog to prompt the user for a Coordinate Reference System.
QgsCoordinateReferenceSystem mCanvasCrs
QgsGenericProjectionSelector * mProjectionSelector
QSortFilterProxyModel * mModelProxy
QButtonGroup * mImageEncodingGroup
ServiceType
Whether the dialog is for a map service or a feature service.
QMap< QString, QStringList > mAvailableCRS
Generic class listing layers available from a remote service.
Class for storing a coordinate reference system (CRS)
typedef WindowFlags
virtual void buildQuery(const QgsOWSConnection &, const QModelIndex &)
May be implemented in child classes for services which support customized queries.