0023000: Improve the way the gradient and textured background is managed in 3d viewer
[occt.git] / src / SelectMgr / SelectMgr_EntityOwner.cxx
CommitLineData
7fd59977 1// Copyright: Matra-Datavision 1995
2// File: SelectMgr_EntityOwner.cxx
3// Created: Tue May 23 10:18:48 1995
4// Author: Robert COUBLANC
5// <rob>
6
7
8
9#include <SelectMgr_EntityOwner.ixx>
10
11
12
13//==================================================
14// Function:
15// Purpose :
16//==================================================
17SelectMgr_EntityOwner::SelectMgr_EntityOwner(const Standard_Integer aPriority):
18SelectBasics_EntityOwner(aPriority),
19mySelectable(NULL),
20mystate(0)
21{
22}
23
24SelectMgr_EntityOwner::SelectMgr_EntityOwner(const Handle(SelectMgr_SelectableObject)& aSO,
25 const Standard_Integer aPriority):
26SelectBasics_EntityOwner(aPriority),
27mystate(0)
28{
29 mySelectable = aSO.operator->();
30}
31
32
33//=======================================================================
34//function : About Selectable...
35//purpose :
36//=======================================================================
37void SelectMgr_EntityOwner::Set(const Handle(SelectMgr_SelectableObject)& aSO)
38{
39 mySelectable = aSO.operator->();
40}
41
42Standard_Boolean SelectMgr_EntityOwner::HasSelectable() const
43{
44 Handle(Standard_Transient) aNull;
45 if(mySelectable != aNull.operator->()){
46 if(!Selectable().IsNull()) return Standard_True;}
47 return Standard_False;
48}
49
50Handle(SelectMgr_SelectableObject) SelectMgr_EntityOwner::Selectable() const
51{
52 return mySelectable;
53}
54
55//=======================================================================
56//function : about Hilight
57//purpose :
58//=======================================================================
59Standard_Boolean SelectMgr_EntityOwner::IsHilighted(const Handle(PrsMgr_PresentationManager)& PM,
60 const Standard_Integer aMode) const
61{if(HasSelectable())
62 return PM->IsHighlighted(mySelectable,aMode);
63 return Standard_False;
64}
65void SelectMgr_EntityOwner::Hilight(const Handle(PrsMgr_PresentationManager)& PM,
66 const Standard_Integer aMode)
67{if(HasSelectable())
68 PM->Highlight(mySelectable,aMode);
69}
70
71void SelectMgr_EntityOwner::HilightWithColor(const Handle(PrsMgr_PresentationManager3d)& PM,
72 const Quantity_NameOfColor aColor,
73 const Standard_Integer aMode)
74{
75 if( HasSelectable() )
76 if( IsAutoHilight() )
77 PM->Color(mySelectable,aColor,aMode);
78 else
79 mySelectable->HilightOwnerWithColor( PM, aColor, this );
80}
81
82void SelectMgr_EntityOwner::Unhilight(const Handle(PrsMgr_PresentationManager)& PM,
83 const Standard_Integer aMode)
84{
85 if(HasSelectable())
86 PM->Unhighlight(mySelectable,aMode);
87}
88
89void SelectMgr_EntityOwner::Clear(const Handle(PrsMgr_PresentationManager)& PM,
90 const Standard_Integer aMode)
91{
92// nothing done on the selectable here...
93}
94
95
96void SelectMgr_EntityOwner::
97Hilight(){}
98
99
100
101//=======================================================================
102//function : about Location
103//purpose :
104//=======================================================================
105
106Standard_Boolean SelectMgr_EntityOwner::HasLocation() const
107{
108 return (HasSelectable() && mySelectable->HasLocation());
109}
110
111void SelectMgr_EntityOwner::SetLocation(const TopLoc_Location&)
112{
113}
114
115const TopLoc_Location& SelectMgr_EntityOwner::Location() const
116{
117 static TopLoc_Location anIdentity;
118 return HasSelectable() ? mySelectable->Location() : anIdentity;
119}
120
121void SelectMgr_EntityOwner::ResetLocation()
122{
123}
124
125Standard_Boolean SelectMgr_EntityOwner::IsAutoHilight () const
126{
127 if ( mySelectable==0 )
128 return Standard_True;
129 else
130 return mySelectable->IsAutoHilight();
131}
132
133Standard_Boolean SelectMgr_EntityOwner::IsForcedHilight () const
134{
135 return Standard_False;
136}