-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 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
// 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
#include <SALOME_InteractiveObject.hxx>
#include <SVTK_Prs.h>
+#include <vtkActorCollection.h>
class vtkMapper;
+template <class ActorType> ActorType* getActor(SVTK_Prs* thePrs);
+
+/**
+ * Get a VTK actor of the given presentation. Create a new one if there is no actor yet.
+ */
+template <class ActorType>
+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<ActorType*>( 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