From 54a98470cd2684e07391bf0bf46cd7db9b5e7d6c Mon Sep 17 00:00:00 2001 From: Claire Mouton Date: Wed, 11 Apr 2012 16:29:40 +0000 Subject: [PATCH] In SphereList box : added the possibility to use a vector of colors defining the color for each sphere. --- packages/vtk/src/bbvtkSphereList.cxx | 12 +++++++++++- packages/vtk/src/bbvtkSphereList.h | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/vtk/src/bbvtkSphereList.cxx b/packages/vtk/src/bbvtkSphereList.cxx index 8e552d7..6978193 100644 --- a/packages/vtk/src/bbvtkSphereList.cxx +++ b/packages/vtk/src/bbvtkSphereList.cxx @@ -21,6 +21,7 @@ void SphereList::Process() double radio; double spc[3]; + int last_valid_color_index = 0; if (bbGetInputRenderer()!=NULL) { @@ -72,7 +73,16 @@ void SphereList::Process() sphereActor.push_back(newActor); newActor -> SetMapper(newMapper); newActor -> SetOrigin(0, 0, 0); - newActor -> GetProperty() -> SetColor( bbGetInputColour()[0] , bbGetInputColour()[1] , bbGetInputColour()[2] ); + + unsigned int j = 3*i +2; + if (j < bbGetInputColour().size() ) + { + newActor -> GetProperty() -> SetColor( bbGetInputColour()[3*i] , bbGetInputColour()[3*i + 1] , bbGetInputColour()[3*i + 2] ); + last_valid_color_index = 3*i; + } + else + newActor -> GetProperty() -> SetColor( bbGetInputColour()[last_valid_color_index] , bbGetInputColour()[last_valid_color_index + 1] , bbGetInputColour()[last_valid_color_index + 2] ); + newActor -> GetProperty() -> SetOpacity( bbGetInputOpacity() ); newActor -> SetPosition( px,py,pz ); diff --git a/packages/vtk/src/bbvtkSphereList.h b/packages/vtk/src/bbvtkSphereList.h index ec632f3..bf929bf 100644 --- a/packages/vtk/src/bbvtkSphereList.h +++ b/packages/vtk/src/bbvtkSphereList.h @@ -50,7 +50,7 @@ BBTK_INPUT(SphereList,lstPointX,"List of X coordinates. Requirement: same size a BBTK_INPUT(SphereList,lstPointY,"List of Y coordinates. Requirement: same size as vector X and vector Z.",std::vector,""); BBTK_INPUT(SphereList,lstPointZ,"List of Z coordinates. Requirement: same size as vector X and vector Y.",std::vector,""); BBTK_INPUT(SphereList,lstRadio,"List of Radio values",std::vector,""); -BBTK_INPUT(SphereList,Colour,"Colour RGB values for the spheres",std::vector,""); +BBTK_INPUT(SphereList,Colour,"Colour RGB values for the spheres (3 first values of the vector for the first sphere, following values for the second sphere, etc.)",std::vector,""); BBTK_INPUT(SphereList,Opacity,"Opacity of the spheres",double,""); BBTK_INPUT(SphereList,Transform,"vtkTransform",vtkLinearTransform*,""); -- 2.47.1