Integration of OCCT 6.5.0 from SVN
[occt.git] / src / SelectMgr / SelectMgr_EntityOwner.cxx
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 //==================================================
17 SelectMgr_EntityOwner::SelectMgr_EntityOwner(const Standard_Integer aPriority):
18 SelectBasics_EntityOwner(aPriority),
19 mySelectable(NULL),
20 mystate(0)
21 {
22 }
23
24 SelectMgr_EntityOwner::SelectMgr_EntityOwner(const Handle(SelectMgr_SelectableObject)& aSO,
25                                              const Standard_Integer aPriority):
26 SelectBasics_EntityOwner(aPriority),
27 mystate(0)
28 {
29   mySelectable = aSO.operator->();
30 }
31
32
33 //=======================================================================
34 //function : About Selectable...
35 //purpose  : 
36 //=======================================================================
37 void SelectMgr_EntityOwner::Set(const Handle(SelectMgr_SelectableObject)& aSO)
38 {
39   mySelectable = aSO.operator->();
40 }
41
42 Standard_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
50 Handle(SelectMgr_SelectableObject) SelectMgr_EntityOwner::Selectable() const
51 {  
52   return mySelectable;
53 }
54
55 //=======================================================================
56 //function : about Hilight
57 //purpose  : 
58 //=======================================================================
59 Standard_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 }
65 void SelectMgr_EntityOwner::Hilight(const Handle(PrsMgr_PresentationManager)& PM,
66                                     const Standard_Integer aMode)
67 {if(HasSelectable())
68    PM->Highlight(mySelectable,aMode);
69 }
70
71 void 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
82 void SelectMgr_EntityOwner::Unhilight(const Handle(PrsMgr_PresentationManager)& PM,
83         const Standard_Integer aMode)
84 {
85   if(HasSelectable())
86     PM->Unhighlight(mySelectable,aMode);
87 }
88
89 void SelectMgr_EntityOwner::Clear(const Handle(PrsMgr_PresentationManager)& PM,
90                                   const Standard_Integer aMode)
91 {
92 // nothing done on the selectable here...
93 }
94
95
96 void SelectMgr_EntityOwner::
97 Hilight(){}
98
99
100
101 //=======================================================================
102 //function : about Location
103 //purpose  : 
104 //=======================================================================
105
106 Standard_Boolean SelectMgr_EntityOwner::HasLocation() const
107 {
108   return (HasSelectable() && mySelectable->HasLocation());
109 }
110
111 void SelectMgr_EntityOwner::SetLocation(const TopLoc_Location&)
112 {
113 }
114
115 const TopLoc_Location& SelectMgr_EntityOwner::Location() const
116 {
117   static TopLoc_Location anIdentity;
118   return HasSelectable() ? mySelectable->Location() : anIdentity;
119 }
120
121 void SelectMgr_EntityOwner::ResetLocation()
122 {
123 }
124
125 Standard_Boolean SelectMgr_EntityOwner::IsAutoHilight () const
126 {
127   if ( mySelectable==0 )
128     return Standard_True;
129   else
130     return mySelectable->IsAutoHilight();
131 }
132
133 Standard_Boolean SelectMgr_EntityOwner::IsForcedHilight () const
134 {
135   return Standard_False;
136 }