1 #include "PipelineEditor.h"
2 #include "ui_PipelineEditor.h"
4 #include <cpPipelineEditor/Editor.h>
7 // -------------------------------------------------------------------------
9 PipelineEditor( int argc, char* argv[], QApplication* app, QWidget* parent )
10 : Superclass( argc, argv, app, parent ),
11 m_UI( new Ui::PipelineEditor )
13 // Basic configuration
14 this->m_UI->setupUi( this );
16 this->m_UI->LoadedPlugins,
18 this->m_UI->Canvas->editor( )
21 // Connect actions to slots
23 this->m_UI->ButtonLoadPluginsFile, SIGNAL( clicked( ) ),
24 this, SLOT( _InteractiveLoadPlugins( ) )
27 this->m_UI->ButtonLoadPluginsPath, SIGNAL( clicked( ) ),
28 this, SLOT( _InteractiveLoadPluginsFromPath( ) )
31 this->m_UI->ActionOpenWorkspace, SIGNAL( triggered( ) ),
32 this, SLOT( _InteractiveLoadWorkspace( ) )
35 this->m_UI->ActionSaveWorkspace, SIGNAL( triggered( ) ),
36 this, SLOT( _InteractiveSaveWorkspace( ) )
39 this->m_UI->Canvas->editor( ),
40 SIGNAL( execFilter( const std::string& ) ),
42 SLOT( _ExecFilter( const std::string& ) )
45 this->m_UI->Canvas->editor( ),
46 SIGNAL( showFilterOutput( const std::string&, const std::string& ) ),
48 SLOT( _ShowFilterOutput( const std::string&, const std::string& ) )
52 // -------------------------------------------------------------------------
59 // -------------------------------------------------------------------------
62 const std::string& filter_name, const std::string& output_name
65 typedef cpPlugins::DataObject _TDataObject;
67 // Update filter, if needed
68 this->_ExecFilter( filter_name );
71 auto filter = this->m_Workspace.GetFilter( filter_name );
74 auto output = filter->GetOutputData( output_name );
77 std::string data_name = output_name + "@" + filter_name;
78 auto idata = output->GetVTK< vtkImageData >( );
79 auto mdata = output->GetVTK< vtkPolyData >( );
82 if( this->m_UI->Viewer->AddData( idata, data_name, "" ) )
84 if( this->m_UI->Viewer->GetNumberOfData( ) > 1 )
85 this->m_UI->Viewer->SetDataColor( data_name, 1, 0, 0 );
87 this->m_UI->Viewer->SetMainImage( data_name );
89 this->m_UI->Viewer->ShowData( data_name );
94 else if( mdata != NULL )
96 if( this->m_UI->Viewer->AddData( mdata, data_name ) )
98 this->m_UI->Viewer->SetDataColor( data_name, 1, 0, 0 );
100 this->m_UI->Viewer->ShowData( data_name );
106 QMessageBox::critical(
108 QMessageBox::tr( "Error showing data" ),
109 QMessageBox::tr( "No known VTK conversion!" )