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)
4 #include "bbvtkText2D.h"
5 #include "bbvtkPackage.h"
7 #include "vtkTextProperty.h"
12 BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,Text2D)
13 BBTK_BLACK_BOX_IMPLEMENTATION(Text2D,bbtk::AtomicBlackBox);
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)
17 void Text2D::Process()
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
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')
32 // bbSetOutputOut( bbGetInputIn() );
33 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
38 _textActor = vtkTextActor::New();
39 _textActor->GetPositionCoordinate()->SetCoordinateSystemToWorld();
41 if (bbGetInputRenderer()!=NULL)
43 bbGetInputRenderer()->AddActor2D(_textActor);
47 _textActor->SetInput(bbGetInputIn().c_str());
49 // textActor->SetTextScaleModeToProp();
50 // textActor->SetDisplayPosition(90, 50);
51 // textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
57 if (bbGetInputPoint().size()>=2)
59 px=bbGetInputPoint()[0];
60 py=bbGetInputPoint()[1];
62 if (bbGetInputSpacing().size()>=2)
64 spx=bbGetInputSpacing()[0];
65 spy=bbGetInputSpacing()[1];
69 _textActor->SetPosition( px*spx , py*spy );
70 // textActor->GetPosition2Coordinate()->SetValue(0.6, 0.1);
72 vtkTextProperty *tprop = _textActor->GetTextProperty();
73 tprop->SetFontSize( bbGetInputFontSize() );
74 tprop->SetFontFamilyToArial();
75 tprop->SetJustificationToCentered();
80 if (bbGetInputColor().size()>=3)
82 tprop->SetColor( bbGetInputColor()[0] , bbGetInputColor()[1] , bbGetInputColor()[2] );
85 tprop->SetOpacity( bbGetInputOpacity() );
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)
91 void Text2D::bbUserSetDefaultValues()
94 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
95 // Here we initialize the input 'In' to 0
100 bbSetInputFontSize(14);
101 std::vector<double> spc;
105 bbSetInputSpacing(spc);
106 std::vector<double> color;
110 bbSetInputColor(color);
112 bbSetInputRenderer(NULL);
116 // 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)
118 void Text2D::bbUserInitializeProcessing()
121 // THE INITIALIZATION METHOD BODY :
123 // but this is where you should allocate the internal/output pointers
129 // 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)
131 void Text2D::bbUserFinalizeProcessing()
134 // THE FINALIZATION METHOD BODY :
136 // but this is where you should desallocate the internal/output pointers
141 // EO namespace bbvtk