]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkMeshReduction_DecimatePro.cxx
Clean code
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkMeshReduction_DecimatePro.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 "bbcreaVtkMeshReduction_DecimatePro.h"
5 #include "bbcreaVtkPackage.h"
6
7
8 namespace bbcreaVtk
9 {
10
11 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,MeshReduction_DecimatePro)
12 BBTK_BLACK_BOX_IMPLEMENTATION(MeshReduction_DecimatePro,bbtk::AtomicBlackBox);
13 //===== 
14 // 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)
15 //===== 
16 void MeshReduction_DecimatePro::Process()
17 {
18 // THE MAIN PROCESSING METHOD BODY
19 //   Here we simply set the input 'In' value to the output 'Out'
20 //   And print out the output value
21 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
22 //    void bbSet{Input|Output}NAME(const TYPE&)
23 //    const TYPE& bbGet{Input|Output}NAME() const 
24 //    Where :
25 //    * NAME is the name of the input/output
26 //      (the one provided in the attribute 'name' of the tag 'input')
27 //    * TYPE is the C++ type of the input/output
28 //      (the one provided in the attribute 'type' of the tag 'input')
29         if (firsttime==true)
30         {
31                 firsttime       = false;
32                 decimatepro = vtkDecimatePro::New();
33         }
34     if (bbGetInputIn()!=NULL)
35     {
36         decimatepro->SetInputData( bbGetInputIn() );
37         decimatepro->SetTargetReduction( bbGetInputTargetReduction() );
38         decimatepro->PreserveTopologyOn();
39         decimatepro->Update();
40         bbSetOutputOut(decimatepro->GetOutput() );
41     } else {
42         bbSetOutputOut( NULL );
43     } // if In
44 }
45 //===== 
46 // 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)
47 //===== 
48 void MeshReduction_DecimatePro::bbUserSetDefaultValues()
49 {
50
51 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
52 //    Here we initialize the input 'In' to 0
53         firsttime       =       true;
54         decimatepro     =       NULL;
55         bbSetInputIn(NULL);
56         bbSetInputTargetReduction(0.5);
57     bbSetOutputOut( NULL );
58 }
59 //===== 
60 // 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)
61 //===== 
62 void MeshReduction_DecimatePro::bbUserInitializeProcessing()
63 {
64
65 //  THE INITIALIZATION METHOD BODY :
66 //    Here does nothing 
67 //    but this is where you should allocate the internal/output pointers 
68 //    if any 
69
70   
71 }
72 //===== 
73 // 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)
74 //===== 
75 void MeshReduction_DecimatePro::bbUserFinalizeProcessing()
76 {
77
78 //  THE FINALIZATION METHOD BODY :
79 //    Here does nothing 
80 //    but this is where you should desallocate the internal/output pointers 
81 //    if any
82   
83         if (decimatepro!=NULL)
84         {
85                 decimatepro->Delete();
86         } 
87
88 }
89 }
90 // EO namespace bbcreaVtk
91
92