18#ifndef QGSMESHDATASET_H
19#define QGSMESHDATASET_H
68 int mDatasetIndex = -1;
98 void set(
double scalar );
101 void setX(
double x );
104 void setY(
double y ) ;
107 double scalar()
const;
118 double mX = std::numeric_limits<double>::quiet_NaN();
119 double mY = std::numeric_limits<double>::quiet_NaN();
157 DataType type()
const;
163 bool isValid()
const;
175 bool active(
int index )
const;
190 void setActive(
const QVector<int> &vals );
203 QVector<int> active()
const;
211 QVector<double> values()
const;
222 void setValues(
const QVector<double> &vals );
225 void setValid(
bool valid );
228 QVector<double> mDoubleBuffer;
229 QVector<int> mIntegerBuffer;
232 bool mIsValid =
false;
262 void setValid(
bool valid );
265 bool isValid()
const;
268 bool isVector()
const;
274 int firstVolumeIndex()
const;
277 int lastVolumeIndex()
const;
280 int volumesCount()
const;
285 QVector<int> verticalLevelsCount()
const;
290 void setVerticalLevelsCount(
const QVector<int> &verticalLevelsCount );
295 QVector<double> verticalLevels()
const;
300 void setVerticalLevels(
const QVector<double> &verticalLevels );
305 QVector<int> faceToVolumeIndex()
const;
310 void setFaceToVolumeIndex(
const QVector<int> &faceToVolumeIndex );
317 QVector<double> values()
const;
332 void setValues(
const QVector<double> &doubleBuffer );
336 bool mIsValid =
false;
337 bool mIsVector =
false;
338 QVector<int> mVerticalLevelsCount;
339 QVector<double> mVerticalLevels;
340 QVector<int> mFaceToVolumeIndex;
341 QVector<double> mDoubleBuffer;
390 int maximumVerticalLevels,
391 const QDateTime &referenceTime,
393 const QMap<QString, QString> &extraOptions );
398 QString name()
const;
408 QString parentQuantityName()
const;
420 QMap<QString, QString> extraOptions()
const;
425 bool isVector()
const;
430 bool isScalar()
const;
435 bool isTemporal()
const;
447 double minimum()
const;
452 double maximum()
const;
459 int maximumVerticalLevelsCount()
const;
466 QDateTime referenceTime()
const;
470 QString mParentQuantityName;
472 bool mIsScalar =
false;
473 DataType mDataType = DataType::DataOnFaces;
474 double mMinimumValue = std::numeric_limits<double>::quiet_NaN();
475 double mMaximumValue = std::numeric_limits<double>::quiet_NaN();
476 QMap<QString, QString> mExtraOptions;
477 int mMaximumVerticalLevelsCount = 0;
478 QDateTime mReferenceTime;
479 bool mIsTemporal =
false;
511 int maximumVerticalLevels
522 bool isValid()
const;
527 double minimum()
const;
532 double maximum()
const;
539 int maximumVerticalLevelsCount()
const;
542 double mTime = std::numeric_limits<double>::quiet_NaN();
543 bool mIsValid =
false;
544 double mMinimumValue = std::numeric_limits<double>::quiet_NaN();
545 double mMaximumValue = std::numeric_limits<double>::quiet_NaN();
546 int mMaximumVerticalLevelsCount = 0;
636 double minimum()
const;
639 double maximum()
const;
642 void setMinimumMaximum(
double min,
double max )
const;
645 QString name()
const;
648 void setName(
const QString &name );
657 void addExtraMetadata( QString key, QString value );
659 QMap<QString, QString> extraMetadata()
const;
662 bool isScalar()
const;
665 void setIsScalar(
bool isScalar );
668 bool checkValueCountPerDataset(
int count )
const;
671 void calculateStatistic()
const;
674 void setStatisticObsolete()
const;
677 virtual QStringList datasetGroupNamesDependentOn()
const;
683 virtual QString description()
const;
686 void setReferenceTime(
const QDateTime &referenceTime );
693 bool mIsScalar =
true;
696 mutable double mMinimum = std::numeric_limits<double>::quiet_NaN();
697 mutable double mMaximum = std::numeric_limits<double>::quiet_NaN();
698 mutable bool mIsStatisticObsolete =
true;
700 void updateStatistic()
const;
702 QDateTime mReferenceTime;
723 QgsMeshDataBlock datasetValues(
bool isScalar,
int valueIndex,
int count )
const override;
726 bool isActive(
int faceIndex )
const override;
727 int valuesCount()
const override;
730 void calculateMinMax();
736 double minimum = std::numeric_limits<double>::quiet_NaN();
737 double maximum = std::numeric_limits<double>::quiet_NaN();
759 void initialize()
override;
760 int datasetCount()
const override;
766 QDomElement writeXml( QDomDocument &doc,
const QgsReadWriteContext &context )
const override;
769 void addDataset( std::shared_ptr<QgsMeshMemoryDataset> dataset );
772 void clearDatasets();
775 std::shared_ptr<const QgsMeshMemoryDataset> constDataset(
int index )
const;
797 bool isActive(
int )
const override {
return true;};
818 void initialize()
override;
820 int datasetCount()
const override;;
826 std::unique_ptr<QgsMeshVerticesElevationDataset> mDataset;
873 const QString &sourceName,
933 int childCount() const;
939 int totalChildCount() const;
947 QList<
int> enabledDatasetGroupIndexes() const;
966 QString name() const;
974 void setName( const QString &name );
983 QString providerName() const;
988 bool isVector() const;
993 int datasetGroupIndex() const;
998 bool isEnabled() const;
1004 void setIsEnabled(
bool isEnabled );
1009 QString defaultName() const;
1024 QList<
int> groupIndexDependencies() const;
1031 QString description() const;
1049 void setPersistentDatasetGroup( const QString &uri );
1066 QString mOriginalName;
1067 QString mSourceName;
1069 QString mDescription;
1071 bool mIsVector = false;
1072 int mDatasetGroupIndex = -1;
1073 bool mIsEnabled = true;
1075 QList<
int> mDatasetGroupDependencies;
1076 QList<
int> mDatasetGroupDependentOn;
1080 void freeAsDependency();
1081 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
virtual ~QgsMeshDatasetGroup()
QMap< QString, QString > mMetadata
Type
Type of the dataset group.
@ Unknown
Generic type used for non typed dataset group.
@ Virtual
Virtual Dataset group defined by a formula.
@ Memory
Temporary dataset group in memory.
@ Persistent
Dataset group store in a file.
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.
virtual QgsMeshDataset * dataset(int index) const =0
Returns the dataset with index.
QgsMeshDatasetIndex is index that identifies the dataset group (e.g.
QgsMeshDatasetValue represents single dataset value.
QgsMeshDatasetValue()=default
Default Ctor, initialize to NaN.
~QgsMeshDatasetValue()=default
Abstract class that represents a dataset.
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
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
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
QVector< QgsMeshDatasetValue > values
Class that represents a dataset group with elevation value of the vertices of a existing mesh that ca...
QDomElement writeXml(QDomDocument &, const QgsReadWriteContext &) const override
Write dataset group information in a DOM element.
Class that represents a dataset with elevation value of the vertices of a existing mesh that can be e...
QgsMeshDatasetValue datasetValue(int valueIndex) const override
Returns the value with index valueIndex.
bool isActive(int) const override
Returns whether the face is active.
int valuesCount() const override
Returns the values count.
QgsMeshDataBlock areFacesActive(int faceIndex, int count) const override
Returns whether faces are active.
QgsMeshDatasetMetadata metadata() const override
Returns the metadata of the dataset.
QgsMeshDataBlock datasetValues(bool isScalar, int valueIndex, int count) const override
Returns count values from valueIndex.
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)
Mesh - vertices, edges and faces.