-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgswmsdataitems.h
223 lines (177 loc) · 7.07 KB
/
qgswmsdataitems.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/***************************************************************************
qgswmsdataitems.h
---------------------
begin : October 2011
copyright : (C) 2011 by Martin Dobias
email : wonder dot sk at gmail dot com
***************************************************************************
* *
* 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 QGSWMSDATAITEMS_H
#define QGSWMSDATAITEMS_H
#include "qgsdataitem.h"
#include "qgsdataitemprovider.h"
#include "qgsdatasourceuri.h"
#include "qgswmsprovider.h"
#include "qgsgeonodeconnection.h"
class QgsWmsCapabilitiesDownload;
class QgsWMSConnectionItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsWMSConnectionItem( QgsDataItem *parent, QString name, QString path, QString uri );
~QgsWMSConnectionItem() override;
QVector<QgsDataItem *> createChildren() override;
bool equal( const QgsDataItem *other ) override;
public slots:
void deleteLater() override;
private:
QString mUri;
QgsWmsCapabilitiesDownload *mCapabilitiesDownload = nullptr;
};
/**
* Base class which contains similar basic attributes and functions needed by the
* wms collection layers and child layers.
*
*/
class QgsWMSItemBase
{
public:
QgsWMSItemBase( const QgsWmsCapabilitiesProperty &capabilitiesProperty,
const QgsDataSourceUri &dataSourceUri,
const QgsWmsLayerProperty &layerProperty );
/**
* Returns the uri for the wms dataitem.
*
* The WMS temporal layers can contain the following parameters uri.
* - "type": the type of the wms provider e.g WMS-T
* - "timeDimensionExtent": the layer's time dimension extent it is available
* - "referencetimeDimensionExtent": reference time extent for the bi-temporal dimension layers
* - "time": time value of the current layer data from the provider
* - "reference_time": reference time value of the current of the layer data, this is applicable for the
* bi-temporal dimension layers
* - "allowTemporalUpdates": whether to allow updates on temporal parameters on this uri
* - "temporalSource": the source of the layer's temporal range, can be either "provider" or "project"
* - "enableTime": if the provider using time part in the temporal range datetime instances
*/
QString createUri();
//! Stores GetCapabilities response
QgsWmsCapabilitiesProperty mCapabilitiesProperty;
//! Stores WMS connection information
QgsDataSourceUri mDataSourceUri;
//! WMS Layer properties, can be inherited by subsidiary layers
QgsWmsLayerProperty mLayerProperty;
};
/**
* \brief WMS Layer Collection.
*
* This collection contains a WMS Layer element that can enclose other layers.
*/
class QgsWMSLayerCollectionItem : public QgsDataCollectionItem, public QgsWMSItemBase
{
Q_OBJECT
public:
QgsWMSLayerCollectionItem( QgsDataItem *parent, QString name, QString path,
const QgsWmsCapabilitiesProperty &capabilitiesProperty,
const QgsDataSourceUri &dataSourceUri,
const QgsWmsLayerProperty &layerProperty );
bool equal( const QgsDataItem *other ) override;
bool hasDragEnabled() const override;
QgsMimeDataUtils::Uri mimeUri() const override;
protected:
//! The URI
QString mUri;
// QgsDataItem interface
public:
bool layerCollection() const override;
};
// WMS Layers may be nested, so that they may be both QgsDataCollectionItem and QgsLayerItem
// We have to use QgsDataCollectionItem and support layer methods if necessary
class QgsWMSLayerItem : public QgsLayerItem, public QgsWMSItemBase
{
Q_OBJECT
public:
QgsWMSLayerItem( QgsDataItem *parent, QString name, QString path,
const QgsWmsCapabilitiesProperty &capabilitiesProperty,
const QgsDataSourceUri &dataSourceUri,
const QgsWmsLayerProperty &layerProperty );
bool equal( const QgsDataItem *other ) override;
};
class QgsWMTSLayerItem : public QgsLayerItem
{
Q_OBJECT
public:
QgsWMTSLayerItem( QgsDataItem *parent,
const QString &name,
const QString &path,
const QgsDataSourceUri &dataSourceUri,
const QString &id,
const QString &format,
const QString &style,
const QString &tileMatrixSet,
const QString &crs,
const QString &title );
QString createUri();
QString layerName() const override { return mTitle; }
private:
QgsDataSourceUri mDataSourceUri;
QString mId, mFormat, mStyle, mTileMatrixSet, mCrs, mTitle;
};
class QgsWMSRootItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsWMSRootItem( QgsDataItem *parent, QString name, QString path );
QVector<QgsDataItem *> createChildren() override;
QVariant sortKey() const override { return 7; }
public slots:
};
class QgsWMTSRootItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsWMTSRootItem( QgsDataItem *parent, QString name, QString path );
public slots:
};
//! Provider for WMS root data item
class QgsWmsDataItemProvider : public QgsDataItemProvider
{
public:
QString name() override { return QStringLiteral( "WMS" ); }
QString dataProviderKey() const override;
int capabilities() const override { return QgsDataProvider::Net; }
QgsDataItem *createDataItem( const QString &path, QgsDataItem *parentItem ) override;
QVector<QgsDataItem *> createDataItems( const QString &path, QgsDataItem *parentItem ) override;
};
//! Root item for XYZ tile layers
class QgsXyzTileRootItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsXyzTileRootItem( QgsDataItem *parent, QString name, QString path );
QVector<QgsDataItem *> createChildren() override;
QVariant sortKey() const override { return 8; }
};
//! Item implementation for XYZ tile layers
class QgsXyzLayerItem : public QgsLayerItem
{
Q_OBJECT
public:
QgsXyzLayerItem( QgsDataItem *parent, QString name, QString path, const QString &encodedUri );
};
//! Provider for XYZ root data item
class QgsXyzTileDataItemProvider : public QgsDataItemProvider
{
public:
QString name() override;
QString dataProviderKey() const override;
int capabilities() const override;
QgsDataItem *createDataItem( const QString &path, QgsDataItem *parentItem ) override;
QVector<QgsDataItem *> createDataItems( const QString &path, QgsDataItem *parentItem ) override;
};
#endif // QGSWMSDATAITEMS_H