IPAL22183: Creation of group with restriction 'Only Sub-Shapes of the Second Shape' doesn't work

This commit is contained in:
jfa 2011-05-27 11:57:32 +00:00
parent a64b9bbcff
commit 956f0bc94a

View File

@ -421,12 +421,15 @@ void GroupGUI_GroupDlg::setInPlaceObj(GEOM::GEOM_Object_var theObj, const bool i
GEOM::ListOfGO_var aSubObjects = aShapesOp->MakeExplode(myInPlaceObj, getShapeType(), false); GEOM::ListOfGO_var aSubObjects = aShapesOp->MakeExplode(myInPlaceObj, getShapeType(), false);
for (int i = 0; i < aSubObjects->length(); i++) for (int i = 0; i < aSubObjects->length(); i++)
{ {
CORBA::Long aMainIndex = aLocOp->GetSubShapeIndex(myMainObj, aSubObjects[i]); GEOM::GEOM_Object_var aSS = aShapesOp->GetSame(myMainObj, aSubObjects[i]);
if (!CORBA::is_nil(aSS)) {
CORBA::Long aMainIndex = aLocOp->GetSubShapeIndex(myMainObj, aSS);
CORBA::Long aPlaceIndex = aLocOp->GetSubShapeIndex(myInPlaceObj, aSubObjects[i]); CORBA::Long aPlaceIndex = aLocOp->GetSubShapeIndex(myInPlaceObj, aSubObjects[i]);
if (aMainIndex >= 0 && aPlaceIndex > 0) if (aMainIndex >= 0 && aPlaceIndex > 0)
myMain2InPlaceIndices.Bind(aMainIndex, aPlaceIndex); myMain2InPlaceIndices.Bind(aMainIndex, aPlaceIndex);
} }
} }
}
myInPlaceObjSelectState = subSelectionWay(); myInPlaceObjSelectState = subSelectionWay();
if (myInPlaceObjSelectState == SUBSHAPES_OF_SHAPE2 && !isVisible) if (myInPlaceObjSelectState == SUBSHAPES_OF_SHAPE2 && !isVisible)
myInPlaceObjSelectState = SUBSHAPES_OF_INVISIBLE_SHAPE2; myInPlaceObjSelectState = SUBSHAPES_OF_INVISIBLE_SHAPE2;
@ -805,11 +808,9 @@ void GroupGUI_GroupDlg::activateSelection()
TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj); TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
TopoDS_Shape aRestrictionShape; TopoDS_Shape aRestrictionShape;
if (subSelectionWay() == ALL_SUBSHAPES)
if (subSelectionWay() == ALL_SUBSHAPES) {
aRestrictionShape = aMainShape; aRestrictionShape = aMainShape;
else if (!myInPlaceObj->_is_nil())
aRestrictionShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myInPlaceObj);
else ;
TopTools_IndexedMapOfShape aSubShapesMap; TopTools_IndexedMapOfShape aSubShapesMap;
TopExp::MapShapes(aMainShape, aSubShapesMap); TopExp::MapShapes(aMainShape, aSubShapesMap);
@ -817,8 +818,7 @@ void GroupGUI_GroupDlg::activateSelection()
QString anEntryBase = aMainEntry.in(); QString anEntryBase = aMainEntry.in();
TopExp_Explorer anExp (aRestrictionShape, getShapeType()); TopExp_Explorer anExp (aRestrictionShape, getShapeType());
for (; anExp.More(); anExp.Next()) for (; anExp.More(); anExp.Next()) {
{
TopoDS_Shape aSubShape = anExp.Current(); TopoDS_Shape aSubShape = anExp.Current();
int index = aSubShapesMap.FindIndex(aSubShape); int index = aSubShapesMap.FindIndex(aSubShape);
QString anEntry = anEntryBase + QString("_%1").arg(index); QString anEntry = anEntryBase + QString("_%1").arg(index);
@ -828,6 +828,27 @@ void GroupGUI_GroupDlg::activateSelection()
displayPreview(aPrs, true, false); // append, do not update displayPreview(aPrs, true, false); // append, do not update
} }
} }
}
else if (!myInPlaceObj->_is_nil()) {
TopTools_IndexedMapOfShape aSubShapesMap;
TopExp::MapShapes(aMainShape, aSubShapesMap);
CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
QString anEntryBase = aMainEntry.in();
TColStd_DataMapIteratorOfDataMapOfIntegerInteger aM2IPit (myMain2InPlaceIndices);
for (; aM2IPit.More(); aM2IPit.Next()) {
int index = aM2IPit.Key();
TopoDS_Shape aSubShape = aSubShapesMap.FindKey(index);
QString anEntry = anEntryBase + QString("_%1").arg(index);
SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView);
if (aPrs) {
displayPreview(aPrs, true, false); // append, do not update
}
}
}
else ;
aDisplayer->UpdateViewer(); aDisplayer->UpdateViewer();
aDisplayer->SetDisplayMode(prevDisplayMode); aDisplayer->SetDisplayMode(prevDisplayMode);
} }