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