]> Creatis software - creaVtk.git/blobdiff - bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager_tool.cxx
#3507 Undo and Redo Meshes
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkMeshManager_tool.cxx
index bda31e1b44a90818c75af3cb1514f33a543bbc5e..546ba7470e3cb129335ecac2011f162cc663e125 100644 (file)
@@ -26,22 +26,23 @@ void MeshManager_tool::Process()
 //      (the one provided in the attribute 'type' of the tag 'input')
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
-
+    
     if (bbGetInputMeshManagerModel()!=NULL)
     {
         if (bbGetInputTool()==10) // Undo
         {
-            printf("EED Warning!   MeshManager_tool Undo   Not implemented.\n");
+               bbGetInputMeshManagerModel()->Undo();
+            //printf("EED Warning!   MeshManager_tool Undo   Not implemented.\n");
         } // if Tool 10 Undo
         
         if (bbGetInputTool()==20) // Redo
         {
-            printf("EED Warning!   MeshManager_tool Redo   Not implemented.\n");
+               bbGetInputMeshManagerModel()->Redo();
+            //printf("EED Warning!   MeshManager_tool Redo   Not implemented.\n");
         } // if Tool 20 Redo
 
         if (bbGetInputTool()==30)  // Set
         {
-            printf("EED    MeshManager_tool::Process Set\n");
             if (bbGetInputMesh()!=NULL){
                 vtkPoints   *points = bbGetInputMesh()->GetPoints();
                 if (points!=NULL)
@@ -50,11 +51,52 @@ void MeshManager_tool::Process()
                 } // if points!=NULL
             } // Mesh!=NULL
         } // if Tool 30 Set
+        
+        if (bbGetInputTool()==31)  // Set/Update PolyData Reference
+        {
+            if (bbGetInputMesh()!=NULL){
+                vtkPoints   *points = bbGetInputMesh()->GetPoints();
+                if (points!=NULL)
+                {
+                    bbGetInputMeshManagerModel()->UpdateMeshReference( bbGetInputMesh() );
+                } // if points!=NULL
+            } // Mesh!=NULL
+        } // if Tool 30 Set
 
-        if (bbGetInputTool()==40) // Reset
+        if (bbGetInputTool()==35)  // Set memory mode
         {
-            printf("EED Warning!   MeshManager_tool Reset   Not implemented.\n");
+                bbGetInputMeshManagerModel()->SetMeshMemoryMode( bbGetInputMesh() );
+        } // if Tool 35 Set memory mode
+
+        if (bbGetInputTool()==32)  // Copy and Set
+        {
+                bbGetInputMeshManagerModel()->CopySetMeshBase( bbGetInputMesh() );
+        } // if Tool 35 Set memory mode
+
+        
+        if (bbGetInputTool()==40) // ResetMeshTemp
+        {
+            bbGetInputMeshManagerModel()->ResetMeshTemp();
         } // if Tool 40 Reset
+        
+        if(bbGetInputTool() == 50) // Set Array of Meshes
+        {
+               if(bbGetInputMeshes().size() > 1)
+               {
+                       bbGetInputMeshManagerModel()->ReplaceMesh(bbGetInputMeshes());
+                   }
+        }
+        if(bbGetInputTool() == 60) // Select Mesh by Name
+        {
+               if(!bbGetInputStringParam().empty())
+               {
+                       bbGetInputMeshManagerModel()->SelectMeshByName(bbGetInputStringParam());
+                   }
+        }
+        if(bbGetInputTool() == 70) // Delete Current Mesh
+        {
+                   bbGetInputMeshManagerModel()->DeleteCurrentMesh();
+        }
     } else {
         printf("EED Warning! MeshManager_tool : MeshManagerModel not defined. \n");
     }// if MeshManagerModel != NULL