Salome HOME
PR: typo
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_DrawableAttribute.cxx
1 //  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : SALOMEDS_DrawableAttribute.cxx
25 //  Author : Yves FRICAUD
26 //  Module : SALOME
27 //  $Header$
28
29 #include "SALOMEDS_DrawableAttribute.ixx"
30 #include <TDataStd_Integer.hxx>
31 using namespace std;
32
33 //=======================================================================
34 //function : GetID
35 //purpose  : 
36 //=======================================================================
37
38 const Standard_GUID& SALOMEDS_DrawableAttribute::GetID () 
39 {
40   static Standard_GUID SALOMEDS_DrawableAttributeID ("12837184-8F52-11d6-A8A3-0001021E8C7F");
41   return SALOMEDS_DrawableAttributeID;
42 }
43
44
45
46 //=======================================================================
47 //function : Set
48 //purpose  : 
49 //=======================================================================
50
51 Handle(SALOMEDS_DrawableAttribute) SALOMEDS_DrawableAttribute::Set (const TDF_Label& L,
52                                                                   const Standard_Integer value) 
53 {
54   Handle(SALOMEDS_DrawableAttribute) A;
55   if (!L.FindAttribute(SALOMEDS_DrawableAttribute::GetID(),A)) {
56     A = new  SALOMEDS_DrawableAttribute(); 
57     L.AddAttribute(A);
58   }
59   
60   (Handle(TDataStd_Integer)::DownCast(A))->Set (value); 
61   return A;
62 }
63
64
65 //=======================================================================
66 //function : constructor
67 //purpose  : 
68 //=======================================================================
69 SALOMEDS_DrawableAttribute::SALOMEDS_DrawableAttribute()
70 {
71   TDataStd_Integer::Set(0);
72 }
73
74 //=======================================================================
75 //function : ID
76 //purpose  : 
77 //=======================================================================
78
79 const Standard_GUID& SALOMEDS_DrawableAttribute::ID () const { return GetID(); }
80
81
82 //=======================================================================
83 //function : NewEmpty
84 //purpose  : 
85 //=======================================================================
86
87 Handle(TDF_Attribute) SALOMEDS_DrawableAttribute::NewEmpty () const
88 {  
89   return new SALOMEDS_DrawableAttribute(); 
90 }
91
92 //=======================================================================
93 //function : Restore
94 //purpose  : 
95 //=======================================================================
96
97 void SALOMEDS_DrawableAttribute::Restore(const Handle(TDF_Attribute)& with) 
98 {
99   Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get ();
100   TDataStd_Integer::Set(s);
101   return;
102 }
103
104 //=======================================================================
105 //function : Paste
106 //purpose  : 
107 //=======================================================================
108
109 void SALOMEDS_DrawableAttribute::Paste (const Handle(TDF_Attribute)& into,
110                                     const Handle(TDF_RelocationTable)& RT) const
111 {
112   Handle(TDataStd_Integer)::DownCast (into)->Set (Get());
113 }
114