]> SALOME platform Git repositories - modules/yacs.git/blob - src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.cxx
Salome HOME
PR: merge from branch BR_UnitTests tag mergeto_trunk_17oct05
[modules/yacs.git] / src / SALOMEDSImpl / SALOMEDSImpl_AttributePixMap.cxx
1 //  File   : SALOMEDSImpl_AttributePixMap.cxx
2 //  Author : Sergey RUIN
3 //  Module : SALOME
4
5 #include "SALOMEDSImpl_AttributePixMap.hxx"
6 #include <TCollection_ExtendedString.hxx>
7 #include <Standard_GUID.hxx>
8
9 using namespace std;
10
11 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributePixMap, SALOMEDSImpl_GenericAttribute )
12 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributePixMap, SALOMEDSImpl_GenericAttribute )
13
14 //=======================================================================
15 //function : GetID
16 //purpose  : 
17 //=======================================================================
18
19 const Standard_GUID& SALOMEDSImpl_AttributePixMap::GetID () 
20 {
21   static Standard_GUID SALOMEDSImpl_AttributePixMapID ("12837187-8F52-11d6-A8A3-0001021E8C7F");
22   return SALOMEDSImpl_AttributePixMapID;
23 }
24
25
26
27 //=======================================================================
28 //function : Set
29 //purpose  : 
30 //=======================================================================
31
32 Handle(SALOMEDSImpl_AttributePixMap) SALOMEDSImpl_AttributePixMap::Set (const TDF_Label& L,
33                                                                         const TCollection_ExtendedString& S) 
34 {
35   Handle(SALOMEDSImpl_AttributePixMap) A;
36   if (!L.FindAttribute(SALOMEDSImpl_AttributePixMap::GetID(),A)) {
37     A = new  SALOMEDSImpl_AttributePixMap(); 
38     L.AddAttribute(A);
39   }
40   
41   A->SetPixMap (S); 
42   return A;
43 }
44
45
46 //=======================================================================
47 //function : constructor
48 //purpose  : 
49 //=======================================================================
50 SALOMEDSImpl_AttributePixMap::SALOMEDSImpl_AttributePixMap()
51 :SALOMEDSImpl_GenericAttribute("AttributePixMap")
52 {
53   myString = "None";
54 }
55
56 //=======================================================================
57 //function : SetPixMap
58 //purpose  :
59 //=======================================================================
60 void SALOMEDSImpl_AttributePixMap::SetPixMap (const TCollection_ExtendedString& S)
61 {
62   CheckLocked();
63
64   if(myString == S) return;
65
66   Backup();
67
68   myString = S;
69
70   SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved 
71 }
72
73 //=======================================================================
74 //function : ID
75 //purpose  : 
76 //=======================================================================
77
78 const Standard_GUID& SALOMEDSImpl_AttributePixMap::ID () const { return GetID(); }
79
80
81 //=======================================================================
82 //function : NewEmpty
83 //purpose  : 
84 //=======================================================================
85
86 Handle(TDF_Attribute) SALOMEDSImpl_AttributePixMap::NewEmpty () const
87 {  
88   return new SALOMEDSImpl_AttributePixMap(); 
89 }
90
91 //=======================================================================
92 //function : Restore
93 //purpose  : 
94 //=======================================================================
95
96 void SALOMEDSImpl_AttributePixMap::Restore(const Handle(TDF_Attribute)& with) 
97 {
98   myString = Handle(SALOMEDSImpl_AttributePixMap)::DownCast (with)->GetPixMap ();
99 }
100
101 //=======================================================================
102 //function : Paste
103 //purpose  : 
104 //=======================================================================
105
106 void SALOMEDSImpl_AttributePixMap::Paste (const Handle(TDF_Attribute)& into,
107                            const Handle(TDF_RelocationTable)& RT) const
108 {
109   Handle(SALOMEDSImpl_AttributePixMap)::DownCast (into)->SetPixMap (myString);
110 }
111