]> Creatis software - cpPlugins.git/blobdiff - lib/cpPipelineEditor/Editor.cxx
MPR objects updated
[cpPlugins.git] / lib / cpPipelineEditor / Editor.cxx
index 736feccf567f3d70baa0f624896a1acac131945e..289ee46431d2e8e51dc0e5f51eb64a658396cd67 100644 (file)
@@ -74,10 +74,16 @@ setWorkspace( TWorkspace* ws )
   auto vIt = this->m_Workspace->GetGraph( )->BeginVertices( );\r
   auto vIt_end = this->m_Workspace->GetGraph( )->EndVertices( );\r
   for( ; vIt != vIt_end; ++vIt )\r
-    this->_createBlock(\r
+  {\r
+    auto b = this->_createBlock(\r
       dynamic_cast< TFilter* >( vIt->second.GetPointer( ) ),\r
+      vIt->first.c_str( ),\r
       QPointF( vIt->second->GetViewX( ), vIt->second->GetViewY( ) )\r
       );\r
+    if( b != NULL )\r
+      this->m_Graph->SetVertex( vIt->first, b );\r
+\r
+  } // rof\r
 \r
   // Add edges\r
   auto rIt = this->m_Workspace->GetGraph( )->BeginEdgesRows( );\r
@@ -113,14 +119,22 @@ setWorkspace( TWorkspace* ws )
 \r
 // -------------------------------------------------------------------------\r
 std::string cpPipelineEditor::Editor::\r
-createFilter( const std::string& filter, const QPointF& pnt )\r
+createFilter(\r
+  const std::string& category,\r
+  const std::string& filter,\r
+  const QPointF& pnt\r
+  )\r
 {\r
   std::string name = filter;\r
   while( this->m_Workspace->HasFilter( name ) )\r
     name += std::string( "_" );\r
-  if( this->m_Workspace->CreateFilter( filter, name ) )\r
+  if( this->m_Workspace->CreateFilter( category, filter, name ) )\r
   {\r
-    this->_createBlock( this->m_Workspace->GetFilter( name ), pnt );\r
+    auto b = this->_createBlock(\r
+      this->m_Workspace->GetFilter( name ),\r
+      name.c_str( ),\r
+      pnt\r
+      );\r
     return( name );\r
   }\r
   else\r
@@ -132,7 +146,6 @@ bool cpPipelineEditor::Editor::
 deleteFilter( const std::string& name )\r
 {\r
   std::cout << name << std::endl;\r
-#error delete filter\r
   return( false );\r
 }\r
 \r
@@ -148,7 +161,6 @@ deleteConnection(
     << des << " "\r
     << in << " "\r
     << out << std::endl;\r
-#error delete connection\r
   return( false );\r
 }\r
 \r
@@ -175,13 +187,13 @@ itemAt( const QPointF& pos )
 \r
 // -------------------------------------------------------------------------\r
 cpPipelineEditor::Block* cpPipelineEditor::Editor::\r
-_createBlock( TFilter* f, const QPointF& pnt )\r
+_createBlock( TFilter* f, const QString& name, const QPointF& pnt )\r
 {\r
   if( f == NULL )\r
     return( NULL );\r
 \r
   // Add block\r
-  Block* b = new Block( f, 0, this->m_Scene );\r
+  Block* b = new Block( f, name, 0, this->m_Scene );\r
   b->setEditor( this );\r
   b->setPos( pnt );\r
 \r
@@ -223,8 +235,6 @@ _createBlock( TFilter* f, const QPointF& pnt )
 \r
   } // rof\r
 \r
-  // Keep a trace of this visual graph\r
-  this->m_Graph->SetVertex( f->GetName( ), b );\r
   return( b );\r
 }\r
 \r
@@ -273,6 +283,24 @@ showOutputData(
   emit showFilterOutput( filter_name, output_name );\r
 }\r
 \r
+// -------------------------------------------------------------------------\r
+void cpPipelineEditor::Editor::\r
+hideOutputData(\r
+  const std::string& filter_name, const std::string& output_name\r
+  )\r
+{\r
+  emit hideFilterOutput( filter_name, output_name );\r
+}\r
+\r
+// -------------------------------------------------------------------------\r
+void cpPipelineEditor::Editor::\r
+visualPropertiesOutputData(\r
+  const std::string& filter_name, const std::string& output_name\r
+  )\r
+{\r
+  emit visualPropertiesFilterOutput( filter_name, output_name );\r
+}\r
+\r
 // -------------------------------------------------------------------------\r
 cpPipelineEditor_Editor_Callback_CODE( ContextMenu )\r
 {\r
@@ -352,15 +380,11 @@ cpPipelineEditor_Editor_Callback_CODE( MouseDoubleClick )
           old_name.toStdString( ),\r
           new_name.toStdString( )\r
           );\r
-        if( ok )\r
-        {\r
-          block->setNamePort( new_name );\r
-          this->m_Workspace->RenameFilter(\r
-            old_name.toStdString( ),\r
-            new_name.toStdString( )\r
-            );\r
-\r
-        } // fi\r
+        block->setNamePort( new_name );\r
+        this->m_Workspace->RenameFilter(\r
+          old_name.toStdString( ),\r
+          new_name.toStdString( )\r
+          );\r
 \r
       } // fi\r
     }\r