1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModuleBase_ResultPrs.h
4 // Created: 21 October 2014
5 // Author: Vitaly SMETANNIKOV
7 #ifndef ModuleBase_ResultPrs_H
8 #define ModuleBase_ResultPrs_H
10 #include "ModuleBase.h"
12 #include <ModelAPI_Result.h>
14 #include <ViewerData_AISShape.hxx>
15 #include <Standard_DefineHandle.hxx>
16 #include <StdSelect_BRepOwner.hxx>
20 DEFINE_STANDARD_HANDLE(ModuleBase_BRepOwner, StdSelect_BRepOwner)
24 * A redefinition of standard BRep Owner in order to provide specific selection
25 * of CompSolid objects. This owner is created only for selection mode TopAbs_COMPSOLID
27 class ModuleBase_BRepOwner: public StdSelect_BRepOwner
31 /// \param aShape an owner shape
32 /// \param aPriority drawig priority
33 /// \param ComesFromDecomposition decomposition flag
34 ModuleBase_BRepOwner(const TopoDS_Shape& aShape,
35 const Standard_Integer aPriority = 0,
36 const Standard_Boolean ComesFromDecomposition = Standard_False)
37 : StdSelect_BRepOwner(aShape, aPriority, ComesFromDecomposition) {}
39 /// Highlight the presentation with the given color
40 /// \param aPM a presentations manager
41 /// \param theStyle a style of presentation
42 /// \param aMode a drawing mode
43 virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& aPM,
44 const Handle(Graphic3d_HighlightStyle)& theStyle, const Standard_Integer aMode = 0)
46 Selectable()->HilightOwnerWithColor(aPM, theStyle, this);
49 DEFINE_STANDARD_RTTIEXT(ModuleBase_BRepOwner, StdSelect_BRepOwner)
54 DEFINE_STANDARD_HANDLE(ModuleBase_ResultPrs, ViewerData_AISShape)
58 * A redefinition of standard AIS Interactive Object in order to provide specific behaviour
59 * for wire presentations based in a one plane
61 class ModuleBase_ResultPrs: public ViewerData_AISShape
65 Sel_Result = TopAbs_SHAPE + 1 /// it should be combined with Compsolid results, so it is not
66 /// the Shape type. It is not defined in XML as compound type
67 /// because this type is processed as shape with compounds inside.
72 /// \param theResult a result object
73 Standard_EXPORT ModuleBase_ResultPrs(ResultPtr theResult);
75 //! Method which draws selected owners ( for fast presentation draw )
76 Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
77 const SelectMgr_SequenceOfOwner& theOwners);
79 //! Method which hilight an owner belonging to
80 //! this selectable object ( for fast presentation draw )
81 Standard_EXPORT virtual void HilightOwnerWithColor(
82 const Handle(PrsMgr_PresentationManager3d)& thePM,
83 const Handle(Graphic3d_HighlightStyle)& theStyle,
84 const Handle(SelectMgr_EntityOwner)& theOwner);
86 /// Returns result object
87 Standard_EXPORT ResultPtr getResult() const { return myResult; }
89 /// Returns selection priorities that will be added to created selection owner
90 /// \return integer value
91 Standard_EXPORT int getAdditionalSelectionPriority() const
92 { return myAdditionalSelectionPriority; }
94 /// Appends a special priority for the mode of selection
95 /// \param theSelectionMode a mode of selection, used in ComputeSelection
96 /// \param thePriority a new priority value
97 Standard_EXPORT void setAdditionalSelectionPriority(const int thePriority);
99 DEFINE_STANDARD_RTTIEXT(ModuleBase_ResultPrs, ViewerData_AISShape)
101 /// Redefinition of virtual function
102 Standard_EXPORT virtual void Compute(
103 const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
104 const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
106 /// Redefinition of virtual function
107 Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
108 const Standard_Integer aMode) ;
111 /// Appens sensitive and owners for wires of the given shape into selection
112 /// \param theSelection a current filled selection
113 /// \param theShape a shape
114 void appendWiresSelection(const Handle(SelectMgr_Selection)& theSelection,
115 const TopoDS_Shape& theShape);
117 /// Reference to result object
120 /// Original shape of the result object
121 TopoDS_Shape myOriginalShape;
123 /// selection priority that will be added to the standard
124 /// selection priority of the selection entity
125 int myAdditionalSelectionPriority;