0020479: EDF 1116 GEOM: Create a group, "Add" button is inactive but "Select all" button is active

This commit is contained in:
dmv 2009-10-27 10:34:46 +00:00
parent f37d81c53d
commit 60b554175f
2 changed files with 70 additions and 42 deletions

View File

@ -941,7 +941,7 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs
} else { } else {
TopExp_Explorer exp (aShape, TopAbs_ShapeEnum(theShapeType)); TopExp_Explorer exp (aShape, TopAbs_ShapeEnum(theShapeType));
for (; exp.More(); exp.Next()) for (; exp.More(); exp.Next())
if (!exp.Current().IsSame(aShape) && mapShape.Add(exp.Current())) if (mapShape.Add(exp.Current()))
listShape.Append(exp.Current()); listShape.Append(exp.Current());
} }

View File

@ -614,13 +614,15 @@ void GroupGUI_GroupDlg::selectAllSubShapes()
return; return;
GEOM::ListOfLong_var aSubShapes; GEOM::ListOfLong_var aSubShapes;
GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
aSubShapes = aShOp->SubShapeAllIDs(myMainObj, getShapeType(), false);
if ( aSubShapes->length() > 0) {
// if ( !myPlaceCheckBox->isChecked() ) // if ( !myPlaceCheckBox->isChecked() )
if ( subSelectionWay() == ALL_SUBSHAPES ) if ( subSelectionWay() == ALL_SUBSHAPES )
{ {
if ( !myIsShapeType )
return;
myIdList->clear(); myIdList->clear();
GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
aSubShapes = aShOp->SubShapeAllIDs(myMainObj, getShapeType(), false);
if ( !aShOp->IsDone() ) if ( !aShOp->IsDone() )
return; return;
@ -656,7 +658,6 @@ void GroupGUI_GroupDlg::selectAllSubShapes()
myIdList->blockSignals( isBlocked ); myIdList->blockSignals( isBlocked );
highlightSubShapes(); highlightSubShapes();
}
} }
//================================================================================= //=================================================================================
@ -680,6 +681,17 @@ void GroupGUI_GroupDlg::add()
aSelMgr->selectedSubOwners( aMap ); aSelMgr->selectedSubOwners( aMap );
if ( aMap.Size() == 1 ) if ( aMap.Size() == 1 )
aMapIndex = LightApp_SelectionMgr::MapEntryOfMapOfInteger::Iterator( aMap ).Value(); aMapIndex = LightApp_SelectionMgr::MapEntryOfMapOfInteger::Iterator( aMap ).Value();
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; GEOM::ListOfGO anObjects;
@ -859,6 +871,22 @@ void GroupGUI_GroupDlg::updateState()
aSelMgr->selectedSubOwners( aMap ); aSelMgr->selectedSubOwners( aMap );
if ( aMap.Size() == 1 ) if ( aMap.Size() == 1 )
aMapIndex = LightApp_SelectionMgr::MapEntryOfMapOfInteger::Iterator( aMap ).Value(); aMapIndex = LightApp_SelectionMgr::MapEntryOfMapOfInteger::Iterator( aMap ).Value();
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;
}
}
} }
} }