SHAPER  9.12.0
ModuleBase_ViewerPrs.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef ModuleBase_ViewerPrs_H
21 #define ModuleBase_ViewerPrs_H
22 
23 #include "ModuleBase.h"
24 
25 #include <memory>
26 #include <SelectMgr_EntityOwner.hxx>
27 #include <AIS_InteractiveObject.hxx>
28 
29 #include <ModelAPI_Result.h>
30 #include <GeomAPI_Shape.h>
31 
37 {
38  public:
43  MODULEBASE_EXPORT ModuleBase_ViewerPrs(ObjectPtr theResult = ObjectPtr(),
44  const GeomShapePtr& theShape = GeomShapePtr(),
45  Handle(SelectMgr_EntityOwner) theOwner = NULL);
46 
48  MODULEBASE_EXPORT virtual ~ModuleBase_ViewerPrs();
49 
52  MODULEBASE_EXPORT void setObject(ObjectPtr theResult)
53  {
54  myResult = theResult;
55  }
56 
59  MODULEBASE_EXPORT ObjectPtr object() const
60  {
61  return myResult;
62  }
63 
66  MODULEBASE_EXPORT void setOwner(Handle_SelectMgr_EntityOwner theOwner)
67  {
68  myOwner = theOwner;
69  }
70 
73  MODULEBASE_EXPORT Handle_SelectMgr_EntityOwner owner() const
74  {
75  return myOwner;
76  }
77 
80  MODULEBASE_EXPORT void setShape(const GeomShapePtr& theShape)
81  {
82  myShape = theShape;
83  }
84 
87  MODULEBASE_EXPORT const GeomShapePtr& shape() const
88  {
89  return myShape;
90  }
91 
94  MODULEBASE_EXPORT void setInteractive(const Handle(AIS_InteractiveObject)& theIO)
95  {
96  myInteractive = theIO;
97  }
98 
100  MODULEBASE_EXPORT Handle(AIS_InteractiveObject) interactive() const
101  {
102  return myInteractive;
103  }
104 
107  MODULEBASE_EXPORT bool isEmpty() const
108  {
109  return (!myShape.get() || myShape->isNull()) &&
110  myOwner.IsNull() && !myResult.get();
111  }
112 
115  MODULEBASE_EXPORT bool isEqual(ModuleBase_ViewerPrs* thePrs) const;
116 
119  MODULEBASE_EXPORT bool operator==(const ModuleBase_ViewerPrs& thePrs);
120 
121  private:
122  ObjectPtr myResult;
123  Handle(SelectMgr_EntityOwner) myOwner;
124  GeomShapePtr myShape;
125  Handle(AIS_InteractiveObject) myInteractive;
126 };
127 
128 typedef std::shared_ptr<ModuleBase_ViewerPrs> ModuleBase_ViewerPrsPtr;
129 
130 #endif
Presentation.
Definition: ModuleBase_ViewerPrs.h:37
ModuleBase_ViewerPrs(ObjectPtr theResult=ObjectPtr(), const GeomShapePtr &theShape=GeomShapePtr(), HandlettheOwner=NULL)
Constructor.
Definition: ModuleBase_ViewerPrs.cpp:25
const GeomShapePtr & shape() const
Returns the shape.
Definition: ModuleBase_ViewerPrs.h:87
void setInteractive(const Handle &&theIO)
Set interactive object.
Definition: ModuleBase_ViewerPrs.h:94
void setShape(const GeomShapePtr &theShape)
Sets the shape.
Definition: ModuleBase_ViewerPrs.h:80
void setObject(ObjectPtr theResult)
Sets the object.
Definition: ModuleBase_ViewerPrs.h:52
Handle_SelectMgr_EntityOwner owner() const
Returns the presentation owner.
Definition: ModuleBase_ViewerPrs.h:73
bool operator==(const ModuleBase_ViewerPrs &thePrs)
Returns True if the current object is equal to the given one.
Definition: ModuleBase_ViewerPrs.cpp:80
void setOwner(Handle_SelectMgr_EntityOwner theOwner)
Set the presentation owner.
Definition: ModuleBase_ViewerPrs.h:66
ObjectPtr object() const
Returns the feature.
Definition: ModuleBase_ViewerPrs.h:59
virtual ~ModuleBase_ViewerPrs()
Destructor.
Definition: ModuleBase_ViewerPrs.cpp:34
bool isEqual(ModuleBase_ViewerPrs *thePrs) const
Returns true if all presentation fields are empty.
Definition: ModuleBase_ViewerPrs.cpp:38
bool isEmpty() const
Returns true if all presentation fields are empty.
Definition: ModuleBase_ViewerPrs.h:107