void SphereList::Process()
{
- int iMin, iMax;
+ int iMin, iMax;
double px = 0.0;
double py = 0.0;
double pz = 0.0;
int last_valid_color_index = 0;
+
if (bbGetInputRenderer()!=NULL)
{
- if (bbGetInputSpacing().size()==3)
- {
+ // If it is not the first time Process is executed, the actors have already been created. The only thing to do is to update the opacity.
+ if (sphereActor.size() != 0)
+ {
+ for (int i = 0; i < sphereActor.size(); i++)
+ sphereActor[i] -> GetProperty() -> SetOpacity( bbGetInputOpacity() );
+ }
+ else
+ {
+ if (bbGetInputSpacing().size()==3)
+ {
spc[0]=bbGetInputSpacing()[0];
spc[1]=bbGetInputSpacing()[1];
spc[2]=bbGetInputSpacing()[2];
- } else {
+ }
+ else
+ {
spc[0]=spc[1]=spc[2]=1;
- }
-
- iMin=0;
- iMax=bbGetInputlstPointX().size();
- printf("EED SphereList::Process iMax=%d \n", iMax);
- // If the vector Y or respectively the vector Z has a different size from the vector X, the position value py or respectively pz is set to 0.
- for ( int i=iMin ; i<iMax ; i=i+1 )
- {
+ }
+
+ iMin=0;
+ iMax=bbGetInputlstPointX().size();
+ printf("EED SphereList::Process iMax=%d \n", iMax);
+ for (int i = 0; i < iMax; i++)
+ {
+ std::cout << "CM SphereList::Process i=" << i << " bbGetInputlstPointX()[i]=" << bbGetInputlstPointX()[i] << std::endl;
+ std::cout << "CM SphereList::Process i=" << i << " bbGetInputlstPointY()[i]=" << bbGetInputlstPointY()[i] << std::endl;
+ std::cout << "CM SphereList::Process i=" << i << " bbGetInputlstPointZ()[i]=" << bbGetInputlstPointZ()[i] << std::endl;
+ }
+ // If the vector Y or respectively the vector Z has a different size from the vector X, the position value py or respectively pz is set to 0.
+ // Stops at iMax - 1 because of a bug of the box stdReadColumnsDouble creating an extra line at the end of the file.
+ for ( int i=iMin ; i<iMax-1; i=i+1 )
+ {
px = bbGetInputlstPointX()[i]*spc[0];
if (bbGetInputlstPointY().size() == bbGetInputlstPointX().size() )
{
// If the number of elements in the radio list is different from the number of X coordinates, the radio value is set to 1.
if (bbGetInputlstRadio().size() == bbGetInputlstPointX().size() )
- {
+ {
radio = bbGetInputlstRadio()[i];
- }
+ }
else
- {
- if (bbGetInputlstRadio().size()>=1){
- radio = bbGetInputlstRadio()[ bbGetInputlstRadio().size() - 1 ];
- } else {
- radio = 1.0;
- }
- }
+ {
+ if (bbGetInputlstRadio().size()>=1)
+ {
+ radio = bbGetInputlstRadio()[ bbGetInputlstRadio().size() - 1 ];
+ }
+ else
+ {
+ radio = 1.0;
+ }
+ }
// Sphere
vtkSphereSource * newSphere = vtkSphereSource::New();
- vtkSphere.push_back(newSphere);
newSphere -> SetThetaResolution(20);
newSphere -> SetPhiResolution(20);
newSphere -> SetRadius(radio);
vtkPolyDataMapper * newMapper = vtkPolyDataMapper::New();
- sphereMapper.push_back(newMapper);
newMapper -> SetInput( newSphere -> GetOutput() );
vtkActor * newActor = vtkActor::New();
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] );
if (bbGetInputRenderer()!=NULL)
- {
+ {
bbGetInputRenderer() -> AddActor( newActor );
- }
-
- } // for
-
- if (sphereActor.size() != 0)
- {
- // Sets the output.
- bbSetOutputActorList(sphereActor);
- }
+ }
- } // if (bbGetInputRenderer()!=NULL)
+ } // for
+ if (sphereActor.size() != 0)
+ {
+ // Sets the output.
+ bbSetOutputActorList(sphereActor);
+ }
+
+ } // if (bbGetInputRenderer()!=NULL)
+ } // if (sphereActor.size() != 0)
}
void SphereList::bbUserSetDefaultValues()