18 #ifndef QGSMESHDATASET_H
19 #define QGSMESHDATASET_H
28 #include "qgis_core.h"
64 int mDatasetIndex = -1;
95 void set(
double scalar );
98 void setX(
double x );
101 void setY(
double y ) ;
104 double scalar()
const;
115 double mX = std::numeric_limits<double>::quiet_NaN();
116 double mY = std::numeric_limits<double>::quiet_NaN();
154 DataType type()
const;
160 bool isValid()
const;
172 bool active(
int index )
const;
187 void setActive(
const QVector<int> &vals );
200 QVector<int> active()
const;
208 QVector<double> values()
const;
219 void setValues(
const QVector<double> &vals );
222 void setValid(
bool valid );
225 QVector<double> mDoubleBuffer;
226 QVector<int> mIntegerBuffer;
229 bool mIsValid =
false;
258 void setValid(
bool valid );
261 bool isValid()
const;
264 bool isVector()
const;
270 int firstVolumeIndex()
const;
273 int lastVolumeIndex()
const;
276 int volumesCount()
const;
281 QVector<int> verticalLevelsCount()
const;
286 void setVerticalLevelsCount(
const QVector<int> &verticalLevelsCount );
291 QVector<double> verticalLevels()
const;
296 void setVerticalLevels(
const QVector<double> &verticalLevels );
301 QVector<int> faceToVolumeIndex()
const;
306 void setFaceToVolumeIndex(
const QVector<int> &faceToVolumeIndex );
313 QVector<double> values()
const;
328 void setValues(
const QVector<double> &doubleBuffer );
332 bool mIsValid =
false;
333 bool mIsVector =
false;
334 QVector<int> mVerticalLevelsCount;
335 QVector<double> mVerticalLevels;
336 QVector<int> mFaceToVolumeIndex;
337 QVector<double> mDoubleBuffer;
386 int maximumVerticalLevels,
387 const QDateTime &referenceTime,
389 const QMap<QString, QString> &extraOptions );
394 QString name()
const;
406 QMap<QString, QString> extraOptions()
const;
411 bool isVector()
const;
416 bool isScalar()
const;
421 bool isTemporal()
const;
433 double minimum()
const;
438 double maximum()
const;
445 int maximumVerticalLevelsCount()
const;
452 QDateTime referenceTime()
const;
457 bool mIsScalar =
false;
458 DataType mDataType = DataType::DataOnFaces;
459 double mMinimumValue = std::numeric_limits<double>::quiet_NaN();
460 double mMaximumValue = std::numeric_limits<double>::quiet_NaN();
461 QMap<QString, QString> mExtraOptions;
462 int mMaximumVerticalLevelsCount = 0;
463 QDateTime mReferenceTime;
464 bool mIsTemporal =
false;
496 int maximumVerticalLevels
507 bool isValid()
const;
512 double minimum()
const;
517 double maximum()
const;
524 int maximumVerticalLevelsCount()
const;
527 double mTime = std::numeric_limits<double>::quiet_NaN();
528 bool mIsValid =
false;
529 double mMinimumValue = std::numeric_limits<double>::quiet_NaN();
530 double mMaximumValue = std::numeric_limits<double>::quiet_NaN();
531 int mMaximumVerticalLevelsCount = 0;
623 double minimum()
const;
626 double maximum()
const;
629 void setMinimumMaximum(
double min,
double max );
632 QString name()
const;
635 void setName(
const QString &name );
644 void addExtraMetadata( QString key, QString value );
646 QMap<QString, QString> extraMetadata()
const;
649 bool isScalar()
const;
652 void setIsScalar(
bool isScalar );
655 bool checkValueCountPerDataset(
int count )
const;
658 void calculateStatistic();
661 virtual QStringList datasetGroupNamesDependentOn()
const;
667 virtual QString description()
const;
670 void setReferenceTime(
const QDateTime &referenceTime );
677 bool mIsScalar =
true;
680 double mMinimum = std::numeric_limits<double>::quiet_NaN();
681 double mMaximum = std::numeric_limits<double>::quiet_NaN();
683 QDateTime mReferenceTime;
704 QgsMeshDataBlock datasetValues(
bool isScalar,
int valueIndex,
int count )
const override;
707 bool isActive(
int faceIndex )
const override;
708 int valuesCount()
const override;
711 void calculateMinMax();
717 double minimum = std::numeric_limits<double>::quiet_NaN();
718 double maximum = std::numeric_limits<double>::quiet_NaN();
740 void initialize()
override;
741 int datasetCount()
const override;
747 QDomElement writeXml( QDomDocument &doc,
const QgsReadWriteContext &context )
const override;
750 void addDataset( std::shared_ptr<QgsMeshMemoryDataset> dataset );
753 void clearDatasets();
756 std::shared_ptr<const QgsMeshMemoryDataset> constDataset(
int index )
const;
806 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)