From: Eduardo DAVILA Date: Mon, 7 Jun 2021 17:25:08 +0000 (+0200) Subject: #3463 Bug SphereLst box Refresh X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=b651bb9ef76c48c2c11ee54affd4142b15c04146;p=bbtk.git #3463 Bug SphereLst box Refresh --- diff --git a/packages/vtk/src/bbvtkSphereList.cxx b/packages/vtk/src/bbvtkSphereList.cxx index cde4561..b8519fb 100644 --- a/packages/vtk/src/bbvtkSphereList.cxx +++ b/packages/vtk/src/bbvtkSphereList.cxx @@ -98,20 +98,19 @@ void SphereList::GetColor(int i, double &cr,double &cg,double &cb) void SphereList::Process() { -printf("EED SphereList::Process Start\n"); - +/* if (bbGetInputRenderer()!=NULL) { - int sizeLstX=bbGetInputlstPointX().size(); - int sizeLstY=bbGetInputlstPointY().size(); - int sizeLstZ=bbGetInputlstPointZ().size(); - int sizeLstActors=sphereActor.size(); + int sizeLstX = bbGetInputlstPointX().size(); + int sizeLstY = bbGetInputlstPointY().size(); + int sizeLstZ = bbGetInputlstPointZ().size(); + int sizeLstActors = sphereActor.size(); if ((sizeLstX==sizeLstY) &&(sizeLstX==sizeLstZ)) { + int i,diff; if (sizeLstActors>sizeLstX) { - int i; - int diff=sizeLstActors-sizeLstX; + diff=sizeLstActors-sizeLstX; for (i=0;iRemoveActor( sphereActor[0] ); @@ -124,8 +123,7 @@ printf("EED SphereList::Process Start\n"); if (sizeLstActorsRemoveActor( sphereActor[i] ); + vtkspheresourceLst[i]->Delete(); + vtkpolydatamaperLst[i]->Delete(); + sphereActor[i]->Delete(); + } // for + vtkspheresourceLst.clear(); + vtkpolydatamaperLst.clear(); + sphereActor.clear(); + + + for (i=0;i SetThetaResolution(20); + newSphere -> SetPhiResolution(20); + newSphere -> SetRadius( 1 ); + vtkPolyDataMapper * newMapper = vtkPolyDataMapper::New(); + vtkpolydatamaperLst.push_back(newMapper); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + newMapper -> SetInput( newSphere -> GetOutput() ); +#else + newSphere -> Update(); + newMapper -> SetInputData( newSphere -> GetOutput() ); +#endif + + vtkActor * newActor = vtkActor::New(); + sphereActor.push_back(newActor); + newActor -> SetMapper(newMapper); + newActor -> SetOrigin(0, 0, 0); + if ( bbGetInputTransform()!=NULL ) + { + newActor->SetUserTransform( bbGetInputTransform() ); + } + bbGetInputRenderer()->AddActor( newActor ); + } // for + + + // Refresh data + for (i = 0; i < sphereActor.size() ; i++) + { + GetPoint(i, px,py,pz); + GetColor(i, cr,cg,cb); + sphereActor[i] ->SetPosition( px,py,pz ); + sphereActor[i] -> GetProperty() -> SetOpacity( bbGetInputOpacity() ); + sphereActor[i] -> GetProperty() -> SetColor( cr,cg,cb ); + vtkspheresourceLst[i] -> SetRadius( GetRadio(i) ); + vtkspheresourceLst[i] -> Update(); + } // for i + + if (sphereActor.size() != 0) + { + // Sets the output. + bbSetOutputActorList(sphereActor); + } + } // sizeLstX sizeLstY sizeLstZ + } // if Renderer } diff --git a/packages/vtk/src/bbvtkSphereList.h b/packages/vtk/src/bbvtkSphereList.h index 070da95..89b471f 100644 --- a/packages/vtk/src/bbvtkSphereList.h +++ b/packages/vtk/src/bbvtkSphereList.h @@ -62,6 +62,7 @@ class bbvtk_EXPORT SphereList void Process(); std::vector sphereActor; + std::vectorvtkpolydatamaperLst; std::vector vtkspheresourceLst; private: