]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkLinearExtrusionFilter.cxx
#3488 Extrusion Boxes
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkLinearExtrusionFilter.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 "bbcreaVtkLinearExtrusionFilter.h"
5 #include "bbcreaVtkPackage.h"
6
7
8 namespace bbcreaVtk
9 {
10
11 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,LinearExtrusionFilter)
12 BBTK_BLACK_BOX_IMPLEMENTATION(LinearExtrusionFilter,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 LinearExtrusionFilter::Process()
17 {
18
19 // THE MAIN PROCESSING METHOD BODY
20 //   Here we simply set the input 'In' value to the output 'Out'
21 //   And print out the output value
22 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
23 //    void bbSet{Input|Output}NAME(const TYPE&)
24 //    const TYPE& bbGet{Input|Output}NAME() const 
25 //    Where :
26 //    * NAME is the name of the input/output
27 //      (the one provided in the attribute 'name' of the tag 'input')
28 //    * TYPE is the C++ type of the input/output
29 //      (the one provided in the attribute 'type' of the tag 'input')
30 //    bbSetOutputOut( bbGetInputIn() );
31 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
32   
33     if (bbGetInputIn()!=NULL)
34     {
35         if (extrude!=NULL)
36         {
37             extrude->Delete();
38         }
39         if (triangleFilter!=NULL)
40         {
41             triangleFilter->Delete();
42         }
43
44         extrude         = vtkLinearExtrusionFilter::New();
45         triangleFilter  = vtkTriangleFilter::New();
46         extrude->SetInputData( bbGetInputIn() );
47         extrude->SetExtrusionTypeToNormalExtrusion();
48         std::vector<double> dir = bbGetInputDirection();
49         if (dir.size()==3)
50         {
51             extrude->SetVector( dir[0],dir[1],dir[2] );
52         } else {
53             extrude->SetVector(1, 0, 0);
54         }
55         extrude->SetScaleFactor( bbGetInputScalarFactor() );
56         extrude->Update();
57         triangleFilter->SetInputData( extrude->GetOutput() );
58         triangleFilter->Update( );
59         bbSetOutputOut( triangleFilter->GetOutput() );
60     } // if bbGetInputIn
61 }
62 //===== 
63 // 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)
64 //===== 
65 void LinearExtrusionFilter::bbUserSetDefaultValues()
66 {
67
68 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
69 //    Here we initialize the input 'In' to 0
70
71     extrude         = NULL;
72     triangleFilter  = NULL;
73     bbSetInputIn(NULL);
74
75     std::vector<double> dir;
76     dir.push_back(1);
77     dir.push_back(0);
78     dir.push_back(0);
79     bbSetInputDirection( dir );
80     bbSetInputScalarFactor(0);
81
82 }
83 //===== 
84 // 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)
85 //===== 
86 void LinearExtrusionFilter::bbUserInitializeProcessing()
87 {
88
89 //  THE INITIALIZATION METHOD BODY :
90 //    Here does nothing 
91 //    but this is where you should allocate the internal/output pointers 
92 //    if any 
93
94   
95 }
96 //===== 
97 // 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)
98 //===== 
99 void LinearExtrusionFilter::bbUserFinalizeProcessing()
100 {
101
102 //  THE FINALIZATION METHOD BODY :
103 //    Here does nothing 
104 //    but this is where you should desallocate the internal/output pointers 
105 //    if any
106   
107 }
108 }
109 // EO namespace bbcreaVtk
110
111