Salome HOME
Boost has been removed from code
[modules/shaper.git] / src / ModuleBase / ModuleBase_ViewerPrs.h
1 // File:        ModuleBase_ViewerPrs.h
2 // Created:     20 Apr 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #ifndef ModuleBase_ViewerPrs_H
6 #define ModuleBase_ViewerPrs_H
7
8 #include "ModuleBase.h"
9
10 #include <memory>
11 #include <TopoDS_Shape.hxx>
12 #include <SelectMgr_EntityOwner.hxx>
13 #include <AIS_InteractiveObject.hxx>
14
15 #include <ModelAPI_Result.h>
16
17 /**\class ModuleBase_ViewerPrs
18  * \ingroup Module base
19  * \brief Presentation. Provides container to have feature, shape and/or selection owner.
20  */
21 class ModuleBase_ViewerPrs
22 {
23  public:
24   /// Constructor
25   ModuleBase_ViewerPrs()
26   {
27   }
28
29   /// Constructor
30   /// \param theFeature a model feature
31   /// \param theShape a viewer shape
32   /// \param theOwner a selection owner
33   ModuleBase_ViewerPrs(ObjectPtr theResult, const TopoDS_Shape& theShape,
34                        Handle_SelectMgr_EntityOwner theOwner)
35       : myResult(theResult),
36         myShape(theShape),
37         myOwner(theOwner)
38   {
39   }
40
41   /// Destructor
42   virtual ~ModuleBase_ViewerPrs()
43   {
44   }
45
46   /// Sets the feature.
47   /// \param theFeature a feature instance
48   void setFeature(ObjectPtr theResult)
49   {
50     myResult = theResult;
51   }
52
53   /// Returns the feature.
54   /// \return a feature instance
55   ObjectPtr object() const
56   {
57     return myResult;
58   }
59
60   /// Returns the presentation owner
61   /// \param the owner
62   void setOwner(Handle_SelectMgr_EntityOwner theOwner)
63   {
64     myOwner = theOwner;
65   }
66
67   /// Returns the presentation owner
68   /// \return an owner
69   Handle_SelectMgr_EntityOwner owner() const
70   {
71     return myOwner;
72   }
73
74   /// Sets the shape
75   /// \param theShape a shape instance
76   void setShape(const TopoDS_Shape& theShape)
77   {
78     myShape = theShape;
79   }
80
81   /// Returns the shape
82   /// \return a shape instance
83   const TopoDS_Shape& shape() const
84   {
85     return myShape;
86   }
87
88   void setInteractive(const Handle(AIS_InteractiveObject)& theIO)
89   {
90     myInteractive = theIO;
91   }
92
93   Handle(AIS_InteractiveObject) interactive() const
94   {
95     return myInteractive;
96   }
97
98   bool operator==(const ModuleBase_ViewerPrs& thePrs)
99   {
100     bool aResult = (myResult.get() == thePrs.object().get());
101     bool aOwner = (myOwner.Access() == thePrs.owner().Access());
102     bool aShape = myShape.IsEqual(thePrs.shape()) == Standard_True;
103     bool aIO = (myInteractive == thePrs.interactive()) == Standard_True;
104     return aResult && aOwner && aShape && aIO;
105   }
106
107  private:
108   ObjectPtr myResult;  /// the feature
109   Handle(SelectMgr_EntityOwner) myOwner;  /// the selection owner
110   TopoDS_Shape myShape;  /// the shape
111   Handle(AIS_InteractiveObject) myInteractive;
112 };
113
114 #endif