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 <SelectMgr_EntityOwner.hxx>
14 #include <AIS_InteractiveObject.hxx>
16 #include <ModelAPI_Result.h>
17 #include <GeomAPI_Shape.h>
19 /**\class ModuleBase_ViewerPrs
21 * \brief Presentation. Provides container to have feature, shape and/or selection owner.
23 class ModuleBase_ViewerPrs
27 /// \param theResult an object
28 /// \param theShape a viewer shape
29 /// \param theOwner a selection owner
30 MODULEBASE_EXPORT ModuleBase_ViewerPrs(ObjectPtr theResult = ObjectPtr(),
31 const GeomShapePtr& theShape = GeomShapePtr(),
32 Handle(SelectMgr_EntityOwner) theOwner = NULL);
35 MODULEBASE_EXPORT virtual ~ModuleBase_ViewerPrs();
38 /// \param theResult an object instance
39 MODULEBASE_EXPORT void setObject(ObjectPtr theResult)
44 /// Returns the feature.
45 /// \return a feature instance
46 MODULEBASE_EXPORT ObjectPtr object() const
51 /// Set the presentation owner
52 /// \param theOwner an owner to set
53 MODULEBASE_EXPORT void setOwner(Handle_SelectMgr_EntityOwner theOwner)
58 /// Returns the presentation owner
60 MODULEBASE_EXPORT Handle_SelectMgr_EntityOwner owner() const
66 /// \param theShape a shape instance
67 MODULEBASE_EXPORT void setShape(const GeomShapePtr& theShape)
73 /// \return a shape instance
74 MODULEBASE_EXPORT const GeomShapePtr& shape() const
79 /// Set interactive object
80 /// \param theIO an interactive object
81 MODULEBASE_EXPORT void setInteractive(const Handle(AIS_InteractiveObject)& theIO)
83 myInteractive = theIO;
86 /// Returns interactive object if it is installed
87 MODULEBASE_EXPORT Handle(AIS_InteractiveObject) interactive() const
92 /// Returns true if all presentation fields are empty
93 /// \return boolean value
94 MODULEBASE_EXPORT bool isEmpty() const
96 return (!myShape.get() || myShape->isNull()) &&
97 myOwner.IsNull() && !myResult.get();
100 /// Returns true if all presentation fields are empty
101 /// \return boolean value
102 MODULEBASE_EXPORT bool isEqual(ModuleBase_ViewerPrs* thePrs) const;
104 /// Returns True if the current object is equal to the given one
105 /// \param thePrs an object to compare
106 MODULEBASE_EXPORT bool operator==(const ModuleBase_ViewerPrs& thePrs);
109 ObjectPtr myResult; /// the feature
110 Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner
111 GeomShapePtr myShape; /// the shape
112 Handle(AIS_InteractiveObject) myInteractive; /// interactive object
115 typedef std::shared_ptr<ModuleBase_ViewerPrs> ModuleBase_ViewerPrsPtr;