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