b311480e |
1 | // Created on: 2003-11-27 |
2 | // Created by: Alexander SOLOVYOV |
973c2be1 |
3 | // Copyright (c) 2003-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
16 | #include <MeshVS_Drawer.ixx> |
17 | |
18 | //================================================================ |
19 | // Function : Assign |
20 | // Purpose : |
21 | //================================================================ |
22 | void MeshVS_Drawer::Assign( const Handle(MeshVS_Drawer)& aDrawer ) |
23 | { |
24 | if ( !aDrawer.IsNull() ) |
25 | { |
26 | myIntegers = aDrawer->myIntegers; |
27 | myDoubles = aDrawer->myDoubles; |
28 | myBooleans = aDrawer->myBooleans; |
29 | myColors = aDrawer->myColors; |
30 | myMaterials = aDrawer->myMaterials; |
31 | myAsciiString = aDrawer->myAsciiString; |
32 | } |
33 | } |
34 | |
35 | //================================================================ |
36 | // Function : SetInteger |
37 | // Purpose : |
38 | //================================================================ |
39 | void MeshVS_Drawer::SetInteger( const Standard_Integer Key, const Standard_Integer Value) |
40 | { |
41 | if ( myIntegers.IsBound ( Key ) ) |
42 | myIntegers.ChangeFind ( Key ) = Value; |
43 | else |
44 | myIntegers.Bind( Key, Value ); |
45 | } |
46 | |
47 | //================================================================ |
48 | // Function : SetDouble |
49 | // Purpose : |
50 | //================================================================ |
51 | void MeshVS_Drawer::SetDouble( const Standard_Integer Key, const Standard_Real Value) |
52 | { |
53 | if ( myDoubles.IsBound ( Key ) ) |
54 | myDoubles.ChangeFind ( Key ) = Value; |
55 | else |
56 | myDoubles.Bind( Key, Value ); |
57 | } |
58 | |
59 | //================================================================ |
60 | // Function : SetBoolean |
61 | // Purpose : |
62 | //================================================================ |
63 | void MeshVS_Drawer::SetBoolean( const Standard_Integer Key, const Standard_Boolean Value) |
64 | { |
65 | if ( myBooleans.IsBound ( Key ) ) |
66 | myBooleans.ChangeFind ( Key ) = Value; |
67 | else |
68 | myBooleans.Bind( Key, Value ); |
69 | } |
70 | |
71 | //================================================================ |
72 | // Function : SetColor |
73 | // Purpose : |
74 | //================================================================ |
75 | void MeshVS_Drawer::SetColor( const Standard_Integer Key, const Quantity_Color& Value) |
76 | { |
77 | if ( myColors.IsBound ( Key ) ) |
78 | myColors.ChangeFind ( Key ) = Value; |
79 | else |
80 | myColors.Bind( Key, Value ); |
81 | } |
82 | |
83 | //================================================================ |
84 | // Function : SetMaterial |
85 | // Purpose : |
86 | //================================================================ |
87 | void MeshVS_Drawer::SetMaterial( const Standard_Integer Key, const Graphic3d_MaterialAspect& Value) |
88 | { |
89 | if ( myMaterials.IsBound ( Key ) ) |
90 | myMaterials.ChangeFind ( Key ) = Value; |
91 | else |
92 | myMaterials.Bind( Key, Value ); |
93 | } |
94 | |
95 | //================================================================ |
96 | // Function : SetMaterial |
97 | // Purpose : |
98 | //================================================================ |
99 | void MeshVS_Drawer::SetAsciiString( const Standard_Integer Key, const TCollection_AsciiString& Value) |
100 | { |
101 | if ( myAsciiString.IsBound ( Key ) ) |
102 | myAsciiString.ChangeFind ( Key ) = Value; |
103 | else |
104 | myAsciiString.Bind( Key, Value ); |
105 | } |
106 | |
107 | |
108 | //================================================================ |
109 | // Function : GetInteger |
110 | // Purpose : |
111 | //================================================================ |
112 | Standard_Boolean MeshVS_Drawer::GetInteger( const Standard_Integer Key, Standard_Integer& Value) const |
113 | { |
114 | Standard_Boolean aRes = myIntegers.IsBound ( Key ); |
115 | if ( aRes ) |
116 | Value = myIntegers.Find ( Key ); |
117 | return aRes; |
118 | } |
119 | |
120 | //================================================================ |
121 | // Function : GetDouble |
122 | // Purpose : |
123 | //================================================================ |
124 | Standard_Boolean MeshVS_Drawer::GetDouble( const Standard_Integer Key, Standard_Real& Value) const |
125 | { |
126 | Standard_Boolean aRes = myDoubles.IsBound ( Key ); |
127 | if ( aRes ) |
128 | Value = myDoubles.Find ( Key ); |
129 | return aRes; |
130 | } |
131 | |
132 | //================================================================ |
133 | // Function : GetBoolean |
134 | // Purpose : |
135 | //================================================================ |
136 | Standard_Boolean MeshVS_Drawer::GetBoolean( const Standard_Integer Key, Standard_Boolean& Value) const |
137 | { |
138 | Standard_Boolean aRes = myBooleans.IsBound ( Key ); |
139 | if ( aRes ) |
140 | Value = myBooleans.Find ( Key ); |
141 | return aRes; |
142 | } |
143 | |
144 | //================================================================ |
145 | // Function : GetColor |
146 | // Purpose : |
147 | //================================================================ |
148 | Standard_Boolean MeshVS_Drawer::GetColor( const Standard_Integer Key, Quantity_Color& Value) const |
149 | { |
150 | Standard_Boolean aRes = myColors.IsBound ( Key ); |
151 | if ( aRes ) |
152 | Value = myColors.Find ( Key ); |
153 | return aRes; |
154 | } |
155 | |
156 | //================================================================ |
157 | // Function : GetMaterial |
158 | // Purpose : |
159 | //================================================================ |
160 | Standard_Boolean MeshVS_Drawer::GetMaterial( const Standard_Integer Key, Graphic3d_MaterialAspect& Value) const |
161 | { |
162 | Standard_Boolean aRes = myMaterials.IsBound ( Key ); |
163 | if ( aRes ) |
164 | Value = myMaterials.Find ( Key ); |
165 | return aRes; |
166 | } |
167 | |
168 | //================================================================ |
169 | // Function : GetAsciiSstring |
170 | // Purpose : |
171 | //================================================================ |
172 | Standard_Boolean MeshVS_Drawer::GetAsciiString( const Standard_Integer Key, TCollection_AsciiString& Value) const |
173 | { |
174 | Standard_Boolean aRes = myAsciiString.IsBound ( Key ); |
175 | if ( aRes ) |
176 | Value = myAsciiString.Find ( Key ); |
177 | return aRes; |
178 | } |
179 | |
180 | |
181 | //================================================================ |
182 | // Function : RemoveInteger |
183 | // Purpose : |
184 | //================================================================ |
185 | Standard_Boolean MeshVS_Drawer::RemoveInteger( const Standard_Integer Key ) |
186 | { |
187 | Standard_Boolean aRes = myIntegers.IsBound ( Key ); |
188 | if ( aRes ) |
189 | myIntegers.UnBind ( Key ); |
190 | return aRes; |
191 | } |
192 | |
193 | //================================================================ |
194 | // Function : RemoveDouble |
195 | // Purpose : |
196 | //================================================================ |
197 | Standard_Boolean MeshVS_Drawer::RemoveDouble( const Standard_Integer Key ) |
198 | { |
199 | Standard_Boolean aRes = myDoubles.IsBound ( Key ); |
200 | if ( aRes ) |
201 | myDoubles.UnBind ( Key ); |
202 | return aRes; |
203 | } |
204 | |
205 | //================================================================ |
206 | // Function : RemoveBoolean |
207 | // Purpose : |
208 | //================================================================ |
209 | Standard_Boolean MeshVS_Drawer::RemoveBoolean( const Standard_Integer Key ) |
210 | { |
211 | Standard_Boolean aRes = myBooleans.IsBound ( Key ); |
212 | if ( aRes ) |
213 | myBooleans.UnBind ( Key ); |
214 | return aRes; |
215 | } |
216 | |
217 | //================================================================ |
218 | // Function : RemoveColor |
219 | // Purpose : |
220 | //================================================================ |
221 | Standard_Boolean MeshVS_Drawer::RemoveColor( const Standard_Integer Key ) |
222 | { |
223 | Standard_Boolean aRes = myColors.IsBound ( Key ); |
224 | if ( aRes ) |
225 | myColors.UnBind ( Key ); |
226 | return aRes; |
227 | } |
228 | |
229 | //================================================================ |
230 | // Function : RemoveMaterial |
231 | // Purpose : |
232 | //================================================================ |
233 | Standard_Boolean MeshVS_Drawer::RemoveMaterial( const Standard_Integer Key ) |
234 | { |
235 | Standard_Boolean aRes = myMaterials.IsBound ( Key ); |
236 | if ( aRes ) |
237 | myMaterials.UnBind ( Key ); |
238 | return aRes; |
239 | } |
240 | |
241 | //================================================================ |
242 | // Function : RemoveAsciiString |
243 | // Purpose : |
244 | //================================================================ |
245 | Standard_Boolean MeshVS_Drawer::RemoveAsciiString( const Standard_Integer Key ) |
246 | { |
247 | Standard_Boolean aRes = myAsciiString.IsBound ( Key ); |
248 | if ( aRes ) |
249 | myAsciiString.UnBind ( Key ); |
250 | return aRes; |
251 | } |
252 | |