QGIS API Documentation  3.6.0-Noosa (5873452)
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 <qgsmeshdataprovider.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...
 
bool active (int index) const
 Returns a value for active flag by the index For scalar and vector 2d the behavior is undefined. More...
 
void * buffer ()
 Returns internal buffer to the array. More...
 
const void * constBuffer () const
 Returns internal buffer to the array for fast values reading. More...
 
int count () const
 Number of items stored in the block. More...
 
bool isValid () const
 Whether the block is valid. 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...
 

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 buffer() (faster) or value by value (slower) with active() or value()

Since
QGIS 3.6

Definition at line 162 of file qgsmeshdataprovider.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 166 of file qgsmeshdataprovider.h.

Constructor & Destructor Documentation

◆ QgsMeshDataBlock() [1/2]

QgsMeshDataBlock::QgsMeshDataBlock ( )

Constructs an invalid block.

Definition at line 221 of file qgsmeshdataprovider.cpp.

◆ QgsMeshDataBlock() [2/2]

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

Constructs a new block.

Definition at line 226 of file qgsmeshdataprovider.cpp.

Member Function Documentation

◆ active()

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 284 of file qgsmeshdataprovider.cpp.

◆ buffer()

void * QgsMeshDataBlock::buffer ( )

Returns internal buffer to the array.

The buffer is already allocated with size: count() * sizeof(int) for ActiveFlagInteger count() * sizeof(double) for ScalarDouble count() * 2 * sizeof(double) for Vector2DDouble

Primary usage of the function is to write/populate data to the block by data provider.

Definition at line 292 of file qgsmeshdataprovider.cpp.

◆ constBuffer()

const void * QgsMeshDataBlock::constBuffer ( ) const

Returns internal buffer to the array for fast values reading.

The buffer is allocated with size: count() * sizeof(int) for ActiveFlagInteger count() * sizeof(double) for ScalarDouble count() * 2 * sizeof(double) for Vector2DDouble

Definition at line 304 of file qgsmeshdataprovider.cpp.

◆ count()

int QgsMeshDataBlock::count ( ) const

Number of items stored in the block.

Definition at line 248 of file qgsmeshdataprovider.cpp.

◆ isValid()

bool QgsMeshDataBlock::isValid ( ) const

Whether the block is valid.

Definition at line 262 of file qgsmeshdataprovider.cpp.

◆ type()

QgsMeshDataBlock::DataType QgsMeshDataBlock::type ( ) const

Type of data stored in the block.

Definition at line 243 of file qgsmeshdataprovider.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 267 of file qgsmeshdataprovider.cpp.


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