From 116ece0f13329629fcf45cb53f719dafafd3520a Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 9 May 2014 16:17:32 +0200 Subject: [PATCH] Text2D FontSize, Color --- packages/vtk/src/bbvtkText2D.cxx | 17 ++++++++++++++--- packages/vtk/src/bbvtkText2D.h | 8 ++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/vtk/src/bbvtkText2D.cxx b/packages/vtk/src/bbvtkText2D.cxx index 75967a2..c5d9d73 100644 --- a/packages/vtk/src/bbvtkText2D.cxx +++ b/packages/vtk/src/bbvtkText2D.cxx @@ -70,13 +70,18 @@ void Text2D::Process() // textActor->GetPosition2Coordinate()->SetValue(0.6, 0.1); vtkTextProperty *tprop = _textActor->GetTextProperty(); - tprop->SetFontSize(10); + tprop->SetFontSize( bbGetInputFontSize() ); tprop->SetFontFamilyToArial(); tprop->SetJustificationToCentered(); // tprop->BoldOn(); // tprop->ItalicOn(); // tprop->ShadowOn(); - tprop->SetColor(0, 0, 1); + + if (bbGetInputColor().size()>=3) + { + tprop->SetColor( bbGetInputColor()[0] , bbGetInputColor()[1] , bbGetInputColor()[2] ); + } + tprop->SetOpacity( bbGetInputOpacity() ); } @@ -92,13 +97,19 @@ void Text2D::bbUserSetDefaultValues() _textActor=NULL; bbSetInputIn("VOID"); bbSetInputOpacity(1); - bbSetInputRenderer(NULL); + bbSetInputFontSize(14); std::vector spc; spc.push_back(1); spc.push_back(1); spc.push_back(1); bbSetInputSpacing(spc); + std::vector color; + color.push_back(0); + color.push_back(0); + color.push_back(1); + bbSetInputColor(color); + bbSetInputRenderer(NULL); } //===== diff --git a/packages/vtk/src/bbvtkText2D.h b/packages/vtk/src/bbvtkText2D.h index ad9821e..ff85ca4 100644 --- a/packages/vtk/src/bbvtkText2D.h +++ b/packages/vtk/src/bbvtkText2D.h @@ -27,6 +27,8 @@ BBTK_DECLARE_INPUT(In,std::string); BBTK_DECLARE_INPUT(Point,std::vector); BBTK_DECLARE_INPUT(Spacing,std::vector); BBTK_DECLARE_INPUT(Opacity,double); + BBTK_DECLARE_INPUT(FontSize,int); + BBTK_DECLARE_INPUT(Color,std::vector); BBTK_DECLARE_OUTPUT( Out , vtkProp* ); BBTK_PROCESS(Process); void Process(); @@ -47,8 +49,10 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(Text2D,bbtk::AtomicBlackBox); BBTK_INPUT(Text2D,In,"Input text (default = 'VOID')",std::string,""); BBTK_INPUT(Text2D,Point,"Point [x,y,z]",std::vector,""); BBTK_INPUT(Text2D,Spacing,"Spacing [sx,sy,sz] default [1,1,1]",std::vector,""); - BBTK_INPUT(Text2D,Opacity,"Pacity default 1 ",double,""); - BBTK_INPUT(Text2D,Renderer,"Input text",vtkRenderer*,""); + BBTK_INPUT(Text2D,Opacity,"Pacity (default 1)",double,""); + BBTK_INPUT(Text2D,Renderer,"Vtk Rendere ",vtkRenderer*,""); + BBTK_INPUT(Text2D,FontSize,"Font size (default 14)",int,""); + BBTK_INPUT(Text2D,Color,"vector color [r,g,b] (default [0,0,1])",std::vector,""); BBTK_OUTPUT(Text2D,Out,"vtk Prop",vtkProp*,""); -- 2.47.1