Salome HOME
DCQ : Merge with Ecole_ete_a6.
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_PixMapAttribute.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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SALOMEDS_PixMapAttribute.cxx
25 //  Author : Yves FRICAUD
26 //  Module : SALOME
27 //  $Header$
28
29 using namespace std;
30 #include "SALOMEDS_PixMapAttribute.ixx"
31 #include <TDataStd_Comment.hxx>
32 #include <TCollection_ExtendedString.hxx>
33
34 //=======================================================================
35 //function : GetID
36 //purpose  : 
37 //=======================================================================
38
39 const Standard_GUID& SALOMEDS_PixMapAttribute::GetID () 
40 {
41   static Standard_GUID SALOMEDS_PixMapAttributeID ("12837187-8F52-11d6-A8A3-0001021E8C7F");
42   return SALOMEDS_PixMapAttributeID;
43 }
44
45
46
47 //=======================================================================
48 //function : Set
49 //purpose  : 
50 //=======================================================================
51
52 Handle(SALOMEDS_PixMapAttribute) SALOMEDS_PixMapAttribute::Set (const TDF_Label& L,
53                                                           const TCollection_ExtendedString& S) 
54 {
55   Handle(SALOMEDS_PixMapAttribute) A;
56   if (!L.FindAttribute(SALOMEDS_PixMapAttribute::GetID(),A)) {
57     A = new  SALOMEDS_PixMapAttribute(); 
58     L.AddAttribute(A);
59   }
60   
61   (Handle(TDataStd_Comment)::DownCast(A))->Set (S); 
62   return A;
63 }
64
65
66 //=======================================================================
67 //function : constructor
68 //purpose  : 
69 //=======================================================================
70 SALOMEDS_PixMapAttribute::SALOMEDS_PixMapAttribute()
71 {TDataStd_Comment::Set("None");}
72
73 //=======================================================================
74 //function : ID
75 //purpose  : 
76 //=======================================================================
77
78 const Standard_GUID& SALOMEDS_PixMapAttribute::ID () const { return GetID(); }
79
80
81 //=======================================================================
82 //function : NewEmpty
83 //purpose  : 
84 //=======================================================================
85
86 Handle(TDF_Attribute) SALOMEDS_PixMapAttribute::NewEmpty () const
87 {  
88   return new SALOMEDS_PixMapAttribute(); 
89 }
90
91 //=======================================================================
92 //function : Restore
93 //purpose  : 
94 //=======================================================================
95
96 void SALOMEDS_PixMapAttribute::Restore(const Handle(TDF_Attribute)& with) 
97 {
98   TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get ();
99   TDataStd_Comment::Set(s);
100   return;
101 }
102
103 //=======================================================================
104 //function : Paste
105 //purpose  : 
106 //=======================================================================
107
108 void SALOMEDS_PixMapAttribute::Paste (const Handle(TDF_Attribute)& into,
109                            const Handle(TDF_RelocationTable)& RT) const
110 {
111   Handle(TDataStd_Comment)::DownCast (into)->Set (Get());
112 }
113