Computer Assited Medical Intervention Tool Kit  version 3.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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-2014 UJF-Grenoble 1, 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 #include <QAbstractTableModel>
27 
28 #include<vtkSmartPointer.h>
29 
30 class vtkSelectionNode;
31 
32 namespace camitk {
33 
34 class MeshComponent;
35 
40 class MeshSelectionModel : public QAbstractTableModel {
41 
42  Q_OBJECT
43 
44 public :
45 
49  MeshSelectionModel ( MeshComponent* const meshComp );
50 
54  int rowCount ( const QModelIndex &parent = QModelIndex() ) const ;
55 
59  int columnCount ( const QModelIndex &parent = QModelIndex() ) const;
60 
64  QVariant data ( const QModelIndex &index, int role = Qt::DisplayRole ) const;
65 
69  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
70 
74  QMap< QString, vtkSmartPointer<vtkSelectionNode> >& getSelectionList();
75 
79  void updateSelection(const QString& name);
80 
84  void refresh();
85 
86 private :
87 
89  QMap< int, QString > fieldName;
90  QMap< int, QString > contentName;
91 
92 };
93 
94 }
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Data header.
Definition: MeshSelectionModel.cpp:89
MeshSelectionModel(MeshComponent *const meshComp)
Constructor.
Definition: MeshSelectionModel.cpp:34
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Model data.
Definition: MeshSelectionModel.cpp:52
Qt model for mesh selection This class use the Qt model/view design.
Definition: MeshSelectionModel.h:40
string name
Definition: select.cpp:111
void updateSelection(const QString &name)
Update the selection.
Definition: MeshSelectionModel.cpp:114
Definition: Action.cpp:40
Basic component to manage any kind of mesh.
Definition: MeshComponent.h:48
int columnCount(const QModelIndex &parent=QModelIndex()) const
Number of selection columns.
Definition: MeshSelectionModel.cpp:48
QMap< int, QString > contentName
Definition: MeshSelectionModel.h:90
void refresh()
Refresh the model.
Definition: MeshSelectionModel.cpp:121
MeshComponent * meshComponent
Definition: MeshSelectionModel.h:88
QMap< QString, vtkSmartPointer< vtkSelectionNode > > & getSelectionList()
Get the selection list.
int rowCount(const QModelIndex &parent=QModelIndex()) const
Number of selection.
Definition: MeshSelectionModel.cpp:42
QMap< int, QString > fieldName
The component where the selection are stored.
Definition: MeshSelectionModel.h:89