X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_VTKPrs.h;h=9d8bcafe7a5b0521df275976a4b596e7de61b5b2;hb=a53349567d67f4df0ef737798a25c24d9dc8f08e;hp=d6a8b206e7cd585a9ef3ee5bcb1cd3f20ea10d65;hpb=9e5f9721be88b2f58dcf4ae6564b2bee69fdb65e;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_VTKPrs.h b/src/HYDROGUI/HYDROGUI_VTKPrs.h index d6a8b206..9d8bcafe 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrs.h +++ b/src/HYDROGUI/HYDROGUI_VTKPrs.h @@ -1,12 +1,8 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// Copyright (C) 2014-2015 EDF-R&D // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,9 +24,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 @@ -42,6 +65,7 @@ public: virtual ~HYDROGUI_VTKPrs(); virtual void compute(); + virtual bool needScalarBar() { return false; } static double InvalidZValue() { return HYDROData_AltitudeObject::GetInvalidAltitude(); }