Salome HOME
NRI : Remove dependence with VISU.
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_PixMapAttribute.cxx
1 using namespace std;
2 //  File      : SALOMEDS_PixMapAttribute.cxx
3 //  Created   : Wed Nov 28 16:23:19 2001
4 //  Author    : Yves FRICAUD
5
6 //  Project   : SALOME
7 //  Module    : SALOMEDS
8 //  Copyright : Open CASCADE 2001
9 //  $Header: 
10
11 #include "SALOMEDS_PixMapAttribute.ixx"
12 #include <TDataStd_Comment.hxx>
13 #include <TCollection_ExtendedString.hxx>
14
15 //=======================================================================
16 //function : GetID
17 //purpose  : 
18 //=======================================================================
19
20 const Standard_GUID& SALOMEDS_PixMapAttribute::GetID () 
21 {
22   static Standard_GUID SALOMEDS_PixMapAttributeID ("12837187-8F52-11d6-A8A3-0001021E8C7F");
23   return SALOMEDS_PixMapAttributeID;
24 }
25
26
27
28 //=======================================================================
29 //function : Set
30 //purpose  : 
31 //=======================================================================
32
33 Handle(SALOMEDS_PixMapAttribute) SALOMEDS_PixMapAttribute::Set (const TDF_Label& L,
34                                                           const TCollection_ExtendedString& S) 
35 {
36   Handle(SALOMEDS_PixMapAttribute) A;
37   if (!L.FindAttribute(SALOMEDS_PixMapAttribute::GetID(),A)) {
38     A = new  SALOMEDS_PixMapAttribute(); 
39     L.AddAttribute(A);
40   }
41   
42   (Handle(TDataStd_Comment)::DownCast(A))->Set (S); 
43   return A;
44 }
45
46
47 //=======================================================================
48 //function : constructor
49 //purpose  : 
50 //=======================================================================
51 SALOMEDS_PixMapAttribute::SALOMEDS_PixMapAttribute()
52 {TDataStd_Comment::Set("None");}
53
54 //=======================================================================
55 //function : ID
56 //purpose  : 
57 //=======================================================================
58
59 const Standard_GUID& SALOMEDS_PixMapAttribute::ID () const { return GetID(); }
60
61
62 //=======================================================================
63 //function : NewEmpty
64 //purpose  : 
65 //=======================================================================
66
67 Handle(TDF_Attribute) SALOMEDS_PixMapAttribute::NewEmpty () const
68 {  
69   return new SALOMEDS_PixMapAttribute(); 
70 }
71
72 //=======================================================================
73 //function : Restore
74 //purpose  : 
75 //=======================================================================
76
77 void SALOMEDS_PixMapAttribute::Restore(const Handle(TDF_Attribute)& with) 
78 {
79   TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get ();
80   TDataStd_Comment::Set(s);
81   return;
82 }
83
84 //=======================================================================
85 //function : Paste
86 //purpose  : 
87 //=======================================================================
88
89 void SALOMEDS_PixMapAttribute::Paste (const Handle(TDF_Attribute)& into,
90                            const Handle(TDF_RelocationTable)& RT) const
91 {
92   Handle(TDataStd_Comment)::DownCast (into)->Set (Get());
93 }
94