]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkActor.cxx
df2080c97d45c0599366dc0bc5b9da72b6846525
[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 // 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)
67 //===== 
68 void Actor::bbUserSetDefaultValues()
69 {
70
71 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
72 //    Here we initialize the input 'In' to 0
73
74         std::vector<double> color;
75         color.push_back(1);
76         color.push_back(0);
77         color.push_back(0);
78         bbSetInputActive( false );
79         backActive=bbGetInputActive();
80         bbSetInputIn( NULL );
81         bbSetInputOpacity( 1 );
82         bbSetInputLineWidth( 0.5 );
83         bbSetInputRenderer( NULL );
84         bbSetInputColor( color );
85         bbSetInputTransform( NULL );
86
87 }
88 //===== 
89 // 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)
90 //===== 
91 void Actor::bbUserInitializeProcessing()
92 {
93
94 //  THE INITIALIZATION METHOD BODY :
95 //    Here does nothing 
96 //    but this is where you should allocate the internal/output pointers 
97 //    if any 
98
99   
100 }
101 //===== 
102 // 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)
103 //===== 
104 void Actor::bbUserFinalizeProcessing()
105 {
106
107 //  THE FINALIZATION METHOD BODY :
108 //    Here does nothing 
109 //    but this is where you should desallocate the internal/output pointers 
110 //    if any
111   
112 }
113 }
114 // EO namespace bbcreaVtk
115
116