21 #include <vtkCallbackCommand.h>
22 #include <vtkInteractorStyle.h>
23 #include <vtkObjectFactory.h>
24 #include <vtkRenderWindowInteractor.h>
28 #define VTKEVENTPROVIDER_INFO MBI_INFO("mitk.core.vtkeventprovider")
29 #define VTKEVENTPROVIDER_WARN MBI_WARN("mitk.core.vtkeventprovider")
30 #define VTKEVENTPROVIDER_ERROR MBI_ERROR("mitk.core.vtkeventprovider")
31 #define VTKEVENTPROVIDER_DEBUG MBI_DEBUG("mitk.core.vtkeventprovider")
41 this->Priority = 99999.99;
50 this->EventCallbackCommand->SetPassiveObserver(1);
71 this->SetInteractor(0);
76 m_RenderWindow = renWin;
81 return m_RenderWindow;
86 if (!this->Interactor)
104 vtkRenderWindowInteractor *i = this->Interactor;
106 InteractionEventsVectorType::iterator it;
107 for (it = m_InteractionEventsVector.begin(); it != m_InteractionEventsVector.end(); ++it)
110 i->GetInteractorStyle()->AddObserver((vtkCommand::EventIds)(*it), this->EventCallbackCommand, this->Priority);
113 this->InvokeEvent(vtkCommand::EnableEvent, NULL);
128 this->Interactor->RemoveObserver(this->EventCallbackCommand);
131 this->InvokeEvent(vtkCommand::DisableEvent, NULL);
139 if (i == this->Interactor)
144 if (this->Interactor)
147 this->Interactor = i;
156 void *vtkNotUsed(callData))
159 vtkRenderWindowInteractor *rwi =
static_cast<vtkInteractorStyle *
>(object)->GetInteractor();
166 case vtkCommand::KeyPressEvent:
171 self->GetRenderWindow()->HandleEvent(adaptedEvent.GetPointer());
176 case vtkCommand::MouseMoveEvent:
181 self->GetRenderWindow()->HandleEvent(adaptedEvent.GetPointer());
185 case vtkCommand::LeftButtonPressEvent:
186 case vtkCommand::MiddleButtonPressEvent:
187 case vtkCommand::RightButtonPressEvent:
192 self->GetRenderWindow()->HandleEvent(adaptedEvent.GetPointer());
196 case vtkCommand::LeftButtonReleaseEvent:
197 case vtkCommand::MiddleButtonReleaseEvent:
198 case vtkCommand::RightButtonReleaseEvent:
203 self->GetRenderWindow()->HandleEvent(adaptedEvent.GetPointer());
208 case vtkCommand::MouseWheelForwardEvent:
209 case vtkCommand::MouseWheelBackwardEvent:
214 self->GetRenderWindow()->HandleEvent(adaptedEvent.GetPointer());
226 InteractionEventsVectorType::iterator it;
227 if (m_InteractionEventsVector.size() > 0)
229 it = std::find(m_InteractionEventsVector.begin(), m_InteractionEventsVector.end(), ievent);
230 if (it != m_InteractionEventsVector.end())
232 m_InteractionEventsVector.erase(it);
241 RemoveInteractionEvent(ievent);
243 m_InteractionEventsVector.push_back(ievent);
static BaseRenderer * GetInstance(vtkRenderWindow *renWin)
#define VTKEVENTPROVIDER_ERROR
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.
virtual void SetInteractor(vtkRenderWindowInteractor *iren) override
DataCollection - Class to facilitate loading/accessing structured data.
#define VTKEVENTPROVIDER_INFO
static mitk::MousePressEvent::Pointer AdaptMousePressEvent(mitk::BaseRenderer *sender, unsigned long vtkCommandEventId, vtkRenderWindowInteractor *rwi)
void AddInteractionEvent(unsigned long ievent)
Integrates into the VTK event mechanism to generate MITK specific events. This class is NON-QT depend...
virtual void SetEnabled(int) override
void RemoveInteractionEvent(unsigned long ievent)
virtual void SetMitkRenderWindow(mitk::RenderWindow *renWin)
vtkStandardNewMacro(AnatomicalStructureColorPresets)
#define VTKEVENTPROVIDER_DEBUG
mitk::RenderWindow * GetRenderWindow()
static mitk::MouseMoveEvent::Pointer AdaptMouseMoveEvent(mitk::BaseRenderer *sender, unsigned long vtkCommandEventId, vtkRenderWindowInteractor *rwi)
mitkRenderWindow integrates the MITK rendering mechanism into VTK and is NOT QT dependent ...
static mitk::MouseWheelEvent::Pointer AdaptMouseWheelEvent(mitk::BaseRenderer *sender, unsigned long vtkCommandEventId, vtkRenderWindowInteractor *rwi)
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)