fw4spl
SPickerInteractor.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_SPICKERINTERACTOR_HPP__
8 #define __VISUVTKADAPTOR_SPICKERINTERACTOR_HPP__
9 
10 #include "visuVTKAdaptor/config.hpp"
11 
12 #include <fwCom/Signal.hpp>
13 #include <fwCom/Signals.hpp>
14 
15 #include <fwDataTools/PickingInfo.hpp>
16 
17 #include <fwRenderVTK/IAdaptor.hpp>
18 
19 #include <vtkCommand.h>
20 
21 #include <vector>
22 
23 namespace visuVTKAdaptor
24 {
25 
55 class VISUVTKADAPTOR_CLASS_API SPickerInteractor : public ::fwRenderVTK::IAdaptor
56 {
57 
58 public:
59 
61 
62  VISUVTKADAPTOR_API SPickerInteractor() noexcept;
63 
64  VISUVTKADAPTOR_API virtual ~SPickerInteractor() noexcept;
65 
70  VISUVTKADAPTOR_API static const ::fwCom::Signals::SignalKeyType s_PICKED_SIGNAL;
71  typedef ::fwCom::Signal<void (::fwDataTools::PickingInfo)> PickedSignalType;
73 
74  typedef enum
75  {
76  MOUSE_LEFT_UP = vtkCommand::LeftButtonReleaseEvent,
77  MOUSE_RIGHT_UP = vtkCommand::RightButtonReleaseEvent,
78  MOUSE_MIDDLE_UP = vtkCommand::MiddleButtonReleaseEvent,
79  MOUSE_WHEELFORWARD = vtkCommand::MouseWheelForwardEvent,
80  MOUSE_LEFT_DOWN = vtkCommand::LeftButtonPressEvent,
81  MOUSE_RIGHT_DOWN = vtkCommand::RightButtonPressEvent,
82  MOUSE_MIDDLE_DOWN = vtkCommand::MiddleButtonPressEvent,
83  MOUSE_WHEELBACKWARD = vtkCommand::MouseWheelBackwardEvent,
84  MOUSE_MOVE = vtkCommand::MouseMoveEvent,
85  KEY_PRESS = vtkCommand::KeyPressEvent
86  } EventID;
87  typedef std::set< EventID > SetEventIdType;
88 
89  static const std::map< unsigned long, ::fwDataTools::PickingInfo::Event > s_vtkEventIDConversion;
90 
91 protected:
92 
93  VISUVTKADAPTOR_API void configuring() override;
94  VISUVTKADAPTOR_API void starting() override;
95  VISUVTKADAPTOR_API void updating() override;
96  VISUVTKADAPTOR_API void stopping() override;
97 
98  typedef std::map< std::string, EventID > MapEventIdType;
99  static MapEventIdType m_eventIdConversion;
100 
101  vtkCommand* m_interactionCommand;
102  SetEventIdType m_eventId;
103 
105 };
106 
107 } //namespace visuVTKAdaptor
108 
109 #endif // __VISUVTKADAPTOR_SPICKERINTERACTOR_HPP__
This service emits a signal when the user click on a actor in the scene.
The namespace visuVTKAdaptor contains the list of adaptors available for the generic scene...
Namespace containing fw4spl communication tools.
Definition: DumpEditor.hpp:30
The namespace fwDataTools contains classes which provide helpers to manipulate fwData::Object. *.
static MapEventIdType m_eventIdConversion
map containing the association between &#39;event text&#39; and &#39;event ID&#39;.
SetEventIdType m_eventId
event ID treated for picking
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
std::map< std::string, EventID > MapEventIdType
typedef for the map (seen below).
bool m_abortOnPick
Disables all following commands if picking was successful.
vtkCommand * m_interactionCommand
the vtk mouse events observer