X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2FPipelineEditor%2FPipelineEditor.cxx;h=65fb82b7f816cd9c8403844a6c5e05b4bae47b7d;hb=e6f0b27971bbd8175ec5e8615e90b8fba9fa07c9;hp=eeaee071237b6a810e4f67c2f2e15ce12dbe6ddc;hpb=b445d953049ba15290197549dcd4e31367e3c8a5;p=cpPlugins.git diff --git a/appli/PipelineEditor/PipelineEditor.cxx b/appli/PipelineEditor/PipelineEditor.cxx index eeaee07..65fb82b 100644 --- a/appli/PipelineEditor/PipelineEditor.cxx +++ b/appli/PipelineEditor/PipelineEditor.cxx @@ -1,9 +1,15 @@ #include "PipelineEditor.h" #include "ui_PipelineEditor.h" -#include #include +#include +#include + +#include +#include +#include + // ------------------------------------------------------------------------- PipelineEditor:: PipelineEditor( int argc, char* argv[], QApplication* app, QWidget* parent ) @@ -47,6 +53,18 @@ PipelineEditor( int argc, char* argv[], QApplication* app, QWidget* parent ) this, SLOT( _ShowFilterOutput( const std::string&, const std::string& ) ) ); + this->connect( + this->m_UI->Canvas->editor( ), + SIGNAL( hideFilterOutput( const std::string&, const std::string& ) ), + this, + SLOT( _HideFilterOutput( const std::string&, const std::string& ) ) + ); + this->connect( + this->m_UI->Canvas->editor( ), + SIGNAL( visualPropertiesFilterOutput( const std::string&, const std::string& ) ), + this, + SLOT( _PropertiesFilterOutput( const std::string&, const std::string& ) ) + ); } // ------------------------------------------------------------------------- @@ -62,56 +80,86 @@ _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( ); +} + +// ------------------------------------------------------------------------- +void PipelineEditor:: +_HideFilterOutput( + const std::string& filter_name, const std::string& output_name + ) +{ + // Get output + /* 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 + */ +} + +// ------------------------------------------------------------------------- +void PipelineEditor:: +_PropertiesFilterOutput( + const std::string& filter_name, const std::string& output_name + ) +{ + /* 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$