]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkMeshReduction_DecimatePro.cxx
fa077d8199c9f84cc34c26a5c67c1527a210603b
[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         printf("EED MeshReduction_DecimatePro::Process  Running... \n");
40         decimatepro->Update();
41         printf("EED MeshReduction_DecimatePro::Process  ...finish \n");
42         bbSetOutputOut(decimatepro->GetOutput() );
43     } else {
44         bbSetOutputOut( NULL );
45     } // if In
46 }
47 //===== 
48 // 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)
49 //===== 
50 void MeshReduction_DecimatePro::bbUserSetDefaultValues()
51 {
52
53 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
54 //    Here we initialize the input 'In' to 0
55         firsttime       =       true;
56         decimatepro     =       NULL;
57         bbSetInputIn(NULL);
58         bbSetInputTargetReduction(0.5);
59     bbSetOutputOut( NULL );
60 }
61 //===== 
62 // 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)
63 //===== 
64 void MeshReduction_DecimatePro::bbUserInitializeProcessing()
65 {
66
67 //  THE INITIALIZATION METHOD BODY :
68 //    Here does nothing 
69 //    but this is where you should allocate the internal/output pointers 
70 //    if any 
71
72   
73 }
74 //===== 
75 // 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)
76 //===== 
77 void MeshReduction_DecimatePro::bbUserFinalizeProcessing()
78 {
79
80 //  THE FINALIZATION METHOD BODY :
81 //    Here does nothing 
82 //    but this is where you should desallocate the internal/output pointers 
83 //    if any
84   
85         if (decimatepro!=NULL)
86         {
87                 decimatepro->Delete();
88         } 
89
90 }
91 }
92 // EO namespace bbcreaVtk
93
94