0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / MeshVS / MeshVS_Drawer.cxx
CommitLineData
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
42cf5bc1 16
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>
7fd59977 22
25e59720 23IMPLEMENT_STANDARD_RTTIEXT(MeshVS_Drawer,Standard_Transient)
92efcf78 24
7fd59977 25//================================================================
26// Function : Assign
27// Purpose :
28//================================================================
29void MeshVS_Drawer::Assign( const Handle(MeshVS_Drawer)& aDrawer )
30{
31 if ( !aDrawer.IsNull() )
32 {
33 myIntegers = aDrawer->myIntegers;
34 myDoubles = aDrawer->myDoubles;
35 myBooleans = aDrawer->myBooleans;
36 myColors = aDrawer->myColors;
37 myMaterials = aDrawer->myMaterials;
38 myAsciiString = aDrawer->myAsciiString;
39 }
40}
41
42//================================================================
43// Function : SetInteger
44// Purpose :
45//================================================================
46void MeshVS_Drawer::SetInteger( const Standard_Integer Key, const Standard_Integer Value)
47{
48 if ( myIntegers.IsBound ( Key ) )
49 myIntegers.ChangeFind ( Key ) = Value;
50 else
51 myIntegers.Bind( Key, Value );
52}
53
54//================================================================
55// Function : SetDouble
56// Purpose :
57//================================================================
58void MeshVS_Drawer::SetDouble( const Standard_Integer Key, const Standard_Real Value)
59{
60 if ( myDoubles.IsBound ( Key ) )
61 myDoubles.ChangeFind ( Key ) = Value;
62 else
63 myDoubles.Bind( Key, Value );
64}
65
66//================================================================
67// Function : SetBoolean
68// Purpose :
69//================================================================
70void MeshVS_Drawer::SetBoolean( const Standard_Integer Key, const Standard_Boolean Value)
71{
72 if ( myBooleans.IsBound ( Key ) )
73 myBooleans.ChangeFind ( Key ) = Value;
74 else
75 myBooleans.Bind( Key, Value );
76}
77
78//================================================================
79// Function : SetColor
80// Purpose :
81//================================================================
82void MeshVS_Drawer::SetColor( const Standard_Integer Key, const Quantity_Color& Value)
83{
84 if ( myColors.IsBound ( Key ) )
85 myColors.ChangeFind ( Key ) = Value;
86 else
87 myColors.Bind( Key, Value );
88}
89
90//================================================================
91// Function : SetMaterial
92// Purpose :
93//================================================================
94void MeshVS_Drawer::SetMaterial( const Standard_Integer Key, const Graphic3d_MaterialAspect& Value)
95{
96 if ( myMaterials.IsBound ( Key ) )
97 myMaterials.ChangeFind ( Key ) = Value;
98 else
99 myMaterials.Bind( Key, Value );
100}
101
102//================================================================
103// Function : SetMaterial
104// Purpose :
105//================================================================
106void MeshVS_Drawer::SetAsciiString( const Standard_Integer Key, const TCollection_AsciiString& Value)
107{
108 if ( myAsciiString.IsBound ( Key ) )
109 myAsciiString.ChangeFind ( Key ) = Value;
110 else
111 myAsciiString.Bind( Key, Value );
112}
113
114
115//================================================================
116// Function : GetInteger
117// Purpose :
118//================================================================
119Standard_Boolean MeshVS_Drawer::GetInteger( const Standard_Integer Key, Standard_Integer& Value) const
120{
121 Standard_Boolean aRes = myIntegers.IsBound ( Key );
122 if ( aRes )
123 Value = myIntegers.Find ( Key );
124 return aRes;
125}
126
127//================================================================
128// Function : GetDouble
129// Purpose :
130//================================================================
131Standard_Boolean MeshVS_Drawer::GetDouble( const Standard_Integer Key, Standard_Real& Value) const
132{
133 Standard_Boolean aRes = myDoubles.IsBound ( Key );
134 if ( aRes )
135 Value = myDoubles.Find ( Key );
136 return aRes;
137}
138
139//================================================================
140// Function : GetBoolean
141// Purpose :
142//================================================================
143Standard_Boolean MeshVS_Drawer::GetBoolean( const Standard_Integer Key, Standard_Boolean& Value) const
144{
145 Standard_Boolean aRes = myBooleans.IsBound ( Key );
146 if ( aRes )
147 Value = myBooleans.Find ( Key );
148 return aRes;
149}
150
151//================================================================
152// Function : GetColor
153// Purpose :
154//================================================================
155Standard_Boolean MeshVS_Drawer::GetColor( const Standard_Integer Key, Quantity_Color& Value) const
156{
157 Standard_Boolean aRes = myColors.IsBound ( Key );
158 if ( aRes )
159 Value = myColors.Find ( Key );
160 return aRes;
161}
162
163//================================================================
164// Function : GetMaterial
165// Purpose :
166//================================================================
167Standard_Boolean MeshVS_Drawer::GetMaterial( const Standard_Integer Key, Graphic3d_MaterialAspect& Value) const
168{
169 Standard_Boolean aRes = myMaterials.IsBound ( Key );
170 if ( aRes )
171 Value = myMaterials.Find ( Key );
172 return aRes;
173}
174
175//================================================================
176// Function : GetAsciiSstring
177// Purpose :
178//================================================================
179Standard_Boolean MeshVS_Drawer::GetAsciiString( const Standard_Integer Key, TCollection_AsciiString& Value) const
180{
181 Standard_Boolean aRes = myAsciiString.IsBound ( Key );
182 if ( aRes )
183 Value = myAsciiString.Find ( Key );
184 return aRes;
185}
186
187
188//================================================================
189// Function : RemoveInteger
190// Purpose :
191//================================================================
192Standard_Boolean MeshVS_Drawer::RemoveInteger( const Standard_Integer Key )
193{
194 Standard_Boolean aRes = myIntegers.IsBound ( Key );
195 if ( aRes )
196 myIntegers.UnBind ( Key );
197 return aRes;
198}
199
200//================================================================
201// Function : RemoveDouble
202// Purpose :
203//================================================================
204Standard_Boolean MeshVS_Drawer::RemoveDouble( const Standard_Integer Key )
205{
206 Standard_Boolean aRes = myDoubles.IsBound ( Key );
207 if ( aRes )
208 myDoubles.UnBind ( Key );
209 return aRes;
210}
211
212//================================================================
213// Function : RemoveBoolean
214// Purpose :
215//================================================================
216Standard_Boolean MeshVS_Drawer::RemoveBoolean( const Standard_Integer Key )
217{
218 Standard_Boolean aRes = myBooleans.IsBound ( Key );
219 if ( aRes )
220 myBooleans.UnBind ( Key );
221 return aRes;
222}
223
224//================================================================
225// Function : RemoveColor
226// Purpose :
227//================================================================
228Standard_Boolean MeshVS_Drawer::RemoveColor( const Standard_Integer Key )
229{
230 Standard_Boolean aRes = myColors.IsBound ( Key );
231 if ( aRes )
232 myColors.UnBind ( Key );
233 return aRes;
234}
235
236//================================================================
237// Function : RemoveMaterial
238// Purpose :
239//================================================================
240Standard_Boolean MeshVS_Drawer::RemoveMaterial( const Standard_Integer Key )
241{
242 Standard_Boolean aRes = myMaterials.IsBound ( Key );
243 if ( aRes )
244 myMaterials.UnBind ( Key );
245 return aRes;
246}
247
248//================================================================
249// Function : RemoveAsciiString
250// Purpose :
251//================================================================
252Standard_Boolean MeshVS_Drawer::RemoveAsciiString( const Standard_Integer Key )
253{
254 Standard_Boolean aRes = myAsciiString.IsBound ( Key );
255 if ( aRes )
256 myAsciiString.UnBind ( Key );
257 return aRes;
258}
259