+ myCurrentLineEdit = 0;
+ myIsBusy = false;
+ if (!myCreate)
+ return;
+
+ if (myTypeId == -1)
+ onTypeChanged(0);
+ else {
+ myElements->clear();
+ setSelectionMode(myTypeId);
+ }
+
+ myIsBusy = false;
+ return;
+
+ } else if (myCurrentLineEdit == myGeomGroupLine) {
+ if (aNbSel != 1) {
+ myGeomGroup = GEOM::GEOM_Object::_nil();
+ myIsBusy = false;
+ return;
+ }
+
+ Standard_Boolean testResult = Standard_False;
+ myGeomGroup = GEOMBase::ConvertIOinGEOMObject(aList.First(), testResult);
+
+ // Check if the object is a geometry group
+ if (!testResult || CORBA::is_nil(myGeomGroup)) {
+ myGeomGroup = GEOM::GEOM_Object::_nil();
+ myIsBusy = false;
+ return;
+ }
+ // Check if group constructed on the same shape as a mesh or on its child
+ _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+ GEOM::GEOM_IGroupOperations_var anOp =
+ SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
+
+ // The main shape of the group
+ GEOM::GEOM_Object_var aGroupMainShape;
+ if (myGeomGroup->GetType() == 37)
+ aGroupMainShape = anOp->GetMainShape(myGeomGroup);
+ else
+ aGroupMainShape = GEOM::GEOM_Object::_duplicate(myGeomGroup);
+ _PTR(SObject) aGroupMainShapeSO =
+ //aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(aGroupMainShape));
+ aStudy->FindObjectID(aGroupMainShape->GetStudyEntry());
+
+ // The mesh SObject
+ _PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
+ if (!aMeshSO) {
+ myGeomGroup = GEOM::GEOM_Object::_nil();
+ myIsBusy = false;
+ return;
+ }
+ _PTR(SObject) anObj, aRef;
+ bool isRefOrSubShape = false;
+ if (aMeshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(aRef)) {
+ //if (strcmp(aRef->GetID(), aGroupMainShapeSO->GetID()) == 0) {
+ if (aRef->GetID() == aGroupMainShapeSO->GetID()) {
+ isRefOrSubShape = true;
+ } else {
+ _PTR(SObject) aFather = aGroupMainShapeSO->GetFather();
+ _PTR(SComponent) aComponent = aGroupMainShapeSO->GetFatherComponent();
+ //while (!isRefOrSubShape && strcmp(aFather->GetID(), aComponent->GetID()) != 0) {
+ while (!isRefOrSubShape && aFather->GetID() != aComponent->GetID()) {
+ //if (strcmp(aRef->GetID(), aFather->GetID()) == 0)
+ if (aRef->GetID() == aFather->GetID())
+ isRefOrSubShape = true;
+ else
+ aFather = aFather->GetFather();
+ }
+ }
+ }
+ if (!isRefOrSubShape) {
+ myGeomGroup = GEOM::GEOM_Object::_nil();
+ myIsBusy = false;
+ return;
+ }
+ }
+
+ if(aNbSel >= 1) {
+ if(aNbSel > 1) {
+ if(myCurrentLineEdit == mySubMeshLine)