-//********************************************************************
-void XGUI_FacesPanel::getObjectsMapFromResult(ResultGroupPtr theResGroup,
- FeaturePtr theGroupFeature,
- std::map<ObjectPtr, TopoDS_ListOfShape>& theObjectToShapes,
- std::map<ObjectPtr, Handle(ModuleBase_ResultPrs) >& theObjectToPrs)
-{
- XGUI_Displayer* aDisplayer = myWorkshop->displayer();
- // Process a grouip result
- AttributeSelectionListPtr aSelectionList = theGroupFeature->selectionList("group_list");
- AISObjectPtr aPrs;
- for (int i = 0; i < aSelectionList->size(); i++) {
- AttributeSelectionPtr aSelection = aSelectionList->value(i);
- ResultPtr aRes = aSelection->context();
- aPrs = aDisplayer->getAISObject(aRes);
- if (aPrs.get()) {
- Handle(ModuleBase_ResultPrs) aResultPrs = Handle(ModuleBase_ResultPrs)::DownCast(
- aPrs->impl<Handle(AIS_InteractiveObject)>());
- if (!aResultPrs.IsNull()) {
- GeomShapePtr aShape = aSelection->value();
- if (theObjectToShapes.find(aRes) != theObjectToShapes.end())
- theObjectToShapes.at(aRes).Append(aShape->impl<TopoDS_Shape>());
- else {
- TopoDS_ListOfShape aListOfShapes;
- aListOfShapes.Append(aShape->impl<TopoDS_Shape>());
- theObjectToShapes[aRes] = aListOfShapes;
- theObjectToPrs[aRes] = aResultPrs;
- }
- }
- }
- }
-}
-
-//********************************************************************
-void objectsMapFromPrs(ModuleBase_ViewerPrsPtr thePrs,
- std::map<ObjectPtr, TopoDS_ListOfShape>& theObjectToShapes,
- std::map<ObjectPtr, Handle(ModuleBase_ResultPrs) >& theObjectToPrs)
-{
- ObjectPtr anObject = thePrs->object();
- if (!anObject.get())
- return;
-
- // Process bodies
- Handle(ModuleBase_ResultPrs) aResultPrs = Handle(ModuleBase_ResultPrs)::DownCast(
- thePrs->interactive());
- if (aResultPrs.IsNull())
- return;
-
- if (theObjectToShapes.find(anObject) != theObjectToShapes.end())
- theObjectToShapes.at(anObject).Append(ModuleBase_Tools::getSelectedShape(thePrs));
- else {
- TopoDS_ListOfShape aListOfShapes;
- aListOfShapes.Append(ModuleBase_Tools::getSelectedShape(thePrs));
- theObjectToShapes[anObject] = aListOfShapes;
- theObjectToPrs[anObject] = aResultPrs;
- }
-}
-
-//********************************************************************
-void XGUI_FacesPanel::getObjectsMapFromPrs(ModuleBase_ViewerPrsPtr thePrs,
- std::map<ObjectPtr, TopoDS_ListOfShape>& theObjectToShapes,
- std::map<ObjectPtr, Handle(ModuleBase_ResultPrs) >& theObjectToPrs)
-{
- ResultGroupPtr aResGroup;
- FeaturePtr aGroupFeature;
- if (getGroup(thePrs, aResGroup, aGroupFeature))
- getObjectsMapFromResult(aResGroup, aGroupFeature, theObjectToShapes, theObjectToPrs);
- else
- objectsMapFromPrs(thePrs, theObjectToShapes, theObjectToPrs);
-}