// This callback is responsible for changing update time
namespace cpPluginsWidgets
{
- /**
- */
- class SeedWidgetCallback
- : public vtkCommand
- {
- public:
- static SeedWidgetCallback* New( )
- { return( new SeedWidgetCallback ); }
- virtual void Execute( vtkObject* caller, unsigned long id, void* data )
- {
- /*
- typedef cpPluginsWidgets::SeedWidget::TImageActor _TImageActor;
- auto actor = dynamic_cast< _TImageActor* >( caller );
-*/
-/*
- if( id == vtkCommand::InteractionEvent && actor != NULL )
- {
- int slice = actor->GetSliceNumber( );
- if( this->Data->ActualWidgetId != slice )
- {
- this->Data->Widgets[ this->Data->ActualWidgetId ]->EnabledOff( );
- this->Data->Widgets[ slice ]->EnabledOn( );
- this->Data->ActualWidgetId = slice;
-
- } // fi
- }
- else
-*/
- // id == vtkCommand::CursorChangedEvent ||
+ /**
+ */
+ class SeedWidgetCallback
+ : public vtkCommand
+ {
+ public:
+ static SeedWidgetCallback* New( )
+ { return( new SeedWidgetCallback ); }
+ virtual void Execute( vtkObject* caller, unsigned long id, void* data )
+ {
+ /* TODO
+ typedef cpPluginsWidgets::SeedWidget::TImageActor _TImageActor;
+ auto actor = dynamic_cast< _TImageActor* >( caller );
+ */
+ /* TODO
+ if( id == vtkCommand::InteractionEvent && actor != NULL )
+ {
+ int slice = actor->GetSliceNumber( );
+ if( this->Data->ActualWidgetId != slice )
+ {
+ this->Data->Widgets[ this->Data->ActualWidgetId ]->EnabledOff( );
+ this->Data->Widgets[ slice ]->EnabledOn( );
+ this->Data->ActualWidgetId = slice;
+ } // fi
+ }
+ else
+ */
+ // id == vtkCommand::CursorChangedEvent ||
if( id == vtkCommand::PlacePointEvent )
{
auto wdg = dynamic_cast< cpExtensions::Interaction::SeedWidget* >( caller );
{
auto rep =
dynamic_cast< vtkSeedRepresentation* >(
- wdg->GetRepresentation( )
- );
+ wdg->GetRepresentation( )
+ );
if( rep != NULL )
{
unsigned long nSeeds = rep->GetNumberOfSeeds( );
Seeds->GetPoints( )->InsertNextPoint( pos );
Seeds->GetVerts( )->InsertNextCell( 1 );
Seeds->GetVerts( )->InsertCellPoint( nSeeds - 1 );
- }
- } // fi
-
-
- }
- }
- }
- protected:
- SeedWidgetCallback( )
- : vtkCommand( ),
- Seeds( NULL )
-/*
- ,
- Widget( NULL ),
- Data( NULL )
- */
- { }
- virtual ~SeedWidgetCallback( ) { }
- public:
- vtkPolyData* Seeds;
- /*
- public:
- SeedWidget* Widget;
- SeedWidget::TWidgetData* Data;
- */
- };
-
- } // ecapseman
+ } // fi
+
+ } // fi
+
+ } // fi
+
+ } // fi
+ }
+
+ protected:
+ SeedWidgetCallback( )
+ : vtkCommand( ),
+ Seeds( NULL )
+ /*
+ ,
+ Widget( NULL ),
+ Data( NULL )
+ */
+ { }
+ virtual ~SeedWidgetCallback( ) { }
+ public:
+ vtkPolyData* Seeds;
+ /*
+ public:
+ SeedWidget* Widget;
+ SeedWidget::TWidgetData* Data;
+ */
+ };
+
+} // ecapseman
// -------------------------------------------------------------------------
cpPluginsWidgets::SeedWidget::
SeedWidget( )
: Superclass( )
- /* TODO
- ,
- m_Configured( false )
- */
+ /* TODO
+ ,
+ m_Configured( false )
+ */
{
typedef cpPlugins::BaseObjects::DataObject _TData;
typedef cpPlugins::DataObjects::Mesh _TMesh;
{
auto cb = vtkSmartPointer< SeedWidgetCallback >::New( );
cb->Seeds = this->GetOutputData< vtkPolyData >( "Output" );
- this->m_Command = cb;
+ this->m_Command = cb;
- for(
- auto inIt = this->m_Interactors.begin( );
- inIt != this->m_Interactors.end( );
- ++inIt
- )
- {
- auto rends = ( *inIt )->GetRenderWindow( )->GetRenderers( );
- std::set< TImageActor* > all_props;
- if( rends != NULL )
+ for(
+ auto inIt = this->m_Interactors.begin( );
+ inIt != this->m_Interactors.end( );
+ ++inIt
+ )
{
- rends->InitTraversal( );
- while( vtkRenderer* ren = rends->GetNextItem( ) )
+ auto rends = ( *inIt )->GetRenderWindow( )->GetRenderers( );
+ std::set< TImageActor* > all_props;
+ if( rends != NULL )
{
- auto props = ren->GetViewProps( );
- props->InitTraversal( );
- while( vtkProp* p = props->GetNextProp( ) )
+ rends->InitTraversal( );
+ while( vtkRenderer* ren = rends->GetNextItem( ) )
{
- auto image_actor = dynamic_cast< TImageActor* >( p );
- if( image_actor != NULL )
+ auto props = ren->GetViewProps( );
+ props->InitTraversal( );
+ while( vtkProp* p = props->GetNextProp( ) )
{
- if( image_actor->GetImage( ) == image )
- all_props.insert( image_actor );
+ auto image_actor = dynamic_cast< TImageActor* >( p );
+ if( image_actor != NULL )
+ {
+ if( image_actor->GetImage( ) == image )
+ all_props.insert( image_actor );
- }
+ }
+ } // elihw
} // elihw
- } // elihw
- } // fi
- if( all_props.size( ) == 1 )
- {
- this->m_Data[ *inIt ] =
- new TWidgetData( this, *( all_props.begin( ) ), *inIt, this->m_Command );
- }
+ } // fi
+ if( all_props.size( ) == 1 )
+ {
+ this->m_Data[ *inIt ] =
+ new TWidgetData( this, *( all_props.begin( ) ), *inIt, this->m_Command );
+ }
- } // rof
-}
-else
-{
- // akjhdaksjhd
-}
+ } // rof
+ }
+ else
+ {
+ // akjhdaksjhd
+ }
}
{
auto cb = dynamic_cast< SeedWidgetCallback* >( cmd );
/*
- auto cb = vtkSmartPointer< SeedWidgetCallback >::New( );
- cb->Widget = seedWidget;
- cb->Data = this;
- this->Command = cb;
- actor->AddObserver( vtkCommand::InteractionEvent, cb );
+ auto cb = vtkSmartPointer< SeedWidgetCallback >::New( );
+ cb->Widget = seedWidget;
+ cb->Data = this;
+ this->Command = cb;
+ actor->AddObserver( vtkCommand::InteractionEvent, cb );
*/
/* TODO
auto image = actor->GetImage( );