fw4spl
SMeshesBoxWidget.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __VISUVTKADAPTOR_SMESHESBOXWIDGET_HPP__
8 #define __VISUVTKADAPTOR_SMESHESBOXWIDGET_HPP__
9 
10 #include "visuVTKAdaptor/config.hpp"
11 
12 #include <fwCom/Connection.hpp>
13 #include <fwCom/Slot.hpp>
14 #include <fwCom/Slots.hpp>
15 
16 #include <fwData/Composite.hpp>
17 
18 #include <fwRenderVTK/IAdaptor.hpp>
19 
20 #ifndef ANDROID
21 
22 class vtkBoxWidget2;
23 class vtkCommand;
24 class vtkPolyData;
25 class vtkAssembly;
26 class vtkActor;
27 
28 namespace visuVTKAdaptor
29 {
30 
57 class VISUVTKADAPTOR_CLASS_API SMeshesBoxWidget : public ::fwRenderVTK::IAdaptor
58 {
59 
60 public:
61 
63 
64  VISUVTKADAPTOR_API SMeshesBoxWidget() noexcept;
65 
66  VISUVTKADAPTOR_API virtual ~SMeshesBoxWidget() noexcept;
67 
69  void updateFromVtk();
70 
71 protected:
72 
73  VISUVTKADAPTOR_API void configuring() override;
74  VISUVTKADAPTOR_API void starting() override;
75  VISUVTKADAPTOR_API void updating() override;
76  VISUVTKADAPTOR_API void stopping() override;
77 
86  VISUVTKADAPTOR_API virtual KeyConnectionsMap getAutoConnections() const override;
87 
89  void updateMeshTransform();
90 
92  void updateMeshMapFromComposite(::fwData::Composite::ContainerType objects);
93 
94 private:
95 
100  void updateMatrices();
102 
104  void addObjects(::fwData::Composite::ContainerType objects);
105 
107  void changeObjects(::fwData::Composite::ContainerType newObjects, ::fwData::Composite::ContainerType);
108 
110  void removeObjects(::fwData::Composite::ContainerType objects);
115  typedef std::map< std::string, ::fwCom::Connection > ConnectionMapType;
116  typedef std::map< std::string, vtkActor* > MeshMapType;
117 
118  MeshMapType m_meshMap;
119  ConnectionMapType m_connections;
120 
121  vtkAssembly* m_assembly;
122  vtkCommand* m_boxWidgetCommand;
123  vtkBoxWidget2* m_vtkBoxWidget;
124 };
125 
126 } //namespace visuVTKAdaptor
127 
128 #endif // ANDROID
129 
130 #endif // __VISUVTKADAPTOR_SMESHESBOXWIDGET_HPP__
This class is a helper to define the connections of a service and its data.
Definition: IService.hpp:454
The namespace visuVTKAdaptor contains the list of adaptors available for the generic scene...
Namespace containing fw4spl communication tools.
Definition: DumpEditor.hpp:30
STL namespace.
Create a Box widget around the meshes contained in the composite.
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
Contains the representation of the data objects used in the framework.