[vtk-developers] proposition: disabling interaction in vtk3DWidgets, API addition
Dean Inglis
dean.inglis at on.aibn.com
Mon Sep 23 14:32:16 EDT 2002
Hi,
I thought I'd tackle this one too, I just need sutiable
API symantics before adding the virtual method(s) to vtk3DWidget.h:
a) two methods:
virtual void EnableInteration() = 0;
virtual void DisableInteration() = 0;
with implementation in say vtkImagePlaneWidget like this:
(from Charl Botha)
void vtkImagePlaneWidget::DisableInteraction(void)
{
if (this->Interactor && this->Enabled)
{
this->Interactor->RemoveObserver(this->EventCallbackCommand);
}
}
void vtkImagePlaneWidget::EnableInteraction(void)
{
if (this->Interactor && this->Enabled)
{
vtkRenderWindowInteractor *i = this->Interactor;
i->AddObserver(vtkCommand::MouseMoveEvent, this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::LeftButtonPressEvent,
this->EventCallbackCommand, this->Priority);
i->AddObserver(vtkCommand::LeftButtonReleaseEvent,
this->EventCallbackCommand, this->Priority);
i->AddObserver(vtkCommand::MiddleButtonPressEvent,
this->EventCallbackCommand, this->Priority);
i->AddObserver(vtkCommand::MiddleButtonReleaseEvent,
this->EventCallbackCommand, this->Priority);
i->AddObserver(vtkCommand::RightButtonPressEvent,
this->EventCallbackCommand, this->Priority);
i->AddObserver(vtkCommand::RightButtonReleaseEvent,
this->EventCallbackCommand, this->Priority);
}
}
this preserves the widget on screen but disables mouse interaction.
something more along the lines of vtkInteractorObserver
b) virtual void SetInteractionEnabled(int) = 0;
Any thoughts?
Dean
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dean Inglis, Ph.D.
- Centre for Appendicular -
- Magnetic Resonance Imaging Studies -
25 Charlton Avenue East, Unit 610
Hamilton, ONT, L8N 1Y2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the vtk-developers
mailing list