Computer Assisted Medical Intervention Tool Kit  version 5.2
MeshSelectionModel.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2024 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef MESH_SELECTION_MODEL_H
27 #define MESH_SELECTION_MODEL_H
28 
29 #include <QAbstractTableModel>
30 
31 #include<vtkSmartPointer.h>
32 
33 class vtkSelectionNode;
34 class vtkAbstractArray;
35 
36 namespace camitk {
37 
38 class MeshComponent;
39 
44 class MeshSelectionModel : public QAbstractTableModel {
45 
46  Q_OBJECT
47 
48 public :
49 
54  DISCARD
55  };
56 
60  MeshSelectionModel(MeshComponent* const meshComp);
61 
65  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
66 
70  int columnCount(const QModelIndex& parent = QModelIndex()) const override;
71 
75  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
76 
80  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
81 
85  int insertSelection(const QString& name, int fieldType, int contentType, vtkSmartPointer< vtkAbstractArray > array, InsertionPolicy policy = REPLACE);
86 
87  int removeSelection(const QString& name);
88 
92  bool setData(const QModelIndex& index, const QVariant& value, int role) override;
93 
94  Qt::ItemFlags flags(const QModelIndex& index) const override;
95 
96 
97 private :
98 
99  MeshComponent* meshComponent;
100  QMap< int, QString > fieldName;
101  QMap< int, QString > contentName;
102 
103 };
104 
105 }
106 
107 #endif
Basic component to manage any kind of mesh.
Definition: MeshComponent.h:53
Qt model for mesh selection This class use the Qt model/view design.
Definition: MeshSelectionModel.h:44
MeshSelectionModel(MeshComponent *const meshComp)
Constructor.
Definition: MeshSelectionModel.cpp:45
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Number of selection.
Definition: MeshSelectionModel.cpp:54
int insertSelection(const QString &name, int fieldType, int contentType, vtkSmartPointer< vtkAbstractArray > array, InsertionPolicy policy=REPLACE)
Insert a selection.
Definition: MeshSelectionModel.cpp:160
bool setData(const QModelIndex &index, const QVariant &value, int role) override
Edit selection data.
Definition: MeshSelectionModel.cpp:284
Qt::ItemFlags flags(const QModelIndex &index) const override
Definition: MeshSelectionModel.cpp:307
int removeSelection(const QString &name)
Definition: MeshSelectionModel.cpp:271
InsertionPolicy
Definition: MeshSelectionModel.h:50
@ MERGE
Definition: MeshSelectionModel.h:52
@ REPLACE
Definition: MeshSelectionModel.h:51
@ SUBTRACT
Definition: MeshSelectionModel.h:53
@ DISCARD
Definition: MeshSelectionModel.h:54
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Data header.
Definition: MeshSelectionModel.cpp:134
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Number of selection columns.
Definition: MeshSelectionModel.cpp:62
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Model data.
Definition: MeshSelectionModel.cpp:67
Definition: Action.cpp:36
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding)