#include "PipelineEditor.h" #include "ui_PipelineEditor.h" #include #include #include #include #include #include // ------------------------------------------------------------------------- PipelineEditor:: PipelineEditor( int argc, char* argv[], QApplication* app, QWidget* parent ) : Superclass( argc, argv, app, parent ), m_UI( new Ui::PipelineEditor ) { // Basic configuration this->m_UI->setupUi( this ); this->_Configure( this->m_UI->LoadedPlugins, this->m_UI->Viewer, this->m_UI->Canvas->editor( ) ); // Connect actions to slots this->connect( this->m_UI->ButtonLoadPluginsFile, SIGNAL( clicked( ) ), this, SLOT( _InteractiveLoadPlugins( ) ) ); this->connect( this->m_UI->ButtonLoadPluginsPath, SIGNAL( clicked( ) ), this, SLOT( _InteractiveLoadPluginsFromPath( ) ) ); this->connect( this->m_UI->ActionOpenWorkspace, SIGNAL( triggered( ) ), this, SLOT( _InteractiveLoadWorkspace( ) ) ); this->connect( this->m_UI->ActionSaveWorkspace, SIGNAL( triggered( ) ), this, SLOT( _InteractiveSaveWorkspace( ) ) ); this->connect( this->m_UI->Canvas->editor( ), SIGNAL( execFilter( const std::string& ) ), this, SLOT( _ExecFilter( const std::string& ) ) ); this->connect( this->m_UI->Canvas->editor( ), SIGNAL( showFilterOutput( const std::string&, const std::string& ) ), 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& ) ) ); } // ------------------------------------------------------------------------- PipelineEditor:: ~PipelineEditor( ) { delete this->m_UI; } // ------------------------------------------------------------------------- void PipelineEditor:: _ShowFilterOutput( const std::string& filter_name, const std::string& output_name ) { // Update filter, if needed this->_ExecFilter( filter_name ); // Get output auto filter = this->m_Workspace.GetFilter( filter_name ); if( filter != NULL ) { auto id = filter->GetOutputData< vtkImageData >( output_name ); auto md = filter->GetOutputData< vtkPolyData >( output_name ); if( id != NULL ) { this->_Block( ); this->m_UI->Viewer->Clear( ); this->m_UI->Viewer->SetMainImage( id ); this->_UnBlock( ); } else if( md != NULL ) { this->_Block( ); this->m_UI->Viewer->AddMesh( md ); this->_UnBlock( ); } else QMessageBox::critical( this, QMessageBox::tr( "Error showing data" ), QMessageBox::tr( "No known VTK conversion!" ) ); } else QMessageBox::critical( this, QMessageBox::tr( "Error showing data" ), QMessageBox::tr( "Unknown filter." ) ); } // ------------------------------------------------------------------------- void PipelineEditor:: _HideFilterOutput( 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; this->m_UI->Viewer->HideData( data_name ); } // fi } // fi */ } // ------------------------------------------------------------------------- void PipelineEditor:: _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 */ } // eof - $RCSfile$