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)
4 #include "bbcreaVtkVoiMPR.h"
5 #include "bbcreaVtkPackage.h"
10 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,VoiMPR)
11 BBTK_BLACK_BOX_IMPLEMENTATION(VoiMPR,bbtk::AtomicBlackBox);
13 // 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 void VoiMPR::Process()
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
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 // bbSetOutputOut( bbGetInputIn() );
30 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
32 if (bbGetInputIn().size()!=6)
34 printf("EED Warning box not defined.\n");
40 std::vector<int> vecP = bbGetInputIn();
42 std::vector<int> vecPoint = bbGetInputActualPoint();
43 if (vecPoint.size()==3)
45 if ((vecPoint[0]>=vecP[0]) && (vecPoint[0]<=vecP[1]) )
47 showActorYZ=bbGetInputActive() && true;
49 showActorYZ=bbGetInputActive() && false;
51 if ((vecPoint[1]>=vecP[2]) && (vecPoint[1]<=vecP[3]) )
53 showActorXZ=bbGetInputActive() && true;
55 showActorXZ=bbGetInputActive() && false;
57 if ((vecPoint[2]>=vecP[4]) && (vecPoint[2]<=vecP[5]) )
59 showActorXY=bbGetInputActive() && true;
61 showActorXY=bbGetInputActive() && false;
65 showActorXY=bbGetInputActive();
66 showActorYZ=bbGetInputActive();
67 showActorXZ=bbGetInputActive();
70 if (bbGetInputXYrender()!=NULL)
73 pointsXY->SetPoint(0, vecP[0], vecP[2], dep);
74 pointsXY->SetPoint(1, vecP[0], vecP[3], dep);
75 pointsXY->SetPoint(2, vecP[1], vecP[3], dep);
76 pointsXY->SetPoint(3, vecP[1], vecP[2], dep);
77 pointsXY-> Modified();
78 if ( showActorXY==true )
80 if (actorAddedXY==false)
82 bbGetInputXYrender()->AddActor(polygonActorXY);
86 if (actorAddedXY==true)
88 bbGetInputXYrender()->RemoveActor(polygonActorXY);
93 if (bbGetInputYZrender()!=NULL)
96 pointsYZ->SetPoint(0, dep,vecP[2], vecP[4] );
97 pointsYZ->SetPoint(1, dep,vecP[2], vecP[5] );
98 pointsYZ->SetPoint(2, dep,vecP[3], vecP[5] );
99 pointsYZ->SetPoint(3, dep,vecP[3], vecP[4] );
100 pointsYZ-> Modified();
101 if ( showActorYZ==true )
103 if (actorAddedYZ==false)
105 bbGetInputYZrender()->AddActor(polygonActorYZ);
109 if (actorAddedYZ==true)
111 bbGetInputYZrender()->RemoveActor(polygonActorYZ);
116 if (bbGetInputXZrender()!=NULL)
119 pointsXZ->SetPoint(0, vecP[0],dep, vecP[4] );
120 pointsXZ->SetPoint(1, vecP[0],dep, vecP[5] );
121 pointsXZ->SetPoint(2, vecP[1],dep, vecP[5] );
122 pointsXZ->SetPoint(3, vecP[1],dep, vecP[4] );
123 pointsXZ-> Modified();
124 if ( showActorXZ==true )
126 if (actorAddedXZ==false)
128 bbGetInputXZrender()->AddActor(polygonActorXZ);
132 if (actorAddedXZ==true)
134 bbGetInputXZrender()->RemoveActor(polygonActorXZ);
142 // 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)
144 void VoiMPR::bbUserSetDefaultValues()
147 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
148 // Here we initialize the input 'In' to 0
152 bbSetInputActive(true);
153 bbSetInputXYrender(NULL);
154 bbSetInputYZrender(NULL);
155 bbSetInputXZrender(NULL);
158 // 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)
160 void VoiMPR::bbUserInitializeProcessing()
163 // THE INITIALIZATION METHOD BODY :
165 // but this is where you should allocate the internal/output pointers
168 pointsXY = vtkPoints ::New();
169 linesXY = vtkCellArray ::New();
170 polygonXY = vtkPolyData ::New();
171 polygonMapperXY = vtkPolyDataMapper ::New();
172 polygonActorXY = vtkActor ::New();
173 pointsXY -> SetNumberOfPoints(4);
174 pointsXY -> SetPoint(0, 0, 0, 0);
175 pointsXY -> SetPoint(1, 0, 0, 0);
176 pointsXY -> SetPoint(2, 0, 0, 0);
177 pointsXY -> SetPoint(3, 0, 0, 0);
178 linesXY -> InsertNextCell(5);
179 linesXY -> InsertCellPoint(0);
180 linesXY -> InsertCellPoint(1);
181 linesXY -> InsertCellPoint(2);
182 linesXY -> InsertCellPoint(3);
183 linesXY -> InsertCellPoint(0);
184 polygonXY -> SetPoints(pointsXY);
185 polygonXY -> SetLines(linesXY);
186 polygonMapperXY -> SetInputData(polygonXY);
187 polygonMapperXY -> Update();
188 polygonActorXY -> SetMapper(polygonMapperXY);
191 pointsXZ = vtkPoints ::New();
192 linesXZ = vtkCellArray ::New();
193 polygonXZ = vtkPolyData ::New();
194 polygonMapperXZ = vtkPolyDataMapper ::New();
195 polygonActorXZ = vtkActor ::New();
196 pointsXZ -> SetNumberOfPoints(4);
197 pointsXZ -> SetPoint(0, 0, 0, 0);
198 pointsXZ -> SetPoint(1, 0, 0, 0);
199 pointsXZ -> SetPoint(2, 0, 0, 0);
200 pointsXZ -> SetPoint(3, 0, 0, 0);
201 linesXZ -> InsertNextCell(5);
202 linesXZ -> InsertCellPoint(0);
203 linesXZ -> InsertCellPoint(1);
204 linesXZ -> InsertCellPoint(2);
205 linesXZ -> InsertCellPoint(3);
206 linesXZ -> InsertCellPoint(0);
207 polygonXZ -> SetPoints(pointsXZ);
208 polygonXZ -> SetLines(linesXZ);
209 polygonMapperXZ -> SetInputData(polygonXZ);
210 polygonMapperXZ -> Update();
211 polygonActorXZ -> SetMapper(polygonMapperXZ);
213 pointsYZ = vtkPoints ::New();
214 linesYZ = vtkCellArray ::New();
215 polygonYZ = vtkPolyData ::New();
216 polygonMapperYZ = vtkPolyDataMapper ::New();
217 polygonActorYZ = vtkActor ::New();
218 pointsYZ ->SetNumberOfPoints(4);
219 pointsYZ ->SetPoint(0, 0, 0, 0);
220 pointsYZ ->SetPoint(1, 0, 0, 0);
221 pointsYZ ->SetPoint(2, 0, 0, 0);
222 pointsYZ ->SetPoint(3, 0, 0, 0);
223 linesYZ ->InsertNextCell(5);
224 linesYZ ->InsertCellPoint(0);
225 linesYZ ->InsertCellPoint(1);
226 linesYZ ->InsertCellPoint(2);
227 linesYZ ->InsertCellPoint(3);
228 linesYZ ->InsertCellPoint(0);
229 polygonYZ -> SetPoints(pointsYZ);
230 polygonYZ -> SetLines(linesYZ);
231 polygonMapperYZ -> SetInputData(polygonYZ);
232 polygonMapperYZ -> Update();
233 polygonActorYZ -> SetMapper(polygonMapperYZ);
236 // 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)
238 void VoiMPR::bbUserFinalizeProcessing()
241 // THE FINALIZATION METHOD BODY :
243 // but this is where you should desallocate the internal/output pointers
248 // EO namespace bbcreaVtk