From: Claire Mouton Date: Wed, 16 Jan 2013 10:36:07 +0000 (+0100) Subject: Enabled dynamic modification of opacity in vtkShereList X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c9eb653b2c0dc9384356c7de79ad9c2422be523c;p=bbtk.git Enabled dynamic modification of opacity in vtkShereList Feature #1888 --- diff --git a/packages/vtk/src/bbvtkSphereList.cxx b/packages/vtk/src/bbvtkSphereList.cxx index 7577a0a..8d5cfe7 100644 --- a/packages/vtk/src/bbvtkSphereList.cxx +++ b/packages/vtk/src/bbvtkSphereList.cxx @@ -41,7 +41,7 @@ BBTK_BLACK_BOX_IMPLEMENTATION(SphereList,bbtk::AtomicBlackBox); void SphereList::Process() { - int iMin, iMax; + int iMin, iMax; double px = 0.0; double py = 0.0; double pz = 0.0; @@ -50,23 +50,41 @@ void SphereList::Process() 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