1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModuleBase_ViewerPrs.h
4 // Created: 20 Apr 2014
5 // Author: Natalia ERMOLAEVA
7 #ifndef ModuleBase_ViewerPrs_H
8 #define ModuleBase_ViewerPrs_H
10 #include "ModuleBase.h"
13 #include <TopoDS_Shape.hxx>
14 #include <SelectMgr_EntityOwner.hxx>
15 #include <AIS_InteractiveObject.hxx>
17 #include <ModelAPI_Result.h>
19 /**\class ModuleBase_ViewerPrs
21 * \brief Presentation. Provides container to have feature, shape and/or selection owner.
23 class ModuleBase_ViewerPrs
27 ModuleBase_ViewerPrs()
32 /// \param theResult an object
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),
44 virtual ~ModuleBase_ViewerPrs()
49 /// \param theResult an object instance
50 void setObject(ObjectPtr theResult)
55 /// Returns the feature.
56 /// \return a feature instance
57 ObjectPtr object() const
62 /// Set the presentation owner
63 /// \param theOwner an owner to set
64 void setOwner(Handle_SelectMgr_EntityOwner theOwner)
69 /// Returns the presentation owner
71 Handle_SelectMgr_EntityOwner owner() const
77 /// \param theShape a shape instance
78 void setShape(const TopoDS_Shape& theShape)
84 /// \return a shape instance
85 const TopoDS_Shape& shape() const
90 /// Set interactive object
91 /// \param theIO an interactive object
92 void setInteractive(const Handle(AIS_InteractiveObject)& theIO)
94 myInteractive = theIO;
97 /// Returns interactive object if it is installed
98 Handle(AIS_InteractiveObject) interactive() const
100 return myInteractive;
103 /// Returns true if all presentation fields are empty
104 /// \return boolean value
107 return myShape.IsNull() &&
108 myOwner.IsNull() && !myResult.get();
111 /// Returns True if the current object is equal to the given one
112 /// \param thePrs an object to compare
113 bool operator==(const ModuleBase_ViewerPrs& thePrs)
115 bool aResult = (myResult.get() == thePrs.object().get());
116 bool aOwner = (myOwner.Access() == thePrs.owner().Access());
117 bool aShape = myShape.IsEqual(thePrs.shape()) == Standard_True;
118 bool aIO = (myInteractive == thePrs.interactive()) == Standard_True;
119 return aResult && aOwner && aShape && aIO;
123 ObjectPtr myResult; /// the feature
124 Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner
125 TopoDS_Shape myShape; /// the shape
126 Handle(AIS_InteractiveObject) myInteractive; /// interactive object