|
Computer Assited Medical Intervention Tool Kit
version 5.0
|
|
Go to the documentation of this file.
26 #ifndef MESH_DATA_MODEL_H
27 #define MESH_DATA_MODEL_H
29 #include <QAbstractTableModel>
30 #include <QSortFilterProxyModel>
45 class CAMITK_API MeshDataModel :
public QAbstractTableModel {
54 MeshDataModel(MeshComponent* meshComp);
59 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
64 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
69 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
74 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
79 bool setData(
const QModelIndex& index,
const QVariant& value,
int role)
override;
83 Qt::ItemFlags flags(
const QModelIndex& index)
const override;
93 MeshComponent* meshComponent;
108 class CAMITK_API MeshDataFilterModel :
public QSortFilterProxyModel {
116 QObject* parent =
nullptr);
118 void setFieldTypeFilter(
int fieldFilter);
120 void setDataTypeFilter(
int dataFilter);
124 bool filterAcceptsRow(
int sourceRow,
const QModelIndex& sourceParent)
const override;
@ SCALARS
1D (scalar value)
Definition: MeshComponent.h:59
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns if a given model index is editable, checkable....
Definition: MeshDataModel.cpp:236
static const QMap< int, QString > & getFieldNames()
static method that returns the FieldType enum as a QString
Definition: MeshComponent.cpp:1192
void setDataRepresentationVisibility(FieldType, const QString &, bool)
set the visibility of a given representation for a given data (identified with its name) of a given f...
Definition: MeshComponent.cpp:932
int fieldTypeFilter
Definition: MeshDataModel.h:151
MeshDataFilterModel(int fieldFilter=MeshComponent::POINTS|MeshComponent::CELLS|MeshComponent::MESH, int dataFilter=MeshComponent::SCALARS|MeshComponent::VECTORS|MeshComponent::TENSORS|MeshComponent::OTHERS, QObject *parent=nullptr)
Definition: MeshDataModel.cpp:286
bool getDataRepresentationVisibility(FieldType, const QString &)
get the current visibility status of a given data (identified with its name) of a given field type
Definition: MeshComponent.cpp:816
@ OTHERS
other dimensions (warning: nothing special are managed by this class, no specific interaction)
Definition: MeshComponent.h:62
void refresh()
Refresh the model.
Definition: MeshDataModel.cpp:274
static const DataType getDataType(vtkSmartPointer< vtkDataArray >)
Returns the data type of a data array depending on the number of components of the given data array:
Definition: MeshComponent.cpp:1229
static const QString getFieldName(const FieldType)
helper method that returns the field type as a string
Definition: MeshComponent.cpp:1200
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Model data, called when the view is refreshing visualization.
Definition: MeshDataModel.cpp:113
DataType
Definition: MeshComponent.h:58
virtual vtkSmartPointer< vtkPointSet > getPointSet()=0
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
Definition: MeshDataModel.cpp:303
@ CELLS
data are attached to cells
Definition: MeshComponent.h:68
MeshComponent * meshComponent
The component where the data are stored.
Definition: MeshDataModel.h:139
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Number of data arrays columns.
Definition: MeshDataModel.cpp:77
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Number of data arrays.
Definition: MeshDataModel.cpp:67
@ POINTS
data are attached to point
Definition: MeshComponent.h:67
void setDataTypeFilter(int dataFilter)
Definition: MeshDataModel.cpp:298
MeshDataModel(MeshComponent *meshComp)
Constructor.
Definition: MeshDataModel.cpp:60
vtkSmartPointer< vtkDataArray > getDataArray(FieldType fieldType, const QString &arrayName)
Get the data array of specified field type and name.
Definition: MeshComponent.cpp:1053
@ VECTORS
3D (3D vector)
Definition: MeshComponent.h:60
int getNumberOfDataArray(int fieldFlag=POINTS|CELLS)
Get the number of data arrays of a given type without taking the specific representation into account...
Definition: MeshComponent.cpp:605
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Header data.
Definition: MeshDataModel.cpp:247
bool setData(const QModelIndex &index, const QVariant &value, int role) override
Edit data, called when the data are modified by the user (view)
Definition: MeshDataModel.cpp:208
@ TENSORS
9D (3x3 matrix)
Definition: MeshComponent.h:61
void refresh()
refresh the display
int dataTypeFilter
Definition: MeshDataModel.h:153
static const QString getDataTypeName(const DataType)
Helper method that returns the datatype as a string.
Definition: MeshComponent.cpp:1223
void getRowInfo(const int, int *dataIndex, MeshComponent::FieldType *, MeshComponent::DataType *, QString &) const
determine the current field type of the item depending on the row index, compute the index of the dat...
Definition: MeshDataModel.cpp:82
FieldType
Definition: MeshComponent.h:66
@ MESH
data are attached to the whole mesh (generic field data of Vtk)
Definition: MeshComponent.h:69
void setFieldTypeFilter(int fieldFilter)
Definition: MeshDataModel.cpp:293
static const QMap< int, QString > & getDataTypeNames()
static method that returns the DataType enum as a QString
Definition: MeshComponent.cpp:1216
#define CAMITK_API
Definition: CamiTKAPI.h:49
Definition: Action.cpp:35