Computer Assited Medical Intervention Tool Kit  version 3.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
MeshComponent.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 #ifndef MESHCOMPONENT_H
27 #define MESHCOMPONENT_H
28 
29 #include "Component.h"
30 #include "Geometry.h"
31 #include "MeshDataModel.h"
32 #include "MeshSelectionModel.h"
33 
34 class vtkPointSet;
35 class vtkSelection;
36 class vtkSelectionNode;
37 
38 class QTableView;
39 
40 namespace camitk {
41 
49  Q_OBJECT
50 public:
51 
57  MeshComponent( const QString & file ) throw( AbortException );
58 
68  MeshComponent( vtkSmartPointer<vtkPointSet> aPointSet, const QString &name );
69 
78  MeshComponent( Component *parentComponent, vtkSmartPointer<vtkPointSet> aPointSet, const QString &name );
79 
81  virtual ~MeshComponent();
82 
84  void pointPicked( vtkIdType pointId, bool );
85 
87  void cellPicked( vtkIdType cellId, bool );
88 
90  vtkIdType getPickedPointId();
91 
93  vtkIdType getPickedCellId();
94 
96  void updateProperty( QString , QVariant ) {};
97 
99  virtual unsigned int getNumberOfPropertyWidget();
100 
102  virtual QWidget * getPropertyWidgetAt( unsigned int i, QWidget* parent = 0 );
103 
112  void addSelection( const QString& name, int fieldType, int contentType );
113 
117  void removeSelection( const QString& name );
118 
122  int getNumberOfSelections() const;
123 
127  vtkSmartPointer<vtkSelectionNode> getSelection( const QString& name ) const;
128 
132  vtkSmartPointer<vtkSelectionNode> getSelectionAt( int i ) const;
133 
137  const QMap< QString, vtkSmartPointer<vtkSelectionNode> >& getSelectionList() const;
138 
142  void addToSelection( const QString& name, vtkSmartPointer<vtkAbstractArray> array );
155  void addDataArray( const QString& name, vtkSmartPointer<vtkDataArray> data );
156 
160  void removeDataArray( const QString& name );
161 
165  void linkDataToPoints( const QString& name );
166 
170  void linkDataToCells( const QString& name );
171 
175  void addPointData( const QString& name, int dataType, vtkSmartPointer<vtkDataArray> data );
176 
180  void addCellData( const QString& name, int dataType, vtkSmartPointer<vtkDataArray> data );
181 
184  return dataModel;
185  }
190 protected:
192  virtual void initRepresentation( vtkSmartPointer<vtkPointSet> );
193 
195  virtual void initDynamicProperties();
196 
197 protected slots :
198 
200  void changeSelectedSelection( const QModelIndex& current, const QModelIndex& previous );
201 
202 private:
203 
205  virtual void initRepresentation() {};
206 
208  void init();
209 
211  vtkIdType pickedPointId;
212 
214  vtkIdType pickedCellId;
215 
217  vtkSmartPointer<vtkSelection> currentSelection;
218 
220  QMap< QString, vtkSmartPointer<vtkSelectionNode> > selectionList;
221 
223  QMap< QString, vtkSmartPointer<vtkDataArray> > dataList;
224 
226  QTableView* selectionView;
227 
229  QTableView* dataView;
230 
233 
236 
237 };
238 
239 }
240 
241 #endif // MESHCOMPONENT_H
void init()
Definition: obj2pml.cpp:213
Exception class to handle abortion in component instanciation.
Definition: AbortException.h:43
Qt model for mesh selection This class use the Qt model/view design.
Definition: MeshSelectionModel.h:40
Qt model for mesh data.
Definition: MeshDataModel.h:39
string name
Definition: select.cpp:111
Definition: Action.cpp:40
Basic component to manage any kind of mesh.
Definition: MeshComponent.h:48
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:299
QTableView * selectionView
selection GUI View (view as the V in Qt MVC design pattern)
Definition: MeshComponent.h:226
#define CAMITK_API
Definition: CamiTKAPI.h:49
virtual void initRepresentation()
the concrete building of the 3D objects (Slice/Geometry): none in this case, everything is done by in...
Definition: MeshComponent.h:205
QTableView * dataView
data GUI View (view as the V in Qt MVC design pattern)
Definition: MeshComponent.h:229
MeshDataModel * dataModel
data model (model as the M in Qt MVC design pattern)
Definition: MeshComponent.h:235
void updateProperty(QString, QVariant)
update property: no specific properties to manage, this is needed to avoid console warnings...
Definition: MeshComponent.h:96
MeshSelectionModel * selectionModel
selection model (model as the M in Qt MVC design pattern)
Definition: MeshComponent.h:232
vtkIdType pickedPointId
the last picked point
Definition: MeshComponent.h:211
vtkSmartPointer< vtkSelection > currentSelection
manages current selection using vtk
Definition: MeshComponent.h:217
vtkIdType pickedCellId
the last picked cell
Definition: MeshComponent.h:214
QMap< QString, vtkSmartPointer< vtkDataArray > > dataList
maps a name with a data array
Definition: MeshComponent.h:223
MeshDataModel * getDataModel()
get the current data view model (model as the M in Qt MVC design pattern)
Definition: MeshComponent.h:183
QMap< QString, vtkSmartPointer< vtkSelectionNode > > selectionList
maps a name with a type of selection
Definition: MeshComponent.h:220