]> Creatis software - bbtk.git/commitdiff
In SphereList box : added the possibility to use a vector of colors defining the...
authorClaire Mouton <Claire.Mouton@creatis.insa-lyon.fr>
Wed, 11 Apr 2012 16:29:40 +0000 (16:29 +0000)
committerClaire Mouton <Claire.Mouton@creatis.insa-lyon.fr>
Wed, 11 Apr 2012 16:29:40 +0000 (16:29 +0000)
packages/vtk/src/bbvtkSphereList.cxx
packages/vtk/src/bbvtkSphereList.h

index 8e552d7614300e3e8b1c31d86477f0e0b7b108e4..69781933ea02317d58e899bf36a99929191e25e0 100644 (file)
@@ -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 );
        
index ec632f30e266289c9d03c209ebcb1cc20e1edc0d..bf929bfc8ea859a9f04af7496319a2df69fb8d61 100644 (file)
@@ -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<double>,"");
 BBTK_INPUT(SphereList,lstPointZ,"List of Z coordinates. Requirement: same size as vector X and vector Y.",std::vector<double>,"");
 BBTK_INPUT(SphereList,lstRadio,"List of Radio values",std::vector<double>,"");
-BBTK_INPUT(SphereList,Colour,"Colour RGB values for the spheres",std::vector<double>,"");
+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<double>,"");
 BBTK_INPUT(SphereList,Opacity,"Opacity of the spheres",double,"");
 BBTK_INPUT(SphereList,Transform,"vtkTransform",vtkLinearTransform*,"");