]> Creatis software - bbtk.git/blob - packages/vtk/src/bbvtkText3D.cxx
Feature #1609 g packages/wxvtk/doc/bbdoc
[bbtk.git] / packages / vtk / src / bbvtkText3D.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 "bbvtkText3D.h"
5 #include "bbvtkPackage.h"
6
7
8 namespace bbvtk
9 {
10
11 BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,Text3D)
12 BBTK_BLACK_BOX_IMPLEMENTATION(Text3D,bbtk::AtomicBlackBox);
13 //===== 
14 // 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 //===== 
16 void Text3D::Process()
17 {
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
31   // First time : creates the text actor and sets its text.
32   if (_textActor == NULL)
33     {
34         _textActor = vtkTextActor3D::New();
35         _textProp = vtkTextProperty::New();
36         if ( bbGetInputRenderer()!=NULL )
37         {
38                 bbGetInputRenderer()->AddActor( _textActor );
39         }
40         _textProp->SetFontSize( 14 );
41         _textActor->SetTextProperty( _textProp  );
42     }
43   // If the text actor already exists in the scene, simply refresh its text.
44   else
45     {
46         _textProp->SetColor( bbGetInputColour()[0] , bbGetInputColour()[1], bbGetInputColour()[2] );
47
48         _textActor->SetInput( bbGetInputIn().c_str()  );
49         _textActor->SetPosition(  bbGetInputX(), bbGetInputY(),bbGetInputZ() );
50         
51         if ( bbGetInputTransform()!=NULL )
52         {
53                 _textActor->SetUserTransform( bbGetInputTransform() );
54         }
55         
56         bbSetOutputOut(_textActor);
57     }
58 }
59
60 //===== 
61 // 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)
62 //===== 
63 void Text3D::bbUserSetDefaultValues()
64 {
65
66 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
67 //    Here we initialize the input 'In' to 0
68         bbSetInputIn("<void>");
69         bbSetInputX(0);
70         bbSetInputY(0);
71         bbSetInputZ(0);
72         
73         std::vector<double> colour;
74         colour.push_back(1);
75         colour.push_back(0);
76         colour.push_back(0);
77         bbSetInputColour(colour);
78         bbSetInputRenderer(NULL);
79         bbSetInputTransform(NULL);
80
81         _textActor = NULL;
82         _textProp = NULL;
83 }
84 //===== 
85 // 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)
86 //===== 
87 void Text3D::bbUserInitializeProcessing()
88 {
89
90 //  THE INITIALIZATION METHOD BODY :
91 //    Here does nothing 
92 //    but this is where you should allocate the internal/output pointers 
93 //    if any 
94
95   
96 }
97 //===== 
98 // 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)
99 //===== 
100 void Text3D::bbUserFinalizeProcessing()
101 {
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 }
110 // EO namespace bbvtk
111
112