1 // File: ModuleBase_ViewerPrs.h
2 // Created: 20 Apr 2014
3 // Author: Natalia ERMOLAEVA
5 #ifndef ModuleBase_ViewerPrs_H
6 #define ModuleBase_ViewerPrs_H
8 #include "ModuleBase.h"
10 #include <boost/shared_ptr.hpp>
11 #include <TopoDS_Shape.hxx>
12 #include <SelectMgr_EntityOwner.hxx>
13 #include <AIS_InteractiveObject.hxx>
15 #include <ModelAPI_Result.h>
17 /**\class ModuleBase_ViewerPrs
18 * \ingroup Module base
19 * \brief Presentation. Provides container to have feature, shape and/or selection owner.
21 class ModuleBase_ViewerPrs
25 ModuleBase_ViewerPrs() {}
28 /// \param theFeature a model feature
29 /// \param theShape a viewer shape
30 /// \param theOwner a selection owner
31 ModuleBase_ViewerPrs(ObjectPtr theResult,
32 const TopoDS_Shape& theShape,
33 Handle_SelectMgr_EntityOwner theOwner)
34 : myResult(theResult), myShape(theShape), myOwner(theOwner) {}
37 virtual ~ModuleBase_ViewerPrs() {}
40 /// \param theFeature a feature instance
41 void setFeature(ObjectPtr theResult) { myResult = theResult; }
43 /// Returns the feature.
44 /// \return a feature instance
45 ObjectPtr object() const { return myResult; }
47 /// Returns the presentation owner
49 void setOwner(Handle_SelectMgr_EntityOwner theOwner) { myOwner = theOwner; }
51 /// Returns the presentation owner
53 Handle_SelectMgr_EntityOwner owner() const { return myOwner; }
56 /// \param theShape a shape instance
57 void setShape(const TopoDS_Shape& theShape) { myShape = theShape; }
60 /// \return a shape instance
61 const TopoDS_Shape& shape() const { return myShape; }
63 void setInteractive(const Handle(AIS_InteractiveObject)& theIO) { myInteractive = theIO; }
65 Handle(AIS_InteractiveObject) interactive() const { return myInteractive; }
67 bool operator==(const ModuleBase_ViewerPrs& thePrs)
69 bool aResult = (myResult.get() == thePrs.object().get());
70 bool aOwner = (myOwner.Access() == thePrs.owner().Access());
71 bool aShape = myShape.IsEqual(thePrs.shape());
72 bool aIO = (myInteractive == thePrs.interactive());
73 return aResult && aOwner && aShape && aIO;
77 ObjectPtr myResult; /// the feature
78 Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner
79 TopoDS_Shape myShape; /// the shape
80 Handle(AIS_InteractiveObject) myInteractive;