0023544: Texture management in TKOpenGl should be redesigned
[occt.git] / src / MeshVS / MeshVS_MeshEntityOwner.cxx
1 // Created on: 2003-09-09
2 // Created by: Alexander SOLOVYOV
3 // Copyright (c) 2003-2012 OPEN CASCADE SAS
4 //
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
9 //
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 //
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
19
20
21 #include <MeshVS_MeshEntityOwner.ixx>
22
23 #include <SelectBasics_EntityOwner.hxx>
24 #include <Graphic3d_Group.hxx>
25 #include <TColStd_ListIteratorOfListOfReal.hxx>
26 #include <Prs3d_Root.hxx>
27 #include <Graphic3d_Vertex.hxx>
28 #include <Graphic3d_Array1OfVertex.hxx>
29 #include <SelectMgr_SelectableObject.hxx>
30 #include <PrsMgr_PresentationManager.hxx>
31 #include <PrsMgr_PresentationManager3d.hxx>
32 #include <MeshVS_Mesh.hxx>
33
34
35 #ifndef MeshVS_PRSBUILDERHXX
36 #include <MeshVS_PrsBuilder.hxx>
37 #endif
38
39
40 //================================================================
41 // Function : Constructor MeshVS_MeshEntityOwner
42 // Purpose  :
43 //================================================================
44 MeshVS_MeshEntityOwner::MeshVS_MeshEntityOwner
45                                    ( const SelectMgr_SOPtr& SelObj,
46                                      const Standard_Integer ID,
47                                      const Standard_Address MeshEntity,
48                                      const MeshVS_EntityType& Type,
49                                      const Standard_Integer Priority,
50                                      const Standard_Boolean IsGroup )
51 : SelectMgr_EntityOwner ( SelObj, Priority ),
52   myAddr    ( MeshEntity ),
53   myType    ( Type ),
54   myID      ( ID ),
55   myIsGroup ( IsGroup )
56 {
57   SelectBasics_EntityOwner::Set ( Priority );
58 }
59
60 //================================================================
61 // Function : Owner
62 // Purpose  :
63 //================================================================
64 Standard_Address MeshVS_MeshEntityOwner::Owner() const
65 {
66   return myAddr;
67 }
68
69 //================================================================
70 // Function : Type
71 // Purpose  :
72 //================================================================
73 MeshVS_EntityType MeshVS_MeshEntityOwner::Type() const
74 {
75   return myType;
76 }
77
78 //================================================================
79 // Function : IsGroup
80 // Purpose  :
81 //================================================================
82 Standard_Boolean MeshVS_MeshEntityOwner::IsGroup() const
83 {
84   return myIsGroup;
85 }
86
87 //================================================================
88 // Function : IsHilighted
89 // Purpose  :
90 //================================================================
91 Standard_Boolean MeshVS_MeshEntityOwner::IsHilighted ( const Handle(PrsMgr_PresentationManager)&,
92                                                  const Standard_Integer ) const
93 {
94   return Standard_False;
95 }
96
97 //================================================================
98 // Function : Hilight
99 // Purpose  :
100 //================================================================
101 void MeshVS_MeshEntityOwner::Hilight ()
102 {
103 }
104
105 //================================================================
106 // Function : Hilight
107 // Purpose  :
108 //================================================================
109 void MeshVS_MeshEntityOwner::Hilight ( const Handle(PrsMgr_PresentationManager)&,
110                                  const Standard_Integer )
111 {
112 }
113
114 //================================================================
115 // Function : HilightWithColor
116 // Purpose  :
117 //================================================================
118 void MeshVS_MeshEntityOwner::HilightWithColor ( const Handle(PrsMgr_PresentationManager3d)& thePM,
119                                           const Quantity_NameOfColor theColor,
120                                           const Standard_Integer /*theMode*/ )
121 {
122   Handle( SelectMgr_SelectableObject ) aSelObj;
123   if ( HasSelectable() )
124     aSelObj = Selectable();
125
126   if ( thePM->IsImmediateModeOn() && aSelObj->IsKind( STANDARD_TYPE( MeshVS_Mesh ) ) )
127   {
128     Handle( MeshVS_Mesh ) aMesh = Handle( MeshVS_Mesh )::DownCast ( aSelObj );
129     aMesh->HilightOwnerWithColor ( thePM, theColor, this );
130   }
131 }
132
133 //================================================================
134 // Function : Unhilight
135 // Purpose  :
136 //================================================================
137 void MeshVS_MeshEntityOwner::Unhilight ( const Handle(PrsMgr_PresentationManager)&,
138                                    const Standard_Integer )
139 {
140 }
141
142 //================================================================
143 // Function : Clear
144 // Purpose  :
145 //================================================================
146 void MeshVS_MeshEntityOwner::Clear ( const Handle(PrsMgr_PresentationManager)&,
147                                const Standard_Integer )
148 {
149 }
150
151 //================================================================
152 // Function : ID
153 // Purpose  :
154 //================================================================
155 Standard_Integer MeshVS_MeshEntityOwner::ID () const
156 {
157   return myID;
158 }