]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkActor.cxx
Clean code
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkActor.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 "bbcreaVtkActor.h"
5 #include "bbcreaVtkPackage.h"
6 #include "vtkProperty.h"
7
8
9 namespace bbcreaVtk
10 {
11
12 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,Actor)
13 BBTK_BLACK_BOX_IMPLEMENTATION(Actor,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 Actor::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 //    bbSetOutputOut( bbGetInputIn() );
33 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
34  
35         if (bbGetInputIn()!=NULL)
36         {
37                 vtkProp3D* vtkprop3D=bbGetInputIn();
38                 std::string className = vtkprop3D->GetClassName();
39                 std::string wantedClass = "vtkOpenGLActor";
40                 if(className == wantedClass)
41                 {
42                         vtkActor *vtkactor=((vtkActor*)vtkprop3D);
43                         vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
44                         vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
45                         double r = bbGetInputColor()[0];
46                         double g = bbGetInputColor()[1];
47                         double b = bbGetInputColor()[2];
48                         vtkactor->GetProperty()->SetColor( r,g,b );
49                 }
50                  if ( bbGetInputTransform()!=NULL )
51                  {
52                     vtkprop3D->SetUserTransform( bbGetInputTransform() );
53                  }
54
55         // bbSetOutputOut( vtkactor );
56         // Interface Update
57
58                 if ((bbGetInputRenderer()!=NULL) && ( backActive!=bbGetInputActive() ))
59                 {
60                         if (bbGetInputActive()==true )
61                         {
62                                 bbGetInputRenderer()->AddActor( vtkprop3D );
63                         }  else {
64                                 bbGetInputRenderer()->RemoveActor( vtkprop3D );
65                         }  //if Active
66                         backActive=bbGetInputActive();
67                 } // if Renderer
68         }// bbGetInputIn
69
70 }
71 //===== 
72 // 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)
73 //===== 
74 void Actor::bbUserSetDefaultValues()
75 {
76
77 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
78 //    Here we initialize the input 'In' to 0
79
80         std::vector<double> color;
81         color.push_back(1);
82         color.push_back(0);
83         color.push_back(0);
84         bbSetInputActive( false );
85         backActive=bbGetInputActive();
86         bbSetInputIn( NULL );
87         bbSetInputOpacity( 1 );
88         bbSetInputLineWidth( 0.5 );
89         bbSetInputRenderer( NULL );
90         bbSetInputColor( color );
91
92 }
93 //===== 
94 // 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)
95 //===== 
96 void Actor::bbUserInitializeProcessing()
97 {
98
99 //  THE INITIALIZATION METHOD BODY :
100 //    Here does nothing 
101 //    but this is where you should allocate the internal/output pointers 
102 //    if any 
103
104   
105 }
106 //===== 
107 // 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)
108 //===== 
109 void Actor::bbUserFinalizeProcessing()
110 {
111
112 //  THE FINALIZATION METHOD BODY :
113 //    Here does nothing 
114 //    but this is where you should desallocate the internal/output pointers 
115 //    if any
116   
117 }
118 }
119 // EO namespace bbcreaVtk
120
121