From 9394468fa9cf0f40f1659442490d5324a93e06fd Mon Sep 17 00:00:00 2001 From: dmv Date: Tue, 27 Oct 2009 10:32:12 +0000 Subject: [PATCH] 0020479: EDF 1116 GEOM: Create a group, "Add" button is inactive but "Select all" button is active --- src/GEOMImpl/GEOMImpl_IShapesOperations.cxx | 2 +- src/GroupGUI/GroupGUI_GroupDlg.cxx | 27 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index 99ace6a7b..681885dee 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -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()); } diff --git a/src/GroupGUI/GroupGUI_GroupDlg.cxx b/src/GroupGUI/GroupGUI_GroupDlg.cxx index 392dc8879..63391bae9 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.cxx +++ b/src/GroupGUI/GroupGUI_GroupDlg.cxx @@ -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; + } + } } } -- 2.39.2