QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
Public Types | Public Member Functions | List of all members
QgsMeshDataBlock Class Reference

QgsMeshDataBlock is a block of integers/doubles that can be used to retrieve: active flags (e.g. More...

#include <qgsmeshdataset.h>

Public Types

enum  DataType { ActiveFlagInteger, ScalarDouble, Vector2DDouble }
 Type of data stored in the block. More...
 

Public Member Functions

 QgsMeshDataBlock ()
 Constructs an invalid block. More...
 
 QgsMeshDataBlock (DataType type, int count)
 Constructs a new block. More...
 
QVector< int > active () const
 Returns active flag array. More...
 
bool active (int index) const
 Returns a value for active flag by the index For scalar and vector 2d the behavior is undefined. More...
 
int count () const
 Number of items stored in the block. More...
 
bool isValid () const
 Whether the block is valid. More...
 
void setActive (const QVector< int > &vals)
 Sets active flag values. More...
 
void setValid (bool valid)
 Sets block validity. More...
 
void setValues (const QVector< double > &vals)
 Sets values. More...
 
DataType type () const
 Type of data stored in the block. More...
 
QgsMeshDatasetValue value (int index) const
 Returns a value represented by the index For active flag the behavior is undefined. More...
 
QVector< double > values () const
 Returns buffer to the array with values For vector it is pairs (x1, y1, x2, y2, ... More...
 

Detailed Description

QgsMeshDataBlock is a block of integers/doubles that can be used to retrieve: active flags (e.g.

face's active integer flag) scalars (e.g. scalar dataset double values) vectors (e.g. vector dataset doubles x,y values)

data are implicitly shared, so the class can be quickly copied std::numeric_limits<double>::quiet_NaN() represents NODATA value

Data can be accessed all at once with values() (faster) or value by value (slower) with active() or value()

Since
QGIS 3.6

Definition at line 135 of file qgsmeshdataset.h.

Member Enumeration Documentation

◆ DataType

Type of data stored in the block.

Enumerator
ActiveFlagInteger 

Integer boolean flag whether face is active.

ScalarDouble 

Scalar double values.

Vector2DDouble 

Vector double pairs (x1, y1, x2, y2, ... )

Definition at line 139 of file qgsmeshdataset.h.

Constructor & Destructor Documentation

◆ QgsMeshDataBlock() [1/2]

QgsMeshDataBlock::QgsMeshDataBlock ( )

Constructs an invalid block.

Definition at line 240 of file qgsmeshdataset.cpp.

◆ QgsMeshDataBlock() [2/2]

QgsMeshDataBlock::QgsMeshDataBlock ( QgsMeshDataBlock::DataType  type,
int  count 
)

Constructs a new block.

Definition at line 245 of file qgsmeshdataset.cpp.

Member Function Documentation

◆ active() [1/2]

QVector< int > QgsMeshDataBlock::active ( ) const

Returns active flag array.

Even for active flag valid dataset, the returned array could be empty. This means that the data provider/dataset does not support active flag capability, so all faces are active by default.

For scalar and vector 2d the behavior is undefined

Since
QGIS 3.12

Definition at line 304 of file qgsmeshdataset.cpp.

◆ active() [2/2]

bool QgsMeshDataBlock::active ( int  index) const

Returns a value for active flag by the index For scalar and vector 2d the behavior is undefined.

Definition at line 282 of file qgsmeshdataset.cpp.

◆ count()

int QgsMeshDataBlock::count ( ) const

Number of items stored in the block.

Definition at line 256 of file qgsmeshdataset.cpp.

◆ isValid()

bool QgsMeshDataBlock::isValid ( ) const

Whether the block is valid.

Definition at line 261 of file qgsmeshdataset.cpp.

◆ setActive()

void QgsMeshDataBlock::setActive ( const QVector< int > &  vals)

Sets active flag values.

If the data provider/datasets does not have active flag capability (== all values are valid), just set block validity by setValid( true )

Parameters
valsvalue vector with size count()

For scalar and vector 2d the behavior is undefined

Since
QGIS 3.12

Definition at line 295 of file qgsmeshdataset.cpp.

◆ setValid()

void QgsMeshDataBlock::setValid ( bool  valid)

Sets block validity.

Definition at line 326 of file qgsmeshdataset.cpp.

◆ setValues()

void QgsMeshDataBlock::setValues ( const QVector< double > &  vals)

Sets values.

For scalar datasets, it must have size count() For vector datasets, it must have size 2 * count() For active flag the behavior is undefined

Since
QGIS 3.12

Definition at line 317 of file qgsmeshdataset.cpp.

◆ type()

QgsMeshDataBlock::DataType QgsMeshDataBlock::type ( ) const

Type of data stored in the block.

Definition at line 251 of file qgsmeshdataset.cpp.

◆ value()

QgsMeshDatasetValue QgsMeshDataBlock::value ( int  index) const

Returns a value represented by the index For active flag the behavior is undefined.

Definition at line 266 of file qgsmeshdataset.cpp.

◆ values()

QVector< double > QgsMeshDataBlock::values ( ) const

Returns buffer to the array with values For vector it is pairs (x1, y1, x2, y2, ...

)

Since
QGIS 3.12

Definition at line 310 of file qgsmeshdataset.cpp.


The documentation for this class was generated from the following files: