]> Creatis software - bbtk.git/blob - packages/vtk/src/bbvtkText2D.cxx
2366 BBTK Feature New Normal Text2D in vtk Package
[bbtk.git] / packages / vtk / src / bbvtkText2D.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 "bbvtkText2D.h"
5 #include "bbvtkPackage.h"
6
7 #include "vtkTextActor.h"
8 #include "vtkTextProperty.h"
9
10 namespace bbvtk
11 {
12
13 BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,Text2D)
14 BBTK_BLACK_BOX_IMPLEMENTATION(Text2D,bbtk::AtomicBlackBox);
15 //===== 
16 // 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)
17 //===== 
18 void Text2D::Process()
19 {
20
21 // THE MAIN PROCESSING METHOD BODY
22 //   Here we simply set the input 'In' value to the output 'Out'
23 //   And print out the output value
24 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
25 //    void bbSet{Input|Output}NAME(const TYPE&)
26 //    const TYPE& bbGet{Input|Output}NAME() const 
27 //    Where :
28 //    * NAME is the name of the input/output
29 //      (the one provided in the attribute 'name' of the tag 'input')
30 //    * TYPE is the C++ type of the input/output
31 //      (the one provided in the attribute 'type' of the tag 'input')
32
33 //    bbSetOutputOut( bbGetInputIn() );
34 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
35   
36  vtkTextActor *textActor = vtkTextActor::New();
37  textActor->SetTextScaleModeToProp();
38  textActor->SetDisplayPosition(90, 50);
39  textActor->SetInput(bbGetInputIn().c_str());
40
41  textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
42  textActor->GetPosition2Coordinate()->SetValue(0.6, 0.1);
43
44  vtkTextProperty *tprop = textActor->GetTextProperty();
45  tprop->SetFontSize(18);
46  tprop->SetFontFamilyToArial();
47  tprop->SetJustificationToCentered();
48 // tprop->BoldOn();
49 // tprop->ItalicOn();
50 // tprop->ShadowOn();
51  tprop->SetColor(0, 0, 1);
52
53  bbGetInputRenderer()->AddActor2D(textActor);
54   
55 }
56 //===== 
57 // 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)
58 //===== 
59 void Text2D::bbUserSetDefaultValues()
60 {
61
62 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
63 //    Here we initialize the input 'In' to 0
64  bbSetInputIn("VOID");  
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 Text2D::bbUserInitializeProcessing()
70 {
71
72 //  THE INITIALIZATION METHOD BODY :
73 //    Here does nothing 
74 //    but this is where you should allocate the internal/output pointers 
75 //    if any 
76
77   
78 }
79 //===== 
80 // 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)
81 //===== 
82 void Text2D::bbUserFinalizeProcessing()
83 {
84
85 //  THE FINALIZATION METHOD BODY :
86 //    Here does nothing 
87 //    but this is where you should desallocate the internal/output pointers 
88 //    if any
89   
90 }
91 }
92 // EO namespace bbvtk
93
94