-
Notifications
You must be signed in to change notification settings - Fork 0
/
webdatamodel.h
72 lines (54 loc) · 2.42 KB
/
webdatamodel.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
#ifndef WEBDATAMODEL_H
#define WEBDATAMODEL_H
#include "qgsdatasourceuri.h"
#include <QStandardItemModel>
class QgisInterface;
class QgsMapLayer;
class QNetworkReply;
/**A model for storing services (WFS/WMS/WCS in future) and their layers*/
class WebDataModel: public QStandardItemModel
{
Q_OBJECT
public:
WebDataModel( QgisInterface* iface );
~WebDataModel();
/**Adds service directory and items for service layers to the model
@param title service title (usually the service name from the combo box)
@param url service url
@param serviceName WMS/WFS/WCS*/
void addService( const QString& title, const QString& url, const QString& service );
void addEntryToMap( const QModelIndex& index );
void removeEntryFromMap( const QModelIndex& index );
void changeEntryToOffline( const QModelIndex& index );
void changeEntryToOnline( const QModelIndex& index );
void reload( const QModelIndex& index );
QString layerStatus( const QModelIndex& index ) const ;
bool layerInMap( const QModelIndex& index ) const;
private slots:
void wmsCapabilitiesRequestFinished();
void wfsCapabilitiesRequestFinished();
void handleItemChange( QStandardItem* item );
void syncLayerRemove( QStringList theLayerIds );
signals:
void serviceAdded();
private:
QNetworkReply *mCapabilitiesReply;
QgisInterface* mIface;
QString wfsUrlFromLayerIndex( const QModelIndex& index ) const;
QgsDataSourceURI wmsUriFromIndex( const QModelIndex& index ) const;
QString layerName( const QModelIndex& index ) const;
QString serviceType( const QModelIndex& index ) const;
/**Exchanges a layer in the map canvas (and copies the style of the new layer to the old one)*/
bool exchangeLayer( const QString& layerId, QgsMapLayer* newLayer );
void deleteOfflineDatasource( const QString& serviceType, const QString& offlinePath );
/**Returns id of layer in current map with given url (or empty string if no such layer)*/
static QString layerIdFromUrl( const QString& url, const QString& serviceType, bool online,
const QString& layerName );
void loadFromXML();
void saveToXML() const;
/**Returns path to web.xml. Creates the file if not there*/
QString xmlFilePath() const;
/**Modes a layer after ml in the legend tree*/
void legendMoveLayer( const QgsMapLayer* ml, const QgsMapLayer* after );
};
#endif //WEBDATAMODEL_H