18#ifndef QGSMESHDATASET_H
19#define QGSMESHDATASET_H
69 int mDatasetIndex = -1;
100 void set(
double scalar );
103 void setX(
double x );
106 void setY(
double y ) ;
109 double scalar()
const;
120 double mX = std::numeric_limits<double>::quiet_NaN();
121 double mY = std::numeric_limits<double>::quiet_NaN();
159 DataType type()
const;
165 bool isValid()
const;
177 bool active(
int index )
const;
192 void setActive(
const QVector<int> &vals );
205 QVector<int> active()
const;
213 QVector<double> values()
const;
224 void setValues(
const QVector<double> &vals );
227 void setValid(
bool valid );
230 QVector<double> mDoubleBuffer;
231 QVector<int> mIntegerBuffer;
234 bool mIsValid =
false;
266 void setValid(
bool valid );
269 bool isValid()
const;
272 bool isVector()
const;
278 int firstVolumeIndex()
const;
281 int lastVolumeIndex()
const;
284 int volumesCount()
const;
289 QVector<int> verticalLevelsCount()
const;
294 void setVerticalLevelsCount(
const QVector<int> &verticalLevelsCount );
299 QVector<double> verticalLevels()
const;
304 void setVerticalLevels(
const QVector<double> &verticalLevels );
309 QVector<int> faceToVolumeIndex()
const;
314 void setFaceToVolumeIndex(
const QVector<int> &faceToVolumeIndex );
321 QVector<double> values()
const;
336 void setValues(
const QVector<double> &doubleBuffer );
340 bool mIsValid =
false;
341 bool mIsVector =
false;
342 QVector<int> mVerticalLevelsCount;
343 QVector<double> mVerticalLevels;
344 QVector<int> mFaceToVolumeIndex;
345 QVector<double> mDoubleBuffer;
394 int maximumVerticalLevels,
395 const QDateTime &referenceTime,
397 const QMap<QString, QString> &extraOptions );
402 QString name()
const;
412 QString parentQuantityName()
const;
424 QMap<QString, QString> extraOptions()
const;
429 bool isVector()
const;
434 bool isScalar()
const;
439 bool isTemporal()
const;
451 double minimum()
const;
456 double maximum()
const;
463 int maximumVerticalLevelsCount()
const;
470 QDateTime referenceTime()
const;
474 QString mParentQuantityName;
476 bool mIsScalar =
false;
477 DataType mDataType = DataType::DataOnFaces;
478 double mMinimumValue = std::numeric_limits<double>::quiet_NaN();
479 double mMaximumValue = std::numeric_limits<double>::quiet_NaN();
480 QMap<QString, QString> mExtraOptions;
481 int mMaximumVerticalLevelsCount = 0;
482 QDateTime mReferenceTime;
483 bool mIsTemporal =
false;
515 int maximumVerticalLevels
526 bool isValid()
const;
531 double minimum()
const;
536 double maximum()
const;
543 int maximumVerticalLevelsCount()
const;
546 double mTime = std::numeric_limits<double>::quiet_NaN();
547 bool mIsValid =
false;
548 double mMinimumValue = std::numeric_limits<double>::quiet_NaN();
549 double mMaximumValue = std::numeric_limits<double>::quiet_NaN();
550 int mMaximumVerticalLevelsCount = 0;
642 double minimum()
const;
645 double maximum()
const;
648 void setMinimumMaximum(
double min,
double max )
const;
651 QString name()
const;
654 void setName(
const QString &name );
663 void addExtraMetadata( QString key, QString value );
665 QMap<QString, QString> extraMetadata()
const;
668 bool isScalar()
const;
671 void setIsScalar(
bool isScalar );
674 bool checkValueCountPerDataset(
int count )
const;
677 void calculateStatistic()
const;
680 void setStatisticObsolete()
const;
683 virtual QStringList datasetGroupNamesDependentOn()
const;
689 virtual QString description()
const;
692 void setReferenceTime(
const QDateTime &referenceTime );
699 bool mIsScalar =
true;
702 mutable double mMinimum = std::numeric_limits<double>::quiet_NaN();
703 mutable double mMaximum = std::numeric_limits<double>::quiet_NaN();
704 mutable bool mIsStatisticObsolete =
true;
706 void updateStatistic()
const;
708 QDateTime mReferenceTime;
729 QgsMeshDataBlock datasetValues(
bool isScalar,
int valueIndex,
int count )
const override;
732 bool isActive(
int faceIndex )
const override;
733 int valuesCount()
const override;
736 void calculateMinMax();
742 double minimum = std::numeric_limits<double>::quiet_NaN();
743 double maximum = std::numeric_limits<double>::quiet_NaN();
765 void initialize()
override;
766 int datasetCount()
const override;
772 QDomElement writeXml( QDomDocument &doc,
const QgsReadWriteContext &context )
const override;
775 void addDataset( std::shared_ptr<QgsMeshMemoryDataset> dataset );
778 void clearDatasets();
781 std::shared_ptr<const QgsMeshMemoryDataset> constDataset(
int index )
const;
803 bool isActive(
int )
const override {
return true;};
824 void initialize()
override;
826 int datasetCount()
const override;;
832 std::unique_ptr<QgsMeshVerticesElevationDataset> mDataset;
879 const QString &sourceName,
939 int childCount() const;
945 int totalChildCount() const;
953 QList<
int> enabledDatasetGroupIndexes() const;
972 QString name() const;
980 void setName( const QString &name );
989 QString providerName() const;
994 bool isVector() const;
999 int datasetGroupIndex() const;
1004 bool isEnabled() const;
1010 void setIsEnabled(
bool isEnabled );
1015 QString defaultName() const;
1030 QList<
int> groupIndexDependencies() const;
1037 QString description() const;
1055 void setPersistentDatasetGroup( const QString &uri );
1072 QString mOriginalName;
1073 QString mSourceName;
1075 QString mDescription;
1077 bool mIsVector = false;
1078 int mDatasetGroupIndex = -1;
1079 bool mIsEnabled = true;
1081 QList<
int> mDatasetGroupDependencies;
1082 QList<
int> mDatasetGroupDependentOn;
1086 void freeAsDependency();
1087 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 ~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.
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
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
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.