0023649: Visualization, AIS_LocalContext - make highlighting of already selected...
[occt.git] / src / SelectMgr / SelectMgr_EntityOwner.cxx
CommitLineData
b311480e 1// Created on: 1995-05-23
2// Created by: Robert COUBLANC
3// Copyright (c) 1995-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
17#include <SelectMgr_EntityOwner.ixx>
18
19
20
21//==================================================
22// Function:
23// Purpose :
24//==================================================
25SelectMgr_EntityOwner::SelectMgr_EntityOwner(const Standard_Integer aPriority):
26SelectBasics_EntityOwner(aPriority),
27mySelectable(NULL),
c398b00e 28myIsSelected (Standard_False)
7fd59977 29{
30}
31
32SelectMgr_EntityOwner::SelectMgr_EntityOwner(const Handle(SelectMgr_SelectableObject)& aSO,
33 const Standard_Integer aPriority):
34SelectBasics_EntityOwner(aPriority),
c398b00e 35myIsSelected (Standard_False)
7fd59977 36{
37 mySelectable = aSO.operator->();
38}
39
40
41//=======================================================================
42//function : About Selectable...
43//purpose :
44//=======================================================================
45void SelectMgr_EntityOwner::Set(const Handle(SelectMgr_SelectableObject)& aSO)
46{
47 mySelectable = aSO.operator->();
48}
49
50Standard_Boolean SelectMgr_EntityOwner::HasSelectable() const
51{
52 Handle(Standard_Transient) aNull;
53 if(mySelectable != aNull.operator->()){
54 if(!Selectable().IsNull()) return Standard_True;}
55 return Standard_False;
56}
57
58Handle(SelectMgr_SelectableObject) SelectMgr_EntityOwner::Selectable() const
59{
60 return mySelectable;
61}
62
63//=======================================================================
64//function : about Hilight
65//purpose :
66//=======================================================================
67Standard_Boolean SelectMgr_EntityOwner::IsHilighted(const Handle(PrsMgr_PresentationManager)& PM,
68 const Standard_Integer aMode) const
69{if(HasSelectable())
70 return PM->IsHighlighted(mySelectable,aMode);
71 return Standard_False;
72}
73void SelectMgr_EntityOwner::Hilight(const Handle(PrsMgr_PresentationManager)& PM,
74 const Standard_Integer aMode)
75{if(HasSelectable())
76 PM->Highlight(mySelectable,aMode);
77}
78
79void SelectMgr_EntityOwner::HilightWithColor(const Handle(PrsMgr_PresentationManager3d)& PM,
80 const Quantity_NameOfColor aColor,
81 const Standard_Integer aMode)
82{
eafb234b 83 if( HasSelectable() ) {
7fd59977 84 if( IsAutoHilight() )
85 PM->Color(mySelectable,aColor,aMode);
86 else
87 mySelectable->HilightOwnerWithColor( PM, aColor, this );
eafb234b 88 }
7fd59977 89}
90
91void SelectMgr_EntityOwner::Unhilight(const Handle(PrsMgr_PresentationManager)& PM,
92 const Standard_Integer aMode)
93{
94 if(HasSelectable())
95 PM->Unhighlight(mySelectable,aMode);
96}
97
35e08fe8 98void SelectMgr_EntityOwner::Clear(const Handle(PrsMgr_PresentationManager)&,
99 const Standard_Integer)
7fd59977 100{
101// nothing done on the selectable here...
102}
103
104
105void SelectMgr_EntityOwner::
106Hilight(){}
107
108
109
110//=======================================================================
111//function : about Location
112//purpose :
113//=======================================================================
114
115Standard_Boolean SelectMgr_EntityOwner::HasLocation() const
116{
117 return (HasSelectable() && mySelectable->HasLocation());
118}
119
120void SelectMgr_EntityOwner::SetLocation(const TopLoc_Location&)
121{
122}
123
124const TopLoc_Location& SelectMgr_EntityOwner::Location() const
125{
126 static TopLoc_Location anIdentity;
127 return HasSelectable() ? mySelectable->Location() : anIdentity;
128}
129
130void SelectMgr_EntityOwner::ResetLocation()
131{
132}
133
134Standard_Boolean SelectMgr_EntityOwner::IsAutoHilight () const
135{
136 if ( mySelectable==0 )
137 return Standard_True;
138 else
139 return mySelectable->IsAutoHilight();
140}
141
142Standard_Boolean SelectMgr_EntityOwner::IsForcedHilight () const
143{
144 return Standard_False;
145}
59f45b7c 146
147//=======================================================================
148//function : SetZLayer
149//purpose :
150//=======================================================================
151void SelectMgr_EntityOwner::SetZLayer
35e08fe8 152 (const Handle(PrsMgr_PresentationManager)&,
153 const Standard_Integer)
59f45b7c 154{
155}