X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPipelineEditor%2FEditor.cxx;h=8fb28bdbadb77045b9b18669b8d7927fba5bd153;hb=7f121822538bc9385583fb0b369a6e47be26fbbc;hp=9ab6b35537b5af476da1c5c4ed7a7b68ad607fa7;hpb=3ac87d29be6f3484efcfb3bcc204b7f99faa1eed;p=cpPlugins.git diff --git a/lib/cpPipelineEditor/Editor.cxx b/lib/cpPipelineEditor/Editor.cxx index 9ab6b35..8fb28bd 100644 --- a/lib/cpPipelineEditor/Editor.cxx +++ b/lib/cpPipelineEditor/Editor.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include "Port.h" #include "Connection.h" @@ -73,10 +74,16 @@ setWorkspace( TWorkspace* ws ) auto vIt = this->m_Workspace->GetGraph( )->BeginVertices( ); auto vIt_end = this->m_Workspace->GetGraph( )->EndVertices( ); for( ; vIt != vIt_end; ++vIt ) - this->_createBlock( + { + auto b = this->_createBlock( dynamic_cast< TFilter* >( vIt->second.GetPointer( ) ), + vIt->first.c_str( ), QPointF( vIt->second->GetViewX( ), vIt->second->GetViewY( ) ) ); + if( b != NULL ) + this->m_Graph->SetVertex( vIt->first, b ); + + } // rof // Add edges auto rIt = this->m_Workspace->GetGraph( )->BeginEdgesRows( ); @@ -119,13 +126,40 @@ createFilter( const std::string& filter, const QPointF& pnt ) name += std::string( "_" ); if( this->m_Workspace->CreateFilter( filter, name ) ) { - this->_createBlock( this->m_Workspace->GetFilter( name ), pnt ); + auto b = this->_createBlock( + this->m_Workspace->GetFilter( name ), + name.c_str( ), + pnt + ); return( name ); } else return( "" ); } +// ------------------------------------------------------------------------- +bool cpPipelineEditor::Editor:: +deleteFilter( const std::string& name ) +{ + std::cout << name << std::endl; + return( false ); +} + +// ------------------------------------------------------------------------- +bool cpPipelineEditor::Editor:: +deleteConnection( + const std::string& src, const std::string& des, + const std::string& in, const std::string& out + ) +{ + std::cout + << src << " " + << des << " " + << in << " " + << out << std::endl; + return( false ); +} + // ------------------------------------------------------------------------- void cpPipelineEditor::Editor:: install( QGraphicsScene* s ) @@ -149,19 +183,19 @@ itemAt( const QPointF& pos ) // ------------------------------------------------------------------------- cpPipelineEditor::Block* cpPipelineEditor::Editor:: -_createBlock( TFilter* f, const QPointF& pnt ) +_createBlock( TFilter* f, const QString& name, const QPointF& pnt ) { if( f == NULL ) return( NULL ); // Add block - Block* b = new Block( f, 0, this->m_Scene ); + Block* b = new Block( f, name, 0, this->m_Scene ); + b->setEditor( this ); b->setPos( pnt ); // Mark exposed inputs auto& e_in = this->m_Workspace->GetExposedInputPorts( ); - std::set< std::string > f_in; - f->GetInputsNames( f_in ); + auto f_in = f->GetInputsNames( ); for( auto iIt = f_in.begin( ); iIt != f_in.end( ); ++iIt ) { auto eIt = e_in.begin( ); @@ -180,8 +214,7 @@ _createBlock( TFilter* f, const QPointF& pnt ) // Mark exposed outputs auto& e_out = this->m_Workspace->GetExposedOutputPorts( ); - std::set< std::string > f_out; - f->GetOutputsNames( f_out ); + auto f_out = f->GetOutputsNames( ); for( auto iIt = f_out.begin( ); iIt != f_out.end( ); ++iIt ) { auto eIt = e_out.begin( ); @@ -198,8 +231,6 @@ _createBlock( TFilter* f, const QPointF& pnt ) } // rof - // Keep a trace of this visual graph - this->m_Graph->SetVertex( f->GetName( ), b ); return( b ); } @@ -232,6 +263,22 @@ eventFilter( QObject* o, QEvent* e ) return( this->Superclass::eventFilter( o, e ) ); } +// ------------------------------------------------------------------------- +void cpPipelineEditor::Editor:: +updateFilter( const std::string& filter_name ) +{ + emit execFilter( filter_name ); +} + +// ------------------------------------------------------------------------- +void cpPipelineEditor::Editor:: +showOutputData( + const std::string& filter_name, const std::string& output_name + ) +{ + emit showFilterOutput( filter_name, output_name ); +} + // ------------------------------------------------------------------------- cpPipelineEditor_Editor_Callback_CODE( ContextMenu ) { @@ -311,15 +358,11 @@ cpPipelineEditor_Editor_Callback_CODE( MouseDoubleClick ) old_name.toStdString( ), new_name.toStdString( ) ); - if( ok ) - { - block->setNamePort( new_name ); - this->m_Workspace->RenameFilter( - old_name.toStdString( ), - new_name.toStdString( ) - ); - - } // fi + block->setNamePort( new_name ); + this->m_Workspace->RenameFilter( + old_name.toStdString( ), + new_name.toStdString( ) + ); } // fi }