From 8ee4f1c7fc34d37b5a1c915b32fa076b25a9b712 Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 14 Jan 2010 11:33:46 +0000 Subject: [PATCH] Mantis issue 0020508: EDF 1059 GEOM : Selection of a group in Suppress Faces. --- src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx | 33 ++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx index a51768540..0253027fc 100644 --- a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx +++ b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx @@ -32,10 +32,14 @@ #include #include #include +#include #include // OCCT Includes #include +#include +#include +#include #include #include @@ -192,6 +196,35 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument() else if (myEditCurrentArgument == GroupArgs->LineEdit2) { TColStd_IndexedMapOfInteger aMap; aSelMgr->GetIndexes(anIO, aMap); + + if (aMap.IsEmpty()) { // try to detect selected published sub-shape + QString anEntry = anIO->getEntry(); + + SalomeApp_Study* appStudy = dynamic_cast(myGeomGUI->getApp()->activeStudy()); + if (!appStudy) return; + _PTR(Study) aStudy = appStudy->studyDS(); + _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData())); + GEOM::GEOM_Object_var aGeomObj = + GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); + TopoDS_Shape aShape; + if (GEOMBase::GetShape(aGeomObj, aShape)) { + if (aGeomObj->GetType() == GEOM_GROUP || aShape.ShapeType() == TopAbs_FACE) { + TopTools_IndexedMapOfShape aMainMap; + TopoDS_Shape aMainShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), myObject); + TopExp::MapShapes(aMainShape, aMainMap); + + TopExp_Explorer anExp (aShape, TopAbs_FACE); + for (; anExp.More(); anExp.Next()) { + TopoDS_Shape aSubShape = anExp.Current(); + int anIndex = aMainMap.FindIndex(aSubShape); + if (anIndex >= 0) { + aMap.Add(anIndex); + } + } + } + } + } + const int n = aMap.Extent(); myFacesInd->length(n); for (int i = 1; i <= n; i++) -- 2.39.2