From 243d2b4557e27cde3789ab089403cbe03aede786 Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Mon, 11 Jan 2016 21:58:56 -0500 Subject: [PATCH] ... --- appli/cpPipelineEditor/QNEBlock.cxx | 8 +++++--- appli/cpPipelineEditor/QNEBlock.h | 9 ++++++++- appli/cpPipelineEditor/QNodesEditor.cxx | 4 ++-- lib/cpExtensions/DataStructures/Graph.h | 2 ++ lib/cpExtensions/DataStructures/Graph.hxx | 16 ++++++++++++++++ 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/appli/cpPipelineEditor/QNEBlock.cxx b/appli/cpPipelineEditor/QNEBlock.cxx index 071effc..5d6f16c 100644 --- a/appli/cpPipelineEditor/QNEBlock.cxx +++ b/appli/cpPipelineEditor/QNEBlock.cxx @@ -36,12 +36,13 @@ // ------------------------------------------------------------------------- PipelineEditor::QNEBlock:: -QNEBlock( QGraphicsItem* parent, QGraphicsScene* scene ) +QNEBlock( TFilter* filter, QGraphicsItem* parent, QGraphicsScene* scene ) : Superclass( parent, scene ), m_HorzMargin( 20 ), m_VertMargin( 5 ), m_NamePort( NULL ), - m_TypePort( NULL ) + m_TypePort( NULL ), + m_Filter( filter ) { QPainterPath p; p.addRoundedRect( -50, -15, 100, 30, 5, 5 ); @@ -69,6 +70,7 @@ setNamePort( const QString& txt ) if( this->m_NamePort == NULL ) this->m_NamePort = new QNENamePort( this ); this->m_NamePort->setName( txt ); + this->m_Filter->SetName( txt.toStdString( ) ); this->_configPort( this->m_NamePort ); } @@ -121,7 +123,7 @@ ports( ) PipelineEditor::QNEBlock* PipelineEditor::QNEBlock:: clone( ) { - QNEBlock* b = new QNEBlock( 0, this->scene( ) ); + QNEBlock* b = new QNEBlock( this->m_Filter, 0, this->scene( ) ); foreach( QGraphicsItem* i, this->childItems( ) ) { QNENamePort* np = dynamic_cast< QNENamePort* >( i ); diff --git a/appli/cpPipelineEditor/QNEBlock.h b/appli/cpPipelineEditor/QNEBlock.h index 6b591ac..dfe5199 100644 --- a/appli/cpPipelineEditor/QNEBlock.h +++ b/appli/cpPipelineEditor/QNEBlock.h @@ -28,6 +28,7 @@ #define __PIPELINEEDITOR__QNEBLOCK__H__ #include +#include namespace PipelineEditor { @@ -43,11 +44,15 @@ namespace PipelineEditor public: typedef QNEBlock Self; typedef QGraphicsPathItem Superclass; + typedef cpPlugins::Interface::ProcessObject TFilter; public: enum { Type = QGraphicsItem::UserType + 6 }; - QNEBlock( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL ); + QNEBlock( + TFilter* filter, + QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL + ); virtual ~QNEBlock( ); void setNamePort( const QString& txt ); @@ -98,6 +103,8 @@ namespace PipelineEditor QNETypePort* m_TypePort; QVector< QNEInputPort* > m_InputPorts; QVector< QNEOutputPort* > m_OutputPorts; + + TFilter::Pointer m_Filter; }; } // ecapseman diff --git a/appli/cpPipelineEditor/QNodesEditor.cxx b/appli/cpPipelineEditor/QNodesEditor.cxx index e026dda..21008db 100644 --- a/appli/cpPipelineEditor/QNodesEditor.cxx +++ b/appli/cpPipelineEditor/QNodesEditor.cxx @@ -210,7 +210,7 @@ _CreateBlock( TFilter* f, const QPointF& pnt ) return; // Add block - QNEBlock* b = new QNEBlock( 0, this->m_Scene ); + QNEBlock* b = new QNEBlock( f, 0, this->m_Scene ); b->setNamePort( f->GetName( ) ); b->setTypePort( f->GetClassName( ) ); b->setPos( pnt ); @@ -264,7 +264,7 @@ _DoubleClick( QGraphicsSceneMouseEvent* evt, QGraphicsItem* item ) ); if( ok ) { - block->namePort( )->setName( new_name ); + block->setNamePort( new_name ); this->m_Workspace->GetGraph( )->RenameVertex( old_name.toStdString( ), new_name.toStdString( ) diff --git a/lib/cpExtensions/DataStructures/Graph.h b/lib/cpExtensions/DataStructures/Graph.h index b11b703..59679c8 100644 --- a/lib/cpExtensions/DataStructures/Graph.h +++ b/lib/cpExtensions/DataStructures/Graph.h @@ -53,10 +53,12 @@ namespace cpExtensions bool HasVertexIndex( const I& index ) const; void SetVertex( const I& index, V& vertex ); bool RenameVertex( const I& old_index, const I& new_index ); + void RemoveVertex( const I& index ); V& GetVertex( const I& index ); const V& GetVertex( const I& index ) const; void AddConnection( const I& orig, const I& dest, const C& cost ); + void RemoveConnection( const I& orig, const I& dest, const C& cost ); std::set< I > GetSinks( ) const; diff --git a/lib/cpExtensions/DataStructures/Graph.hxx b/lib/cpExtensions/DataStructures/Graph.hxx index c9c67cf..ef334d3 100644 --- a/lib/cpExtensions/DataStructures/Graph.hxx +++ b/lib/cpExtensions/DataStructures/Graph.hxx @@ -159,6 +159,14 @@ RenameVertex( const I& old_index, const I& new_index ) return( false ); } +// ------------------------------------------------------------------------- +template< class V, class C, class I > +void cpExtensions::DataStructures::Graph< V, C, I >:: +RemoveVertex( const I& index ) +{ +#error REMOVE +} + // ------------------------------------------------------------------------- template< class V, class C, class I > V& cpExtensions::DataStructures::Graph< V, C, I >:: @@ -183,6 +191,14 @@ AddConnection( const I& orig, const I& dest, const C& cost ) this->m_Matrix[ orig ][ dest ].push_back( cost ); } +// ------------------------------------------------------------------------- +template< class V, class C, class I > +void cpExtensions::DataStructures::Graph< V, C, I >:: +RemoveConnection( const I& orig, const I& dest, const C& cost ) +{ +#error remove connection +} + // ------------------------------------------------------------------------- template< class V, class C, class I > std::set< I > cpExtensions::DataStructures::Graph< V, C, I >:: -- 2.47.1