QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
qgsmeshvirtualdatasetgroup.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmeshvirtualdatasetgroup.h
3  ---------------------
4  begin : June 2020
5  copyright : (C) 2020 by Vincent Cloarec
6  email : vcloarec at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSMESHVIRTUALDATASETGROUP_H
19 #define QGSMESHVIRTUALDATASETGROUP_H
20 
21 #include "qgsmeshdataset.h"
22 #include "qgsmeshcalcnode.h"
23 
25 
26 #define SIP_NO_FILE
27 
39 {
40  public:
41 
50  QgsMeshVirtualDatasetGroup( const QString &name,
51  const QString &formulaString,
52  QgsMeshLayer *layer,
53  qint64 relativeStartTime,
54  qint64 relativeEndTime );
55 
56  void initialize() override;
57  int datasetCount() const override;
58  QgsMeshDataset *dataset( int index ) const override;
59  QgsMeshDatasetMetadata datasetMetadata( int datasetIndex ) const override;
60  QStringList datasetGroupNamesDependentOn() const override;
61  QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const override;
62  QString description() const override;
64 
65  private:
66  QString mFormula;
67  std::unique_ptr<QgsMeshCalcNode> mCalcNode;
68  QgsMeshLayer *mLayer = nullptr;
69  qint64 mStartTime = 0.0;
70  qint64 mEndTime = 0.0;
71  QStringList mDatasetGroupNameUsed;
72  QList<qint64> mDatasetTimes;
73 
74  mutable std::shared_ptr<QgsMeshMemoryDataset> mCacheDataset;
75  mutable QVector<QgsMeshDatasetMetadata> mDatasetMetaData;
76  mutable int mCurrentDatasetIndex = -1;
77 
78  bool calculateDataset() const;
79 };
80 
81 #endif // QGSMESHVIRTUALDATASETGROUP_H
Abstract class that represents a dataset group.
virtual QgsMeshDatasetMetadata datasetMetadata(int datasetIndex) const =0
Returns the metadata of the dataset with index datasetIndex.
virtual QgsMeshDataset * dataset(int index) const =0
Returns the dataset with index.
virtual QStringList datasetGroupNamesDependentOn() const
Returns the dataset group variable name which this dataset group depends on.
virtual QString description() const
Returns some information about the dataset group.
Type
Type of the dataset group.
@ Virtual
Temporary dataset group in memory.
virtual void initialize()=0
Initialize the dataset group.
virtual QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const =0
Write dataset group information in a DOM element.
virtual int datasetCount() const =0
Returns the count of datasets in the group.
QgsMeshDatasetMetadata is a collection of mesh dataset metadata such as whether the data is valid or ...
Abstract class that represents a dataset.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Definition: qgsmeshlayer.h:95
Represents a dataset group calculated from a formula string.
QgsMeshDatasetGroup::Type type() const override
Returns the type of dataset group.
The class is used as a container of context for various read/write operations on other objects.