25 : mGroupIndex( group ), mDatasetIndex( dataset )
71 if ( std::isnan( mY ) )
75 else if ( std::isnan( mX ) )
77 return std::numeric_limits<double>::quiet_NaN();
81 return std::sqrt( ( mX ) * ( mX ) + ( mY ) * ( mY ) );
112 bool equal = std::isnan( mX ) == std::isnan( other.
x() );
113 equal &= std::isnan( mY ) == std::isnan( other.
y() );
117 if ( std::isnan( mY ) )
135 int maximumVerticalLevels,
136 const QDateTime &referenceTime,
137 const QMap<QString, QString> &extraOptions )
139 , mIsScalar( isScalar )
140 , mDataType( dataType )
141 , mMinimumValue( minimum )
142 , mMaximumValue( maximum )
143 , mExtraOptions( extraOptions )
144 , mMaximumVerticalLevelsCount( maximumVerticalLevels )
145 , mReferenceTime( referenceTime )
151 return mExtraOptions;
176 return mMinimumValue;
181 return mMaximumValue;
186 return mMaximumVerticalLevelsCount;
191 return mReferenceTime;
196 return datasetCount( index.
group() );
201 return datasetGroupMetadata( index.
group() );
209 int maximumVerticalLevels )
211 , mIsValid( isValid )
212 , mMinimumValue( minimum )
213 , mMaximumValue( maximum )
214 , mMaximumVerticalLevelsCount( maximumVerticalLevels )
230 return mMinimumValue;
235 return mMaximumValue;
240 return mMaximumVerticalLevelsCount;
244 : mType( ActiveFlagInteger )
266 return (
count() > 0 ) && ( mIsValid );
280 mDoubleBuffer[2 * index],
281 mDoubleBuffer[2 * index + 1]
292 if ( mIntegerBuffer.empty() )
295 return bool( mIntegerBuffer[index] );
301 Q_ASSERT( vals.size() ==
count() );
303 mIntegerBuffer = vals;
310 return mIntegerBuffer;
317 return mDoubleBuffer;
325 mDoubleBuffer = vals;
336 if ( index < vertices.size() && index >= 0 )
337 return vertices[index];
343 if ( index < faces.size() && index >= 0 )
350 return vertices.size();
364 , mIsVector( isVector )
385 if ( mFaceToVolumeIndex.empty() )
387 return mFaceToVolumeIndex[0];
392 if ( mFaceToVolumeIndex.empty() || mVerticalLevelsCount.empty() )
394 const int lastVolumeStartIndex = mFaceToVolumeIndex[mFaceToVolumeIndex.size() - 1];
395 const int volumesCountInLastRow = mVerticalLevelsCount[mVerticalLevelsCount.size() - 1];
396 return lastVolumeStartIndex + volumesCountInLastRow;
407 return mVerticalLevelsCount;
412 Q_ASSERT( faceToVolumeIndex.size() ==
count() );
418 Q_ASSERT( verticalLevelsCount.size() ==
count() );
425 return mVerticalLevels;
437 return mFaceToVolumeIndex;
443 return mDoubleBuffer;
455 mDoubleBuffer[2 * volumeIndex],
456 mDoubleBuffer[2 * volumeIndex + 1]
463 mDoubleBuffer = doubleBuffer;
QgsMeshDatasetValue value(int volumeIndex) const
Returns the value at volume centers.
QVector< int > active() const
Returns active flag array.
void set(double scalar)
Sets scalar value.
void setVerticalLevels(const QVector< double > &verticalLevels)
Sets the vertical levels height.
QgsMeshDatasetValue()=default
Default Ctor, initialize to NaN.
int firstVolumeIndex() const
Index of the first volume stored in the buffer (absolute)
QgsMeshVertex vertex(int index) const
Returns a vertex at the index.
int dataset() const
Returns a dataset index within group()
QVector< int > faceToVolumeIndex() const
Returns the indexing between faces and volumes.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
int count() const
Number of items stored in the block.
int lastVolumeIndex() const
Index of the last volume stored in the buffer (absolute)
virtual int datasetCount(int groupIndex) const =0
Returns number of datasets loaded in the group.
QgsMeshDatasetIndex(int group=-1, int dataset=-1)
Creates an index. -1 represents invalid group/dataset.
QgsMesh3dDataBlock()
Constructs an invalid block.
Abstract base class for spatial data provider implementations.
void setY(double y)
Sets Y value.
QVector< int > verticalLevelsCount() const
Returns number of vertical level above 2d faces.
bool operator==(QgsMeshDatasetValue other) const
DataType type() const
Type of data stored in the block.
int group() const
Returns a group index.
bool isVector() const
Whether we store vector values.
bool isValid() const
Whether the block is valid.
~QgsMesh3dDataBlock()
Dtor.
double y() const
Returns y value.
int count() const
Number of 2d faces for which the volume data is stored in the block.
void setVerticalLevelsCount(const QVector< int > &verticalLevelsCount)
Sets the vertical level counts.
QVector< double > values() const
Returns buffer to the array with values For vector it is pairs (x1, y1, x2, y2, ...
void setValid(bool valid)
Sets block validity.
QVector< double > values() const
Returns the values at volume centers.
QgsMeshDataBlock()
Constructs an invalid block.
Integer boolean flag whether face is active.
int volumesCount() const
Returns number of volumes stored in the buffer.
double scalar() const
Returns magnitude of vector for vector data or scalar value for scalar data.
Point geometry type, with support for z-dimension and m-values.
DataType
Type of data stored in the block.
Setting options for creating vector data providers.
void setActive(const QVector< int > &vals)
Sets active flag values.
void setValid(bool valid)
Sets block validity.
bool isValid() const
Whether the block is valid.
bool operator!=(QgsMeshDatasetIndex other) const
Inequality operator.
void setFaceToVolumeIndex(const QVector< int > &faceToVolumeIndex)
Sets the indexing between faces and volumes.
QVector< int > QgsMeshFace
List of vertex indexes.
QgsMeshDatasetIndex is index that identifies the dataset group (e.g.
QgsMeshDataProvider(const QString &uri, const QgsDataProvider::ProviderOptions &providerOptions)
Ctor.
void setValues(const QVector< double > &doubleBuffer)
Sets the values at volume centers.
bool isValid() const
Returns whether index is valid, ie at least groups is set.
QgsMeshDatasetValue value(int index) const
Returns a value represented by the index For active flag the behavior is undefined.
bool operator==(QgsMeshDatasetIndex other) const
Equality operator.
QgsMeshFace face(int index) const
Returns a face at the index.
QgsMeshDatasetValue represents single dataset value.
int vertexCount() const
Returns number of vertices.
int faceCount() const
Returns number of faces.
void setX(double x)
Sets X value.
void setValues(const QVector< double > &vals)
Sets values.
double x() const
Returns x value.
QgsPoint QgsMeshVertex
xyz coords of vertex
virtual QgsMeshDatasetGroupMetadata datasetGroupMetadata(int groupIndex) const =0
Returns dataset group metadata.
QVector< double > verticalLevels() const
Returns the vertical levels height.