QgsMeshDatasetSourceInterface class

Interface for mesh datasets and dataset groups.

Dataset is a collection of vector or scalar values on vertices or faces of the mesh. Based on the underlying data provider/format, whole dataset is either stored in memory or read on demand

Datasets are grouped in the dataset groups. A dataset group represents a measured quantity (e.g. depth or wind speed), dataset represents values of the quantity in a particular time.

Derived classes

class QgsMeshDataProvider
Base class for providing data for QgsMeshLayer.

Constructors, destructors, conversion operators

~QgsMeshDatasetSourceInterface() defaulted virtual
Dtor.

Public functions

auto addDataset(const QString& uri) -> bool pure virtual
Associate dataset with the mesh.
auto areFacesActive(QgsMeshDatasetIndex index, int faceIndex, int count) const -> QgsMeshDataBlock pure virtual
Returns whether the faces are active for particular dataset.
auto datasetCount(int groupIndex) const -> int pure virtual
Returns number of datasets loaded in the group.
auto datasetCount(QgsMeshDatasetIndex index) const -> int
Returns number of datasets loaded in the group.
auto datasetGroupCount() const -> int pure virtual
Returns number of datasets groups loaded.
auto datasetGroupMetadata(int groupIndex) const -> QgsMeshDatasetGroupMetadata pure virtual
Returns dataset group metadata.
auto datasetGroupMetadata(QgsMeshDatasetIndex index) const -> QgsMeshDatasetGroupMetadata
Returns dataset group metadata.
auto datasetMetadata(QgsMeshDatasetIndex index) const -> QgsMeshDatasetMetadata pure virtual
Returns dataset metadata.
auto datasetValue(QgsMeshDatasetIndex index, int valueIndex) const -> QgsMeshDatasetValue pure virtual
Returns vector/scalar value associated with the index from the dataset To read multiple continuous values, use QgsMeshDatasetSourceInterface::datasetValues()
auto datasetValues(QgsMeshDatasetIndex index, int valueIndex, int count) const -> QgsMeshDataBlock pure virtual
Returns N vector/scalar values from the index from the dataset.
auto extraDatasets() const -> QStringList pure virtual
Returns list of additional dataset file URIs added using addDataset() calls.
auto isFaceActive(QgsMeshDatasetIndex index, int faceIndex) const -> bool pure virtual
Returns whether the face is active for particular dataset.
auto persistDatasetGroup(const QString& path, const QgsMeshDatasetGroupMetadata& meta, const QVector<QgsMeshDataBlock>& datasetValues, const QVector<QgsMeshDataBlock>& datasetActive, const QVector<double>& times) -> bool pure virtual
Creates a new dataset group from a data and persists it into a destination path.

Function documentation

bool QgsMeshDatasetSourceInterface::addDataset(const QString& uri) pure virtual

Associate dataset with the mesh.

emits dataChanged when successful

QgsMeshDataBlock QgsMeshDatasetSourceInterface::areFacesActive(QgsMeshDatasetIndex index, int faceIndex, int count) const pure virtual

Returns whether the faces are active for particular dataset.

QgsMeshDatasetValue QgsMeshDatasetSourceInterface::datasetValue(QgsMeshDatasetIndex index, int valueIndex) const pure virtual

Returns vector/scalar value associated with the index from the dataset To read multiple continuous values, use QgsMeshDatasetSourceInterface::datasetValues()

See QgsMeshDatasetMetadata::isVector() or QgsMeshDataBlock::type() to check if the returned value is vector or scalar

QgsMeshDataBlock QgsMeshDatasetSourceInterface::datasetValues(QgsMeshDatasetIndex index, int valueIndex, int count) const pure virtual

Returns N vector/scalar values from the index from the dataset.

See QgsMeshDatasetMetadata::isVector() to check if the returned value is vector or scalar

bool QgsMeshDatasetSourceInterface::isFaceActive(QgsMeshDatasetIndex index, int faceIndex) const pure virtual

Returns whether the face is active for particular dataset.

For example to represent the situation when F1 and F3 are flooded, but F2 is dry, some solvers store water depth on vertices V1-V8 (all non-zero values) and set active flag for F2 to false. V1 -— V2 -— V5--—V7 | F1 | F2 | F3 | V3 -— V4 -— V6--—V8

bool QgsMeshDatasetSourceInterface::persistDatasetGroup(const QString& path, const QgsMeshDatasetGroupMetadata& meta, const QVector<QgsMeshDataBlock>& datasetValues, const QVector<QgsMeshDataBlock>& datasetActive, const QVector<double>& times) pure virtual

Creates a new dataset group from a data and persists it into a destination path.

Parameters
path destination path of the stored file
meta new group's metadata
datasetValues scalar/vector values for all datasets and all faces/vertices in the group
datasetActive active flag values for all datasets in the group. Empty array represents can be used when all faces are active
times times in hours for all datasets in the group
Returns true on failure, false on success

On success, the mesh's dataset group count is changed