Computer Assited Medical Intervention Tool Kit  version 4.1
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-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
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 
55  };
56 
60  MeshSelectionModel(MeshComponent* const meshComp);
61 
65  int rowCount(const QModelIndex& parent = QModelIndex()) const ;
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 // * @brief Get the selection list
98 // */
99 // QMap< QString, vtkSmartPointer<vtkSelectionNode> >& getSelectionList();
100 //
101 // /**
102 // * @brief Update the selection
103 // */
104 // void updateSelection(const QString& name);
105 //
106 // /**
107 // * @brief Refresh the model
108 // */
109 // void refresh();
110 
111 private :
112 
114  QMap< int, QString > fieldName;
115  QMap< int, QString > contentName;
116 
117 };
118 
119 }
120 
121 #endif
MeshSelectionModel(MeshComponent *const meshComp)
Constructor.
Definition: MeshSelectionModel.cpp:41
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Model data.
Definition: MeshSelectionModel.cpp:63
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Data header.
Definition: MeshSelectionModel.cpp:130
Qt model for mesh selection This class use the Qt model/view design.
Definition: MeshSelectionModel.h:44
Definition: MeshSelectionModel.h:53
int rowCount(const QModelIndex &parent=QModelIndex()) const
Number of selection.
Definition: MeshSelectionModel.cpp:50
Definition: Action.cpp:36
Basic component to manage any kind of mesh.
Definition: MeshComponent.h:53
QMap< int, QString > contentName
Definition: MeshSelectionModel.h:115
Definition: MeshSelectionModel.h:54
Definition: MeshSelectionModel.h:51
bool setData(const QModelIndex &index, const QVariant &value, int role) override
Edit selection data.
Definition: MeshSelectionModel.cpp:280
MeshComponent * meshComponent
Get the selection list.
Definition: MeshSelectionModel.h:113
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Number of selection columns.
Definition: MeshSelectionModel.cpp:58
int removeSelection(const QString &name)
Definition: MeshSelectionModel.cpp:267
InsertionPolicy
Definition: MeshSelectionModel.h:50
Qt::ItemFlags flags(const QModelIndex &index) const override
Definition: MeshSelectionModel.cpp:303
int insertSelection(const QString &name, int fieldType, int contentType, vtkSmartPointer< vtkAbstractArray > array, InsertionPolicy policy=REPLACE)
Insert a selection.
Definition: MeshSelectionModel.cpp:156
Definition: MeshSelectionModel.h:52
QMap< int, QString > fieldName
The component where the selection are stored.
Definition: MeshSelectionModel.h:114