+}
+
+
+bool ModuleBase_ResultPrs::hasCompSolidSelectionMode() const
+{
+ if (!HasInteractiveContext())
+ return false;
+
+ Handle(AIS_InteractiveContext) aContext = GetContext();
+ TColStd_ListOfInteger aModes;
+ aContext->ActivatedModes(this, aModes);
+
+ TColStd_ListIteratorOfListOfInteger aIt(aModes);
+ for (; aIt.More(); aIt.Next()) {
+ if (aIt.Value() == AIS_Shape::SelectionMode(TopAbs_COMPSOLID))
+ return true;
+ }
+ return false;
+}
+
+
+TopoDS_Shape ModuleBase_ResultPrs::getSelectionShape() const
+{
+ if (hasCompSolidSelectionMode()) {
+ // In case of CompSolid mode use shape from Parent for highlighting
+ ResultCompSolidPtr aCompSolid = ModelAPI_Tools::compSolidOwner(myResult);
+ if (aCompSolid.get()) {
+ std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aCompSolid);
+ if (aShapePtr.get())
+ return aShapePtr->impl<TopoDS_Shape>();
+ }
+ }
+ return myOriginalShape;
+}
+
+
+void ModuleBase_ResultPrs::HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
+ const SelectMgr_SequenceOfOwner& theOwners)
+{
+ Handle(SelectMgr_EntityOwner) anOwner;
+ Handle(ModuleBase_BRepOwner) aCompOwner;
+ for (int i = 1; i <= theOwners.Length(); i++) {
+ anOwner = theOwners.Value(i);
+ aCompOwner = Handle(ModuleBase_BRepOwner)::DownCast(anOwner);
+ if (aCompOwner.IsNull())
+ anOwner->Hilight(thePM);
+ else {
+ TopoDS_Shape aShape = aCompOwner->Shape();
+ Handle( Prs3d_Presentation ) aSelectionPrs = GetSelectPresentation( thePM );
+ aSelectionPrs->Clear();
+
+ StdPrs_WFDeflectionShape::Add(aSelectionPrs, aShape, myDrawer);
+
+ aSelectionPrs->SetDisplayPriority(9);
+ aSelectionPrs->Highlight(Aspect_TOHM_COLOR, aSelectionPrs->HighlightColor());
+ aSelectionPrs->Display();
+ thePM->Highlight(this);
+ }
+ }
+}
+
+void ModuleBase_ResultPrs::HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d)& thePM,
+ const Quantity_NameOfColor theColor,
+ const Handle(SelectMgr_EntityOwner)& theOwner)
+{
+ Handle(StdSelect_BRepOwner) aOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
+ if (aOwner.IsNull())
+ return;
+
+ TopoDS_Shape aShape = aOwner->Shape();
+ if (!aShape.IsNull()) {
+ thePM->Color(this, theColor);
+
+ Handle( Prs3d_Presentation ) aHilightPrs = GetHilightPresentation( thePM );
+ aHilightPrs->Clear();
+
+ StdPrs_WFDeflectionShape::Add(aHilightPrs, aShape, myDrawer);
+ aHilightPrs->Highlight(Aspect_TOHM_COLOR, theColor);
+
+ if (thePM->IsImmediateModeOn())
+ thePM->AddToImmediateList(aHilightPrs);
+ }
+}