]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix a bug: if custom vtk actors are displayed in the viewer (not SALOME_Actor based...
authorvsr <vsr@opencascade.com>
Fri, 27 Oct 2006 12:44:39 +0000 (12:44 +0000)
committervsr <vsr@opencascade.com>
Fri, 27 Oct 2006 12:44:39 +0000 (12:44 +0000)
src/SVTK/SVTK_Trihedron.cxx
src/VTKViewer/VTKViewer_Trihedron.cxx
src/VTKViewer/VTKViewer_Trihedron.h

index ac0bbd4d89b8dd41e7252cce952185bbca6078a8..45751cfec523a7e16a2337c203dd95a162b3e113 100644 (file)
@@ -46,9 +46,13 @@ SVTK_Trihedron
   int aCount = 0;
   while(vtkActor* aProp = aCollection->GetNextActor()) {
     if(aProp->GetVisibility())
-      if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(aProp))
+      if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(aProp)) {
         if(!anActor->IsInfinitive()) 
-          aCount++;
+         aCount++;
+      }
+      else if ( !OwnActor( anActor ) ) {
+       aCount++;
+      }
   }
   return aCount;
 }
index c426e0280d7cb5e319e9a4042a8cdbfcfe409c0c..9caa0606ad2dca02b16bc2f4692a038b17fe6cd4 100755 (executable)
@@ -259,6 +259,17 @@ void VTKViewer_Axis::SetSize(vtkFloatingPointType theSize)
   myLabelActor->AddPosition(aPosition);
 }
 
+/*! Check if actor belongs to the axis object
+ * \param theActor - vtkActor pointer
+ * \retval Return true if the actor belongs to the axis object
+ */
+bool VTKViewer_Axis::OwnActor(const vtkActor* theActor)
+{
+  return theActor == myLineActor  || 
+         theActor == myArrowActor ||
+         theActor == myLabelActor;
+}
+
 /*! \class VTKViewer_XAxis
  * \brief X Axis actor
  */
@@ -425,11 +436,31 @@ int VTKViewer_Trihedron::GetVisibleActorCount(vtkRenderer* theRenderer)
   int aCount = 0;
   while(vtkActor* prop = aCollection->GetNextActor()) {
     if( prop->GetVisibility())
-      if(VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast(prop))
+      if(VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast(prop)) {
         if(!anActor->IsInfinitive()) 
-          aCount++;
+         aCount++;
+      }
+      else if ( !OwnActor( anActor ) ) {
+       aCount++;
+      }
         //int aCount = theRenderer->VisibleActorCount();
         //SetVisibility(aVis);
   }
   return aCount;
 }
+
+/*! Check if actor belongs to the axis object
+ * \param theActor - vtkActor pointer
+ * \retval Return true if the actor belongs to the axis object
+ */
+bool VTKViewer_Trihedron::OwnActor(const vtkActor* theActor)
+{
+  myPresent->InitTraversal();
+  while(vtkActor* anActor = myPresent->GetNextActor()) {
+    if ( anActor == theActor ) return true;
+  }
+  for(int i = 0; i < 3; i++) {
+    if ( myAxis[i]->OwnActor(theActor) ) return true;
+  }
+  return false;
+}
index 69b7074a343ac7a3fba48f3fa88fe80639ae87fb..70f2502c02980b68645039f62c734402174d0bfd 100755 (executable)
@@ -170,6 +170,12 @@ public:
    */
   virtual int         GetVisibleActorCount(vtkRenderer* theRenderer);
   
+  /*! Check if actor belongs to the trihedron object
+   * \param theActor - vtkActor pointer
+   * \retval Return true if the actor belongs to the trihedron object
+   */
+  virtual bool        OwnActor(const vtkActor* theActor);
+
 protected:
   /*! Actor collection*/
   vtkActorCollection* myPresent;
@@ -234,6 +240,12 @@ public:
    * \retval Return myArrowActor
    */
   virtual VTKViewer_UnScaledActor* GetArrow() { return myArrowActor; }
+
+  /*! Check if actor belongs to the axis object
+   * \param theActor - vtkActor pointer
+   * \retval Return true if the actor belongs to the axis object
+   */
+  virtual bool OwnActor(const vtkActor* theActor);
   
 protected:
   /*! Visibility flag.