[vtk-developers] proposition: disabling interaction in vtk3DW idgets, API addition

Miller, James V (Research) millerjv at crd.ge.com
Mon Sep 23 16:00:10 EDT 2002


The vtkRenderWindowInteractor has two methods Enable()/Disable().

Should the widget's method have the same name as the interactor? 
In other words, should the widget method just be called Enable()/Disable()?

Jim

> -----Original Message-----
> From: Dean Inglis [mailto:dean.inglis at on.aibn.com]
> Sent: Monday, September 23, 2002 2:32 PM
> To: Vtk-Developers
> Subject: RE: [vtk-developers] proposition: disabling interaction in
> vtk3DWidgets, API addition
> 
> 
> 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
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at public.kitware.com
> http://public.kitware.com/mailman/listinfo/vtk-developers
> 



More information about the vtk-developers mailing list