0024837: Visualization - revise design and implementation of connected Interactive...
[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
0717ddc1 40SelectMgr_EntityOwner::SelectMgr_EntityOwner (const Handle(SelectMgr_EntityOwner)& theOwner, const Standard_Integer aPriority)
41:
42 SelectBasics_EntityOwner(aPriority),
43 mySelectable (theOwner->mySelectable)
44{
45}
46
7fd59977 47
48//=======================================================================
49//function : About Selectable...
50//purpose :
51//=======================================================================
52void SelectMgr_EntityOwner::Set(const Handle(SelectMgr_SelectableObject)& aSO)
53{
54 mySelectable = aSO.operator->();
55}
56
57Standard_Boolean SelectMgr_EntityOwner::HasSelectable() const
58{
59 Handle(Standard_Transient) aNull;
60 if(mySelectable != aNull.operator->()){
61 if(!Selectable().IsNull()) return Standard_True;}
62 return Standard_False;
63}
64
65Handle(SelectMgr_SelectableObject) SelectMgr_EntityOwner::Selectable() const
66{
67 return mySelectable;
68}
69
70//=======================================================================
71//function : about Hilight
72//purpose :
73//=======================================================================
74Standard_Boolean SelectMgr_EntityOwner::IsHilighted(const Handle(PrsMgr_PresentationManager)& PM,
75 const Standard_Integer aMode) const
76{if(HasSelectable())
77 return PM->IsHighlighted(mySelectable,aMode);
78 return Standard_False;
79}
80void SelectMgr_EntityOwner::Hilight(const Handle(PrsMgr_PresentationManager)& PM,
81 const Standard_Integer aMode)
82{if(HasSelectable())
83 PM->Highlight(mySelectable,aMode);
84}
85
86void SelectMgr_EntityOwner::HilightWithColor(const Handle(PrsMgr_PresentationManager3d)& PM,
87 const Quantity_NameOfColor aColor,
88 const Standard_Integer aMode)
89{
eafb234b 90 if( HasSelectable() ) {
7fd59977 91 if( IsAutoHilight() )
92 PM->Color(mySelectable,aColor,aMode);
93 else
94 mySelectable->HilightOwnerWithColor( PM, aColor, this );
eafb234b 95 }
7fd59977 96}
97
98void SelectMgr_EntityOwner::Unhilight(const Handle(PrsMgr_PresentationManager)& PM,
99 const Standard_Integer aMode)
100{
101 if(HasSelectable())
102 PM->Unhighlight(mySelectable,aMode);
103}
104
35e08fe8 105void SelectMgr_EntityOwner::Clear(const Handle(PrsMgr_PresentationManager)&,
106 const Standard_Integer)
7fd59977 107{
108// nothing done on the selectable here...
109}
110
111
112void SelectMgr_EntityOwner::
113Hilight(){}
114
115
7fd59977 116//=======================================================================
0717ddc1 117//function : about Transformation
7fd59977 118//purpose :
119//=======================================================================
120
121Standard_Boolean SelectMgr_EntityOwner::HasLocation() const
122{
0717ddc1 123 return (HasSelectable() && mySelectable->HasTransformation());
7fd59977 124}
125
126void SelectMgr_EntityOwner::SetLocation(const TopLoc_Location&)
127{
128}
129
0717ddc1 130TopLoc_Location SelectMgr_EntityOwner::Location() const
7fd59977 131{
0717ddc1 132 return !HasSelectable() ? TopLoc_Location() : TopLoc_Location(mySelectable->Transformation());
7fd59977 133}
134
135void SelectMgr_EntityOwner::ResetLocation()
136{
137}
138
139Standard_Boolean SelectMgr_EntityOwner::IsAutoHilight () const
140{
141 if ( mySelectable==0 )
142 return Standard_True;
143 else
144 return mySelectable->IsAutoHilight();
145}
146
147Standard_Boolean SelectMgr_EntityOwner::IsForcedHilight () const
148{
149 return Standard_False;
150}
59f45b7c 151
152//=======================================================================
153//function : SetZLayer
154//purpose :
155//=======================================================================
156void SelectMgr_EntityOwner::SetZLayer
35e08fe8 157 (const Handle(PrsMgr_PresentationManager)&,
158 const Standard_Integer)
59f45b7c 159{
160}