From 8bff94dfc51d67440ade63fd19ef1975a241b2c6 Mon Sep 17 00:00:00 2001 From: Eduardo Enrique Davila Serrano Date: Mon, 17 Oct 2022 12:43:27 +0200 Subject: [PATCH] #3493 ShowNPoints_UndoRedo --- .../bbcreaMaracasVisuShowNPoints_Tools.cxx | 32 ++++++++++++++-- .../wxWindows/widgets/WidgetShowNPoints.cxx | 37 +++++++++++++++++-- 2 files changed, 62 insertions(+), 7 deletions(-) diff --git a/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx b/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx index 5585788..5b98808 100644 --- a/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx +++ b/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx @@ -4,6 +4,10 @@ #include "bbcreaMaracasVisuShowNPoints_Tools.h" #include "bbcreaMaracasVisuPackage.h" +#include +#include +#include + namespace bbcreaMaracasVisu { @@ -120,10 +124,30 @@ void ShowNPoints_Tools::CreatePatch01() // Check normals - 1. Recorrer las normales de lstIdNormals y calcular el promedio -> V1 - 2. Calcular el promedio de 4 normales de la nueva superficie -> V2 - 3. Calcular el angulo entre V1 y V2 - 4. Si el angulo es major de 90 Invertir las normales de la superficie actual +// 1. Recorrer las normales de lstIdNormals y calcular el promedio -> V1 + double *nValue; + double n1[3]; + vtkPointData *pointdata = bbGetInputMesh()->GetPointData(); + vtkDataArray *dataarray = pointdata->GetNormals(); + int i,size = lstIdNormal.size(); + n1[0]=0; + n1[1]=0; + n1[2]=0; + for (i=0; iGetTuple3( i ); + n1[0] = n1[0]+nValue[0]; + n1[1] = n1[1]+nValue[1]; + n1[2] = n1[2]+nValue[2]; + } // for i + n1[0] = n1[0]/size; + n1[1] = n1[1]/size; + n1[2] = n1[2]/size; + + +// 2. Calcular el promedio de 4 normales de la nueva superficie -> V2 +// 3. Calcular el angulo entre V1 y V2 +// 4. Si el angulo es major de 90 Invertir las normales de la superficie actual // --- Finish --- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx index ff7e623..8cbb9c5 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx @@ -22,9 +22,40 @@ // EED 2022-05-19 // mmodelShowNPoints = new ModelShowNPoints(); idUndoRedo = 0; - maxUndoRedo = 0; - UndoRedoDir = "/tmp"; - + maxUndoRedo = 0; +#if defined(_WIN32) + char * val = getenv( "TEMP" ); + if (val == NULL) + { + UndoRedoDir = std::string(""); + } else { + UndoRedoDir = std::string(val)+"\\creatools"; + printf("WidgetShowNPoints::WidgetShowNPoints UndoRedoDir = %s %p \n", UndoRedoDir.c_str() , this ); + std::string cmd1 = "mkdir "+ UndoRedoDir; + system( cmd1.c_str() ); + // Erasing files of more than 1 day old ( -1 ) + std::string cmd2 = "ForFiles /p \"" + UndoRedoDir + "\" /s /d -1 /c \"cmd /c del @file \""; + system( cmd2.c_str() ); + } +#elif defined(__GNUC__) + + + #if defined(MACOSX) + UndoRedoDir = "/tmp"; + #else // Linux + UndoRedoDir = "/tmp"; + #endif + + printf("WidgetShowNPoints::WidgetShowNPoints UndoRedoDir = %s %p \n", UndoRedoDir.c_str() , this ); + // Erasing files of more than 1 day old ( +1 ) + str::string cmd= "find "+UndoRedoDir+" -name \"UndoRedo_collection_*.undoredo\" -type f -mtime +1 -delete"; + system( cmd.c_str() ); + +#else + UndoRedoDir = "./"; +#endif + + mActualCollection = 0; ModelShowNPoints* modelShowNPoints = new ModelShowNPoints(); lstModelShowNPoints.push_back( modelShowNPoints ); -- 2.47.1