18 #ifndef QGSMESHDATASET_H
19 #define QGSMESHDATASET_H
28 #include "qgis_core.h"
63 int mDatasetIndex = -1;
94 void set(
double scalar );
97 void setX(
double x );
100 void setY(
double y ) ;
103 double scalar()
const;
114 double mX = std::numeric_limits<double>::quiet_NaN();
115 double mY = std::numeric_limits<double>::quiet_NaN();
153 DataType type()
const;
159 bool isValid()
const;
171 bool active(
int index )
const;
186 void setActive(
const QVector<int> &vals );
199 QVector<int> active()
const;
207 QVector<double> values()
const;
218 void setValues(
const QVector<double> &vals );
221 void setValid(
bool valid );
224 QVector<double> mDoubleBuffer;
225 QVector<int> mIntegerBuffer;
228 bool mIsValid =
false;
257 void setValid(
bool valid );
260 bool isValid()
const;
263 bool isVector()
const;
269 int firstVolumeIndex()
const;
272 int lastVolumeIndex()
const;
275 int volumesCount()
const;
280 QVector<int> verticalLevelsCount()
const;
285 void setVerticalLevelsCount(
const QVector<int> &verticalLevelsCount );
290 QVector<double> verticalLevels()
const;
295 void setVerticalLevels(
const QVector<double> &verticalLevels );
300 QVector<int> faceToVolumeIndex()
const;
305 void setFaceToVolumeIndex(
const QVector<int> &faceToVolumeIndex );
312 QVector<double> values()
const;
327 void setValues(
const QVector<double> &doubleBuffer );
331 bool mIsValid =
false;
332 bool mIsVector =
false;
333 QVector<int> mVerticalLevelsCount;
334 QVector<double> mVerticalLevels;
335 QVector<int> mFaceToVolumeIndex;
336 QVector<double> mDoubleBuffer;
385 int maximumVerticalLevels,
386 const QDateTime &referenceTime,
388 const QMap<QString, QString> &extraOptions );
393 QString name()
const;
405 QMap<QString, QString> extraOptions()
const;
410 bool isVector()
const;
415 bool isScalar()
const;
420 bool isTemporal()
const;
432 double minimum()
const;
437 double maximum()
const;
444 int maximumVerticalLevelsCount()
const;
451 QDateTime referenceTime()
const;
456 bool mIsScalar =
false;
457 DataType mDataType = DataType::DataOnFaces;
458 double mMinimumValue = std::numeric_limits<double>::quiet_NaN();
459 double mMaximumValue = std::numeric_limits<double>::quiet_NaN();
460 QMap<QString, QString> mExtraOptions;
461 int mMaximumVerticalLevelsCount = 0;
462 QDateTime mReferenceTime;
463 bool mIsTemporal =
false;
495 int maximumVerticalLevels
506 bool isValid()
const;
511 double minimum()
const;
516 double maximum()
const;
523 int maximumVerticalLevelsCount()
const;
526 double mTime = std::numeric_limits<double>::quiet_NaN();
527 bool mIsValid =
false;
528 double mMinimumValue = std::numeric_limits<double>::quiet_NaN();
529 double mMaximumValue = std::numeric_limits<double>::quiet_NaN();
530 int mMaximumVerticalLevelsCount = 0;
622 double minimum()
const;
625 double maximum()
const;
628 void setMinimumMaximum(
double min,
double max );
631 QString name()
const;
634 void setName(
const QString &name );
643 void addExtraMetadata( QString key, QString value );
645 QMap<QString, QString> extraMetadata()
const;
648 bool isScalar()
const;
651 void setIsScalar(
bool isScalar );
654 bool checkValueCountPerDataset(
int count )
const;
657 void calculateStatistic();
660 virtual QStringList datasetGroupNamesDependentOn()
const;
666 virtual QString description()
const;
669 void setReferenceTime(
const QDateTime &referenceTime );
676 bool mIsScalar =
true;
679 double mMinimum = std::numeric_limits<double>::quiet_NaN();
680 double mMaximum = std::numeric_limits<double>::quiet_NaN();
682 QDateTime mReferenceTime;
703 QgsMeshDataBlock datasetValues(
bool isScalar,
int valueIndex,
int count )
const override;
706 bool isActive(
int faceIndex )
const override;
707 int valuesCount()
const override;
710 void calculateMinMax();
716 double minimum = std::numeric_limits<double>::quiet_NaN();
717 double maximum = std::numeric_limits<double>::quiet_NaN();
739 void initialize()
override;
740 int datasetCount()
const override;
746 QDomElement writeXml( QDomDocument &doc,
const QgsReadWriteContext &context )
const override;
749 void addDataset( std::shared_ptr<QgsMeshMemoryDataset> dataset );
752 void clearDatasets();
755 std::shared_ptr<const QgsMeshMemoryDataset> constDataset(
int index )
const;
805 const QString &sourceName,
868 int childCount() const;
874 int totalChildCount() const;
882 QList<
int> enabledDatasetGroupIndexes() const;
901 QString name() const;
909 void setName( const QString &name );
918 QString providerName() const;
923 bool isVector() const;
928 int datasetGroupIndex() const;
933 bool isEnabled() const;
939 void setIsEnabled(
bool isEnabled );
944 QString defaultName() const;
959 QList<
int> groupIndexDependencies() const;
966 QString description() const;
984 void setPersistentDatasetGroup( const QString &uri );
1001 QString mOriginalName;
1002 QString mSourceName;
1004 QString mDescription;
1006 bool mIsVector = false;
1007 int mDatasetGroupIndex = -1;
1008 bool mIsEnabled = true;
1010 QList<
int> mDatasetGroupDependencies;
1011 QList<
int> mDatasetGroupDependentOn;
1015 void freeAsDependency();
1016 void freeFromDependencies();
QgsMesh3dDataBlock is a block of 3d stacked mesh data related N faces defined on base mesh frame.
QgsMesh3dDataBlock()
Constructs an invalid block.
QgsMeshDataBlock is a block of integers/doubles that can be used to retrieve: active flags (e....
DataType
Type of data stored in the block.
@ ScalarDouble
Scalar double values.
@ Vector2DDouble
Vector double pairs (x1, y1, x2, y2, ... )
@ ActiveFlagInteger
Integer boolean flag whether face is active.
Tree item for display of the mesh dataset groups.
QgsMeshDatasetGroupTreeItem()
Constructor for an empty dataset group tree item.
Abstract class that represents a dataset group.
virtual QgsMeshDatasetMetadata datasetMetadata(int datasetIndex) const =0
Returns the metadata of the dataset with index datasetIndex.
QgsMeshDatasetGroup()=default
Default constructor.
virtual QgsMeshDataset * dataset(int index) const =0
Returns the dataset with index.
virtual ~QgsMeshDatasetGroup()
QMap< QString, QString > mMetadata
Type
Type of the dataset group.
@ Virtual
Temporary dataset group in memory.
@ Memory
Dataset group store in a file.
@ Persistent
Generic type used for non typed dataset group.
virtual void initialize()=0
Initialize the dataset group.
virtual QgsMeshDatasetGroup::Type type() const =0
Returns the type of 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.
QgsMeshDatasetIndex is index that identifies the dataset group (e.g.
QgsMeshDatasetValue represents single dataset value.
QgsMeshDatasetValue()=default
Default Ctor, initialize to NaN.
~QgsMeshDatasetValue()=default
Dtor.
Abstract class that represents a dataset.
QgsMeshDataset()=default
Constructor.
virtual QgsMeshDataBlock datasetValues(bool isScalar, int valueIndex, int count) const =0
Returns count values from valueIndex.
virtual int valuesCount() const =0
Returns the values count.
virtual ~QgsMeshDataset()=default
Destructor.
virtual QgsMeshDatasetMetadata metadata() const =0
Returns the metadata of the dataset.
virtual bool isActive(int faceIndex) const =0
Returns whether the face is active.
virtual QgsMeshDataBlock areFacesActive(int faceIndex, int count) const =0
Returns whether faces are active.
virtual QgsMeshDatasetValue datasetValue(int valueIndex) const =0
Returns the value with index valueIndex.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Class that represents a dataset group stored in memory.
QgsMeshMemoryDatasetGroup()=default
Constructor.
virtual QgsMeshDatasetGroup::Type type() const override
Returns the type of dataset group.
QVector< std::shared_ptr< QgsMeshMemoryDataset > > memoryDatasets
Contains all the memory datasets.
Class to store memory dataset.
QgsMeshMemoryDataset()=default
Constructor.
QVector< QgsMeshDatasetValue > values
The class is used as a container of context for various read/write operations on other objects.
A rectangle specified with double values.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)