]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0020501: EDF 1098 SMESH: Display only groups, edit a group: can't select face from...
authordmv <dmv@opencascade.com>
Wed, 7 Oct 2009 12:27:27 +0000 (12:27 +0000)
committerdmv <dmv@opencascade.com>
Wed, 7 Oct 2009 12:27:27 +0000 (12:27 +0000)
src/SMESHGUI/SMESHGUI_GroupDlg.cxx
src/SMESHGUI/SMESHGUI_GroupDlg.h

index 9d76c2fee6c0ffd321cd9bf9bf28b5cf1c868c3a..114a7fd973a694755128d2eaa056c291fbbf4299 100644 (file)
@@ -1298,20 +1298,32 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
   }
   
   if (myActorsList.count() == 0) {
-    if (!myGroup->_is_nil())
-      myActorsList.append( SMESH::FindActorByObject(myGroup) );
-    else if(!myGroupOnGeom->_is_nil())
-      myActorsList.append( SMESH::FindActorByObject(myGroupOnGeom) );
-    else
-      myActorsList.append( SMESH::FindActorByObject(myMesh) );
+    if (!myGroup->_is_nil()) {
+      SMESH_Actor* anActor = SMESH::FindActorByObject(myGroup);
+      if ( anActor )
+        myActorsList.append( anActor  );
+    }
+    else if(!myGroupOnGeom->_is_nil()) {
+      SMESH_Actor* anActor = SMESH::FindActorByObject(myGroupOnGeom);
+      if ( anActor )
+        myActorsList.append( anActor );
+    }
+    else {
+      SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh );
+      if ( anActor )
+        myActorsList.append( anActor );
+    }
   }
 
   // somehow, if we display the mesh, while selecting from another actor,
   // the mesh becomes pickable, and there is no way to select any element
   if (myActorsList.count() > 0) {
     QListIterator<SMESH_Actor*> it( myActorsList );
-    while ( it.hasNext() )
-      it.next()->SetPickable(true);
+    while ( it.hasNext() ) {
+      SMESH_Actor* anActor = it.next();
+      if ( IsActorVisible(anActor) )
+        anActor->SetPickable(true);
+    }
   }
 
   myIsBusy = false;
@@ -2257,8 +2269,11 @@ bool SMESHGUI_GroupDlg::SetAppropriateActor()
   
   if (myActorsList.count() > 0) {
     QListIterator<SMESH_Actor*> it( myActorsList );
-    while ( it.hasNext() )
-      it.next()->SetPickable(true);
+    while ( it.hasNext() ) {
+      SMESH_Actor* anActor = it.next();
+      if ( IsActorVisible(anActor) )
+        anActor->SetPickable(true);
+    }
   }
   
   return ( isActor || (myActorsList.count() > 0) );
@@ -2297,3 +2312,15 @@ void SMESHGUI_GroupDlg::restoreShowEntityMode()
   }
   myStoredShownEntity = 0;
 }
+
+//=======================================================================
+//function : IsActorVisible
+//purpose  : return visibility of the actor
+//=======================================================================
+bool SMESHGUI_GroupDlg::IsActorVisible( SMESH_Actor* theActor )
+{
+  SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
+  if (theActor && aViewWindow)
+    return aViewWindow->isVisible(theActor->getIO());
+  return false;
+}
index 4c5ebbe38e86d95f7262b7da07bb354a82d11f73..2a01d48af31035cc2b0307426d395a9209458265 100644 (file)
@@ -127,6 +127,8 @@ private:
   bool                          SetAppropriateActor();
   void                          setShowEntityMode();
   void                          restoreShowEntityMode();
+
+  bool                          IsActorVisible( SMESH_Actor* );
   
   void                          setGroupColor( const SALOMEDS::Color& );
   SALOMEDS::Color               getGroupColor() const;