15 #include "vtkCommand.h" 25 unsigned long vtkCommandEventId,
26 vtkRenderWindowInteractor *rwi)
29 point[0] = rwi->GetEventPosition()[0];
30 point[1] = rwi->GetEventPosition()[1];
40 if (buttonStateMap.find(sender) != buttonStateMap.end())
43 buttonState = buttonStateMap.find(sender)->second;
46 if (vtkCommandEventId == vtkCommand::MouseMoveEvent)
50 modifiers = buttonState;
55 MITK_WARN <<
"Wrong usage of function AdaptMouseMoveEvent. Wrong input type.";
58 if (rwi->GetShiftKey())
62 if (rwi->GetControlKey())
73 static_cast<InteractionEvent::MouseButtons>(buttonState),
74 static_cast<InteractionEvent::ModifierKeys>(modifiers));
79 unsigned long vtkCommandEventId,
80 vtkRenderWindowInteractor *rwi)
83 point[0] = rwi->GetEventPosition()[0];
84 point[1] = rwi->GetEventPosition()[1];
94 if (buttonStateMap.find(sender) != buttonStateMap.end())
95 buttonState = buttonStateMap.find(sender)->second;
97 if (buttonState != 0 && vtkCommandEventId != vtkCommand::MouseMoveEvent)
98 buttonStateMap.erase(buttonStateMap.find(sender));
100 switch (vtkCommandEventId)
102 case vtkCommand::LeftButtonReleaseEvent:
105 buttonStateMap[sender] = (buttonState - button);
107 case vtkCommand::MiddleButtonReleaseEvent:
110 buttonStateMap[sender] = (buttonState - button);
112 case vtkCommand::RightButtonReleaseEvent:
115 buttonStateMap[sender] = (buttonState - button);
119 if (rwi->GetShiftKey())
123 if (rwi->GetControlKey())
127 if (rwi->GetAltKey())
133 if (buttonStateMap.find(sender) != buttonStateMap.end())
135 buttonState = buttonStateMap.find(sender)->second;
140 static_cast<InteractionEvent::MouseButtons>(buttonState),
141 static_cast<InteractionEvent::ModifierKeys>(modifiers),
142 static_cast<InteractionEvent::MouseButtons>(button));
147 unsigned long vtkCommandEventId,
148 vtkRenderWindowInteractor *rwi)
151 p[0] = rwi->GetEventPosition()[0];
152 p[1] = rwi->GetEventPosition()[1];
155 switch (vtkCommandEventId)
157 case vtkCommand::MouseWheelForwardEvent:
160 case vtkCommand::MouseWheelBackwardEvent:
166 if (rwi->GetShiftKey())
170 if (rwi->GetControlKey())
174 if (rwi->GetAltKey())
180 point[0] = rwi->GetEventPosition()[0];
181 point[1] = rwi->GetEventPosition()[1];
187 static_cast<InteractionEvent::MouseButtons>(buttonState),
188 static_cast<InteractionEvent::ModifierKeys>(modifiers),
194 unsigned long vtkCommandEventId,
195 vtkRenderWindowInteractor *rwi)
197 if (vtkCommandEventId != vtkCommand::KeyPressEvent)
199 MITK_WARN <<
"mitk::VtkEventAdapter::AdaptInteractionKeyEvent() called with wrong argument";
203 if (rwi->GetShiftKey())
207 if (rwi->GetControlKey())
211 if (rwi->GetAltKey())
216 sender, std::string(rwi->GetKeySym()), static_cast<InteractionEvent::ModifierKeys>(modifiers));
221 unsigned long vtkCommandEventId,
222 vtkRenderWindowInteractor *rwi)
225 point[0] = rwi->GetEventPosition()[0];
226 point[1] = rwi->GetEventPosition()[1];
236 if (buttonStateMap.find(sender) != buttonStateMap.end())
237 buttonState = buttonStateMap.find(sender)->second;
239 if (buttonState != 0 && vtkCommandEventId != vtkCommand::MouseMoveEvent)
240 buttonStateMap.erase(buttonStateMap.find(sender));
242 switch (vtkCommandEventId)
244 case vtkCommand::LeftButtonPressEvent:
246 buttonState |= button;
247 buttonStateMap[sender] = buttonState;
249 case vtkCommand::MiddleButtonPressEvent:
251 buttonState |= button;
252 buttonStateMap[sender] = buttonState;
254 case vtkCommand::RightButtonPressEvent:
256 buttonState |= button;
257 buttonStateMap[sender] = buttonState;
261 if (rwi->GetShiftKey())
265 if (rwi->GetControlKey())
269 if (rwi->GetAltKey())
276 static_cast<InteractionEvent::MouseButtons>(buttonState),
277 static_cast<InteractionEvent::ModifierKeys>(modifiers),
278 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