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;
259 void setValid(
bool valid );
262 bool isValid()
const;
265 bool isVector()
const;
271 int firstVolumeIndex()
const;
274 int lastVolumeIndex()
const;
277 int volumesCount()
const;
282 QVector<int> verticalLevelsCount()
const;
287 void setVerticalLevelsCount(
const QVector<int> &verticalLevelsCount );
292 QVector<double> verticalLevels()
const;
297 void setVerticalLevels(
const QVector<double> &verticalLevels );
302 QVector<int> faceToVolumeIndex()
const;
307 void setFaceToVolumeIndex(
const QVector<int> &faceToVolumeIndex );
314 QVector<double> values()
const;
329 void setValues(
const QVector<double> &doubleBuffer );
333 bool mIsValid =
false;
334 bool mIsVector =
false;
335 QVector<int> mVerticalLevelsCount;
336 QVector<double> mVerticalLevels;
337 QVector<int> mFaceToVolumeIndex;
338 QVector<double> mDoubleBuffer;
387 int maximumVerticalLevels,
388 const QDateTime &referenceTime,
390 const QMap<QString, QString> &extraOptions );
395 QString name()
const;
407 QMap<QString, QString> extraOptions()
const;
412 bool isVector()
const;
417 bool isScalar()
const;
422 bool isTemporal()
const;
434 double minimum()
const;
439 double maximum()
const;
446 int maximumVerticalLevelsCount()
const;
453 QDateTime referenceTime()
const;
458 bool mIsScalar =
false;
459 DataType mDataType = DataType::DataOnFaces;
460 double mMinimumValue = std::numeric_limits<double>::quiet_NaN();
461 double mMaximumValue = std::numeric_limits<double>::quiet_NaN();
462 QMap<QString, QString> mExtraOptions;
463 int mMaximumVerticalLevelsCount = 0;
464 QDateTime mReferenceTime;
465 bool mIsTemporal =
false;
497 int maximumVerticalLevels
508 bool isValid()
const;
513 double minimum()
const;
518 double maximum()
const;
525 int maximumVerticalLevelsCount()
const;
528 double mTime = std::numeric_limits<double>::quiet_NaN();
529 bool mIsValid =
false;
530 double mMinimumValue = std::numeric_limits<double>::quiet_NaN();
531 double mMaximumValue = std::numeric_limits<double>::quiet_NaN();
532 int mMaximumVerticalLevelsCount = 0;
624 double minimum()
const;
627 double maximum()
const;
630 void setMinimumMaximum(
double min,
double max )
const;
633 QString name()
const;
636 void setName(
const QString &name );
645 void addExtraMetadata( QString key, QString value );
647 QMap<QString, QString> extraMetadata()
const;
650 bool isScalar()
const;
653 void setIsScalar(
bool isScalar );
656 bool checkValueCountPerDataset(
int count )
const;
659 void calculateStatistic()
const;
662 void setStatisticObsolete()
const;
665 virtual QStringList datasetGroupNamesDependentOn()
const;
671 virtual QString description()
const;
674 void setReferenceTime(
const QDateTime &referenceTime );
681 bool mIsScalar =
true;
684 mutable double mMinimum = std::numeric_limits<double>::quiet_NaN();
685 mutable double mMaximum = std::numeric_limits<double>::quiet_NaN();
686 mutable bool mIsStatisticObsolete =
true;
688 void updateStatictic()
const;
690 QDateTime mReferenceTime;
711 QgsMeshDataBlock datasetValues(
bool isScalar,
int valueIndex,
int count )
const override;
714 bool isActive(
int faceIndex )
const override;
715 int valuesCount()
const override;
718 void calculateMinMax();
724 double minimum = std::numeric_limits<double>::quiet_NaN();
725 double maximum = std::numeric_limits<double>::quiet_NaN();
747 void initialize()
override;
748 int datasetCount()
const override;
754 QDomElement writeXml( QDomDocument &doc,
const QgsReadWriteContext &context )
const override;
757 void addDataset( std::shared_ptr<QgsMeshMemoryDataset> dataset );
760 void clearDatasets();
763 std::shared_ptr<const QgsMeshMemoryDataset> constDataset(
int index )
const;
785 bool isActive(
int )
const override {
return true;};
806 void initialize()
override;
808 int datasetCount()
const override;;
814 std::unique_ptr<QgsMeshVerticesElevationDataset> mDataset;
861 const QString &sourceName,
921 int childCount() const;
927 int totalChildCount() const;
935 QList<
int> enabledDatasetGroupIndexes() const;
954 QString name() const;
962 void setName( const QString &name );
971 QString providerName() const;
976 bool isVector() const;
981 int datasetGroupIndex() const;
986 bool isEnabled() const;
992 void setIsEnabled(
bool isEnabled );
997 QString defaultName() const;
1012 QList<
int> groupIndexDependencies() const;
1019 QString description() const;
1037 void setPersistentDatasetGroup( const QString &uri );
1054 QString mOriginalName;
1055 QString mSourceName;
1057 QString mDescription;
1059 bool mIsVector = false;
1060 int mDatasetGroupIndex = -1;
1061 bool mIsEnabled = true;
1063 QList<
int> mDatasetGroupDependencies;
1064 QList<
int> mDatasetGroupDependentOn;
1068 void freeAsDependency();
1069 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.
QgsMeshVerticesElevationDataset(QgsMesh *mesh)
Constructor.
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.