1 // Created on: 1995-05-23
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <SelectMgr_EntityOwner.hxx>
19 #include <PrsMgr_PresentationManager.hxx>
20 #include <Standard_NoSuchObject.hxx>
21 #include <Standard_Type.hxx>
22 #include <TopLoc_Location.hxx>
24 IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_EntityOwner,SelectBasics_EntityOwner)
26 //==================================================
27 // Function: SelectMgr_EntityOwner
29 //==================================================
30 SelectMgr_EntityOwner::SelectMgr_EntityOwner (const Standard_Integer thePriority)
31 : SelectBasics_EntityOwner (thePriority),
33 myIsSelected (Standard_False),
34 myFromDecomposition (Standard_False)
39 //==================================================
40 // Function: SelectMgr_EntityOwner
42 //==================================================
43 SelectMgr_EntityOwner::SelectMgr_EntityOwner (const Handle(SelectMgr_SelectableObject)& theSelObj,
44 const Standard_Integer thePriority)
45 : SelectBasics_EntityOwner (thePriority),
46 mySelectable (theSelObj.operator->()),
47 myIsSelected (Standard_False),
48 myFromDecomposition (Standard_False)
53 //==================================================
54 // Function: SelectMgr_EntityOwner
56 //==================================================
57 SelectMgr_EntityOwner::SelectMgr_EntityOwner (const Handle(SelectMgr_EntityOwner)& theOwner,
58 const Standard_Integer thePriority)
59 : SelectBasics_EntityOwner (thePriority),
60 mySelectable (theOwner->mySelectable),
61 myIsSelected (Standard_False),
62 myFromDecomposition (Standard_False)
67 //=======================================================================
68 //function : SetSelectable
70 //=======================================================================
71 void SelectMgr_EntityOwner::SetSelectable (const Handle(SelectMgr_SelectableObject)& theSelObj)
73 mySelectable = theSelObj.operator->();
76 //=======================================================================
77 //function : Selectable
79 //=======================================================================
80 Handle(SelectMgr_SelectableObject) SelectMgr_EntityOwner::Selectable() const
85 //=======================================================================
86 //function : IsHilighted
88 //=======================================================================
89 Standard_Boolean SelectMgr_EntityOwner::IsHilighted (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
90 const Standard_Integer theMode) const
92 return mySelectable != NULL
93 && thePrsMgr->IsHighlighted (mySelectable, theMode);
96 void SelectMgr_EntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
97 const Handle(Prs3d_Drawer)& theStyle,
98 const Standard_Integer theMode)
100 if (!HasSelectable())
107 const Graphic3d_ZLayerId aHiLayer = theStyle->ZLayer() != Graphic3d_ZLayerId_UNKNOWN ? theStyle->ZLayer() : mySelectable->ZLayer();
108 thePM->Color (mySelectable, theStyle, theMode, NULL, aHiLayer);
112 mySelectable->HilightOwnerWithColor (thePM, theStyle, this);
116 void SelectMgr_EntityOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Standard_Integer )
120 thePrsMgr->Unhighlight (mySelectable);
124 void SelectMgr_EntityOwner::Clear(const Handle(PrsMgr_PresentationManager)&,
125 const Standard_Integer)
127 // nothing done on the selectable here...
130 //=======================================================================
131 //function : about Transformation
133 //=======================================================================
135 Standard_Boolean SelectMgr_EntityOwner::HasLocation() const
137 return (HasSelectable() && mySelectable->HasTransformation());
140 void SelectMgr_EntityOwner::SetLocation(const TopLoc_Location&)
144 TopLoc_Location SelectMgr_EntityOwner::Location() const
146 return !HasLocation() ? TopLoc_Location() : TopLoc_Location(mySelectable->Transformation());
149 void SelectMgr_EntityOwner::ResetLocation()
153 Standard_Boolean SelectMgr_EntityOwner::IsAutoHilight () const
155 return mySelectable == NULL
156 || mySelectable->IsAutoHilight();
159 Standard_Boolean SelectMgr_EntityOwner::IsForcedHilight () const
161 return Standard_False;
164 //=======================================================================
165 //function : SetZLayer
167 //=======================================================================
168 void SelectMgr_EntityOwner::SetZLayer (const Standard_Integer )
173 //=======================================================================
174 //function : UpdateHighlightTrsf
176 //=======================================================================
177 void SelectMgr_EntityOwner::UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
178 const Handle(PrsMgr_PresentationManager3d)& theManager,
179 const Standard_Integer theDispMode)
181 if (mySelectable == NULL)
184 theManager->UpdateHighlightTrsf (theViewer, mySelectable, theDispMode);