Salome HOME
Additional fix for the '23097: EDF GEOM: [HYDRO 513] Fit only on selected objects...
authorrnv <rnv@opencascade.com>
Mon, 28 Sep 2015 13:26:57 +0000 (16:26 +0300)
committerrnv <rnv@opencascade.com>
Mon, 28 Sep 2015 13:26:57 +0000 (16:26 +0300)
src/SVTK/SVTK_Renderer.cxx

index 6a6420e6fc88755712f20b4faab34970e20b00ab..89c645acabdb7e58297f6230508859ca3191ec01 100644 (file)
@@ -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 );