![]() |
Computer Assited Medical Intervention Tool Kit
version 4.0
|
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 | |
MeshComponent * | meshComponent |
The component where the data are stored. More... | |
Qt model for mesh data.
This class use the Qt model/view design
camitk::MeshDataModel::MeshDataModel | ( | MeshComponent * | meshComp | ) |
Constructor.
int camitk::MeshDataModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
Number of data arrays columns.
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().
Qt::ItemFlags camitk::MeshDataModel::flags | ( | const QModelIndex & | index | ) | const |
Returns if a given model index is editable, checkable....
|
static |
static method that returns the DataType enum as a QString
References initDataNames().
Referenced by camitk::MeshDataFilterModel::filterAcceptsRow().
|
static |
static method that returns the FieldType enum as a QString
References initFieldNames().
Referenced by camitk::MeshDataFilterModel::filterAcceptsRow(), and camitk::MeshComponent::removeDataArray().
|
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.
QVariant camitk::MeshDataModel::headerData | ( | int | section, |
Qt::Orientation | orientation, | ||
int | role = Qt::DisplayRole |
||
) | const |
Header data.
|
staticprivate |
initialize DataType QString map
References OTHERS, SCALARS, TENSORS, and VECTORS.
Referenced by getDataNames().
|
staticprivate |
void camitk::MeshDataModel::refresh | ( | ) |
Refresh the model.
Referenced by camitk::MeshComponent::initData(), and camitk::MeshComponent::setActiveData().
int camitk::MeshDataModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
Number of data arrays.
References camitk::InterfaceGeometry::getPointSet(), and meshComponent.
bool camitk::MeshDataModel::setData | ( | const QModelIndex & | index, |
const QVariant & | value, | ||
int | role | ||
) |
Edit data, called when the data are modified by the user (view)
References CELLS, data(), camitk::MeshComponent::getDataProp(), getFieldTypeOfRow(), camitk::InterfaceGeometry::getPointSet(), meshComponent, POINTS, camitk::Component::refresh(), and camitk::MeshComponent::setActiveData().
|
private |
The component where the data are stored.
Referenced by data(), getFieldTypeOfRow(), rowCount(), and setData().