]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0020479: EDF 1116 GEOM: Create a group, "Add" button is inactive but "Select all...
authordmv <dmv@opencascade.com>
Tue, 27 Oct 2009 10:32:12 +0000 (10:32 +0000)
committerdmv <dmv@opencascade.com>
Tue, 27 Oct 2009 10:32:12 +0000 (10:32 +0000)
src/GEOMImpl/GEOMImpl_IShapesOperations.cxx
src/GroupGUI/GroupGUI_GroupDlg.cxx

index 99ace6a7b2dd8923cabf3b3fc51783a866da28be..681885deeed2d2478fc2f71d85785edf2fa5f982 100644 (file)
@@ -887,7 +887,7 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs
   } else {
     TopExp_Explorer exp (aShape, TopAbs_ShapeEnum(theShapeType));
     for (; exp.More(); exp.Next())
-      if (!exp.Current().IsSame(aShape) && mapShape.Add(exp.Current()))
+      if (mapShape.Add(exp.Current()))
        listShape.Append(exp.Current());
   }
 
index 392dc887933cb0622a0252c0d9ac70b9f445afac..63391bae9668da13d5ebf85e2fa7b7b66c606c73 100644 (file)
@@ -676,6 +676,17 @@ void GroupGUI_GroupDlg::add()
       aSelMgr->selectedSubOwners(aMap);
       if (aMap.size() == 1)
         aMapIndex = aMap.begin().data();
+      else { // selected the same subshape as the main object
+        SALOME_ListIO aSelList;
+        TColStd_IndexedMapOfInteger aMap;
+        aSelMgr->selectedObjects(aSelList);
+        if (aSelList.Extent() == 1) {
+          Standard_Boolean aRes = Standard_False;
+          GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
+          if ( aSelectedObject->_is_equivalent(myMainObj) )
+            aMapIndex.Add(1); // add index of the only subshape of selected type
+        }
+      }
     }
   }
   GEOM::ListOfGO anObjects;
@@ -859,6 +870,22 @@ void GroupGUI_GroupDlg::updateState()
       aSelMgr->selectedSubOwners(aMap);
       if (aMap.size() == 1)
         aMapIndex = aMap.begin().data();
+      else { // selected the same subshape as the main object
+        SALOME_ListIO aSelList;
+        aSelMgr->selectedObjects(aSelList);
+        if (aSelList.Extent() == 1) {
+          myBusy = true;
+          Standard_Boolean aRes = Standard_False;
+          GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
+          if ( aSelectedObject->_is_equivalent(myMainObj) ) {
+            aMapIndex.Add(1); // add index of the only subshape of selected type
+            TColStd_MapOfInteger anIds; // higlight selected index
+            anIds.Add(1);
+            aSelMgr->AddOrRemoveIndex(aSelList.First(), anIds, false);
+          }
+          myBusy = false;
+        }
+      }
     }
   }