19 #include "vtkCommand.h"
29 unsigned long vtkCommandEventId,
30 vtkRenderWindowInteractor *rwi)
33 point[0] = rwi->GetEventPosition()[0];
34 point[1] = rwi->GetEventPosition()[1];
50 if (vtkCommandEventId == vtkCommand::MouseMoveEvent)
54 modifiers = buttonState;
59 MITK_WARN <<
"Wrong usage of function AdaptMouseMoveEvent. Wrong input type.";
62 if (rwi->GetShiftKey())
66 if (rwi->GetControlKey())
77 static_cast<InteractionEvent::MouseButtons>(buttonState),
78 static_cast<InteractionEvent::ModifierKeys>(modifiers));
83 unsigned long vtkCommandEventId,
84 vtkRenderWindowInteractor *rwi)
87 point[0] = rwi->GetEventPosition()[0];
88 point[1] = rwi->GetEventPosition()[1];
98 if (buttonStateMap.find(sender) != buttonStateMap.end())
99 buttonState = buttonStateMap.find(sender)->second;
101 if (buttonState != 0 && vtkCommandEventId != vtkCommand::MouseMoveEvent)
102 buttonStateMap.erase(buttonStateMap.find(sender));
104 switch (vtkCommandEventId)
106 case vtkCommand::LeftButtonReleaseEvent:
109 buttonStateMap[sender] = (buttonState - button);
111 case vtkCommand::MiddleButtonReleaseEvent:
114 buttonStateMap[sender] = (buttonState - button);
116 case vtkCommand::RightButtonReleaseEvent:
119 buttonStateMap[sender] = (buttonState - button);
123 if (rwi->GetShiftKey())
127 if (rwi->GetControlKey())
131 if (rwi->GetAltKey())
137 if (buttonStateMap.find(sender) != buttonStateMap.end())
139 buttonState = buttonStateMap.find(sender)->second;
144 static_cast<InteractionEvent::MouseButtons>(buttonState),
145 static_cast<InteractionEvent::ModifierKeys>(modifiers),
146 static_cast<InteractionEvent::MouseButtons>(button));
151 unsigned long vtkCommandEventId,
152 vtkRenderWindowInteractor *rwi)
155 p[0] = rwi->GetEventPosition()[0];
156 p[1] = rwi->GetEventPosition()[1];
159 switch (vtkCommandEventId)
161 case vtkCommand::MouseWheelForwardEvent:
164 case vtkCommand::MouseWheelBackwardEvent:
170 if (rwi->GetShiftKey())
174 if (rwi->GetControlKey())
178 if (rwi->GetAltKey())
184 point[0] = rwi->GetEventPosition()[0];
185 point[1] = rwi->GetEventPosition()[1];
191 static_cast<InteractionEvent::MouseButtons>(buttonState),
192 static_cast<InteractionEvent::ModifierKeys>(modifiers),
198 unsigned long vtkCommandEventId,
199 vtkRenderWindowInteractor *rwi)
201 if (vtkCommandEventId != vtkCommand::KeyPressEvent)
203 MITK_WARN <<
"mitk::VtkEventAdapter::AdaptInteractionKeyEvent() called with wrong argument";
207 if (rwi->GetShiftKey())
211 if (rwi->GetControlKey())
215 if (rwi->GetAltKey())
220 sender, std::string(rwi->GetKeySym()), static_cast<InteractionEvent::ModifierKeys>(modifiers));
225 unsigned long vtkCommandEventId,
226 vtkRenderWindowInteractor *rwi)
229 point[0] = rwi->GetEventPosition()[0];
230 point[1] = rwi->GetEventPosition()[1];
240 if (buttonStateMap.find(sender) != buttonStateMap.end())
241 buttonState = buttonStateMap.find(sender)->second;
243 if (buttonState != 0 && vtkCommandEventId != vtkCommand::MouseMoveEvent)
244 buttonStateMap.erase(buttonStateMap.find(sender));
246 switch (vtkCommandEventId)
248 case vtkCommand::LeftButtonPressEvent:
250 buttonState |= button;
251 buttonStateMap[sender] = buttonState;
253 case vtkCommand::MiddleButtonPressEvent:
255 buttonState |= button;
256 buttonStateMap[sender] = buttonState;
258 case vtkCommand::RightButtonPressEvent:
260 buttonState |= button;
261 buttonStateMap[sender] = buttonState;
265 if (rwi->GetShiftKey())
269 if (rwi->GetControlKey())
273 if (rwi->GetAltKey())
280 static_cast<InteractionEvent::MouseButtons>(buttonState),
281 static_cast<InteractionEvent::ModifierKeys>(modifiers),
282 static_cast<InteractionEvent::MouseButtons>(button));
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd, MouseButtons _arge)
static mitk::InteractionKeyEvent::Pointer AdaptInteractionKeyEvent(mitk::BaseRenderer *sender, unsigned long vtkCommandEventId, vtkRenderWindowInteractor *rwi)
static mitk::MouseReleaseEvent::Pointer AdaptMouseReleaseEvent(mitk::BaseRenderer *sender, unsigned long vtkCommandEventId, vtkRenderWindowInteractor *rwi)
Organizes the rendering process.
DataCollection - Class to facilitate loading/accessing structured data.
Constants for most interaction classes, due to the generic StateMachines.
static mitk::MousePressEvent::Pointer AdaptMousePressEvent(mitk::BaseRenderer *sender, unsigned long vtkCommandEventId, vtkRenderWindowInteractor *rwi)
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd, int _arge)
static Pointer New(BaseRenderer *_arga, const std::string &_argb, ModifierKeys _argc)
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd)
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd, MouseButtons _arge)
static mitk::MouseMoveEvent::Pointer AdaptMouseMoveEvent(mitk::BaseRenderer *sender, unsigned long vtkCommandEventId, vtkRenderWindowInteractor *rwi)
static mitk::MouseWheelEvent::Pointer AdaptMouseWheelEvent(mitk::BaseRenderer *sender, unsigned long vtkCommandEventId, vtkRenderWindowInteractor *rwi)
static std::map< BaseRenderer *, int > buttonStateMap