+++ /dev/null
-#include <cpExtensions/Interaction/SeedWidget.h>
-
-#include <vtkCommand.h>
-#include <vtkEvent.h>
-#include <vtkRenderWindowInteractor.h>
-#include <vtkWidgetCallbackMapper.h>
-#include <vtkWidgetEvent.h>
-
-// -------------------------------------------------------------------------
-cpExtensions::Interaction::SeedWidget::
-Self* cpExtensions::Interaction::SeedWidget::
-New( )
-{
- return( new Self );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::SeedWidget::
-SetInteractor( vtkRenderWindowInteractor* rwi )
-{
- this->Superclass::SetInteractor( rwi );
- /* TODO
- if( rwi != NULL )
- {
- TBaseStyle* s =
- dynamic_cast< TBaseStyle* >( rwi->GetInteractorStyle( ) );
- if( s != NULL )
- {
- s->AddMouseClickCommand( Self::_Click, this );
- s->AddMouseDoubleClickCommand( Self::_DoubleClick, this );
-
- } // fi
-
- } // fi
- */
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::Interaction::SeedWidget::
-SeedWidget( )
- : Superclass( )
-{
- // These are the event callbacks supported by this widget
- this->CallbackMapper->SetCallbackMethod(
- vtkCommand::LeftButtonPressEvent,
- vtkWidgetEvent::AddPoint,
- this, Self::_AddPointAction
- );
- this->CallbackMapper->SetCallbackMethod(
- vtkCommand::RightButtonPressEvent,
- vtkWidgetEvent::Completed,
- this, Self::_CompletedAction
- );
- this->CallbackMapper->SetCallbackMethod(
- vtkCommand::MouseMoveEvent,
- vtkWidgetEvent::Move,
- this, Self::_MoveAction
- );
- this->CallbackMapper->SetCallbackMethod(
- vtkCommand::LeftButtonReleaseEvent,
- vtkWidgetEvent::EndSelect,
- this, Self::_EndSelectAction
- );
- this->CallbackMapper->SetCallbackMethod(
- vtkCommand::KeyPressEvent,
- vtkEvent::NoModifier, 127, 1, "Delete",
- vtkWidgetEvent::Delete,
- this, Self::_DeleteAction
- );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::Interaction::SeedWidget::
-~SeedWidget( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::SeedWidget::
-_AddPointAction( vtkAbstractWidget* wdg )
-{
- Self* self = dynamic_cast< Self* >( wdg );
- if( self == NULL )
- return;
- auto iren = self->GetInteractor( );
- if( iren == NULL )
- return;
- int shift = iren->GetShiftKey( );
- if( shift == 1 )
- Self::AddPointAction( wdg );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::SeedWidget::
-_CompletedAction( vtkAbstractWidget* wdg )
-{
- // Do nothing
- Self::CompletedAction( wdg );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::SeedWidget::
-_MoveAction( vtkAbstractWidget* wdg )
-{
- // Do nothing
- Self::MoveAction( wdg );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::SeedWidget::
-_EndSelectAction( vtkAbstractWidget* wdg )
-{
- // Do nothing
- Self::EndSelectAction( wdg );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::SeedWidget::
-_DeleteAction( vtkAbstractWidget* wdg )
-{
- // Do nothing
- Self::DeleteAction( wdg );
-}
-
-// -------------------------------------------------------------------------
-/* TODO
- void cpExtensions::Interaction::SeedWidget::
- _Click(
- void* data, const TBaseStyle::ButtonID& button,
- int* idx, double* pos, bool alt, bool ctr, bool sft
- )
- {
- SeedWidget* self = reinterpret_cast< SeedWidget* >( data );
- if( self == NULL )
- return;
- if( self->WidgetState == vtkSeedWidget::MovingSeed )
- return;
-
- int st = self->WidgetRep->ComputeInteractionState( idx[ 0 ], idx[ 1 ] );
- if( st == vtkSeedRepresentation::NearSeed )
- {
- self->WidgetState = vtkSeedWidget::MovingSeed;
-
- // Invoke an event on ourself for the handles
- self->InvokeEvent( vtkCommand::LeftButtonPressEvent, NULL );
- self->Superclass::StartInteraction( );
- self->InvokeEvent( vtkCommand::StartInteractionEvent, NULL );
- self->EventCallbackCommand->SetAbortFlag( 1 );
- self->Render( );
-
- } // fi
- }
-
- // -------------------------------------------------------------------------
- void cpExtensions::Interaction::SeedWidget::
- _DoubleClick(
- void* data, const TBaseStyle::ButtonID& button,
- int* idx, double* pos, bool alt, bool ctr, bool sft
- )
- {
- Self::AddPointAction( reinterpret_cast< vtkAbstractWidget* >( data ) );
- }
-*/
-
-// eof - $RCSfile$