Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/gui.git] / src / SVTK / SVTK_Trihedron.cxx
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either 
6 // version 2.1 of the License.
7 // 
8 // This library is distributed in the hope that it will be useful 
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public  
14 // License along with this library; if not, write to the Free Software 
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #include "SVTK_Trihedron.h"
20 #include "SALOME_Actor.h"
21
22 #include <vtkObjectFactory.h>
23 #include <vtkActorCollection.h>
24 #include <vtkRenderer.h>
25
26 vtkStandardNewMacro(SVTK_Trihedron);
27
28 /*!
29   Constructor
30 */
31 SVTK_Trihedron
32 ::SVTK_Trihedron()
33 {
34 }
35
36 /*!
37   \return count of visible actors
38   \param theRenderer - renderer to be checked
39 */
40 int 
41 SVTK_Trihedron
42 ::GetVisibleActorCount(vtkRenderer* theRenderer)
43 {
44   vtkActorCollection* aCollection = theRenderer->GetActors();
45   aCollection->InitTraversal();
46   int aCount = 0;
47   while(vtkActor* aProp = aCollection->GetNextActor()) {
48     if(aProp->GetVisibility())
49       if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(aProp)) {
50         if(!anActor->IsInfinitive()) 
51           aCount++;
52       }
53       else if ( !OwnActor( anActor ) ) {
54         aCount++;
55       }
56   }
57   return aCount;
58 }