-void ModuleBase_ResultPrs::appendWiresSelection(const Handle(SelectMgr_Selection)& theSelection,
- const TopoDS_Shape& theShape)
-{
- static TopAbs_ShapeEnum TypOfSel
- = AIS_Shape::SelectionType(AIS_Shape::SelectionMode(TopAbs_WIRE));
- // POP protection against crash in low layers
- Standard_Real aDeflection = Prs3d::GetDeflection(theShape, myDrawer);
- try {
- StdSelect_BRepSelectionTool::Load(theSelection,
- this,
- theShape,
- TypOfSel,
- aDeflection,
- myDrawer->HLRAngle(),
- myDrawer->IsAutoTriangulation());
- } catch ( Standard_Failure ) {
+ // bug 2110: if (theMode == AIS_Shape::SelectionMode(TopAbs_COMPSOLID)) {
+ // // Limit selection area only by actual object (Shape)
+ // ResultCompSolidPtr aCompSolid = ModelAPI_Tools::compSolidOwner(myResult);
+ // if (aCompSolid.get()) {
+ // std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aCompSolid);
+ // if (aShapePtr.get()) {
+ // TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
+ // int aPriority = StdSelect_BRepSelectionTool::GetStandardPriority(aShape, TopAbs_COMPSOLID);
+ // /// It is important to have priority for the shape of comp solid result less than priority
+ // /// for the presentation shape which is a sub-result.
+ // /// Reason is to select the sub-objects before: #1592
+ // aPriority = aPriority - 1;
+ // double aDeflection = Prs3d::GetDeflection(aShape, myDrawer);
+
+ // Handle(ModuleBase_BRepOwner) aOwner = new ModuleBase_BRepOwner(aShape, aPriority);
+ // StdSelect_BRepSelectionTool::ComputeSensitive(aShape, aOwner, aSelection,
+ // aDeflection, myDrawer->HLRAngle(), 9, 500);
+
+ // for (aSelection->Init(); aSelection->More(); aSelection->Next()) {
+ // Handle(SelectMgr_EntityOwner) anOwner =
+ // Handle(SelectMgr_EntityOwner)
+ // ::DownCast(aSelection->Sensitive()->BaseSensitive()->OwnerId());
+ // anOwner->Set(this);
+ // }
+ // return;
+ // }
+ // }
+ //}
+ AIS_Shape::ComputeSelection(aSelection, theMode);
+
+ if (myAdditionalSelectionPriority > 0) {
+ NCollection_Vector<Handle(SelectMgr_SensitiveEntity)> anEntities = aSelection->Entities();
+ for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator anIt(anEntities);
+ anIt.More();
+ anIt.Next()) {
+ Handle(SelectMgr_SensitiveEntity) anEntity = anIt.Value();
+ Handle(SelectBasics_EntityOwner) aBasicsOwner = anEntity->BaseSensitive()->OwnerId();
+ if (!aBasicsOwner.IsNull())
+ aBasicsOwner->Set(aBasicsOwner->Priority() + myAdditionalSelectionPriority);
+ }