Salome HOME
Upgrade to paraview 5.4
[modules/gui.git] / src / SVTK / SVTK_Renderer.cxx
index 6a6420e6fc88755712f20b4faab34970e20b00ab..b763565036dee2438591f8b4603b66b894139a1c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  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
@@ -708,10 +708,15 @@ void SVTK_Renderer::onFitSelection()
   vtkActorCollection* aCollection = aCopy.GetActors();
   aCollection->InitTraversal();
   while ( vtkActor* aProp = aCollection->GetNextActor() )
-    if ( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( aProp ) )
-      if ( mySelector->IsSelected( anActor ) )
+    if ( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( aProp ) ) {
+      const Handle(SALOME_InteractiveObject)& io = anActor->getIO();
+      if ( !io.IsNull() && mySelector->IsSelected( io ) )
         aSelectedCollection->AddItem( aProp );
-
+    }
+  
+  if( aSelectedCollection->GetNumberOfItems() == 0 )
+    return; // if collection is empty
+  
   double bounds[6];
   ::ComputeBounds( aSelectedCollection, bounds );