Computer Assited Medical Intervention Tool Kit  version 4.0
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
camitk::MeshDataModel Class Reference

Qt model for mesh data. More...

#include <MeshDataModel.h>

Inherits QAbstractTableModel.

Public Types

enum  DataType { SCALARS = 1, VECTORS = 2, TENSORS = 4, OTHERS = 8 }
 Data fields can have different dimensions. More...
 
enum  FieldType { POINTS = 1, CELLS = 2, MESH = 4 }
 Data fields can be applied to one of this. More...
 

Public Member Functions

int columnCount (const QModelIndex &parent=QModelIndex()) const
 Number of data arrays columns. More...
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 Model data, called when the view is refreshing visualization. More...
 
Qt::ItemFlags flags (const QModelIndex &index) const
 Returns if a given model index is editable, checkable.... More...
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 Header data. More...
 
 MeshDataModel (MeshComponent *meshComp)
 Constructor. More...
 
void refresh ()
 Refresh the model. More...
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 Number of data arrays. More...
 
bool setData (const QModelIndex &index, const QVariant &value, int role)
 Edit data, called when the data are modified by the user (view) More...
 

Static Public Member Functions

static const QMap< int, QString > & getDataNames ()
 static method that returns the DataType enum as a QString More...
 
static const QMap< int, QString > & getFieldNames ()
 static method that returns the FieldType enum as a QString More...
 

Private Member Functions

FieldType getFieldTypeOfRow (const int, int *dataIndex) const
 determine the current field type of the item depending on the row index, compute the index of the data in its field category More...
 

Static Private Member Functions

static QMap< int, QString > initDataNames ()
 initialize DataType QString map More...
 
static QMap< int, QString > initFieldNames ()
 initialize FieldType QString map More...
 

Private Attributes

MeshComponentmeshComponent
 The component where the data are stored. More...
 

Detailed Description

Qt model for mesh data.

This class use the Qt model/view design

Member Enumeration Documentation

◆ DataType

Data fields can have different dimensions.

Enumerator
SCALARS 

1D (scalar value)

VECTORS 

3D (3D vector)

TENSORS 

9D (3x3 matrix)

OTHERS 

other dimensions (warning: nothing special are managed by this class, no specific interaction)

◆ FieldType

Data fields can be applied to one of this.

Enumerator
POINTS 

data are attached to point

CELLS 

data are attached to cells

MESH 

data are attached to the whole mesh

Constructor & Destructor Documentation

◆ MeshDataModel()

camitk::MeshDataModel::MeshDataModel ( MeshComponent meshComp)

Constructor.

Member Function Documentation

◆ columnCount()

int camitk::MeshDataModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const

Number of data arrays columns.

◆ data()

QVariant camitk::MeshDataModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const

Model data, called when the view is refreshing visualization.

References CELLS, camitk::MeshComponent::getDataProp(), getFieldTypeOfRow(), camitk::InterfaceGeometry::getPointSet(), MESH, meshComponent, and POINTS.

Referenced by setData().

◆ flags()

Qt::ItemFlags camitk::MeshDataModel::flags ( const QModelIndex &  index) const

Returns if a given model index is editable, checkable....

See also
QAbstractTableModel

◆ getDataNames()

const QMap< int, QString > & camitk::MeshDataModel::getDataNames ( )
static

static method that returns the DataType enum as a QString

References initDataNames().

Referenced by camitk::MeshDataFilterModel::filterAcceptsRow().

◆ getFieldNames()

const QMap< int, QString > & camitk::MeshDataModel::getFieldNames ( )
static

static method that returns the FieldType enum as a QString

References initFieldNames().

Referenced by camitk::MeshDataFilterModel::filterAcceptsRow(), and camitk::MeshComponent::removeDataArray().

◆ getFieldTypeOfRow()

MeshDataModel::FieldType camitk::MeshDataModel::getFieldTypeOfRow ( const int  row,
int *  dataIndex 
) const
private

determine the current field type of the item depending on the row index, compute the index of the data in its field category

References CELLS, camitk::InterfaceGeometry::getPointSet(), MESH, meshComponent, and POINTS.

Referenced by data(), and setData().

◆ headerData()

QVariant camitk::MeshDataModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const

Header data.

◆ initDataNames()

QMap< int, QString > camitk::MeshDataModel::initDataNames ( )
staticprivate

initialize DataType QString map

References OTHERS, SCALARS, TENSORS, and VECTORS.

Referenced by getDataNames().

◆ initFieldNames()

QMap< int, QString > camitk::MeshDataModel::initFieldNames ( )
staticprivate

initialize FieldType QString map

References CELLS, and POINTS.

Referenced by getFieldNames().

◆ refresh()

void camitk::MeshDataModel::refresh ( )

◆ rowCount()

int camitk::MeshDataModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const

Number of data arrays.

References camitk::InterfaceGeometry::getPointSet(), and meshComponent.

◆ setData()

bool camitk::MeshDataModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role 
)

Member Data Documentation

◆ meshComponent

MeshComponent* camitk::MeshDataModel::meshComponent
private

The component where the data are stored.

Referenced by data(), getFieldTypeOfRow(), rowCount(), and setData().


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