]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkVectorPolyDataReader.cxx
#2542 creaVtk Feature New Normal - VectorPolyDataReader DirName
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkVectorPolyDataReader.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 "bbcreaVtkVectorPolyDataReader.h"
5 #include "bbcreaVtkPackage.h"
6
7 #include <vtkPolyDataReader.h>
8
9 namespace bbcreaVtk
10 {
11
12 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,VectorPolyDataReader)
13 BBTK_BLACK_BOX_IMPLEMENTATION(VectorPolyDataReader,bbtk::AtomicBlackBox);
14 //===== 
15 // 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)
16 //===== 
17 void VectorPolyDataReader::Process()
18 {
19
20 // THE MAIN PROCESSING METHOD BODY
21 //   Here we simply set the input 'In' value to the output 'Out'
22 //   And print out the output value
23 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
24 //    void bbSet{Input|Output}NAME(const TYPE&)
25 //    const TYPE& bbGet{Input|Output}NAME() const 
26 //    Where :
27 //    * NAME is the name of the input/output
28 //      (the one provided in the attribute 'name' of the tag 'input')
29 //    * TYPE is the C++ type of the input/output
30 //      (the one provided in the attribute 'type' of the tag 'input')
31
32
33          std::vector<vtkPolyData*> vecPolyData;
34          std::string tmpFileName;
35
36     int i,size=bbGetInputFileNameVector().size();
37          for (i=0;i<size; i++)
38     {
39        vtkPolyDataReader *reader = vtkPolyDataReader::New();
40                  tmpFileName=bbGetInputDirName() + "/" + bbGetInputFileNameVector()[i];
41                  reader->SetFileName( tmpFileName.c_str() );
42        reader->ReadAllScalarsOn();
43        reader->ReadAllVectorsOn();
44        reader->ReadAllNormalsOn();
45        reader->ReadAllTensorsOn();
46        reader->ReadAllColorScalarsOn ();
47        reader->ReadAllTCoordsOn();
48        reader->ReadAllFieldsOn();
49        reader->Update();
50        vecPolyData.push_back( reader->GetOutput() );
51     }
52         
53     bbSetOutputPolyDataVector( vecPolyData );
54   
55 }
56 //===== 
57 // 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)
58 //===== 
59 void VectorPolyDataReader::bbUserSetDefaultValues()
60 {
61
62 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
63 //    Here we initialize the input 'In' to 0
64
65    bbSetInputDirName("");
66   
67 }
68 //===== 
69 // 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)
70 //===== 
71 void VectorPolyDataReader::bbUserInitializeProcessing()
72 {
73
74 //  THE INITIALIZATION METHOD BODY :
75 //    Here does nothing 
76 //    but this is where you should allocate the internal/output pointers 
77 //    if any 
78
79   
80 }
81 //===== 
82 // 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)
83 //===== 
84 void VectorPolyDataReader::bbUserFinalizeProcessing()
85 {
86
87 //  THE FINALIZATION METHOD BODY :
88 //    Here does nothing 
89 //    but this is where you should desallocate the internal/output pointers 
90 //    if any
91   
92 }
93 }
94 // EO namespace bbcreaVtk
95
96