X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_VTKPrs.h;h=f5a3f86fc8db2ebd2c3cd004d6e0b801c0ffae3d;hb=81c9f5cdf82909d0aebd2c491c50fa7516cc80b7;hp=558d7ba54c120f592c8c232ed6abbd5d4a4c1454;hpb=575fad0fb31108a6daa332a6610254b7e57d4caf;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_VTKPrs.h b/src/HYDROGUI/HYDROGUI_VTKPrs.h index 558d7ba5..f5a3f86f 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrs.h +++ b/src/HYDROGUI/HYDROGUI_VTKPrs.h @@ -28,9 +28,36 @@ #include #include +#include class vtkMapper; +template ActorType* getActor(SVTK_Prs* thePrs); + +/** + * Get a VTK actor of the given presentation. Create a new one if there is no actor yet. + */ +template +ActorType* getActor(SVTK_Prs* thePrs) +{ + ActorType* anActor = 0; + vtkActorCollection* aContent = thePrs->GetObjects(); + if ( aContent ) + { + // Remove old actor because of the problem of GEOM_Actor updating. + //anActor = dynamic_cast( aContent->GetLastActor() ); + aContent->RemoveAllItems(); + } + if ( !anActor ) + { + anActor = ActorType::New(); + thePrs->AddObject( anActor ); + anActor->Delete(); + } + return anActor; +} + + /* Class : HYDROGUI_VTKPrs Description : Base class for all HYDRO presentation in VTK viewer