X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPipelineEditor%2FEditor.cxx;h=319edb540c7aa6de4e63aed36809d83d1eea17f7;hb=e2fb8817731f6231d34941a208e46b36dad425b2;hp=736feccf567f3d70baa0f624896a1acac131945e;hpb=1b79f6573aa3b01d97ca4f100ba9ee0c809a4243;p=cpPlugins.git diff --git a/lib/cpPipelineEditor/Editor.cxx b/lib/cpPipelineEditor/Editor.cxx index 736fecc..319edb5 100644 --- a/lib/cpPipelineEditor/Editor.cxx +++ b/lib/cpPipelineEditor/Editor.cxx @@ -74,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( ); @@ -113,14 +119,22 @@ setWorkspace( TWorkspace* ws ) // ------------------------------------------------------------------------- std::string cpPipelineEditor::Editor:: -createFilter( const std::string& filter, const QPointF& pnt ) +createFilter( + const std::string& category, + const std::string& filter, + const QPointF& pnt + ) { std::string name = filter; while( this->m_Workspace->HasFilter( name ) ) name += std::string( "_" ); - if( this->m_Workspace->CreateFilter( filter, name ) ) + if( this->m_Workspace->CreateFilter( category, 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 @@ -132,7 +146,6 @@ bool cpPipelineEditor::Editor:: deleteFilter( const std::string& name ) { std::cout << name << std::endl; -#error delete filter return( false ); } @@ -148,7 +161,6 @@ deleteConnection( << des << " " << in << " " << out << std::endl; -#error delete connection return( false ); } @@ -175,13 +187,13 @@ 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 ); @@ -223,8 +235,6 @@ _createBlock( TFilter* f, const QPointF& pnt ) } // rof - // Keep a trace of this visual graph - this->m_Graph->SetVertex( f->GetName( ), b ); return( b ); } @@ -352,15 +362,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 }