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