From ddac653a6488ed63e893808a3bf062a44a14de58 Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Fri, 30 Sep 2016 08:28:26 -0500 Subject: [PATCH] ... --- plugins/Widgets/SeedWidget.cxx | 203 +++++++++++++++++---------------- 1 file changed, 102 insertions(+), 101 deletions(-) diff --git a/plugins/Widgets/SeedWidget.cxx b/plugins/Widgets/SeedWidget.cxx index 646c7b0..2b11821 100644 --- a/plugins/Widgets/SeedWidget.cxx +++ b/plugins/Widgets/SeedWidget.cxx @@ -16,35 +16,34 @@ // 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 ); @@ -52,8 +51,8 @@ namespace cpPluginsWidgets { auto rep = dynamic_cast< vtkSeedRepresentation* >( - wdg->GetRepresentation( ) - ); + wdg->GetRepresentation( ) + ); if( rep != NULL ) { unsigned long nSeeds = rep->GetNumberOfSeeds( ); @@ -65,44 +64,46 @@ namespace cpPluginsWidgets 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; @@ -291,49 +292,49 @@ _GD0_Image( vtkImageData* image ) { 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 + } } @@ -348,11 +349,11 @@ TWidgetData( { 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( ); -- 2.47.1