1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef ModuleBase_ViewerPrs_H
21 #define ModuleBase_ViewerPrs_H
23 #include "ModuleBase.h"
26 #include <SelectMgr_EntityOwner.hxx>
27 #include <AIS_InteractiveObject.hxx>
29 #include <ModelAPI_Result.h>
30 #include <GeomAPI_Shape.h>
32 /**\class ModuleBase_ViewerPrs
34 * \brief Presentation. Provides container to have feature, shape and/or selection owner.
36 class ModuleBase_ViewerPrs
40 /// \param theResult an object
41 /// \param theShape a viewer shape
42 /// \param theOwner a selection owner
43 MODULEBASE_EXPORT ModuleBase_ViewerPrs(ObjectPtr theResult = ObjectPtr(),
44 const GeomShapePtr& theShape = GeomShapePtr(),
45 Handle(SelectMgr_EntityOwner) theOwner = NULL);
48 MODULEBASE_EXPORT virtual ~ModuleBase_ViewerPrs();
51 /// \param theResult an object instance
52 MODULEBASE_EXPORT void setObject(ObjectPtr theResult)
57 /// Returns the feature.
58 /// \return a feature instance
59 MODULEBASE_EXPORT ObjectPtr object() const
64 /// Set the presentation owner
65 /// \param theOwner an owner to set
66 MODULEBASE_EXPORT void setOwner(Handle_SelectMgr_EntityOwner theOwner)
71 /// Returns the presentation owner
73 MODULEBASE_EXPORT Handle_SelectMgr_EntityOwner owner() const
79 /// \param theShape a shape instance
80 MODULEBASE_EXPORT void setShape(const GeomShapePtr& theShape)
86 /// \return a shape instance
87 MODULEBASE_EXPORT const GeomShapePtr& shape() const
92 /// Set interactive object
93 /// \param theIO an interactive object
94 MODULEBASE_EXPORT void setInteractive(const Handle(AIS_InteractiveObject)& theIO)
96 myInteractive = theIO;
99 /// Returns interactive object if it is installed
100 MODULEBASE_EXPORT Handle(AIS_InteractiveObject) interactive() const
102 return myInteractive;
105 /// Returns true if all presentation fields are empty
106 /// \return boolean value
107 MODULEBASE_EXPORT bool isEmpty() const
109 return (!myShape.get() || myShape->isNull()) &&
110 myOwner.IsNull() && !myResult.get();
113 /// Returns true if all presentation fields are empty
114 /// \return boolean value
115 MODULEBASE_EXPORT bool isEqual(ModuleBase_ViewerPrs* thePrs) const;
117 /// Returns True if the current object is equal to the given one
118 /// \param thePrs an object to compare
119 MODULEBASE_EXPORT bool operator==(const ModuleBase_ViewerPrs& thePrs);
122 ObjectPtr myResult; /// the feature
123 Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner
124 GeomShapePtr myShape; /// the shape
125 Handle(AIS_InteractiveObject) myInteractive; /// interactive object
128 typedef std::shared_ptr<ModuleBase_ViewerPrs> ModuleBase_ViewerPrsPtr;