vtk-based camera controller More...
#include <mitkVtkInteractorCameraController.h>


Public Member Functions | |
| mitkClassMacro (VtkInteractorCameraController, CameraController) | |
| vtkRenderWindowInteractor * | GetVtkInteractor () |
| Returns the vtkRenderWindowInteractor used internally by this CameraController. | |
| virtual void | Resize (int w, int h) |
| Implemented in sub-classes. | |
| virtual void | MousePressEvent (mitk::MouseEvent *) |
| Implemented in sub-classes. | |
| virtual void | MouseReleaseEvent (mitk::MouseEvent *) |
| Implemented in sub-classes. | |
| virtual void | MouseMoveEvent (mitk::MouseEvent *) |
| Implemented in sub-classes. | |
| virtual void | KeyPressEvent (mitk::KeyEvent *) |
| Implemented in sub-classes. | |
| virtual void | SetRenderer (const mitk::BaseRenderer *renderer) |
| Set the BaseRenderer to be controlled by this vtk-based camera controller. | |
Static Public Member Functions | |
| static Pointer | New () |
Protected Member Functions | |
| VtkInteractorCameraController (const char *type=NULL) | |
| Default Constructor. | |
| virtual | ~VtkInteractorCameraController () |
| Default Destructor. | |
Protected Attributes | |
| vtkRenderWindowInteractor * | m_VtkInteractor |
vtk-based camera controller
Definition at line 33 of file mitkVtkInteractorCameraController.h.
| mitk::VtkInteractorCameraController::VtkInteractorCameraController | ( | const char * | type = NULL ) |
[protected] |
Default Constructor.
Definition at line 27 of file mitkVtkInteractorCameraController.cpp.
: CameraController(type), m_VtkInteractor(NULL) { //m_VtkInteractor = vtkRenderWindowInteractor::New(); }
| mitk::VtkInteractorCameraController::~VtkInteractorCameraController | ( | ) | [protected, virtual] |
Default Destructor.
Definition at line 33 of file mitkVtkInteractorCameraController.cpp.
{
if(m_VtkInteractor!=NULL)
{
m_VtkInteractor->SetRenderWindow(NULL);
m_VtkInteractor->Delete();
m_VtkInteractor = NULL;
}
}
| vtkRenderWindowInteractor * mitk::VtkInteractorCameraController::GetVtkInteractor | ( | ) |
Returns the vtkRenderWindowInteractor used internally by this CameraController.
Definition at line 260 of file mitkVtkInteractorCameraController.cpp.
{
return m_VtkInteractor;
}
| void mitk::VtkInteractorCameraController::KeyPressEvent | ( | mitk::KeyEvent * | ) | [virtual] |
Implemented in sub-classes.
Reimplemented from mitk::CameraController.
Definition at line 201 of file mitkVtkInteractorCameraController.cpp.
References mitk::BS_ControlButton, mitk::BS_ShiftButton, mitk::Event::GetButtonState(), mitk::KeyEvent::GetDisplayPosition(), mitk::KeyEvent::GetText(), and MITK_INFO.
{
MITK_INFO<<"Called KeyPressEvent() in VtkInteractorCameraController. Seems to be obsolete after QVTK restructuring (bug #1503, bug #954)"<<std::endl;
if(m_VtkInteractor)
{
if (!m_VtkInteractor->GetEnabled())
{
return;
}
int ctrl = ke->GetButtonState() & BS_ControlButton;
int shift = ke->GetButtonState() & BS_ShiftButton;
#if ((VTK_MAJOR_VERSION>4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=2)))
Point2D p(ke->GetDisplayPosition());
m_VtkInteractor->SetEventInformationFlipY(p[0], p[1], ctrl, shift, tolower(ke->GetText()[0]), 1, ke->GetText());
m_VtkInteractor->InvokeEvent(vtkCommand::KeyPressEvent, NULL);
m_VtkInteractor->InvokeEvent(vtkCommand::CharEvent, NULL);
#else
m_VtkInteractor->InteractorStyle->OnChar(ctrl, shift, (char)ke->ascii(), ke->count());
#endif
}
}
| mitk::VtkInteractorCameraController::mitkClassMacro | ( | VtkInteractorCameraController | , |
| CameraController | |||
| ) |
| void mitk::VtkInteractorCameraController::MouseMoveEvent | ( | mitk::MouseEvent * | ) | [virtual] |
Implemented in sub-classes.
Reimplemented from mitk::CameraController.
Definition at line 161 of file mitkVtkInteractorCameraController.cpp.
References mitk::BS_ControlButton, mitk::BS_ShiftButton, mitk::Event::GetButtonState(), mitk::DisplayPositionEvent::GetDisplayPosition(), int(), and MITK_INFO.
{
MITK_INFO<<"Called MouseMoveEvent() in VtkInteractorCameraController. Seems to be obsolete after QVTK restructuring (bug #1503, bug #954)"<<std::endl;
if(m_VtkInteractor)
{
if (!m_VtkInteractor->GetEnabled())
{
return;
}
int ctrl = me->GetButtonState() & BS_ControlButton;
int shift = me->GetButtonState() & BS_ShiftButton;
#if ((VTK_MAJOR_VERSION>4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=2)))
int xp = (int)me->GetDisplayPosition()[0];
int yp = (int)me->GetDisplayPosition()[1];
m_VtkInteractor->SetEventInformationFlipY(xp, yp, ctrl, shift);
m_VtkInteractor->InvokeEvent(vtkCommand::MouseMoveEvent, NULL);
#else
if (!m_VtkInteractor->MouseInWindow &&
((me->GetDisplayPosition().x >= 0) && (me->GetDisplayPosition().x < m_VtkInteractor->Size[0]) && (me->GetDisplayPosition().y >= 0) && (me->GetDisplayPosition().y < m_VtkInteractor->Size[1])))
{
m_VtkInteractor->InteractorStyle->OnEnter(ctrl, shift,
me->GetDisplayPosition().x, m_VtkInteractor->Size[1] - me->GetDisplayPosition().y - 1);
m_VtkInteractor->MouseInWindow = 1;
}
if (m_VtkInteractor->MouseInWindow &&
((me->GetDisplayPosition().x < 0) || (me->GetDisplayPosition().x >= m_VtkInteractor->Size[0]) || (me->GetDisplayPosition().y < 0) || (me->GetDisplayPosition().y >= m_VtkInteractor->Size[1])))
{
m_VtkInteractor->InteractorStyle->OnLeave(ctrl, shift,
me->GetDisplayPosition().x, m_VtkInteractor->Size[1] - me->GetDisplayPosition().y - 1);
m_VtkInteractor->MouseInWindow = 0;
}
m_VtkInteractor->InteractorStyle->OnMouseMove(ctrl, shift,
me->GetDisplayPosition().x, m_VtkInteractor->Size[1] - me->GetDisplayPosition().y - 1);
#endif
}
}
| void mitk::VtkInteractorCameraController::MousePressEvent | ( | mitk::MouseEvent * | ) | [virtual] |
Implemented in sub-classes.
Reimplemented from mitk::CameraController.
Definition at line 49 of file mitkVtkInteractorCameraController.cpp.
References mitk::BS_ControlButton, mitk::BS_LeftButton, mitk::BS_MidButton, mitk::BS_RightButton, mitk::BS_ShiftButton, mitk::Event::GetButton(), mitk::Event::GetButtonState(), mitk::DisplayPositionEvent::GetDisplayPosition(), int(), and MITK_INFO.
{
MITK_INFO<<"Called MousePressEvent() in VtkInteractorCameraController. Seems to be obsolete after QVTK restructuring (bug #1503, bug #954)"<<std::endl;
if(m_VtkInteractor)
{
if (!m_VtkInteractor->GetEnabled())
{
return;
}
int ctrl = me->GetButtonState() & BS_ControlButton;
int shift = me->GetButtonState() & BS_ShiftButton;
#if ((VTK_MAJOR_VERSION>4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=2)))
int xp = (int)me->GetDisplayPosition()[0];
int yp = (int)me->GetDisplayPosition()[1];
m_VtkInteractor->SetEventInformationFlipY(xp, yp, ctrl, shift);
switch (me->GetButton())
{
case BS_LeftButton:
m_VtkInteractor->InvokeEvent(vtkCommand::LeftButtonPressEvent,NULL);
break;
case BS_MidButton:
m_VtkInteractor->InvokeEvent(vtkCommand::MiddleButtonPressEvent,NULL);
break;
case BS_RightButton:
m_VtkInteractor->InvokeEvent(vtkCommand::RightButtonPressEvent,NULL);
break;
default:
return;
}
#else
if(me->GetButton() & BS_LeftButton)
{
// SetCapture(wnd);
m_VtkInteractor->InteractorStyle->OnLeftButtonDown(ctrl, shift,
me->GetDisplayPosition().x, m_VtkInteractor->Size[1] - me->GetDisplayPosition().y - 1);
}
else
if(me->button() & BS_MidButton)
{
// SetCapture(wnd);
m_VtkInteractor->InteractorStyle->OnMiddleButtonDown(ctrl, shift,
me->GetDisplayPosition().x, m_VtkInteractor->Size[1] - me->GetDisplayPosition().y - 1);
}
else
if(me->button() & BS_RightButton)
{
// SetCapture(wnd);
m_VtkInteractor->InteractorStyle->OnRightButtonDown(ctrl, shift,
me->GetDisplayPosition().x, m_VtkInteractor->Size[1] - me->GetDisplayPosition().y - 1);
}
#endif
}
}
| void mitk::VtkInteractorCameraController::MouseReleaseEvent | ( | mitk::MouseEvent * | ) | [virtual] |
Implemented in sub-classes.
Reimplemented from mitk::CameraController.
Definition at line 105 of file mitkVtkInteractorCameraController.cpp.
References mitk::BS_ControlButton, mitk::BS_LeftButton, mitk::BS_MidButton, mitk::BS_RightButton, mitk::BS_ShiftButton, mitk::Event::GetButton(), mitk::Event::GetButtonState(), mitk::DisplayPositionEvent::GetDisplayPosition(), int(), and MITK_INFO.
{
MITK_INFO<<"Called MouseReleaseEvent() in VtkInteractorCameraController. Seems to be obsolete after QVTK restructuring (bug #1503, bug #954)"<<std::endl;
if(m_VtkInteractor)
{
if (!m_VtkInteractor->GetEnabled())
{
return;
}
int ctrl = me->GetButtonState() & BS_ControlButton;
int shift = me->GetButtonState() & BS_ShiftButton;
#if ((VTK_MAJOR_VERSION>4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=2)))
int xp = (int)me->GetDisplayPosition()[0];
int yp = (int)me->GetDisplayPosition()[1];
m_VtkInteractor->SetEventInformationFlipY(xp, yp, ctrl, shift);
switch (me->GetButton())
{
case BS_LeftButton:
m_VtkInteractor->InvokeEvent(vtkCommand::LeftButtonReleaseEvent,NULL);
break;
case BS_MidButton:
m_VtkInteractor->InvokeEvent(vtkCommand::MiddleButtonReleaseEvent,NULL);
break;
case BS_RightButton:
m_VtkInteractor->InvokeEvent(vtkCommand::RightButtonReleaseEvent,NULL);
break;
default:
return;
}
#else
if(me->button() & BS_LeftButton)
{
m_VtkInteractor->InteractorStyle->OnLeftButtonUp(ctrl, shift,
me->GetDisplayPosition().x, m_VtkInteractor->Size[1] - me->GetDisplayPosition().y - 1);
//ReleaseCapture( );
}
else
if(me->button() & BS_MidButton)
{
m_VtkInteractor->InteractorStyle->OnMiddleButtonUp(ctrl, shift,
me->GetDisplayPosition().x, m_VtkInteractor->Size[1] - me->GetDisplayPosition().y - 1);
//ReleaseCapture( );
}
else
if(me->button() & BS_RightButton)
{
m_VtkInteractor->InteractorStyle->OnRightButtonUp(ctrl, shift,
me->GetDisplayPosition().x, m_VtkInteractor->Size[1] - me->GetDisplayPosition().y - 1);
//ReleaseCapture( );
}
#endif
}
}
| static Pointer mitk::VtkInteractorCameraController::New | ( | ) | [static] |
Reimplemented from mitk::BaseController.
| void mitk::VtkInteractorCameraController::Resize | ( | int | w, |
| int | h | ||
| ) | [virtual] |
Implemented in sub-classes.
Reimplemented from mitk::CameraController.
Definition at line 43 of file mitkVtkInteractorCameraController.cpp.
{
if(m_VtkInteractor)
m_VtkInteractor->SetSize(w, h);
}
| void mitk::VtkInteractorCameraController::SetRenderer | ( | const mitk::BaseRenderer * | renderer ) | [virtual] |
Set the BaseRenderer to be controlled by this vtk-based camera controller.
Definition at line 223 of file mitkVtkInteractorCameraController.cpp.
References mitk::BaseRenderer::GetVtkRenderer().
{
Superclass::SetRenderer(renderer);
if (renderer)
{
// CHG 11-07: QVTK-Widget comes along with vtkRenderWindow and vtkRenWinInteractor, therefore do not
// generate a new one any more
m_VtkInteractor = renderer->GetVtkRenderer()->GetRenderWindow()->GetInteractor();
m_VtkInteractor->SetRenderWindow(renderer->GetVtkRenderer()->GetRenderWindow());
// Enable possibility to (mouse-)interact with the renderer
m_VtkInteractor->Enable();
m_VtkInteractor->Register(NULL);
}
/* VtkRenderWindowInteractor* windowInteractor =
dynamic_cast<VtkRenderWindowInteractor*>(m_VtkInteractor);
if (windowInteractor == NULL)
{
itkWarningMacro(<< "renderwindow is not an mitk::VtkRenderWindow");
}
else
{
windowInteractor->SetMitkRenderer(const_cast<mitk::BaseRenderer*>(this->GetRenderer()));
}
m_VtkInteractor->Initialize();
m_VtkInteractor->SetRenderWindow(renderer->GetVtkRenderWindow());
}
else
{
m_VtkInteractor->SetRenderWindow(NULL);
m_VtkInteractor->Delete();
m_VtkInteractor = NULL;
}*/
}
vtkRenderWindowInteractor* mitk::VtkInteractorCameraController::m_VtkInteractor [protected] |
Definition at line 66 of file mitkVtkInteractorCameraController.h.
1.7.2