1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef ModuleBase_ViewerPrs_H
22 #define ModuleBase_ViewerPrs_H
24 #include "ModuleBase.h"
27 #include <SelectMgr_EntityOwner.hxx>
28 #include <AIS_InteractiveObject.hxx>
30 #include <ModelAPI_Result.h>
31 #include <GeomAPI_Shape.h>
33 /**\class ModuleBase_ViewerPrs
35 * \brief Presentation. Provides container to have feature, shape and/or selection owner.
37 class ModuleBase_ViewerPrs
41 /// \param theResult an object
42 /// \param theShape a viewer shape
43 /// \param theOwner a selection owner
44 MODULEBASE_EXPORT ModuleBase_ViewerPrs(ObjectPtr theResult = ObjectPtr(),
45 const GeomShapePtr& theShape = GeomShapePtr(),
46 Handle(SelectMgr_EntityOwner) theOwner = NULL);
49 MODULEBASE_EXPORT virtual ~ModuleBase_ViewerPrs();
52 /// \param theResult an object instance
53 MODULEBASE_EXPORT void setObject(ObjectPtr theResult)
58 /// Returns the feature.
59 /// \return a feature instance
60 MODULEBASE_EXPORT ObjectPtr object() const
65 /// Set the presentation owner
66 /// \param theOwner an owner to set
67 MODULEBASE_EXPORT void setOwner(Handle_SelectMgr_EntityOwner theOwner)
72 /// Returns the presentation owner
74 MODULEBASE_EXPORT Handle_SelectMgr_EntityOwner owner() const
80 /// \param theShape a shape instance
81 MODULEBASE_EXPORT void setShape(const GeomShapePtr& theShape)
87 /// \return a shape instance
88 MODULEBASE_EXPORT const GeomShapePtr& shape() const
93 /// Set interactive object
94 /// \param theIO an interactive object
95 MODULEBASE_EXPORT void setInteractive(const Handle(AIS_InteractiveObject)& theIO)
97 myInteractive = theIO;
100 /// Returns interactive object if it is installed
101 MODULEBASE_EXPORT Handle(AIS_InteractiveObject) interactive() const
103 return myInteractive;
106 /// Returns true if all presentation fields are empty
107 /// \return boolean value
108 MODULEBASE_EXPORT bool isEmpty() const
110 return (!myShape.get() || myShape->isNull()) &&
111 myOwner.IsNull() && !myResult.get();
114 /// Returns true if all presentation fields are empty
115 /// \return boolean value
116 MODULEBASE_EXPORT bool isEqual(ModuleBase_ViewerPrs* thePrs) const;
118 /// Returns True if the current object is equal to the given one
119 /// \param thePrs an object to compare
120 MODULEBASE_EXPORT bool operator==(const ModuleBase_ViewerPrs& thePrs);
123 ObjectPtr myResult; /// the feature
124 Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner
125 GeomShapePtr myShape; /// the shape
126 Handle(AIS_InteractiveObject) myInteractive; /// interactive object
129 typedef std::shared_ptr<ModuleBase_ViewerPrs> ModuleBase_ViewerPrsPtr;