/
qgswfssourceselect.h
127 lines (105 loc) · 4.62 KB
/
qgswfssourceselect.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/***************************************************************************
qgswfssourceselect.h
-------------------
begin : August 25, 2006
copyright : (C) 2006 by Marco Hugentobler
email : marco dot hugentobler at karto dot baug dot ethz dot ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSWFSSOURCESELECT_H
#define QGSWFSSOURCESELECT_H
#include "ui_qgswfssourceselectbase.h"
#include "qgshelp.h"
#include "qgswfscapabilities.h"
#include "qgsoapiflandingpagerequest.h"
#include "qgsoapifcollection.h"
#include "qgsproviderregistry.h"
#include "qgsabstractdatasourcewidget.h"
#include <QItemDelegate>
#include <QStandardItemModel>
#include <QSortFilterProxyModel>
class QgsProjectionSelectionDialog;
class QgsWfsCapabilities;
class QgsSubsetStringEditorInterface;
class QgsWFSItemDelegate : public QItemDelegate
{
Q_OBJECT
public:
explicit QgsWFSItemDelegate( QObject *parent = nullptr ) : QItemDelegate( parent ) { }
QSize sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
};
class QgsWFSSourceSelect: public QgsAbstractDataSourceWidget, private Ui::QgsWFSSourceSelectBase
{
Q_OBJECT
public:
QgsWFSSourceSelect( QWidget *parent = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None );
~QgsWFSSourceSelect() override;
void reset() override;
private:
QgsWFSSourceSelect(); //default constructor is forbidden
QgsProjectionSelectionDialog *mProjectionSelector = nullptr;
/**
* Stores the available CRS for a server connections.
* The first string is the typename, the corresponding list
* stores the CRS for the typename in the form 'EPSG:XXXX'
*/
QMap<QString, QStringList > mAvailableCRS;
std::unique_ptr<QgsWfsCapabilities> mCapabilities;
std::unique_ptr<QgsOapifLandingPageRequest> mOAPIFLandingPage;
std::unique_ptr<QgsOapifCollectionsRequest> mOAPIFCollections;
QString mUri; // data source URI
QgsWFSItemDelegate *mItemDelegate = nullptr;
QStandardItemModel *mModel = nullptr;
QSortFilterProxyModel *mModelProxy = nullptr;
QPushButton *mBuildQueryButton = nullptr;
QgsWfsCapabilities::Capabilities mCaps;
QModelIndex mSQLIndex;
QgsSubsetStringEditorInterface *mSQLComposerDialog = nullptr;
QString mVersion;
/**
* Returns the best suited CRS from a set of authority ids
* 1. project CRS if contained in the set
* 2. WGS84 if contained in the set
* 3. the first entry in the set else
* \returns the authority id of the crs or an empty string in case of error
*/
QString getPreferredCrs( const QSet<QString> &crsSet ) const;
void showHelp();
public slots:
//! Triggered when the provider's connections need to be refreshed
void refresh() override;
void addButtonClicked() override;
private slots:
void addEntryToServerList();
void modifyEntryOfServerList();
void deleteEntryOfServerList();
void connectToServer();
void buildQuery( const QModelIndex &index );
void changeCRS();
void changeCRSFilter();
void cmbConnections_activated( int index );
void capabilitiesReplyFinished();
void oapifLandingPageReplyFinished();
void oapifCollectionsReplyFinished();
void btnSave_clicked();
void btnLoad_clicked();
void treeWidgetItemDoubleClicked( const QModelIndex &index );
void treeWidgetCurrentRowChanged( const QModelIndex ¤t, const QModelIndex &previous );
void buildQueryButtonClicked();
void filterChanged( const QString &text );
void updateSql();
void populateConnectionList();
void changeConnection();
void startOapifLandingPageRequest();
void startOapifCollectionsRequest( const QString &url );
void resizeTreeViewAfterModelFill();
bool isOapif() const { return mVersion == QLatin1String( "OGC_API_FEATURES" ); }
};
#endif