- GEOM::GEOM_Object_var anObj;
- Standard_Boolean aResult = Standard_False;
- if (IObjectCount() == 1) {
- anObj = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aResult);
- if (aResult) {
- if (anObj->_is_nil()) {
- aResult = Standard_False;
- } else {
- mySelName[aCurrFocus]->setText(GEOMBase::GetName(anObj));
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ SALOME_ListIO aSelList;
+ aSelMgr->selectedObjects(aSelList);
+
+ TopAbs_ShapeEnum aType = TopAbs_EDGE;
+ if (aCurrFocus == Vertex1 || aCurrFocus == Vertex2 ||
+ aCurrFocus == Vertex3 || aCurrFocus == Vertex4)
+ aType = TopAbs_VERTEX;
+
+ QString aName;
+ GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_nil();
+
+ if (aSelList.Extent() == 1) {
+ Standard_Boolean aResult = Standard_False;
+ anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
+ if (aResult && !anObj->_is_nil()) {
+ aName = GEOMBase::GetName(anObj);
+
+ // Get Selected object if selected subshape
+ TopoDS_Shape aShape;
+ if (GEOMBase::GetShape(anObj, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(aSelList.First(), aMap);
+ if (aMap.Extent() == 1) // Local Selection
+ {
+ int anIndex = aMap(1);
+ if (aType == TopAbs_VERTEX)
+ aName += QString(":vertex_%1").arg(anIndex);
+ else
+ aName += QString(":edge_%1").arg(anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(anObj, aName);
+
+ if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+ anObj = aShapesOp->GetSubShape(anObj, anIndex);
+ }
+ else
+ anObj = aFindedObject; // get Object from study
+ }
+ else // Global Selection
+ {
+ if (aShape.ShapeType() != aType) {
+ anObj = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
+ }