}
void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
- const Standard_Integer aMode)
+ const Standard_Integer theMode)
{
- if (aMode > TopAbs_SHAPE) {
+ if (appendVertexSelection(aSelection, theMode))
+ return;
+
+ if (theMode > TopAbs_SHAPE) {
// In order to avoid using custom selection modes
- if (aMode == ModuleBase_ResultPrs::Sel_Result) {
+ if (theMode == ModuleBase_ResultPrs::Sel_Result) {
AIS_Shape::ComputeSelection(aSelection, TopAbs_COMPOUND);
}
return;
// TODO: OCCT issue should be created for the COMPOUND processing
// before it is fixed, the next workaround in necessary
- if (aMode == AIS_Shape::SelectionMode(TopAbs_COMPOUND)) {
+ if (theMode == AIS_Shape::SelectionMode(TopAbs_COMPOUND)) {
const TopoDS_Shape& aShape = Shape();
TopExp_Explorer aCompExp(aShape, TopAbs_COMPOUND);
// do not activate in compound mode shapes which do not contain compounds
return;
}
- if (aMode == AIS_Shape::SelectionMode(TopAbs_COMPSOLID)) {
+ if (theMode == AIS_Shape::SelectionMode(TopAbs_COMPSOLID)) {
// Limit selection area only by actual object (Shape)
ResultCompSolidPtr aCompSolid = ModelAPI_Tools::compSolidOwner(myResult);
if (aCompSolid.get()) {
}
//AIS_Shape::ComputeSelection(aSelection, 0);
}
- AIS_Shape::ComputeSelection(aSelection, aMode);
+ AIS_Shape::ComputeSelection(aSelection, theMode);
if (myAdditionalSelectionPriority > 0) {
for (aSelection->Init(); aSelection->More(); aSelection->Next()) {
}
}
+bool ModuleBase_ResultPrs::appendVertexSelection(const Handle(SelectMgr_Selection)& aSelection,
+ const Standard_Integer theMode)
+{
+ if (Shape().ShapeType() == TopAbs_VERTEX) {
+ const TopoDS_Shape& aShape = Shape();
+
+ int aPriority = StdSelect_BRepSelectionTool::GetStandardPriority(aShape, TopAbs_VERTEX);
+ double aDeflection = Prs3d::GetDeflection(aShape, myDrawer);
+
+ /// The cause of this method is the last parameter of BRep owner setting into True.
+ /// That means that owner should behave like it comes from decomposition. (In this case, OCCT
+ /// visualizes it in Ring style) OCCT version is 7.0.0 with path for SHAPER module.
+ Handle(StdSelect_BRepOwner) aOwner = new StdSelect_BRepOwner(aShape, aPriority, Standard_True);
+ 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 true;
+ }
+ return false;
+}
+
+/* OBSOLETE
void ModuleBase_ResultPrs::appendWiresSelection(const Handle(SelectMgr_Selection)& theSelection,
const TopoDS_Shape& theShape)
{
myDrawer->IsAutoTriangulation());
} catch ( Standard_Failure ) {
}
-}
+}*/
void ModuleBase_ResultPrs::HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
const SelectMgr_SequenceOfOwner& theOwners)
/// Highlight the presentation with the given color
/// \param aPM a presentations manager
/// \param theStyle a style of presentation
- /// \param aMode a drawing mode
+ /// \param theMode a drawing mode
virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& aPM,
- const Handle(Graphic3d_HighlightStyle)& theStyle, const Standard_Integer aMode = 0)
+ const Handle(Graphic3d_HighlightStyle)& theStyle, const Standard_Integer theMode = 0)
{
Selectable()->HilightOwnerWithColor(aPM, theStyle, this);
}
/// Redefinition of virtual function
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
- const Standard_Integer aMode) ;
+ const Standard_Integer theMode) ;
private:
+ /// If the shape of this presentation is Vertex, it appends custom sensitive and owners for it.
+ /// Owner is a usual Brep owner with "isDecomposite" in true. It is necessary to have "Ring"
+ /// highlight/selected marker.
+ /// \param theSelection a current filled selection
+ /// \param theMode a selection mode
+ /// \return true if the owner is created
+ bool appendVertexSelection(const Handle(SelectMgr_Selection)& aSelection,
+ const Standard_Integer theMode);
/// Appens sensitive and owners for wires of the given shape into selection
/// \param theSelection a current filled selection
/// \param theShape a shape
- void appendWiresSelection(const Handle(SelectMgr_Selection)& theSelection,
- const TopoDS_Shape& theShape);
+ //void appendWiresSelection(const Handle(SelectMgr_Selection)& theSelection,
+ // const TopoDS_Shape& theShape);
/// Reference to result object
ResultPtr myResult;