fw4spl
SMeshNormals.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_SMESHNORMALS_HPP__
8 #define __VISUVTKADAPTOR_SMESHNORMALS_HPP__
9 
10 #include "visuVTKAdaptor/config.hpp"
11 
12 #include <fwCom/Slot.hpp>
13 #include <fwCom/Slots.hpp>
14 
15 #include <fwRenderVTK/IAdaptor.hpp>
16 
17 #include <vtkSmartPointer.h>
18 
19 class vtkPolyData;
20 class vtkActor;
21 
22 namespace visuVTKAdaptor
23 {
24 
52 class VISUVTKADAPTOR_CLASS_API SMeshNormals : public ::fwRenderVTK::IAdaptor
53 {
54 
55 public:
56 
57  static const ::fwServices::IService::KeyType s_MESH_INPUT;
58 
59  typedef enum
60  {
61  NONE,
62  POINT_NORMAL,
63  CELL_NORMAL
64  } NormalRepresentation;
65 
67 
68  VISUVTKADAPTOR_API SMeshNormals() noexcept;
69 
70  VISUVTKADAPTOR_API virtual ~SMeshNormals() noexcept;
71 
72  VISUVTKADAPTOR_API void setPolyData(vtkSmartPointer< vtkPolyData > polydata);
73 
78  VISUVTKADAPTOR_API static const ::fwCom::Slots::SlotKeyType s_UPDATE_VERTEX_SLOT;
79  typedef ::fwCom::Slot<void ()> UpdateVertexSlotType;
80 
81  VISUVTKADAPTOR_API static const ::fwCom::Slots::SlotKeyType s_UPDATE_POINT_NORMALS_SLOT;
82  typedef ::fwCom::Slot<void ()> UpdatePointNormalsSlotType;
83 
84  VISUVTKADAPTOR_API static const ::fwCom::Slots::SlotKeyType s_UPDATE_CELL_NORMALS_SLOT;
85  typedef ::fwCom::Slot<void ()> UpdateCellNormalsSlotType;
86 
87  VISUVTKADAPTOR_API static const ::fwCom::Slots::SlotKeyType s_SHOW_POINT_NORMALS_SLOT;
88  typedef ::fwCom::Slot<void ()> ShowPointNormalsSlotType;
89 
90  VISUVTKADAPTOR_API static const ::fwCom::Slots::SlotKeyType s_SHOW_CELL_NORMALS_SLOT;
91  typedef ::fwCom::Slot<void ()> ShowCellNormalsSlotType;
92 
93  VISUVTKADAPTOR_API static const ::fwCom::Slots::SlotKeyType s_HIDE_NORMALS_SLOT;
94  typedef ::fwCom::Slot<void ()> HideNormalsSlotType;
95 
96  VISUVTKADAPTOR_API static const ::fwCom::Slots::SlotKeyType s_UPDATE_NORMAL_MODE_SLOT;
97  typedef ::fwCom::Slot<void (std::uint8_t)> UpdateNormalModeSlotType;
98 
100  void updateNormalMode(std::uint8_t mode);
112  VISUVTKADAPTOR_API virtual KeyConnectionsMap getAutoConnections() const override;
113 
114 protected:
115 
116  VISUVTKADAPTOR_API void configuring() override;
117  VISUVTKADAPTOR_API void starting() override;
118  VISUVTKADAPTOR_API void updating() override;
119  VISUVTKADAPTOR_API void stopping() override;
120 
121  vtkActor* getActor() const;
122  void updateMeshNormals();
123 
129  void updateVertex();
131 
133  void updatePointNormals();
134 
136  void updateCellNormals();
137 
139  void showPointNormals();
140 
142  void showCellNormals();
143 
145  void hideNormals();
146 
151 private:
152 
153  NormalRepresentation m_normalRepresentation;
154  vtkSmartPointer< vtkPolyData > m_polyData;
155  vtkSmartPointer< vtkActor > m_actor;
156  static std::map< std::string, NormalRepresentation > m_normalRepresentationConversion;
157 };
158 
159 } //namespace visuVTKAdaptor
160 
161 #endif // __VISUVTKADAPTOR_SMESHNORMALS_HPP__
This class is a helper to define the connections of a service and its data.
Definition: IService.hpp:454
This adaptor displays mesh normals.
The namespace visuVTKAdaptor contains the list of adaptors available for the generic scene...
Namespace containing fw4spl communication tools.
Definition: DumpEditor.hpp:30
STL namespace.
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.