1 // Created on: 2003-11-27
2 // Created by: Alexander SOLOVYOV
3 // Copyright (c) 2003-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
17 #include <Graphic3d_MaterialAspect.hxx>
18 #include <MeshVS_Drawer.hxx>
19 #include <Quantity_Color.hxx>
20 #include <Standard_Type.hxx>
21 #include <TCollection_AsciiString.hxx>
23 IMPLEMENT_STANDARD_RTTIEXT(MeshVS_Drawer,Standard_Transient)
25 //================================================================
28 //================================================================
29 void MeshVS_Drawer::Assign( const Handle(MeshVS_Drawer)& aDrawer )
31 if ( !aDrawer.IsNull() )
33 myIntegers = aDrawer->myIntegers;
34 myDoubles = aDrawer->myDoubles;
35 myBooleans = aDrawer->myBooleans;
36 myColors = aDrawer->myColors;
37 myMaterials = aDrawer->myMaterials;
38 myAsciiString = aDrawer->myAsciiString;
42 //================================================================
43 // Function : SetInteger
45 //================================================================
46 void MeshVS_Drawer::SetInteger( const Standard_Integer Key, const Standard_Integer Value)
48 if ( myIntegers.IsBound ( Key ) )
49 myIntegers.ChangeFind ( Key ) = Value;
51 myIntegers.Bind( Key, Value );
54 //================================================================
55 // Function : SetDouble
57 //================================================================
58 void MeshVS_Drawer::SetDouble( const Standard_Integer Key, const Standard_Real Value)
60 if ( myDoubles.IsBound ( Key ) )
61 myDoubles.ChangeFind ( Key ) = Value;
63 myDoubles.Bind( Key, Value );
66 //================================================================
67 // Function : SetBoolean
69 //================================================================
70 void MeshVS_Drawer::SetBoolean( const Standard_Integer Key, const Standard_Boolean Value)
72 if ( myBooleans.IsBound ( Key ) )
73 myBooleans.ChangeFind ( Key ) = Value;
75 myBooleans.Bind( Key, Value );
78 //================================================================
79 // Function : SetColor
81 //================================================================
82 void MeshVS_Drawer::SetColor( const Standard_Integer Key, const Quantity_Color& Value)
84 if ( myColors.IsBound ( Key ) )
85 myColors.ChangeFind ( Key ) = Value;
87 myColors.Bind( Key, Value );
90 //================================================================
91 // Function : SetMaterial
93 //================================================================
94 void MeshVS_Drawer::SetMaterial( const Standard_Integer Key, const Graphic3d_MaterialAspect& Value)
96 if ( myMaterials.IsBound ( Key ) )
97 myMaterials.ChangeFind ( Key ) = Value;
99 myMaterials.Bind( Key, Value );
102 //================================================================
103 // Function : SetMaterial
105 //================================================================
106 void MeshVS_Drawer::SetAsciiString( const Standard_Integer Key, const TCollection_AsciiString& Value)
108 if ( myAsciiString.IsBound ( Key ) )
109 myAsciiString.ChangeFind ( Key ) = Value;
111 myAsciiString.Bind( Key, Value );
115 //================================================================
116 // Function : GetInteger
118 //================================================================
119 Standard_Boolean MeshVS_Drawer::GetInteger( const Standard_Integer Key, Standard_Integer& Value) const
121 Standard_Boolean aRes = myIntegers.IsBound ( Key );
123 Value = myIntegers.Find ( Key );
127 //================================================================
128 // Function : GetDouble
130 //================================================================
131 Standard_Boolean MeshVS_Drawer::GetDouble( const Standard_Integer Key, Standard_Real& Value) const
133 Standard_Boolean aRes = myDoubles.IsBound ( Key );
135 Value = myDoubles.Find ( Key );
139 //================================================================
140 // Function : GetBoolean
142 //================================================================
143 Standard_Boolean MeshVS_Drawer::GetBoolean( const Standard_Integer Key, Standard_Boolean& Value) const
145 Standard_Boolean aRes = myBooleans.IsBound ( Key );
147 Value = myBooleans.Find ( Key );
151 //================================================================
152 // Function : GetColor
154 //================================================================
155 Standard_Boolean MeshVS_Drawer::GetColor( const Standard_Integer Key, Quantity_Color& Value) const
157 Standard_Boolean aRes = myColors.IsBound ( Key );
159 Value = myColors.Find ( Key );
163 //================================================================
164 // Function : GetMaterial
166 //================================================================
167 Standard_Boolean MeshVS_Drawer::GetMaterial( const Standard_Integer Key, Graphic3d_MaterialAspect& Value) const
169 Standard_Boolean aRes = myMaterials.IsBound ( Key );
171 Value = myMaterials.Find ( Key );
175 //================================================================
176 // Function : GetAsciiSstring
178 //================================================================
179 Standard_Boolean MeshVS_Drawer::GetAsciiString( const Standard_Integer Key, TCollection_AsciiString& Value) const
181 Standard_Boolean aRes = myAsciiString.IsBound ( Key );
183 Value = myAsciiString.Find ( Key );
188 //================================================================
189 // Function : RemoveInteger
191 //================================================================
192 Standard_Boolean MeshVS_Drawer::RemoveInteger( const Standard_Integer Key )
194 Standard_Boolean aRes = myIntegers.IsBound ( Key );
196 myIntegers.UnBind ( Key );
200 //================================================================
201 // Function : RemoveDouble
203 //================================================================
204 Standard_Boolean MeshVS_Drawer::RemoveDouble( const Standard_Integer Key )
206 Standard_Boolean aRes = myDoubles.IsBound ( Key );
208 myDoubles.UnBind ( Key );
212 //================================================================
213 // Function : RemoveBoolean
215 //================================================================
216 Standard_Boolean MeshVS_Drawer::RemoveBoolean( const Standard_Integer Key )
218 Standard_Boolean aRes = myBooleans.IsBound ( Key );
220 myBooleans.UnBind ( Key );
224 //================================================================
225 // Function : RemoveColor
227 //================================================================
228 Standard_Boolean MeshVS_Drawer::RemoveColor( const Standard_Integer Key )
230 Standard_Boolean aRes = myColors.IsBound ( Key );
232 myColors.UnBind ( Key );
236 //================================================================
237 // Function : RemoveMaterial
239 //================================================================
240 Standard_Boolean MeshVS_Drawer::RemoveMaterial( const Standard_Integer Key )
242 Standard_Boolean aRes = myMaterials.IsBound ( Key );
244 myMaterials.UnBind ( Key );
248 //================================================================
249 // Function : RemoveAsciiString
251 //================================================================
252 Standard_Boolean MeshVS_Drawer::RemoveAsciiString( const Standard_Integer Key )
254 Standard_Boolean aRes = myAsciiString.IsBound ( Key );
256 myAsciiString.UnBind ( Key );