1 // SALOME VTKViewer : build VTK viewer into Salome desktop
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : VTKViewer_ViewFrame.h
25 // Author : Nicolas REJNERI
29 #ifndef VTKViewer_Algorithm_H
30 #define VTKViewer_Algorithm_H
32 #include <vtkActorCollection.h>
38 /*!For each actor(for ex: someActor) from \a theCollection(that can be dynamic cast to type TActor)\n
39 * Call method \a theFun(someActor)
41 template<typename TActor, typename TFunction>
42 TFunction ForEach(vtkActorCollection *theCollection, TFunction theFun)
45 theCollection->InitTraversal();
46 while(vtkActor *anAct = theCollection->GetNextActor())
47 if(TActor *anActor = dynamic_cast<TActor*>(anAct))
53 /*!For each actor(for ex: someActor) from \a theCollection(that can be dynamic cast to type TActor and \n
54 * method \a thePredicate(someActor) return true) \n
55 * Call method \a theFun(someActor)
57 template<typename TActor, typename TPredicate, typename TFunction>
58 TFunction ForEachIf(vtkActorCollection *theCollection,
59 TPredicate thePredicate,
63 theCollection->InitTraversal();
64 while(vtkActor *anAct = theCollection->GetNextActor())
65 if(TActor *anActor = dynamic_cast<TActor*>(anAct))
66 if(thePredicate(anActor))
72 /*!Find actor from collection, that can be dynamicaly cast to \a TActor, \n
73 *and method \a thePredicate(someActor) return true) \n
76 template<typename TActor, typename TPredicate>
77 TActor* Find(vtkActorCollection *theCollection, TPredicate thePredicate)
80 theCollection->InitTraversal();
81 while(vtkActor *anAct = theCollection->GetNextActor())
82 if(TActor *anActor = dynamic_cast<TActor*>(anAct))
83 if(thePredicate(anActor))