]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModuleBase/ModuleBase_ResultPrs.h
Salome HOME
Update classes documentation
[modules/shaper.git] / src / ModuleBase / ModuleBase_ResultPrs.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModuleBase_ResultPrs.h
4 // Created:     21 October 2014
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef ModuleBase_ResultPrs_H
8 #define ModuleBase_ResultPrs_H
9
10 #include "ModuleBase.h"
11
12 #include <ModelAPI_Result.h>
13
14 #include <ViewerData_AISShape.hxx>
15 #include <Standard_DefineHandle.hxx>
16 #include <StdSelect_BRepOwner.hxx>
17
18 DEFINE_STANDARD_HANDLE(ModuleBase_BRepOwner, StdSelect_BRepOwner)
19
20 /**
21 * \ingroup GUI
22 * A redefinition of standard BRep Owner in order to provide specific selection
23 * of CompSolid objects. This owner is created only for selection mode TopAbs_COMPSOLID
24 */
25 class ModuleBase_BRepOwner: public StdSelect_BRepOwner
26 {
27 public:
28   /// Constructor
29   /// \param aShape an owner shape
30   /// \param aPriority drawig priority
31   /// \param ComesFromDecomposition decomposition flag
32   ModuleBase_BRepOwner(const TopoDS_Shape& aShape, 
33     const Standard_Integer aPriority = 0, 
34     const Standard_Boolean ComesFromDecomposition = Standard_False)
35     : StdSelect_BRepOwner(aShape, aPriority, ComesFromDecomposition) {}
36
37   /// Highlight the presentation with the given color
38   /// \param aPM a presentations manager
39   /// \param aCol a color
40   /// \param aMode a drawing mode
41   virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& aPM, 
42     const Quantity_NameOfColor aCol, const Standard_Integer aMode = 0)
43   {  Selectable()->HilightOwnerWithColor(aPM, aCol, this); }
44
45   DEFINE_STANDARD_RTTI(ModuleBase_BRepOwner)
46 };
47
48
49
50 DEFINE_STANDARD_HANDLE(ModuleBase_ResultPrs, ViewerData_AISShape)
51
52 /**
53 * \ingroup GUI
54 * A redefinition of standard AIS Interactive Object in order to provide specific behaviour 
55 * for wire presentations based in a one plane
56 */
57 class ModuleBase_ResultPrs: public ViewerData_AISShape
58 {
59 public:
60   /// Constructor
61   /// \param theResult a result object
62   Standard_EXPORT ModuleBase_ResultPrs(ResultPtr theResult);
63
64   /// Returns true if the checked type can be accepted for the base selection type
65   /// It returns true if they are coicide or if the base type is face and the checked type is wire
66   /// @return boolean result
67   static Standard_EXPORT bool isValidShapeType(const TopAbs_ShapeEnum& theBaseType,
68                                                const TopAbs_ShapeEnum& theCheckedType);
69
70
71   //! Method which draws selected owners ( for fast presentation draw )
72   Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM, 
73                                                const SelectMgr_SequenceOfOwner& theOwners);
74   
75   //! Method which hilight an owner belonging to
76   //! this selectable object  ( for fast presentation draw )
77   Standard_EXPORT virtual void HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d)& thePM, 
78                                                      const Quantity_NameOfColor theColor, const Handle(SelectMgr_EntityOwner)& theOwner);
79
80   /// Returns result object
81   Standard_EXPORT ResultPtr getResult() const { return myResult; }
82
83   DEFINE_STANDARD_RTTI(ModuleBase_ResultPrs)
84 protected:
85   /// Redefinition of virtual function
86   Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
87     const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
88
89   /// Redefinition of virtual function
90   Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
91     const Standard_Integer aMode) ;
92
93 private:
94   /// Appens sensitive and owners for wires of the given shape into selection
95   /// \param theSelection a current filled selection
96   /// \param theShape a shape
97   void appendWiresSelection(const Handle(SelectMgr_Selection)& theSelection,
98                             const TopoDS_Shape& theShape);
99
100   /// Reference to result object
101   ResultPtr myResult;
102
103   /// Original shape of the result object
104   TopoDS_Shape myOriginalShape;
105 };
106
107
108 #endif