From 7ea07ff0d06edfe66780de979e34b7932357a1f5 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 9 Sep 2022 16:07:16 +0200 Subject: [PATCH] MeshManager --- .../src/bbcreaVtkMeshDeformation.cxx | 6 +-- .../src/bbcreaVtkMeshManager_tool.cxx | 12 +++++- .../src/bbcreaVtkMeshManager_tool.h | 2 +- lib/creaVtk/MeshManagerModel.cpp | 40 +++++++++++++++++-- lib/creaVtk/MeshManagerModel.h | 3 ++ 5 files changed, 54 insertions(+), 9 deletions(-) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshDeformation.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshDeformation.cxx index cddffce..830d8ad 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshDeformation.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshDeformation.cxx @@ -30,13 +30,13 @@ void MeshDeformation::Process() std::vector lstCenter = bbGetInputCenter(); - double s = bbGetInputS(); - bool ok=false; + double s = bbGetInputS(); + bool ok = false; if (bbGetInputTypeIn()==0) // direction { if (bbGetInputDirection().size()==3) { - ok = !( (bbGetInputDirection()[0]==0) && (bbGetInputDirection()[1]==0) && (bbGetInputDirection()[2]==0) ); + ok = !( (bbGetInputDirection()[0]==0) && (bbGetInputDirection()[1]==0) && (bbGetInputDirection()[2]==0) ); } } // if TypeIn 0 diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager_tool.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager_tool.cxx index c087d1b..9182458 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager_tool.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager_tool.cxx @@ -55,9 +55,17 @@ void MeshManager_tool::Process() bbGetInputMeshManagerModel()->SetMeshMemoryMode( bbGetInputMesh() ); } // if Tool 35 Set memory mode - if (bbGetInputTool()==40) // Reset + if (bbGetInputTool()==32) // Copy and Set { - printf("EED Warning! MeshManager_tool Reset Not implemented.\n"); + bbGetInputMeshManagerModel()->CopySetMeshBase( bbGetInputMesh() ); + } // if Tool 35 Set memory mode + + + if (bbGetInputTool()==40) // ResetMeshTemp + { + printf("EED MeshManager_tool::Process ResetMeshTemp 1\n"); + bbGetInputMeshManagerModel()->ResetMeshTemp(); + printf("EED MeshManager_tool::Process ResetMeshTemp 2\n"); } // if Tool 40 Reset } else { diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager_tool.h b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager_tool.h index b861c85..3cf9b79 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager_tool.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager_tool.h @@ -38,7 +38,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(MeshManager_tool,bbtk::AtomicBlackBox); BBTK_DESCRIPTION("No Description."); BBTK_CATEGORY("empty"); - BBTK_INPUT(MeshManager_tool,Tool,"(default 0) 0:Nothing 10:Undo 20:ReDo 30:Set 35:Set memory mode 40:Reset",int,""); + BBTK_INPUT(MeshManager_tool,Tool,"(default 0) 0:Nothing 10:Undo 20:ReDo 30:Set 32:Copy and Set 35:Set memory mode 40:ResetMeshTemp",int,""); BBTK_INPUT(MeshManager_tool,Mesh,"Mesh",vtkPolyData*,""); BBTK_INPUT(MeshManager_tool,MeshManagerModel,"Mesh Manager Model",MeshManagerModel*,""); diff --git a/lib/creaVtk/MeshManagerModel.cpp b/lib/creaVtk/MeshManagerModel.cpp index f87f714..5c21451 100644 --- a/lib/creaVtk/MeshManagerModel.cpp +++ b/lib/creaVtk/MeshManagerModel.cpp @@ -37,17 +37,31 @@ MeshManagerModel::~MeshManagerModel() { } -void MeshManagerModel::SetMeshBase(vtkPolyData* mesh) +void MeshManagerModel::ResetMeshTemp_() { - if (mesh!=NULL) + printf("EED MeshManagerModel::Process ResetMeshTemp_ Start\n"); + if (_meshBase!=NULL) { - _meshBase = mesh; if (_meshTemp!=NULL) { _meshTemp->Delete(); } // if _meshTemp = vtkPolyData::New(); + printf("EED MeshManagerModel::Process ResetMeshTemp_ 1\n"); _meshTemp->DeepCopy(_meshBase); + printf("EED MeshManagerModel::Process ResetMeshTemp_ 2\n"); + } else { + _meshTemp=NULL; + } + printf("EED MeshManagerModel::Process ResetMeshTemp_ End\n"); +} + +void MeshManagerModel::SetMeshBase(vtkPolyData* mesh) +{ + if (mesh!=NULL) + { + _meshBase = mesh; + ResetMeshTemp_(); RefreshOutputs(); } // if mesh } @@ -58,6 +72,26 @@ void MeshManagerModel::SetMeshMemoryMode(vtkPolyData* mesh) RefreshOutputs(); } +void MeshManagerModel::ResetMeshTemp() +{ + printf("EED MeshManagerModel::Process ResetMeshTemp 1\n"); + ResetMeshTemp_(); + printf("EED MeshManagerModel::Process ResetMeshTemp 2\n"); + RefreshOutputs(); + printf("EED MeshManagerModel::Process ResetMeshTemp 3\n"); +} + +void MeshManagerModel::CopySetMeshBase(vtkPolyData* mesh) +{ + if (mesh!=NULL) + { + vtkPolyData *newMesh = vtkPolyData::New(); + newMesh->DeepCopy( mesh ); + SetMeshBase(newMesh); + } // if mesh +} + + vtkPolyData* MeshManagerModel::GetMeshBase() { return _meshBase; diff --git a/lib/creaVtk/MeshManagerModel.h b/lib/creaVtk/MeshManagerModel.h index 4373ff1..b2f5dc9 100644 --- a/lib/creaVtk/MeshManagerModel.h +++ b/lib/creaVtk/MeshManagerModel.h @@ -47,6 +47,9 @@ public : void SetMeshBase(vtkPolyData* mesh); void SetMeshMemoryMode(vtkPolyData* mesh); + void CopySetMeshBase(vtkPolyData* mesh); + void ResetMeshTemp(); + void ResetMeshTemp_(); vtkPolyData* GetMeshBase(); vtkPolyData* GetMeshTemp(); virtual void RefreshOutputs(); -- 2.47.1