247d8cac24bb0947a596c231493c374c793d9826
[occt.git] / src / MeshVS / MeshVS_MeshEntityOwner.cxx
1 // Created on: 2003-09-09
2 // Created by: Alexander SOLOVYOV
3 // Copyright (c) 2003-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16
17 #include <Graphic3d_Group.hxx>
18 #include <MeshVS_Mesh.hxx>
19 #include <MeshVS_MeshEntityOwner.hxx>
20 #include <Prs3d_Root.hxx>
21 #include <PrsMgr_PresentationManager.hxx>
22 #include <PrsMgr_PresentationManager3d.hxx>
23 #include <SelectBasics_EntityOwner.hxx>
24 #include <SelectMgr_SelectableObject.hxx>
25 #include <Standard_Type.hxx>
26 #include <TColStd_ListIteratorOfListOfReal.hxx>
27
28 IMPLEMENT_STANDARD_RTTIEXT(MeshVS_MeshEntityOwner,SelectMgr_EntityOwner)
29
30 #ifndef MeshVS_PRSBUILDERHXX
31 #include <MeshVS_PrsBuilder.hxx>
32 #endif
33
34
35 //================================================================
36 // Function : Constructor MeshVS_MeshEntityOwner
37 // Purpose  :
38 //================================================================
39 MeshVS_MeshEntityOwner::MeshVS_MeshEntityOwner
40                                    ( const SelectMgr_SOPtr& SelObj,
41                                      const Standard_Integer ID,
42                                      const Standard_Address MeshEntity,
43                                      const MeshVS_EntityType& Type,
44                                      const Standard_Integer Priority,
45                                      const Standard_Boolean IsGroup )
46 : SelectMgr_EntityOwner ( SelObj, Priority ),
47   myAddr    ( MeshEntity ),
48   myType    ( Type ),
49   myID      ( ID ),
50   myIsGroup ( IsGroup )
51 {
52   SelectBasics_EntityOwner::Set ( Priority );
53 }
54
55 //================================================================
56 // Function : Owner
57 // Purpose  :
58 //================================================================
59 Standard_Address MeshVS_MeshEntityOwner::Owner() const
60 {
61   return myAddr;
62 }
63
64 //================================================================
65 // Function : Type
66 // Purpose  :
67 //================================================================
68 MeshVS_EntityType MeshVS_MeshEntityOwner::Type() const
69 {
70   return myType;
71 }
72
73 //================================================================
74 // Function : IsGroup
75 // Purpose  :
76 //================================================================
77 Standard_Boolean MeshVS_MeshEntityOwner::IsGroup() const
78 {
79   return myIsGroup;
80 }
81
82 //================================================================
83 // Function : IsHilighted
84 // Purpose  :
85 //================================================================
86 Standard_Boolean MeshVS_MeshEntityOwner::IsHilighted ( const Handle(PrsMgr_PresentationManager)&,
87                                                  const Standard_Integer ) const
88 {
89   return Standard_False;
90 }
91
92 //================================================================
93 // Function : HilightWithColor
94 // Purpose  :
95 //================================================================
96 void MeshVS_MeshEntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
97                                                const Handle(Prs3d_Drawer)& theStyle,
98                                                const Standard_Integer /*theMode*/ )
99 {
100   Handle( SelectMgr_SelectableObject ) aSelObj;
101   if ( HasSelectable() )
102     aSelObj = Selectable();
103
104   if ( thePM->IsImmediateModeOn() && aSelObj->IsKind( STANDARD_TYPE( MeshVS_Mesh ) ) )
105   {
106     Handle( MeshVS_Mesh ) aMesh = Handle( MeshVS_Mesh )::DownCast ( aSelObj );
107     aMesh->HilightOwnerWithColor ( thePM, theStyle, this );
108   }
109 }
110
111 //================================================================
112 // Function : Unhilight
113 // Purpose  :
114 //================================================================
115 void MeshVS_MeshEntityOwner::Unhilight ( const Handle(PrsMgr_PresentationManager)&,
116                                    const Standard_Integer )
117 {
118 }
119
120 //================================================================
121 // Function : Clear
122 // Purpose  :
123 //================================================================
124 void MeshVS_MeshEntityOwner::Clear ( const Handle(PrsMgr_PresentationManager)&,
125                                const Standard_Integer )
126 {
127 }
128
129 //================================================================
130 // Function : ID
131 // Purpose  :
132 //================================================================
133 Standard_Integer MeshVS_MeshEntityOwner::ID () const
134 {
135   return myID;
136 }