X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPipelineEditor%2FEditor.cxx;h=289ee46431d2e8e51dc0e5f51eb64a658396cd67;hb=733108d258a27799df875ceda2d84c3cafea64d3;hp=2a0fca6a04a4bb222ea61ca8d4e2dbf70e7d42dc;hpb=19a9e1774044cc32c415ad38695800c1d169820d;p=cpPlugins.git diff --git a/lib/cpPipelineEditor/Editor.cxx b/lib/cpPipelineEditor/Editor.cxx index 2a0fca6..289ee46 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,20 +119,51 @@ 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 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 ) @@ -150,20 +187,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( ); @@ -182,8 +218,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( ); @@ -200,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 ); } @@ -250,6 +283,24 @@ showOutputData( emit showFilterOutput( filter_name, output_name ); } +// ------------------------------------------------------------------------- +void cpPipelineEditor::Editor:: +hideOutputData( + const std::string& filter_name, const std::string& output_name + ) +{ + emit hideFilterOutput( filter_name, output_name ); +} + +// ------------------------------------------------------------------------- +void cpPipelineEditor::Editor:: +visualPropertiesOutputData( + const std::string& filter_name, const std::string& output_name + ) +{ + emit visualPropertiesFilterOutput( filter_name, output_name ); +} + // ------------------------------------------------------------------------- cpPipelineEditor_Editor_Callback_CODE( ContextMenu ) { @@ -329,15 +380,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 }