]> Creatis software - bbtk.git/blobdiff - packages/vtk/src/bbvtkSphereList.cxx
In SphereList box : added the possibility to use a vector of colors defining the...
[bbtk.git] / packages / vtk / src / bbvtkSphereList.cxx
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 );