]> 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 e39e25fd66ef4e531c2a0d259875f32b3b1d3871..546ba7470e3cb129335ecac2011f162cc663e125 100644 (file)
@@ -31,12 +31,14 @@ void MeshManager_tool::Process()
     {
         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
@@ -49,6 +51,17 @@ 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()==35)  // Set memory mode
         {
@@ -70,14 +83,7 @@ void MeshManager_tool::Process()
         {
                if(bbGetInputMeshes().size() > 1)
                {
-                       if(bbGetInputMeshManagerModel()->GetNumberOfMeshes() == 1){
-                                       bbGetInputMeshManagerModel()->DeleteAll();
-                       }
-                       if(bbGetInputMeshManagerModel()->GetNumberOfMeshes() > 1)
-                       {
-                               bbGetInputMeshManagerModel()->DeleteCurrentMesh();
-                       }
-                               bbGetInputMeshManagerModel()->InsertMeshesAtCurrent(bbGetInputMeshes());
+                       bbGetInputMeshManagerModel()->ReplaceMesh(bbGetInputMeshes());
                    }
         }
         if(bbGetInputTool() == 60) // Select Mesh by Name