- if(myEditCurrentArgument == GroupPoints->LineEdit1)
- {
- int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName);
- if(aNbSel < 1)
- {
- myObjects.length(0);
- return;
- }
- GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects);
- if (!myObjects.length())
- return;
- if(aNbSel != 1)
- aName = tr("%1_objects").arg(aNbSel);
- }
- else if(myEditCurrentArgument == GroupPoints->LineEdit2)
- {
- if(IObjectCount() != 1)
- {
- myArgument = GEOM::GEOM_Object::_nil();
- return;
- }
- Standard_Boolean testResult = Standard_False;
- myArgument = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
- if(!testResult || CORBA::is_nil( myArgument ))
- return;
- aName = GEOMBase::GetName( myArgument );
+ if (myEditCurrentArgument == GroupPoints->LineEdit1) {
+ int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
+ if (aNbSel < 1)
+ return;
+
+ GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
+ if (!myObjects.length())
+ return;
+ else
+ myEditCurrentArgument->setText(aName);
+ }
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
+ if (aSelList.Extent() != 1)
+ return;
+
+ // nbSel == 1
+ Standard_Boolean testResult = Standard_False;
+ myArgument = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
+ if (!testResult || CORBA::is_nil(myArgument))
+ return;
+
+ aName = GEOMBase::GetName(myArgument);
+
+ if (testResult && !myArgument->_is_nil()) {
+ TopoDS_Shape aShape;
+ if (GEOMBase::GetShape(myArgument, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (getConstructorId() == 1)
+ aNeedType = TopAbs_EDGE;
+ else if (getConstructorId() == 2)
+ aNeedType = TopAbs_FACE;
+
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(aSelList.First(), aMap);
+ if (aMap.Extent() == 1) {
+ int anIndex = aMap(1);
+ if (aNeedType == 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 = findObjectInFather(myArgument, aName);
+
+ if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations(getStudyId());
+ myArgument = aShapesOp->GetSubShape(myArgument, anIndex);
+ }
+ else {
+ myArgument = aFindedObject; // get Object from study
+ }
+ }
+ else {
+ if (aShape.ShapeType() != aNeedType) {
+ myArgument = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
+ }
+ }