10
10
11
11
12
12
13
+ class QgsMeshDatasetIndex
14
+ {
15
+ %Docstring
16
+
17
+ QgsMeshDatasetIndex is index that identifies the dataset group (e.g. wind speed)
18
+ and a dataset in this group (e.g. magnitude of wind speed in particular time)
19
+
20
+ .. note::
21
+
22
+ The API is considered EXPERIMENTAL and can be changed without a notice
23
+
24
+ .. versionadded:: 3.4
25
+ %End
26
+
27
+ %TypeHeaderCode
28
+ #include "qgsmeshdataprovider.h"
29
+ %End
30
+ public:
31
+ QgsMeshDatasetIndex( int group = -1, int dataset = -1 );
32
+ %Docstring
33
+ Creates an index. -1 represents invalid group/dataset
34
+ %End
35
+ int group() const;
36
+ %Docstring
37
+ Returns a group index
38
+ %End
39
+ int dataset() const;
40
+ %Docstring
41
+ Returns a dataset index within group()
42
+ %End
43
+ bool isValid() const;
44
+ %Docstring
45
+ Returns whether index is valid, ie at least groups is set
46
+ %End
47
+ bool operator == ( const QgsMeshDatasetIndex &other ) const;
48
+ };
49
+
13
50
typedef QgsPoint QgsMeshVertex;
14
51
15
52
typedef QVector<int> QgsMeshFace;
@@ -18,7 +55,7 @@ class QgsMeshDatasetValue
18
55
{
19
56
%Docstring
20
57
21
- QgsMeshDatasetValue represents single mesh dataset value
58
+ QgsMeshDatasetValue represents single dataset value
22
59
23
60
could be scalar or vector. Nodata values are represented by NaNs.
24
61
@@ -85,63 +122,104 @@ Returns y value
85
122
86
123
};
87
124
88
-
89
-
90
- class QgsMeshDatasetMetadata
125
+ class QgsMeshDatasetGroupMetadata
91
126
{
92
127
%Docstring
93
128
94
- QgsMeshDatasetMetadata is a collection of mesh dataset metadata such
95
- as whether the data is vector or scalar, etc.
129
+ QgsMeshDatasetGroupMetadata is a collection of dataset group metadata
130
+ such as whether the data is vector or scalar, name
96
131
97
132
.. note::
98
133
99
134
The API is considered EXPERIMENTAL and can be changed without a notice
100
135
101
- .. versionadded:: 3.2
136
+ .. versionadded:: 3.4
102
137
%End
103
138
104
139
%TypeHeaderCode
105
140
#include "qgsmeshdataprovider.h"
106
141
%End
107
142
public:
108
- QgsMeshDatasetMetadata ();
143
+ QgsMeshDatasetGroupMetadata ();
109
144
%Docstring
110
145
Constructs an empty metadata object
111
146
%End
112
147
113
- QgsMeshDatasetMetadata( bool isScalar ,
114
- bool isValid ,
115
- bool isOnVertices,
116
- const QMap<QString, QString> &extraOptions );
148
+ QgsMeshDatasetGroupMetadata( const QString &name ,
149
+ bool isScalar ,
150
+ bool isOnVertices,
151
+ const QMap<QString, QString> &extraOptions );
117
152
%Docstring
118
153
Constructs a valid metadata object
119
154
155
+ :param name: name of the dataset group
120
156
:param isScalar: dataset contains scalar data, specifically the y-value of QgsMeshDatasetValue is NaN
121
- :param isValid: dataset is loadad and valid for fetching the data
122
157
:param isOnVertices: dataset values are defined on mesh's vertices. If false, values are defined on faces.
123
158
:param extraOptions: dataset's extra options stored by the provider. Usually contains the name, time value, time units, data file vendor, ...
159
+ %End
160
+
161
+ QString name() const;
162
+ %Docstring
163
+ Returns name of the dataset group
124
164
%End
125
165
126
166
QMap<QString, QString> extraOptions() const;
127
167
%Docstring
128
- Returns extra metadata options
129
- Usually including name, description or time variable
168
+ Returns extra metadata options, for example description
130
169
%End
131
170
132
171
bool isVector() const;
133
172
%Docstring
134
- Returns whether dataset has vector data
173
+ Returns whether dataset group has vector data
135
174
%End
136
175
137
176
bool isScalar() const;
138
177
%Docstring
139
- Returns whether dataset has scalar data
178
+ Returns whether dataset group has scalar data
140
179
%End
141
180
142
181
bool isOnVertices() const;
143
182
%Docstring
144
- Returns whether dataset data is defined on vertices
183
+ Returns whether dataset group data is defined on vertices
184
+ %End
185
+
186
+ };
187
+
188
+ class QgsMeshDatasetMetadata
189
+ {
190
+ %Docstring
191
+
192
+ QgsMeshDatasetMetadata is a collection of mesh dataset metadata such
193
+ as whether the data is valid or associated time for the dataset
194
+
195
+ .. note::
196
+
197
+ The API is considered EXPERIMENTAL and can be changed without a notice
198
+
199
+ .. versionadded:: 3.2
200
+ %End
201
+
202
+ %TypeHeaderCode
203
+ #include "qgsmeshdataprovider.h"
204
+ %End
205
+ public:
206
+ QgsMeshDatasetMetadata();
207
+ %Docstring
208
+ Constructs an empty metadata object
209
+ %End
210
+
211
+ QgsMeshDatasetMetadata( double time,
212
+ bool isValid );
213
+ %Docstring
214
+ Constructs a valid metadata object
215
+
216
+ :param time: a time which this dataset represents in the dataset group
217
+ :param isValid: dataset is loadad and valid for fetching the data
218
+ %End
219
+
220
+ double time() const;
221
+ %Docstring
222
+ Returns the time value for this dataset
145
223
%End
146
224
147
225
bool isValid() const;
@@ -157,7 +235,7 @@ class QgsMeshDataSourceInterface /Abstract/
157
235
158
236
Interface for mesh data sources
159
237
160
- Mesh is a collection of vertices and faces in 2D or 3D space
238
+ Mesh is a collection of vertices and faces in 2D or 3D space
161
239
- vertex - XY(Z) point (in the mesh's coordinate reference system)
162
240
- faces - sets of vertices forming a closed shape - typically triangles or quadrilaterals
163
241
@@ -205,12 +283,15 @@ Returns the mesh face at index
205
283
class QgsMeshDatasetSourceInterface /Abstract/
206
284
{
207
285
%Docstring
208
- Interface for mesh datasets
286
+ Interface for mesh datasets and dataset groups
209
287
210
288
Dataset is a collection of vector or scalar values on vertices or faces of the mesh.
211
289
Based on the underlying data provider/format, whole dataset is either stored in memory
212
290
or read on demand
213
291
292
+ Datasets are grouped in the dataset groups. A dataset group represents a measured quantity
293
+ (e.g. depth or wind speed), dataset represents values of the quantity in a particular time.
294
+
214
295
.. note::
215
296
216
297
The API is considered EXPERIMENTAL and can be changed without a notice
@@ -231,17 +312,37 @@ Associate dataset with the mesh
231
312
emits dataChanged when successful
232
313
%End
233
314
234
- virtual int datasetCount() const = 0;
315
+ virtual int datasetGroupCount( ) const = 0;
316
+ %Docstring
317
+ Returns number of datasets groups loaded
318
+ %End
319
+
320
+ virtual int datasetCount( int groupIndex ) const = 0;
321
+ %Docstring
322
+ Returns number of datasets loaded in the group
323
+ %End
324
+
325
+ int datasetCount( QgsMeshDatasetIndex index ) const;
326
+ %Docstring
327
+ Returns number of datasets loaded in the group
328
+ %End
329
+
330
+ virtual QgsMeshDatasetGroupMetadata datasetGroupMetadata( int groupIndex ) const = 0;
331
+ %Docstring
332
+ Returns dataset group metadata
333
+ %End
334
+
335
+ QgsMeshDatasetGroupMetadata datasetGroupMetadata( QgsMeshDatasetIndex index ) const;
235
336
%Docstring
236
- Returns number of datasets loaded
337
+ Returns dataset group metadata
237
338
%End
238
339
239
- virtual QgsMeshDatasetMetadata datasetMetadata( int datasetIndex ) const = 0;
340
+ virtual QgsMeshDatasetMetadata datasetMetadata( QgsMeshDatasetIndex index ) const = 0;
240
341
%Docstring
241
342
Returns dataset metadata
242
343
%End
243
344
244
- virtual QgsMeshDatasetValue datasetValue( int datasetIndex , int valueIndex ) const = 0;
345
+ virtual QgsMeshDatasetValue datasetValue( QgsMeshDatasetIndex index , int valueIndex ) const = 0;
245
346
%Docstring
246
347
Returns vector/scalar value associated with the index from the dataset
247
348
0 commit comments