18#ifndef QGSMESHDATASET_H
19#define QGSMESHDATASET_H
65 int mDatasetIndex = -1;
96 void set(
double scalar );
99 void setX(
double x );
102 void setY(
double y ) ;
105 double scalar()
const;
116 double mX = std::numeric_limits<double>::quiet_NaN();
117 double mY = std::numeric_limits<double>::quiet_NaN();
155 DataType type()
const;
161 bool isValid()
const;
173 bool active(
int index )
const;
188 void setActive(
const QVector<int> &vals );
201 QVector<int> active()
const;
209 QVector<double> values()
const;
220 void setValues(
const QVector<double> &vals );
223 void setValid(
bool valid );
226 QVector<double> mDoubleBuffer;
227 QVector<int> mIntegerBuffer;
230 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;
410 QMap<QString, QString> extraOptions()
const;
415 bool isVector()
const;
420 bool isScalar()
const;
425 bool isTemporal()
const;
437 double minimum()
const;
442 double maximum()
const;
449 int maximumVerticalLevelsCount()
const;
456 QDateTime referenceTime()
const;
461 bool mIsScalar =
false;
462 DataType mDataType = DataType::DataOnFaces;
463 double mMinimumValue = std::numeric_limits<double>::quiet_NaN();
464 double mMaximumValue = std::numeric_limits<double>::quiet_NaN();
465 QMap<QString, QString> mExtraOptions;
466 int mMaximumVerticalLevelsCount = 0;
467 QDateTime mReferenceTime;
468 bool mIsTemporal =
false;
500 int maximumVerticalLevels
511 bool isValid()
const;
516 double minimum()
const;
521 double maximum()
const;
528 int maximumVerticalLevelsCount()
const;
531 double mTime = std::numeric_limits<double>::quiet_NaN();
532 bool mIsValid =
false;
533 double mMinimumValue = std::numeric_limits<double>::quiet_NaN();
534 double mMaximumValue = std::numeric_limits<double>::quiet_NaN();
535 int mMaximumVerticalLevelsCount = 0;
627 double minimum()
const;
630 double maximum()
const;
633 void setMinimumMaximum(
double min,
double max )
const;
636 QString name()
const;
639 void setName(
const QString &name );
648 void addExtraMetadata( QString key, QString value );
650 QMap<QString, QString> extraMetadata()
const;
653 bool isScalar()
const;
656 void setIsScalar(
bool isScalar );
659 bool checkValueCountPerDataset(
int count )
const;
662 void calculateStatistic()
const;
665 void setStatisticObsolete()
const;
668 virtual QStringList datasetGroupNamesDependentOn()
const;
674 virtual QString description()
const;
677 void setReferenceTime(
const QDateTime &referenceTime );
684 bool mIsScalar =
true;
687 mutable double mMinimum = std::numeric_limits<double>::quiet_NaN();
688 mutable double mMaximum = std::numeric_limits<double>::quiet_NaN();
689 mutable bool mIsStatisticObsolete =
true;
691 void updateStatictic()
const;
693 QDateTime mReferenceTime;
714 QgsMeshDataBlock datasetValues(
bool isScalar,
int valueIndex,
int count )
const override;
717 bool isActive(
int faceIndex )
const override;
718 int valuesCount()
const override;
721 void calculateMinMax();
727 double minimum = std::numeric_limits<double>::quiet_NaN();
728 double maximum = std::numeric_limits<double>::quiet_NaN();
750 void initialize()
override;
751 int datasetCount()
const override;
757 QDomElement writeXml( QDomDocument &doc,
const QgsReadWriteContext &context )
const override;
760 void addDataset( std::shared_ptr<QgsMeshMemoryDataset> dataset );
763 void clearDatasets();
766 std::shared_ptr<const QgsMeshMemoryDataset> constDataset(
int index )
const;
788 bool isActive(
int )
const override {
return true;};
809 void initialize()
override;
811 int datasetCount()
const override;;
817 std::unique_ptr<QgsMeshVerticesElevationDataset> mDataset;
864 const QString &sourceName,
924 int childCount() const;
930 int totalChildCount() const;
938 QList<
int> enabledDatasetGroupIndexes() const;
957 QString name() const;
965 void setName( const QString &name );
974 QString providerName() const;
979 bool isVector() const;
984 int datasetGroupIndex() const;
989 bool isEnabled() const;
995 void setIsEnabled(
bool isEnabled );
1000 QString defaultName() const;
1015 QList<
int> groupIndexDependencies() const;
1022 QString description() const;
1040 void setPersistentDatasetGroup( const QString &uri );
1057 QString mOriginalName;
1058 QString mSourceName;
1060 QString mDescription;
1062 bool mIsVector = false;
1063 int mDatasetGroupIndex = -1;
1064 bool mIsEnabled = true;
1066 QList<
int> mDatasetGroupDependencies;
1067 QList<
int> mDatasetGroupDependentOn;
1071 void freeAsDependency();
1072 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.