]> Creatis software - creaVtk.git/commitdiff
Merge branch 'vtk9itk5wx3-macos' of ssh://git.creatis.insa-lyon.fr/creaVtk into vtk9i...
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Mon, 15 May 2023 11:45:10 +0000 (13:45 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Mon, 15 May 2023 11:45:10 +0000 (13:45 +0200)
14 files changed:
bbtk_creaVtk_PKG/src/bbcreaVtkBooleanOperationPolyDataFilter.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkCleanPolyData.cxx [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkCleanPolyData.h [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager.h
bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager_tool.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager_tool.h
bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataConnectivityFilter.cxx [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataConnectivityFilter.h [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkTriangleFilter.cxx [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkTriangleFilter.h [new file with mode: 0644]
lib/creaVtk/MeshManagerModel.cpp
lib/creaVtk/MeshManagerModel.h

index 7a2d9567050dfcb69e8f565d3edc8e0aa1597a20..79a92c2539abe2b87e7dc70041a09438a7e830a8 100644 (file)
@@ -40,7 +40,7 @@ void BooleanOperationPolyDataFilter::Process()
   
        if ((bbGetInputIn1()!=NULL)  && (bbGetInputIn2()!=NULL) )
        {
-        
+/*        
 printf("EED Warnning BooleanOperationPolyDataFilter::Process  Put this code at the end of CreateMesh.. or create 2 new boxes\n");
 printf("EED Warnning BooleanOperationPolyDataFilter::Process  Put this code at the end of CreateMesh.. or create 2 new boxes\n");
 printf("EED Warnning BooleanOperationPolyDataFilter::Process  Put this code at the end of CreateMesh.. or create 2 new boxes\n");
@@ -49,7 +49,9 @@ printf("EED Warnning BooleanOperationPolyDataFilter::Process  Put this code at t
 printf("EED Warnning BooleanOperationPolyDataFilter::Process  Put this code at the end of CreateMesh.. or create 2 new boxes\n");
 printf("EED Warnning BooleanOperationPolyDataFilter::Process  Put this code at the end of CreateMesh.. or create 2 new boxes\n");
 printf("EED Warnning BooleanOperationPolyDataFilter::Process  Put this code at the end of CreateMesh.. or create 2 new boxes\n");
-    
+*/
+
+/*    
         vtkCleanPolyData *clean1 = vtkCleanPolyData::New();
                vtkCleanPolyData *clean2 = vtkCleanPolyData::New();
                clean1->SetInputData( bbGetInputIn1() );
@@ -62,17 +64,20 @@ printf("EED Warnning BooleanOperationPolyDataFilter::Process  Put this code at t
                triangle2->SetInputData( clean2->GetOutput() );
                triangle1->Update();
                triangle2->Update();
+*/
+       //TRIANGLE FILTER NOT NEEDED, this can handle non triangle meshes.
+       
 
 //  vtkPolyDataBooleanFilter  is not a vtk filter   (this one yes: vtkBooleanOperationPolyDataFilter )
 //   https://github.com/zippy84/vtkbool
         //  vtkPolyDataBooleanFilter is a local code creaVtk lib
         vtkPolyDataBooleanFilter *booleanOperation = vtkPolyDataBooleanFilter::New();
 
-        booleanOperation->SetInputData(0, triangle1->GetOutput() );
-        booleanOperation->SetInputData(1, triangle2->GetOutput() );
+//        booleanOperation->SetInputData(0, triangle1->GetOutput() );
+//        booleanOperation->SetInputData(1, triangle2->GetOutput() );
 
-//        booleanOperation->SetInputData(0, bbGetInputIn1() );
-//        booleanOperation->SetInputData(1, bbGetInputIn2() );
+        booleanOperation->SetInputData(0, bbGetInputIn1() );
+        booleanOperation->SetInputData(1, bbGetInputIn2() );
 
         if (bbGetInputOperation()==0 )
         {
@@ -116,6 +121,22 @@ printf("EED Warnning BooleanOperationPolyDataFilter::Process  Put this code at t
 //            fillHolesFilter->SetHoleSize(100000.0);
 //            fillHolesFilter->Update();
 //            bbSetOutputOut( fillHolesFilter->GetOutput() );
+                       
+                       /*
+                       *
+                       *Added boxes(triangleFilter and CleanPolyData) to handle this outside the box
+                       *
+                       
+                       //vtkTriangleFilter *triangleEnd = vtkTriangleFilter::New();
+                       //triangleEnd->SetInputData( booleanOperation->GetOutput() );
+                       //triangleEnd->Update();
+                       
+                       vtkCleanPolyData *cleanEnd = vtkCleanPolyData::New();
+                       cleanEnd->SetInputData( booleanOperation->GetOutput() );
+                       cleanEnd->Update();
+                       bbSetOutputOut( cleanEnd->GetOutput() );
+                       */
+                       
             bbSetOutputOut( booleanOperation->GetOutput() );
         } else {
             bbSetOutputOut( NULL );
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkCleanPolyData.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkCleanPolyData.cxx
new file mode 100644 (file)
index 0000000..8e79bed
--- /dev/null
@@ -0,0 +1,79 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#include "bbcreaVtkCleanPolyData.h"
+#include "bbcreaVtkPackage.h"
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,CleanPolyData)
+BBTK_BLACK_BOX_IMPLEMENTATION(CleanPolyData,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void CleanPolyData::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+//   Here we simply set the input 'In' value to the output 'Out'
+//   And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+//    void bbSet{Input|Output}NAME(const TYPE&)
+//    const TYPE& bbGet{Input|Output}NAME() const 
+//    Where :
+//    * NAME is the name of the input/output
+//      (the one provided in the attribute 'name' of the tag 'input')
+//    * TYPE is the C++ type of the input/output
+//      (the one provided in the attribute 'type' of the tag 'input')
+    if( bbGetInputIn() != NULL )
+    {
+       cleanPolyData->SetInputData( bbGetInputIn() );
+       cleanPolyData->Update();
+       bbSetOutputOut( cleanPolyData->GetOutput() );
+    }else{
+       bbSetOutputOut(NULL);
+    }
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void CleanPolyData::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputIn(NULL);
+   cleanPolyData = NULL;
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void CleanPolyData::bbUserInitializeProcessing()
+{
+
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any 
+       cleanPolyData = vtkCleanPolyData::New();
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void CleanPolyData::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+       cleanPolyData->Delete();
+       cleanPolyData = NULL;
+}
+}
+// EO namespace bbcreaVtk
+
+
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkCleanPolyData.h b/bbtk_creaVtk_PKG/src/bbcreaVtkCleanPolyData.h
new file mode 100644 (file)
index 0000000..f5f0d01
--- /dev/null
@@ -0,0 +1,51 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#ifndef __bbcreaVtkCleanPolyData_h_INCLUDED__
+#define __bbcreaVtkCleanPolyData_h_INCLUDED__
+
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkCleanPolyData.h"
+#include "vtkPolyData.h"
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT CleanPolyData
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(CleanPolyData,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+  BBTK_DECLARE_INPUT(In,vtkPolyData*);
+  BBTK_DECLARE_OUTPUT(Out,vtkPolyData*);
+  BBTK_PROCESS(Process);
+  void Process();
+  
+  vtkCleanPolyData *cleanPolyData;
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(CleanPolyData,bbtk::AtomicBlackBox);
+BBTK_NAME("CleanPolyData");
+BBTK_AUTHOR("InfoDev");
+BBTK_DESCRIPTION("No Description.");
+BBTK_CATEGORY("empty");
+BBTK_INPUT(CleanPolyData,In,"Input PolyData",vtkPolyData*,"");
+BBTK_OUTPUT(CleanPolyData,Out,"Output PolyData",vtkPolyData*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(CleanPolyData);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+}
+// EO namespace bbcreaVtk
+
+#endif // __bbcreaVtkCleanPolyData_h_INCLUDED__
+
index 79b999135824b68eafc2a10a76d7e737a2ccad67..58448a4fe7a84f819c63dcf8d215c3dbcbf3212a 100644 (file)
@@ -169,6 +169,9 @@ void CreateMeshFromPoints::CloseContourSides(std::vector<int> lstIndexs, bool uP
                        {
                                bool normalOrder    = isPointingCorrectly(firstIndex, firstIndex+increment, centroid, contraryId);
                                centroidId          = points->InsertNextPoint(centroid[0], centroid[1], centroid[2]);
+                               //vtkSmartPointer<vtkTriangleStrip> triangleStrip = vtkSmartPointer<vtkTriangleStrip>::New();
+                               //triangleStrip->GetPointIds()->SetNumberOfIds(numPointsFace*2 + (!isClosedCont?2:0));
+                               //int triangleIndex = 0;
                                if( normalOrder )
                 {
                        int initial = firstIndex;
@@ -186,11 +189,21 @@ void CreateMeshFromPoints::CloseContourSides(std::vector<int> lstIndexs, bool uP
                                                        triangle->GetPointIds()->SetId(2, centroidId);
                                                        cells->InsertNextCell(triangle);
                                                }
+                                               /*
+                                               triangleStrip->GetPointIds()->SetId(triangleIndex,index);
+                                               triangleStrip->GetPointIds()->SetId(triangleIndex+1,centroidId);//1
+                                               if(index+increment >= end && !isClosedCont){
+                                                       triangleStrip->GetPointIds()->SetId(triangleIndex+2,initial);//2
+                                                       triangleStrip->GetPointIds()->SetId(triangleIndex+3,centroidId);//3
+                                               }
+                                               triangleIndex+=2;
+                                               */
                                        }
+                                       //cells->InsertNextCell(triangleStrip);
                                } else {
                                        int initial = firstIndex-1;
                                        int triangleStripStart = end-1;
-                                       for(int index = triangleStripStart; index > initial; index-=increment){
+                                       for(int index = triangleStripStart; index > initial; index-=increment){ 
                                                if(index-increment <= initial && !isClosedCont){
                                                        vtkNew<vtkTriangle> triangle;
                                                        triangle->GetPointIds()->SetId(0, index);
@@ -204,8 +217,17 @@ void CreateMeshFromPoints::CloseContourSides(std::vector<int> lstIndexs, bool uP
                                                        triangle->GetPointIds()->SetId(2, centroidId);
                                                        cells->InsertNextCell(triangle);
                                                }
+                                               /**triangleStrip->GetPointIds()->SetId(triangleIndex,index);
+                                               triangleStrip->GetPointIds()->SetId(triangleIndex+1,centroidId);
+                                               if(index-increment <= initial && !isClosedCont){
+                                                       triangleStrip->GetPointIds()->SetId(triangleIndex+2,triangleStripStart);
+                                                       triangleStrip->GetPointIds()->SetId(triangleIndex+3,centroidId);
+                                               }
+                                               triangleIndex+=2;
+                                               */
                                        }
-                               }
+                                       //cells->InsertNextCell(triangleStrip);
+                               }//if normalOrder
                        }//if validCentroid
                }//if numPointsFace
        }//for facesIdx
@@ -239,34 +261,39 @@ bool CreateMeshFromPoints::isPointingCorrectly( int firstPointId, int secPointId
 }
 
 /**
-* Checks if points on each side of the shapes represent a curve.
+* Checks if the order of the points represent a curved spline (U shape) or the points resemble a straight spline.
+* Now it checks the angle between each point and the vector that goes from the last point to the first.
+*
+* Previous version checked the curvature between 3 points in the spline, but this created problems when the straight lines
+* had curves in the middle, increasing the curvature although they are not in the U shape.
 */
 bool CreateMeshFromPoints::CheckLinePointOrder(){
        int sizePoints = bbGetInputLstX().size();
        std::vector<int> lstIndexs = bbGetInputLstIndexs();
        double point1[3], point2[3], point3[3];
        double center[3];
-       double firstRadiusSum = 0;
-       double secondRadiusSum = 0;
-       for(int i = 0; i < lstIndexs[0] && lstIndexs[0] > 9; i+=5){
-               if(i+10 < lstIndexs[0]){
-                       points->GetPoint(i, point1);
-                       points->GetPoint(i+5, point2);
-                       points->GetPoint(i+10, point3);
-                       firstRadiusSum += vtkMath::Solve3PointCircle(point1, point2, point3, center);
-               }
+       double firstAngleSum = 0;
+       double secondAngleSum = 0;
+
+       points->GetPoint(0, point1);
+       points->GetPoint((lstIndexs[0]-1), point3);
+       double firstVect[3];
+       double secVect[3];
+       vtkMath::Subtract(point3, point1, firstVect);
+       for(int i = 0; i < lstIndexs[0]; i++){
+               points->GetPoint(i, point2);
+               vtkMath::Subtract(point2, point1, secVect);
+               firstAngleSum += vtkMath::SignedAngleBetweenVectors(firstVect, secVect, firstVect);
        }
-       
-       for(int i = 0; i < sizePoints && lstIndexs.size() > 9; i+=(lstIndexs.size()*5)){
-               if(i+(10*lstIndexs.size()) < sizePoints){
-                       points->GetPoint(i, point1);
-                       points->GetPoint(i+(5*lstIndexs.size()), point2);
-                       points->GetPoint(i+(10*lstIndexs.size()), point3);
-                       secondRadiusSum += vtkMath::Solve3PointCircle(point1, point2, point3, center);
-               }
+       points->GetPoint((sizePoints-lstIndexs[0]), point3);
+       vtkMath::Subtract(point3, point1, firstVect);
+       for(int i = 0; i < sizePoints; i+=lstIndexs.size()){
+               points->GetPoint(i, point2);
+               vtkMath::Subtract(point2, point1, secVect);
+               secondAngleSum += vtkMath::SignedAngleBetweenVectors(firstVect, secVect, firstVect);
        }
 
-       return firstRadiusSum > secondRadiusSum;
+       return firstAngleSum < secondAngleSum;
 }
 
 /**
index 25be322b77ae54db2506b330d78485caec30fe62..3fa8d4b50775e338915f2a6b09029889c9ab355d 100644 (file)
@@ -15,11 +15,14 @@ MeshManagerModel_Box::~MeshManagerModel_Box( )
 {
 }
 
-void MeshManagerModel_Box::RefreshOutputs( )
+void MeshManagerModel_Box::RefreshOutputs(bool signalBox)
 {
     mBox->bbSetOutputMeshBase( GetMeshBase() );
     mBox->bbSetOutputMeshTemp( GetMeshTemp() );
-    mBox->bbSignalOutputModification();
+    mBox->bbSetOutputMeshNames( GetMeshNames() );
+    if(signalBox==true){
+               mBox->bbSignalOutputModification();
+    }
 }
 
 
@@ -47,8 +50,12 @@ void MeshManager::Process()
     if (meshManagerModel_Box==NULL)
     {
         meshManagerModel_Box = new MeshManagerModel_Box(this);
-        meshManagerModel_Box->SetMeshBase( bbGetInputMesh() );
-        meshManagerModel_Box->RefreshOutputs();
+
+        meshManagerModel_Box->AddMeshes_( bbGetInputMeshVector() );
+
+               meshManagerModel_Box->AddMesh_( bbGetInputMesh() );
+        //meshManagerModel_Box->SetMeshBase( bbGetInputMesh() );
+        meshManagerModel_Box->RefreshOutputs(false);
         bbSetOutputMeshManagerModel( meshManagerModel_Box );
     } // if meshManagerModel_Box
 }
index e4e389ae0c0131f618eaa1e179bb03c8fc7ecc90..3b544e3b2a4f853991c5a58717aa68ebf270c5c0 100644 (file)
@@ -24,8 +24,10 @@ class bbcreaVtk_EXPORT MeshManager
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
   BBTK_DECLARE_INPUT(Mesh,vtkPolyData*);
+  BBTK_DECLARE_INPUT(MeshVector, std::vector<vtkPolyData*>);
   BBTK_DECLARE_OUTPUT(MeshBase,vtkPolyData*);
   BBTK_DECLARE_OUTPUT(MeshTemp,vtkPolyData*);
+  BBTK_DECLARE_OUTPUT(MeshNames,std::vector<std::string>);
   BBTK_DECLARE_OUTPUT(MeshManagerModel,MeshManagerModel*);
   BBTK_PROCESS(Process);
   void Process();
@@ -41,7 +43,7 @@ class MeshManagerModel_Box : public MeshManagerModel
 public :
     MeshManagerModel_Box(MeshManager *box);
     ~MeshManagerModel_Box();
-    virtual void RefreshOutputs();
+    virtual void RefreshOutputs(bool signalBox);
 protected:
 private:
     MeshManager *mBox;
@@ -56,8 +58,10 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(MeshManager,bbtk::AtomicBlackBox);
   BBTK_CATEGORY("empty");
 
   BBTK_INPUT(MeshManager,Mesh,"Mesh",vtkPolyData*,"");
+  BBTK_INPUT(MeshManager,MeshVector,"Vector of Meshes",std::vector<vtkPolyData*>,"");
   BBTK_OUTPUT(MeshManager,MeshBase,"Mesh Base",vtkPolyData*,"");
   BBTK_OUTPUT(MeshManager,MeshTemp,"Mesh Temp",vtkPolyData*,"");
+  BBTK_OUTPUT(MeshManager,MeshNames,"Mesh Names",std::vector<std::string>,"");
   BBTK_OUTPUT(MeshManager,MeshManagerModel,"Mesh manager model",MeshManagerModel*,"");
 
 BBTK_END_DESCRIBE_BLACK_BOX(MeshManager);
index d0f63ed3017600b637bf926fb586e9f7e1f0f40c..e39e25fd66ef4e531c2a0d259875f32b3b1d3871 100644 (file)
@@ -66,6 +66,31 @@ void MeshManager_tool::Process()
             bbGetInputMeshManagerModel()->ResetMeshTemp();
         } // if Tool 40 Reset
         
+        if(bbGetInputTool() == 50) // Set Array of Meshes
+        {
+               if(bbGetInputMeshes().size() > 1)
+               {
+                       if(bbGetInputMeshManagerModel()->GetNumberOfMeshes() == 1){
+                                       bbGetInputMeshManagerModel()->DeleteAll();
+                       }
+                       if(bbGetInputMeshManagerModel()->GetNumberOfMeshes() > 1)
+                       {
+                               bbGetInputMeshManagerModel()->DeleteCurrentMesh();
+                       }
+                               bbGetInputMeshManagerModel()->InsertMeshesAtCurrent(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
index 3cf9b798b46dc31b3dc3d2572a44204a7a465461..76ba719e2999fcfa98dac4f41064d16033f40883 100644 (file)
@@ -24,6 +24,8 @@ class bbcreaVtk_EXPORT MeshManager_tool
     BBTK_DECLARE_INPUT(Tool,int);
     BBTK_DECLARE_INPUT(Mesh,vtkPolyData*);
     BBTK_DECLARE_INPUT(MeshManagerModel,MeshManagerModel*);
+    BBTK_DECLARE_INPUT(Meshes,std::vector<vtkPolyData*>);
+    BBTK_DECLARE_INPUT(StringParam, std::string);
 //  BBTK_DECLARE_OUTPUT(Out,double);
   BBTK_PROCESS(Process);
   void Process();
@@ -38,8 +40,10 @@ 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  32:Copy and Set  35:Set memory mode  40:ResetMeshTemp",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     50: Set Array of meshes  60:Select mesh by name  70:Delete current mesh",int,"");
   BBTK_INPUT(MeshManager_tool,Mesh,"Mesh",vtkPolyData*,"");
+  BBTK_INPUT(MeshManager_tool,Meshes,"Input meshes, required for tool 50",std::vector<vtkPolyData*>,"");
+  BBTK_INPUT(MeshManager_tool,StringParam,"String input",std::string,"");
   BBTK_INPUT(MeshManager_tool,MeshManagerModel,"Mesh Manager Model",MeshManagerModel*,"");
 
 //  BBTK_OUTPUT(MeshManager_tool,Out,"First output",double,"");
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataConnectivityFilter.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataConnectivityFilter.cxx
new file mode 100644 (file)
index 0000000..fdce1f4
--- /dev/null
@@ -0,0 +1,93 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#include "bbcreaVtkPolyDataConnectivityFilter.h"
+#include "bbcreaVtkPackage.h"
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,PolyDataConnectivityFilter)
+BBTK_BLACK_BOX_IMPLEMENTATION(PolyDataConnectivityFilter,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void PolyDataConnectivityFilter::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+//   Here we simply set the input 'In' value to the output 'Out'
+//   And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+//    void bbSet{Input|Output}NAME(const TYPE&)
+//    const TYPE& bbGet{Input|Output}NAME() const 
+//    Where :
+//    * NAME is the name of the input/output
+//      (the one provided in the attribute 'name' of the tag 'input')
+//    * TYPE is the C++ type of the input/output
+//      (the one provided in the attribute 'type' of the tag 'input')
+    
+    //Get all connected components in a polydata vector
+    if(bbGetInputIn() == NULL){
+       printf("PG PolyDataConnectivityFilter::Process Input polydata is null \n");
+       return;
+    }
+    
+       if(bbGetInputType() == 1){
+               std::vector<vtkPolyData*> output;
+               connFilter->SetInputData( bbGetInputIn() );
+               connFilter->SetExtractionModeToSpecifiedRegions();
+               connFilter->Update();
+               vtkPolyData *component;
+               int numRegions = connFilter->GetNumberOfExtractedRegions();
+
+               for(int i = 0; i < numRegions; i++){
+                       connFilter->AddSpecifiedRegion(i);
+                       connFilter->Update();
+                       component = vtkPolyData::New();
+                       component->DeepCopy(connFilter->GetOutput());
+                       output.push_back(component);
+                       connFilter->DeleteSpecifiedRegion(i);
+               }
+
+               bbSetOutputOut(output);
+       }
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void PolyDataConnectivityFilter::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+       connFilter = NULL;  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void PolyDataConnectivityFilter::bbUserInitializeProcessing()
+{
+
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any 
+       connFilter = vtkPolyDataConnectivityFilter::New();
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void PolyDataConnectivityFilter::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+}
+// EO namespace bbcreaVtk
+
+
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataConnectivityFilter.h b/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataConnectivityFilter.h
new file mode 100644 (file)
index 0000000..d9547d4
--- /dev/null
@@ -0,0 +1,52 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#ifndef __bbcreaVtkPolyDataConnectivityFilter_h_INCLUDED__
+#define __bbcreaVtkPolyDataConnectivityFilter_h_INCLUDED__
+
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+#include <vtkPolyData.h>
+#include <vtkPolyDataConnectivityFilter.h>
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT PolyDataConnectivityFilter
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(PolyDataConnectivityFilter,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+  BBTK_DECLARE_INPUT(In,vtkPolyData*);
+  BBTK_DECLARE_INPUT(Type,int);
+  BBTK_DECLARE_OUTPUT(Out,std::vector<vtkPolyData*>);
+  BBTK_PROCESS(Process);
+  void Process();
+  
+  vtkPolyDataConnectivityFilter *connFilter;
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(PolyDataConnectivityFilter,bbtk::AtomicBlackBox);
+BBTK_NAME("PolyDataConnectivityFilter");
+BBTK_AUTHOR("InfoDev");
+BBTK_DESCRIPTION("No Description.");
+BBTK_CATEGORY("empty");
+BBTK_INPUT(PolyDataConnectivityFilter,In,"Input polydata",vtkPolyData*,"");
+BBTK_INPUT(PolyDataConnectivityFilter,Type,"0: nothing, 1: Extract all connected regions",int,"");
+BBTK_OUTPUT(PolyDataConnectivityFilter,Out,"output polydatas",std::vector<vtkPolyData*>,"");
+BBTK_END_DESCRIBE_BLACK_BOX(PolyDataConnectivityFilter);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+}
+// EO namespace bbcreaVtk
+
+#endif // __bbcreaVtkPolyDataConnectivityFilter_h_INCLUDED__
+
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkTriangleFilter.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkTriangleFilter.cxx
new file mode 100644 (file)
index 0000000..b54f51a
--- /dev/null
@@ -0,0 +1,78 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#include "bbcreaVtkTriangleFilter.h"
+#include "bbcreaVtkPackage.h"
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,TriangleFilter)
+BBTK_BLACK_BOX_IMPLEMENTATION(TriangleFilter,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void TriangleFilter::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+//   Here we simply set the input 'In' value to the output 'Out'
+//   And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+//    void bbSet{Input|Output}NAME(const TYPE&)
+//    const TYPE& bbGet{Input|Output}NAME() const 
+//    Where :
+//    * NAME is the name of the input/output
+//      (the one provided in the attribute 'name' of the tag 'input')
+//    * TYPE is the C++ type of the input/output
+//      (the one provided in the attribute 'type' of the tag 'input')
+    if( bbGetInputIn() != NULL )
+    {
+       triangleFilter->SetInputData( bbGetInputIn() );
+       triangleFilter->Update();
+       bbSetOutputOut( triangleFilter->GetOutput() );
+    }else{
+       bbSetOutputOut(NULL);
+    }
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void TriangleFilter::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputIn(NULL);
+   triangleFilter = NULL;
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void TriangleFilter::bbUserInitializeProcessing()
+{
+
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any 
+       triangleFilter = vtkTriangleFilter::New();
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void TriangleFilter::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+       triangleFilter->Delete();
+       triangleFilter = NULL;
+}
+}
+// EO namespace bbcreaVtk
+
+
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkTriangleFilter.h b/bbtk_creaVtk_PKG/src/bbcreaVtkTriangleFilter.h
new file mode 100644 (file)
index 0000000..c210b45
--- /dev/null
@@ -0,0 +1,51 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#ifndef __bbcreaVtkTriangleFilter_h_INCLUDED__
+#define __bbcreaVtkTriangleFilter_h_INCLUDED__
+
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkPolyData.h"
+#include "vtkTriangleFilter.h"
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT TriangleFilter
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(TriangleFilter,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+  BBTK_DECLARE_INPUT(In,vtkPolyData*);
+  BBTK_DECLARE_OUTPUT(Out,vtkPolyData*);
+  BBTK_PROCESS(Process);
+  void Process();
+  
+  vtkTriangleFilter *triangleFilter;
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(TriangleFilter,bbtk::AtomicBlackBox);
+BBTK_NAME("TriangleFilter");
+BBTK_AUTHOR("InfoDev");
+BBTK_DESCRIPTION("No Description.");
+BBTK_CATEGORY("empty");
+BBTK_INPUT(TriangleFilter,In,"Input PolyData", vtkPolyData*,"");
+BBTK_OUTPUT(TriangleFilter,Out,"Output PolyData", vtkPolyData*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(TriangleFilter);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+}
+// EO namespace bbcreaVtk
+
+#endif // __bbcreaVtkTriangleFilter_h_INCLUDED__
+
index cf0b3dd2384da5f2e7b1b01847a5fbcc3a840e4e..677727c6057a054b06ecb097298ba36977c1f78a 100644 (file)
 
 #include "MeshManagerModel.h"
 
-MeshManagerModel::MeshManagerModel()
+////////////////////
+/////////////////////// MESH MODEL
+////////////////////
+
+MeshModel::MeshModel(int id)
 {
-    _meshBase = NULL;
+       _meshBase = NULL;
     _meshTemp = NULL;
+    _meshId = id;
+    _name = "mesh-" + std::to_string(id);
 }
 
-MeshManagerModel::~MeshManagerModel()
+MeshModel::MeshModel(vtkPolyData* mesh, int id)
 {
+       if(mesh != NULL){       
+               _meshBase = mesh;
+               _meshTemp = vtkPolyData::New();
+               _meshTemp->DeepCopy(_meshBase);
+               _meshId = id;
+       _name = "mesh-" + std::to_string(id);
+       }
 }
 
-void MeshManagerModel::ResetMeshTemp_()
+MeshModel::~MeshModel(){
+       if(_meshBase != NULL){
+               _meshBase->Delete();
+       }
+       if(_meshTemp != NULL){
+               _meshTemp->Delete();
+       }
+}
+
+void MeshModel::ResetMeshTemp_()
 {
     if (_meshBase!=NULL)
     {
@@ -52,29 +74,26 @@ void MeshManagerModel::ResetMeshTemp_()
     }
 }
 
-void MeshManagerModel::SetMeshBase(vtkPolyData* mesh)
+void MeshModel::SetMeshBase(vtkPolyData* mesh)
 {
     if (mesh!=NULL)
     {
         _meshBase = mesh;
         ResetMeshTemp_();
-        RefreshOutputs();
     } // if mesh
 }
 
-void MeshManagerModel::SetMeshMemoryMode(vtkPolyData* mesh)
+void MeshModel::SetMeshMemoryMode(vtkPolyData* mesh)
 {
     _meshBase = mesh;
-    RefreshOutputs();
 }
 
-void MeshManagerModel::ResetMeshTemp()
+void MeshModel::ResetMeshTemp()
 {
     ResetMeshTemp_();
-    RefreshOutputs();
 }
 
-void MeshManagerModel::CopySetMeshBase(vtkPolyData* mesh)
+void MeshModel::CopySetMeshBase(vtkPolyData* mesh)
 {
     if (mesh!=NULL)
     {
@@ -85,16 +104,291 @@ void MeshManagerModel::CopySetMeshBase(vtkPolyData* mesh)
 }
 
 
-vtkPolyData*  MeshManagerModel::GetMeshBase()
+vtkPolyData*  MeshModel::GetMeshBase()
 {
    return _meshBase;
 }
 
-vtkPolyData*  MeshManagerModel::GetMeshTemp()
+vtkPolyData*  MeshModel::GetMeshTemp()
 {
    return _meshTemp;
 }
 
-void MeshManagerModel::RefreshOutputs() // virtula
+int MeshModel::GetId()
+{
+       return _meshId;
+}
+
+std::string MeshModel::GetName()
+{
+       return _name;
+}
+
+////////////////////
+/////////////////////// MESH MANAGER
+////////////////////
+
+MeshManagerModel::MeshManagerModel()
+{
+       //MeshModel* firstMesh = new MeshModel();
+       //_meshes.push_back(firstMesh);
+       currentMesh = 0;
+       meshId = 0;
+}
+
+MeshManagerModel::~MeshManagerModel()
+{
+       DeleteAll();
+}
+
+void MeshManagerModel::RefreshOutputs(bool signalBox) // virtual
+{
+}
+
+int MeshManagerModel::GetNumberOfMeshes(){
+       return _meshes.size();
+}
+
+void MeshManagerModel::AddMesh_(vtkPolyData* mesh){
+       if(mesh != NULL){
+               MeshModel *meshModel = new MeshModel(mesh, meshId);
+               _meshes.push_back(meshModel);
+               meshId++;
+       }
+       else{
+               printf("PG MeshManagerModel::AddMesh Mesh is null \n");
+       }
+}
+
+void MeshManagerModel::AddMesh(vtkPolyData* mesh){
+       AddMesh_(mesh);
+       RefreshOutputs(true);
+}
+
+void MeshManagerModel::AddMeshes_(std::vector<vtkPolyData*> meshList){
+       if(!meshList.empty())
+       {
+               MeshModel *meshModel;
+               for(int i = 0; i < meshList.size(); i++){
+                       meshModel = new MeshModel(meshList[i], meshId);
+                       _meshes.push_back(meshModel);
+                       meshId++;
+               }
+       }else{
+               printf("PG MeshManagerModel::AddMeshes Empty list of meshes \n");
+       }
+}
+
+void MeshManagerModel::AddMeshes(std::vector<vtkPolyData*> meshList){
+       AddMeshes_(meshList);
+       RefreshOutputs(true);
+}
+
+void MeshManagerModel::AddEmptyMesh_(){
+       MeshModel *meshModel = new MeshModel(meshId);
+       _meshes.push_back(meshModel);
+       meshId++;
+}
+
+void MeshManagerModel::AddEmptyMesh(){
+       AddEmptyMesh_();
+       RefreshOutputs(true);
+}
+
+void MeshManagerModel::InsertMeshesAtCurrent_(std::vector<vtkPolyData*> meshList)
+{
+       if(!meshList.empty())
+       {
+               std::vector<MeshModel*> tmpVect;
+               MeshModel *meshModel;
+               for(int i = 0; i < meshList.size(); i++){
+                       meshModel = new MeshModel(meshList[i], meshId);
+                       tmpVect.push_back(meshModel);
+                       meshId++;
+               }
+               _meshes.insert(_meshes.begin() + currentMesh, tmpVect.begin(), tmpVect.end());
+       }else{
+               printf("PG MeshManagerModel::AddMeshes Empty list of meshes \n");
+       }
+}
+
+void MeshManagerModel::InsertMeshesAtCurrent(std::vector<vtkPolyData*> meshList)
+{
+       InsertMeshesAtCurrent_(meshList);
+       RefreshOutputs(true);
+}
+
+void MeshManagerModel::SelectMesh(int i) {
+       if(i >= 0 && i < _meshes.size()){
+               int prevCurrent = currentMesh;
+               currentMesh = i;
+               if(prevCurrent != i){
+                       RefreshOutputs(true);           
+               }
+       }
+       else{
+               printf("PG MeshManagerModel::SelectMesh index out of bounds \n");
+       }
+}
+
+void MeshManagerModel::SelectMeshByName(std::string meshName) {
+       if(!_meshes.empty()){
+               bool found = false;
+               for(int i = 0; i < _meshes.size() && !found; i++){
+                       if(_meshes.at(i)->GetName() == meshName){
+                               found = true;
+                               SelectMesh(i);
+                       }
+               }
+       }
+}
+
+void MeshManagerModel::DeleteMesh(int position){
+       if(position >= 0 && position < _meshes.size()){
+               delete _meshes.at(position);
+               _meshes.erase(_meshes.begin() + position);
+               currentMesh = currentMesh + (position <= currentMesh?-1:0);
+               if(currentMesh < 0){
+                       currentMesh = 0;
+               }
+               RefreshOutputs(true);
+       }
+}
+
+void MeshManagerModel::DeleteMeshByName(std::string meshName){
+       if(!_meshes.empty()){
+               bool found = false;
+               for(int i = 0; i < _meshes.size() && !found; i++){
+                       if(_meshes.at(i)->GetName() == meshName){
+                               found = true;
+                               delete _meshes.at(i);
+                               _meshes.erase(_meshes.begin() + i);
+                               currentMesh = currentMesh + (i <= currentMesh?-1:0);
+                               if(currentMesh < 0){
+                                       currentMesh = 0;
+                               }
+                               RefreshOutputs(true);
+                       }
+               }
+       }
+}
+
+void MeshManagerModel::DeleteCurrentMesh(){
+       if(!_meshes.empty()){   
+               delete _meshes.at(currentMesh);
+               _meshes.erase(_meshes.begin() + currentMesh);
+               currentMesh--;
+               if(currentMesh < 0){
+                       currentMesh = 0;
+               }
+               RefreshOutputs(true);
+       }
+}
+
+void MeshManagerModel::DeleteAll(){
+       if(!_meshes.empty()){   
+               for (MeshModel* element : _meshes)
+               {
+                       delete element;
+               } 
+               _meshes.clear();
+               RefreshOutputs(true);
+       }
+}
+
+void MeshManagerModel::NextMesh(){
+       currentMesh++;
+       if(currentMesh >= _meshes.size()){
+               currentMesh = _meshes.size()-1;
+       }
+       RefreshOutputs(true);
+}
+
+void MeshManagerModel::PreviousMesh(){
+       currentMesh--;
+       if(currentMesh < 0){
+               currentMesh = 0;
+       }
+       RefreshOutputs(true);
+}
+
+MeshModel* MeshManagerModel::GetMeshModel(){
+       return _meshes.at(currentMesh);
+}
+
+vtkPolyData*  MeshManagerModel::GetMeshBase()
+{
+       if(!_meshes.empty()){
+               return _meshes.at(currentMesh)->GetMeshBase();
+       }
+       else{
+               return NULL;
+       }
+}
+
+vtkPolyData*  MeshManagerModel::GetMeshTemp()
+{
+       if(!_meshes.empty()){
+               return _meshes.at(currentMesh)->GetMeshTemp();
+       }
+       else{
+               return NULL;
+       }
+}
+
+void MeshManagerModel::SetMeshBase(vtkPolyData* mesh)
+{
+    if(!_meshes.empty()){
+        _meshes.at(currentMesh)->SetMeshBase(mesh);
+        RefreshOutputs(true);
+    }else{
+       printf("PG MeshManagerModel::SetMeshMemoryMode Mesh vector is empty \n");
+    }
+}
+
+void MeshManagerModel::SetMeshMemoryMode(vtkPolyData* mesh)
+{
+       //if(!_meshes.empty()){
+       if(_meshes.size() > 1){
+               DeleteAll();
+       }
+       if(_meshes.size() == 0){
+               AddEmptyMesh_();
+       }
+       _meshes.at(currentMesh)->SetMeshMemoryMode(mesh);
+       RefreshOutputs(true);
+    //}else{
+    // printf("PG MeshManagerModel::SetMeshMemoryMode Mesh vector is empty \n");
+    //}
+}
+
+void MeshManagerModel::ResetMeshTemp()
+{
+       if(!_meshes.empty()){
+       _meshes.at(currentMesh)->ResetMeshTemp();
+       RefreshOutputs(true);
+    }else{
+       printf("PG MeshManagerModel::ResetMeshTemp Mesh vector is empty \n");
+    }
+    
+}
+
+void MeshManagerModel::CopySetMeshBase(vtkPolyData* mesh)
+{
+       if(!_meshes.empty()){
+               _meshes.at(currentMesh)->CopySetMeshBase(mesh);
+               RefreshOutputs(true);
+       }
+       else{
+               printf("PG MeshManagerModel::CopySetMeshBase Mesh vector is empty \n");
+       }
+}
+
+std::vector<std::string> MeshManagerModel::GetMeshNames()
 {
+       std::vector<std::string> names;
+       for(int i = 0; i < _meshes.size(); i++){
+               names.push_back(_meshes.at(i)->GetName());
+       }
+       return names;
 }
index b2f5dc9051b13963e1383c8cf511ce6f54140d12..b679255a55e1686afbf39b4ad59a030752c4aedf 100644 (file)
 #  knowledge of the CeCILL-B license and that you accept its terms.
 # ------------------------------------------------------------------------
 */
+#include <vtkPolyData.h>
+
+class MeshModel{
+
+public:
+       MeshModel(int id);
+       MeshModel(vtkPolyData* mesh, int id);
+       ~MeshModel();
+       
+       void                    SetMeshBase(vtkPolyData* mesh);
+    void                       SetMeshMemoryMode(vtkPolyData* mesh);
+    void                       CopySetMeshBase(vtkPolyData* mesh);
+    void                       ResetMeshTemp();
+    void                       ResetMeshTemp_();
+    vtkPolyData*       GetMeshBase();
+    vtkPolyData*       GetMeshTemp();
+    int                        GetId();
+    std::string        GetName();
+    
+protected:
+
+private:
+       vtkPolyData                             *_meshBase;
+    vtkPolyData                                *_meshTemp;
+    int                                                        _meshId;
+    std::string                                        _name;
+};
 
 #ifndef _MESHMANAGERMODEL_H_
 #define _MESHMANAGERMODEL_H_
@@ -33,8 +60,6 @@
 // [classdescription]
 //---------------------------------------------
 
-#include <vtkPolyData.h>
-
 class MeshManagerModel
 {
 
@@ -49,10 +74,36 @@ public :
     void SetMeshMemoryMode(vtkPolyData* mesh);
     void CopySetMeshBase(vtkPolyData* mesh);
     void ResetMeshTemp();
-    void ResetMeshTemp_();
+    //void ResetMeshTemp_();
     vtkPolyData* GetMeshBase();
     vtkPolyData* GetMeshTemp();
-    virtual void RefreshOutputs();
+    
+    virtual void RefreshOutputs(bool signalBox);
+    
+    MeshModel* GetMeshModel();
+    int GetNumberOfMeshes();
+    
+    void AddMesh_(vtkPolyData* mesh);
+    void AddMesh(vtkPolyData* mesh);
+    
+    void AddEmptyMesh_();
+    void AddEmptyMesh();
+    
+    void AddMeshes(std::vector<vtkPolyData*> meshList);
+    void AddMeshes_(std::vector<vtkPolyData*> meshList);
+    
+    void InsertMeshesAtCurrent_(std::vector<vtkPolyData*> meshList);
+    void InsertMeshesAtCurrent(std::vector<vtkPolyData*> meshList);
+    
+    void SelectMesh(int i);
+    void SelectMeshByName(std::string meshName);
+    void DeleteMesh(int position);
+    void DeleteMeshByName(std::string meshName);
+    void DeleteCurrentMesh();
+    void DeleteAll();
+    void NextMesh();
+    void PreviousMesh();
+    std::vector<std::string> GetMeshNames();
 
 //--Method template----------------------------
 //  void FunctionName(int& parameterA);
@@ -67,8 +118,10 @@ protected:
 //Methods and attributes only visible by this class
 //---------------------------------------------
 private:
-    vtkPolyData *_meshBase;
-    vtkPolyData *_meshTemp;
+    
+    std::vector<MeshModel*>    _meshes;
+    int                                                currentMesh;
+    int                                                        meshId;
 };
 
 //-end of _MESHMANAGERMODEL_H_------------------------------------------------------