]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager_tool.cxx
#3513 CleanMeshWithPatch
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkMeshManager_tool.cxx
1 //===== 
2 // 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)
3 //===== 
4 #include "bbcreaVtkMeshManager_tool.h"
5 #include "bbcreaVtkPackage.h"
6 namespace bbcreaVtk
7 {
8
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,MeshManager_tool)
10 BBTK_BLACK_BOX_IMPLEMENTATION(MeshManager_tool,bbtk::AtomicBlackBox);
11 //===== 
12 // 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)
13 //===== 
14 void MeshManager_tool::Process()
15 {
16 // THE MAIN PROCESSING METHOD BODY
17 //   Here we simply set the input 'In' value to the output 'Out'
18 //   And print out the output value
19 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
20 //    void bbSet{Input|Output}NAME(const TYPE&)
21 //    const TYPE& bbGet{Input|Output}NAME() const 
22 //    Where :
23 //    * NAME is the name of the input/output
24 //      (the one provided in the attribute 'name' of the tag 'input')
25 //    * TYPE is the C++ type of the input/output
26 //      (the one provided in the attribute 'type' of the tag 'input')
27 //    bbSetOutputOut( bbGetInputIn() );
28 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
29     
30     if (bbGetInputMeshManagerModel()!=NULL)
31     {
32         if (bbGetInputTool()==10) // Undo
33         {
34                 bbGetInputMeshManagerModel()->Undo();
35             //printf("EED Warning!   MeshManager_tool Undo   Not implemented.\n");
36         } // if Tool 10 Undo
37         
38         if (bbGetInputTool()==20) // Redo
39         {
40                 bbGetInputMeshManagerModel()->Redo();
41             //printf("EED Warning!   MeshManager_tool Redo   Not implemented.\n");
42         } // if Tool 20 Redo
43
44         if (bbGetInputTool()==30)  // Set
45         {
46             if (bbGetInputMesh()!=NULL){
47                 vtkPoints   *points = bbGetInputMesh()->GetPoints();
48                 if (points!=NULL)
49                 {
50                     bbGetInputMeshManagerModel()->SetMeshBase( bbGetInputMesh() );
51                 } // if points!=NULL
52             } // Mesh!=NULL
53         } // if Tool 30 Set
54
55         if (bbGetInputTool()==35)  // Set memory mode
56         {
57                 bbGetInputMeshManagerModel()->SetMeshMemoryMode( bbGetInputMesh() );
58         } // if Tool 35 Set memory mode
59
60         if (bbGetInputTool()==32)  // Copy and Set
61         {
62                 bbGetInputMeshManagerModel()->CopySetMeshBase( bbGetInputMesh() );
63         } // if Tool 35 Set memory mode
64
65         
66         if (bbGetInputTool()==40) // ResetMeshTemp
67         {
68             bbGetInputMeshManagerModel()->ResetMeshTemp();
69         } // if Tool 40 Reset
70         
71         if(bbGetInputTool() == 50) // Set Array of Meshes
72         {
73                 if(bbGetInputMeshes().size() > 1)
74                 {
75                         bbGetInputMeshManagerModel()->ReplaceMesh(bbGetInputMeshes());
76                     }
77         }
78         if(bbGetInputTool() == 60) // Select Mesh by Name
79         {
80                 if(!bbGetInputStringParam().empty())
81                 {
82                         bbGetInputMeshManagerModel()->SelectMeshByName(bbGetInputStringParam());
83                     }
84         }
85         if(bbGetInputTool() == 70) // Delete Current Mesh
86         {
87                     bbGetInputMeshManagerModel()->DeleteCurrentMesh();
88         }
89     } else {
90         printf("EED Warning! MeshManager_tool : MeshManagerModel not defined. \n");
91     }// if MeshManagerModel != NULL
92 }
93
94 //===== 
95 // 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)
96 //===== 
97 void MeshManager_tool::bbUserSetDefaultValues()
98 {
99 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
100 //    Here we initialize the input 'In' to 0
101    bbSetInputTool(0);
102    bbSetInputMesh(NULL);
103    bbSetInputMeshManagerModel(NULL);
104 }
105
106 //===== 
107 // 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)
108 //===== 
109 void MeshManager_tool::bbUserInitializeProcessing()
110 {
111 //  THE INITIALIZATION METHOD BODY :
112 //    Here does nothing 
113 //    but this is where you should allocate the internal/output pointers 
114 //    if any
115 }
116 //===== 
117 // 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)
118 //===== 
119 void MeshManager_tool::bbUserFinalizeProcessing()
120 {
121 //  THE FINALIZATION METHOD BODY :
122 //    Here does nothing 
123 //    but this is where you should desallocate the internal/output pointers 
124 //    if any
125 }
126
127 } // EO namespace bbcreaVtk
128
129