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