]> Creatis software - creaVtk.git/commitdiff
#3460 Feauture box Actor color option
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 27 Apr 2021 18:26:35 +0000 (20:26 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 27 Apr 2021 18:26:35 +0000 (20:26 +0200)
bbtk_creaVtk_PKG/src/bbcreaVtkActor.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkActor.h

index 6b002489e95175181c7ef321052d601dbd0b5c8f..19626b8aac4d263007a3a74caff0a1a77f3158de 100644 (file)
@@ -40,7 +40,13 @@ void Actor::Process()
     std::string wantedClass = "vtkOpenGLActor";
     if(className == wantedClass)
     {
-               ((vtkActor*)vtkprop3D)->GetProperty()->SetOpacity( bbGetInputOpacity() );
+       vtkActor *vtkactor=((vtkActor*)vtkprop3D);
+               vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
+               vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
+               double r = bbGetInputColor()[0];
+               double g = bbGetInputColor()[1];
+               double b = bbGetInputColor()[2];
+               vtkactor->GetProperty()->SetColor( r,g,b );
     }
      
      if ( bbGetInputTransform()!=NULL )
@@ -73,11 +79,18 @@ void Actor::bbUserSetDefaultValues()
 
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
-   bbSetInputActive(false);
-   backActive=bbGetInputActive();
-   bbSetInputIn(NULL);
-   bbSetInputOpacity(1);
-   bbSetInputRenderer(NULL);
+
+       std::vector<double> color;
+       color.push_back(1);
+       color.push_back(0);
+       color.push_back(0);
+       bbSetInputActive( false );
+       backActive=bbGetInputActive();
+       bbSetInputIn( NULL );
+       bbSetInputOpacity( 1 );
+       bbSetInputLineWidth( 0.5 );
+       bbSetInputRenderer( NULL );
+       bbSetInputColor( color );
 
 }
 //===== 
index 405369fd8cfdad1f911d3d278265510db535c489..101b2aba381a92957f6c52a8cb827f2d412e0285 100644 (file)
@@ -25,6 +25,8 @@ class bbcreaVtk_EXPORT Actor
   BBTK_DECLARE_INPUT(Active,bool);
   BBTK_DECLARE_INPUT(In,vtkProp3D*);
   BBTK_DECLARE_INPUT(Opacity,double);
+  BBTK_DECLARE_INPUT(Color,std::vector<double>);
+  BBTK_DECLARE_INPUT(LineWidth,double);
   BBTK_DECLARE_INPUT(Transform,vtkTransform*);
   BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
 //  BBTK_DECLARE_OUTPUT(Out,double);
@@ -46,6 +48,8 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(Actor,bbtk::AtomicBlackBox);
  BBTK_INPUT(Actor,Active,"Active true/false  (default false)",bool,"");
  BBTK_INPUT(Actor,In,"First input",vtkProp3D*,"");
  BBTK_INPUT(Actor,Opacity,"Opacity 0..1 (default 1)",double,"");
+ BBTK_INPUT(Actor,Color,"(default [1 0 0]red )  RGB color vector [0..1, 0..1, 0..1]   )", std::vector<double>,"");
+ BBTK_INPUT(Actor,LineWidth,"(default 0.5 ) With ligne   )",double,"");
  BBTK_INPUT(Actor,Renderer,"Renderer",vtkRenderer*,"");
 
 // BBTK_OUTPUT(Actor,Out,"First output",double,"");