]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix of 'c' problem described in 0019932 issue (see comment 0004258).
authorakl <akl@opencascade.com>
Fri, 6 Mar 2009 13:46:59 +0000 (13:46 +0000)
committerakl <akl@opencascade.com>
Fri, 6 Mar 2009 13:46:59 +0000 (13:46 +0000)
Now 'isVisible' method checks all actors with the given IObject and returns 'true' if at least one of these actors is visible.

src/SVTK/SVTK_View.cxx

index 8174f0c4f5e23ab963563e3247ec7b4331e835f9..d55865565ccf67202b4e5a068bfbc303ceb937f5 100644 (file)
@@ -279,6 +279,25 @@ SVTK_View
   return anActor != NULL;
 }
 
+namespace SVTK
+{
+  struct TIsActorVisibleAction
+  {
+    bool& myResult;
+    TIsActorVisibleAction(bool& theResult): 
+      myResult(theResult)
+    {
+      myResult = false;
+    }
+    void
+    operator()(SALOME_Actor* theActor)
+    {
+      if( !myResult )
+       myResult = theActor->GetVisibility();
+    }
+  };
+}
+
 /*!
   \return true if object is displayed in viewer
   \param theIO - object to be checked
@@ -288,10 +307,11 @@ SVTK_View
 ::isVisible(const Handle(SALOME_InteractiveObject)& theIObject)
 {
   using namespace SVTK;
-  SALOME_Actor* anActor = 
-    Find<SALOME_Actor>(getRenderer()->GetActors(),
-                      TIsSameIObject<SALOME_Actor>(theIObject));
-  return anActor != NULL && anActor->GetVisibility();
+  bool aResult;
+  ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
+                         TIsSameIObject<SALOME_Actor>(theIObject),
+                         TIsActorVisibleAction(aResult));
+  return aResult;
 }
 
 /*!