]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkMeshManager_tool.cxx
#3504 Mesh Manager handle multiple meshes
[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             printf("EED Warning!   MeshManager_tool Undo   Not implemented.\n");
35         } // if Tool 10 Undo
36         
37         if (bbGetInputTool()==20) // Redo
38         {
39             printf("EED Warning!   MeshManager_tool Redo   Not implemented.\n");
40         } // if Tool 20 Redo
41
42         if (bbGetInputTool()==30)  // Set
43         {
44             if (bbGetInputMesh()!=NULL){
45                 vtkPoints   *points = bbGetInputMesh()->GetPoints();
46                 if (points!=NULL)
47                 {
48                     bbGetInputMeshManagerModel()->SetMeshBase( bbGetInputMesh() );
49                 } // if points!=NULL
50             } // Mesh!=NULL
51         } // if Tool 30 Set
52
53         if (bbGetInputTool()==35)  // Set memory mode
54         {
55                 bbGetInputMeshManagerModel()->SetMeshMemoryMode( bbGetInputMesh() );
56         } // if Tool 35 Set memory mode
57
58         if (bbGetInputTool()==32)  // Copy and Set
59         {
60                 bbGetInputMeshManagerModel()->CopySetMeshBase( bbGetInputMesh() );
61         } // if Tool 35 Set memory mode
62
63         
64         if (bbGetInputTool()==40) // ResetMeshTemp
65         {
66             bbGetInputMeshManagerModel()->ResetMeshTemp();
67         } // if Tool 40 Reset
68         
69         if(bbGetInputTool() == 50) // Set Array of Meshes
70         {
71                 if(bbGetInputMeshes().size() > 1)
72                 {
73                         if(bbGetInputMeshManagerModel()->GetNumberOfMeshes() == 1){
74                                         bbGetInputMeshManagerModel()->DeleteAll();
75                         }
76                         if(bbGetInputMeshManagerModel()->GetNumberOfMeshes() > 1)
77                         {
78                                 bbGetInputMeshManagerModel()->DeleteCurrentMesh();
79                         }
80                                 bbGetInputMeshManagerModel()->InsertMeshesAtCurrent(bbGetInputMeshes());
81                     }
82         }
83         if(bbGetInputTool() == 60) // Select Mesh by Name
84         {
85                 if(!bbGetInputStringParam().empty())
86                 {
87                         bbGetInputMeshManagerModel()->SelectMeshByName(bbGetInputStringParam());
88                     }
89         }
90         if(bbGetInputTool() == 70) // Delete Current Mesh
91         {
92                     bbGetInputMeshManagerModel()->DeleteCurrentMesh();
93         }
94     } else {
95         printf("EED Warning! MeshManager_tool : MeshManagerModel not defined. \n");
96     }// if MeshManagerModel != NULL
97 }
98
99 //===== 
100 // 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)
101 //===== 
102 void MeshManager_tool::bbUserSetDefaultValues()
103 {
104 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
105 //    Here we initialize the input 'In' to 0
106    bbSetInputTool(0);
107    bbSetInputMesh(NULL);
108    bbSetInputMeshManagerModel(NULL);
109 }
110
111 //===== 
112 // 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)
113 //===== 
114 void MeshManager_tool::bbUserInitializeProcessing()
115 {
116 //  THE INITIALIZATION METHOD BODY :
117 //    Here does nothing 
118 //    but this is where you should allocate the internal/output pointers 
119 //    if any
120 }
121 //===== 
122 // 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)
123 //===== 
124 void MeshManager_tool::bbUserFinalizeProcessing()
125 {
126 //  THE FINALIZATION METHOD BODY :
127 //    Here does nothing 
128 //    but this is where you should desallocate the internal/output pointers 
129 //    if any
130 }
131
132 } // EO namespace bbcreaVtk
133
134