From c9eb653b2c0dc9384356c7de79ad9c2422be523c Mon Sep 17 00:00:00 2001 From: Claire Mouton Date: Wed, 16 Jan 2013 11:36:07 +0100 Subject: [PATCH] Enabled dynamic modification of opacity in vtkShereList Feature #1888 --- packages/vtk/src/bbvtkSphereList.cxx | 91 +++++++++++++++++----------- packages/vtk/src/bbvtkSphereList.h | 2 - 2 files changed, 55 insertions(+), 38 deletions(-) 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