X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2FPipelineEditor%2FPipelineEditor.cxx;h=65fb82b7f816cd9c8403844a6c5e05b4bae47b7d;hb=e6f0b27971bbd8175ec5e8615e90b8fba9fa07c9;hp=7c06aac5af584e0432a6264c967e55e090fab3bc;hpb=e6bef8234ffd9030c68a6786466a08cf144b7871;p=cpPlugins.git diff --git a/appli/PipelineEditor/PipelineEditor.cxx b/appli/PipelineEditor/PipelineEditor.cxx index 7c06aac..65fb82b 100644 --- a/appli/PipelineEditor/PipelineEditor.cxx +++ b/appli/PipelineEditor/PipelineEditor.cxx @@ -1,9 +1,13 @@ #include "PipelineEditor.h" #include "ui_PipelineEditor.h" -#include -#include #include + +#include +#include + +#include +#include #include // ------------------------------------------------------------------------- @@ -76,56 +80,26 @@ _ShowFilterOutput( const std::string& filter_name, const std::string& output_name ) { - typedef cpPlugins::DataObject _TDataObject; - // Update filter, if needed this->_ExecFilter( filter_name ); // Get output - auto filter = this->m_Workspace.GetFilter( filter_name ); - if( filter != NULL ) + auto output = this->m_Workspace.GetOutput( filter_name, output_name ); + if( output == NULL ) { - auto output = filter->GetOutputData( output_name ); - if( output != NULL ) - { - std::string data_name = output_name + "@" + filter_name; - auto idata = output->GetVTK< vtkImageData >( ); - auto mdata = output->GetVTK< vtkPolyData >( ); - if( idata != NULL ) - { - if( this->m_UI->Viewer->AddData( idata, data_name, "" ) ) - { - if( this->m_UI->Viewer->GetNumberOfData( ) > 1 ) - this->m_UI->Viewer->SetDataColor( data_name, 1, 0, 0 ); - else - this->m_UI->Viewer->SetMainImage( data_name ); - this->_Block( ); - this->m_UI->Viewer->ShowData( data_name ); - this->_UnBlock( ); - - } // fi - } - else if( mdata != NULL ) - { - if( this->m_UI->Viewer->AddData( mdata, data_name ) ) - { - this->m_UI->Viewer->SetDataColor( data_name, 1, 0, 0 ); - this->_Block( ); - this->m_UI->Viewer->ShowData( data_name ); - this->_UnBlock( ); - - } // fi - } - else - QMessageBox::critical( - this, - QMessageBox::tr( "Error showing data" ), - QMessageBox::tr( "No known VTK conversion!" ) - ); - - } // fi + QMessageBox::critical( + this, + QMessageBox::tr( "Error showing data" ), + QMessageBox::tr( "Unknown port name." ) + ); + return; } // fi + + // Create and associate actor + this->_Block( ); + this->m_UI->Viewer->AddActor( output->GetVTKActor( ) ); + this->_UnBlock( ); } // ------------------------------------------------------------------------- @@ -135,18 +109,20 @@ _HideFilterOutput( ) { // Get output - auto filter = this->m_Workspace.GetFilter( filter_name ); - if( filter != NULL ) - { - auto output = filter->GetOutputData( output_name ); - if( output != NULL ) - { - std::string data_name = output_name + "@" + filter_name; - this->m_UI->Viewer->HideData( data_name ); - - } // fi - - } // fi + /* TODO + auto filter = this->m_Workspace.GetFilter( filter_name ); + if( filter != NULL ) + { + auto output = filter->GetOutputData( output_name ); + if( output != NULL ) + { + std::string data_name = output_name + "@" + filter_name; + this->m_UI->Viewer->HideData( data_name ); + + } // fi + + } // fi + */ } // ------------------------------------------------------------------------- @@ -155,30 +131,35 @@ _PropertiesFilterOutput( const std::string& filter_name, const std::string& output_name ) { - // Get output - auto filter = this->m_Workspace.GetFilter( filter_name ); - if( filter != NULL ) - { - auto output = filter->GetOutputData( output_name ); - if( output != NULL ) - { - std::string data_name = output_name + "@" + filter_name; - auto prop = this->m_UI->Viewer->GetProp( data_name ); - - cpExtensions::QT::PropertyWidget* wdg = - new cpExtensions::QT::PropertyWidget( NULL ); - wdg->SetProp( prop ); - wdg->SetRenderWindow( this->m_UI->Viewer->GetInteractor( 3 )->GetRenderWindow( ) ); - wdg->show( ); - } - else - QMessageBox::critical( - this, - QMessageBox::tr( "Error showing data" ), - QMessageBox::tr( "No known VTK conversion!" ) - ); - - } // fi + /* TODO + auto filter = this->m_Workspace.GetFilter( filter_name ); + if( filter != NULL ) + { + auto output = filter->GetOutputData< vtkPolyData >( output_name ); + if( output != NULL ) + { + auto actor = this->m_UI->Viewer->GetActor( output ); + if( actor != NULL ) + { + cpExtensions::QT::PropertyWidget* wdg = + new cpExtensions::QT::PropertyWidget( NULL ); + wdg->SetProp( actor ); + wdg->SetRenderWindow( + this->m_UI->Viewer->GetInteractor( 3 )->GetRenderWindow( ) + ); + wdg->show( ); + + } // fi + } + else + QMessageBox::critical( + this, + QMessageBox::tr( "Error showing data" ), + QMessageBox::tr( "No known VTK conversion!" ) + ); + + } // fi + */ } // eof - $RCSfile$