]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 12 Jan 2016 02:58:56 +0000 (21:58 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 12 Jan 2016 02:58:56 +0000 (21:58 -0500)
appli/cpPipelineEditor/QNEBlock.cxx
appli/cpPipelineEditor/QNEBlock.h
appli/cpPipelineEditor/QNodesEditor.cxx
lib/cpExtensions/DataStructures/Graph.h
lib/cpExtensions/DataStructures/Graph.hxx

index 071effc1077bf48a23f420f4514a9987938b043d..5d6f16c4e6b1e674ae0c49e8ab7c6608de89cbe2 100644 (file)
 \r
 // -------------------------------------------------------------------------\r
 PipelineEditor::QNEBlock::\r
-QNEBlock( QGraphicsItem* parent, QGraphicsScene* scene )\r
+QNEBlock( TFilter* filter, QGraphicsItem* parent, QGraphicsScene* scene )\r
   : Superclass( parent, scene ),\r
     m_HorzMargin( 20 ),\r
     m_VertMargin( 5 ),\r
     m_NamePort( NULL ),\r
-    m_TypePort( NULL )\r
+    m_TypePort( NULL ),\r
+    m_Filter( filter )\r
 {\r
   QPainterPath p;\r
   p.addRoundedRect( -50, -15, 100, 30, 5, 5 );\r
@@ -69,6 +70,7 @@ setNamePort( const QString& txt )
   if( this->m_NamePort == NULL )\r
     this->m_NamePort = new QNENamePort( this );\r
   this->m_NamePort->setName( txt );\r
+  this->m_Filter->SetName( txt.toStdString( ) );\r
   this->_configPort( this->m_NamePort );\r
 }\r
 \r
@@ -121,7 +123,7 @@ ports( )
 PipelineEditor::QNEBlock* PipelineEditor::QNEBlock::\r
 clone( )\r
 {\r
-  QNEBlock* b = new QNEBlock( 0, this->scene( ) );\r
+  QNEBlock* b = new QNEBlock( this->m_Filter, 0, this->scene( ) );\r
   foreach( QGraphicsItem* i, this->childItems( ) )\r
   {\r
     QNENamePort* np = dynamic_cast< QNENamePort* >( i );\r
index 6b591ac726c15b8cae1016398d936289ff762bf6..dfe51991deb45c99bc576038c46b6a26853c4029 100644 (file)
@@ -28,6 +28,7 @@
 #define __PIPELINEEDITOR__QNEBLOCK__H__\r
 \r
 #include <QGraphicsPathItem>\r
+#include <cpPlugins/Interface/ProcessObject.h>\r
 \r
 namespace PipelineEditor\r
 {\r
@@ -43,11 +44,15 @@ namespace PipelineEditor
   public:\r
     typedef QNEBlock          Self;\r
     typedef QGraphicsPathItem Superclass;\r
+    typedef cpPlugins::Interface::ProcessObject TFilter;\r
   \r
   public:\r
     enum { Type = QGraphicsItem::UserType + 6 };\r
 \r
-    QNEBlock( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );\r
+    QNEBlock(\r
+      TFilter* filter,\r
+      QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL\r
+      );\r
     virtual ~QNEBlock( );\r
 \r
     void setNamePort( const QString& txt );\r
@@ -98,6 +103,8 @@ namespace PipelineEditor
     QNETypePort* m_TypePort;\r
     QVector< QNEInputPort* >  m_InputPorts;\r
     QVector< QNEOutputPort* > m_OutputPorts;\r
+\r
+    TFilter::Pointer m_Filter;\r
   };\r
 \r
 } // ecapseman\r
index e026dda9d12f683e1cf9c495dbe9662ace367fd6..21008db5e9a27a2b13ccb4b9ad08f7e8e08f85f3 100644 (file)
@@ -210,7 +210,7 @@ _CreateBlock( TFilter* f, const QPointF& pnt )
     return;\r
 \r
   // Add block\r
-  QNEBlock* b = new QNEBlock( 0, this->m_Scene );\r
+  QNEBlock* b = new QNEBlock( f, 0, this->m_Scene );\r
   b->setNamePort( f->GetName( ) );\r
   b->setTypePort( f->GetClassName( ) );\r
   b->setPos( pnt );\r
@@ -264,7 +264,7 @@ _DoubleClick( QGraphicsSceneMouseEvent* evt, QGraphicsItem* item )
           );\r
         if( ok )\r
         {\r
-          block->namePort( )->setName( new_name );\r
+          block->setNamePort( new_name );\r
           this->m_Workspace->GetGraph( )->RenameVertex(\r
             old_name.toStdString( ),\r
             new_name.toStdString( )\r
index b11b7031891437142ee70ce33dd3665dc872b3b4..59679c8671e3a1aa262cb3317283e6f41f488f56 100644 (file)
@@ -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;
 
index c9c67cf4d709a77be4cfb264d56acc356715003b..ef334d3c487d0535aff1683358b1989a5ddb1b92 100644 (file)
@@ -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 >::