Salome HOME
Fix regression in unit tests
[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   ModuleBase_BRepOwner(const TopoDS_Shape& aShape, 
29     const Standard_Integer aPriority = 0, 
30     const Standard_Boolean ComesFromDecomposition = Standard_False)
31     : StdSelect_BRepOwner(aShape, aPriority, ComesFromDecomposition) {}
32
33   virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& aPM, 
34     const Quantity_NameOfColor aCol, const Standard_Integer aMode = 0)
35   {  Selectable()->HilightOwnerWithColor(aPM, aCol, this); }
36
37   DEFINE_STANDARD_RTTI(ModuleBase_BRepOwner)
38 };
39
40
41
42 DEFINE_STANDARD_HANDLE(ModuleBase_ResultPrs, ViewerData_AISShape)
43
44 /**
45 * \ingroup GUI
46 * A redefinition of standard AIS Interactive Object in order to provide specific behaviour 
47 * for wire presentations based in a one plane
48 */
49 class ModuleBase_ResultPrs: public ViewerData_AISShape
50 {
51 public:
52   /// Constructor
53   /// \param theResult a result object
54   Standard_EXPORT ModuleBase_ResultPrs(ResultPtr theResult);
55
56
57   //! Method which draws selected owners ( for fast presentation draw )
58   Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM, 
59                                                const SelectMgr_SequenceOfOwner& theOwners);
60   
61   //! Method which hilight an owner belonging to
62   //! this selectable object  ( for fast presentation draw )
63   Standard_EXPORT virtual void HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d)& thePM, 
64                                                      const Quantity_NameOfColor theColor, const Handle(SelectMgr_EntityOwner)& theOwner);
65
66   /// Returns result object
67   Standard_EXPORT ResultPtr getResult() const { return myResult; }
68
69   /// Returns True if the presentation is in sketch mode
70   Standard_EXPORT bool isSketchMode() const { return myIsSketchMode; }
71
72   /// Returns a list of faces
73   Standard_EXPORT const std::list<std::shared_ptr<GeomAPI_Shape> >& facesList() { return myFacesList; }
74
75   /// Returns true if the object is used in CompSolid selection mode
76   Standard_EXPORT bool hasCompSolidSelectionMode() const;
77
78   DEFINE_STANDARD_RTTI(ModuleBase_ResultPrs)
79 protected:
80   /// Redefinition of virtual function
81   Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
82     const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
83
84   /// Redefinition of virtual function
85   Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
86     const Standard_Integer aMode) ;
87
88 private:
89   /// Returns shape dependent on CompSolid selection mode
90   /// In case CompSolid selection mode it returns parent's compsolid shape
91   TopoDS_Shape getSelectionShape() const;
92
93   /// Reference to result object
94   ResultPtr myResult;
95
96   /// A sketch mode flag
97   bool myIsSketchMode;
98
99   /// Original shape of the result object
100   TopoDS_Shape myOriginalShape;
101
102   /// List of faces
103   std::list<std::shared_ptr<GeomAPI_Shape> > myFacesList;
104 };
105
106
107 #endif