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_EXPORT ModuleBase_ViewerPrs();
30 /// \param theResult an object
31 /// \param theShape a viewer shape
32 /// \param theOwner a selection owner
33 MODULEBASE_EXPORT ModuleBase_ViewerPrs(ObjectPtr theResult, const TopoDS_Shape& theShape,
34 Handle_SelectMgr_EntityOwner theOwner);
37 MODULEBASE_EXPORT virtual ~ModuleBase_ViewerPrs();
40 /// \param theResult an object instance
41 MODULEBASE_EXPORT void setObject(ObjectPtr theResult)
46 /// Returns the feature.
47 /// \return a feature instance
48 MODULEBASE_EXPORT ObjectPtr object() const
53 /// Set the presentation owner
54 /// \param theOwner an owner to set
55 MODULEBASE_EXPORT void setOwner(Handle_SelectMgr_EntityOwner theOwner)
60 /// Returns the presentation owner
62 MODULEBASE_EXPORT Handle_SelectMgr_EntityOwner owner() const
68 /// \param theShape a shape instance
69 MODULEBASE_EXPORT void setShape(const TopoDS_Shape& theShape)
75 /// \return a shape instance
76 MODULEBASE_EXPORT const TopoDS_Shape& shape() const
81 /// Set interactive object
82 /// \param theIO an interactive object
83 MODULEBASE_EXPORT void setInteractive(const Handle(AIS_InteractiveObject)& theIO)
85 myInteractive = theIO;
88 /// Returns interactive object if it is installed
89 MODULEBASE_EXPORT Handle(AIS_InteractiveObject) interactive() const
94 /// Returns true if all presentation fields are empty
95 /// \return boolean value
96 MODULEBASE_EXPORT bool isEmpty() const
98 return myShape.IsNull() &&
99 myOwner.IsNull() && !myResult.get();
102 /// Returns True if the current object is equal to the given one
103 /// \param thePrs an object to compare
104 MODULEBASE_EXPORT bool operator==(const ModuleBase_ViewerPrs& thePrs)
106 bool aResult = (myResult.get() == thePrs.object().get());
107 bool aOwner = (myOwner.Access() == thePrs.owner().Access());
108 bool aShape = myShape.IsEqual(thePrs.shape()) == Standard_True;
109 bool aIO = (myInteractive == thePrs.interactive()) == Standard_True;
110 return aResult && aOwner && aShape && aIO;
114 ObjectPtr myResult; /// the feature
115 Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner
116 TopoDS_Shape myShape; /// the shape
117 Handle(AIS_InteractiveObject) myInteractive; /// interactive object