]> SALOME platform Git repositories - modules/kernel.git/blob - src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.cxx
Salome HOME
PR: merge from branch BR_UnitTests tag mergeto_trunk_17oct05
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_StudyHandle.cxx
1 //  File   : SALOMEDSImpl_StudyHandle.cxx
2 //  Author : Sergey LITONIN
3 //  Module : SALOME
4
5 #include "SALOMEDSImpl_StudyHandle.hxx"
6 #include <TDF_Attribute.hxx>
7 #include <Standard_GUID.hxx>
8
9 /*
10   Class       : SALOMEDSImpl_StudyHandle
11   Description : This class is intended for storing information about
12                 graphic representation of objects in dirrent views
13 */
14
15 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyHandle, TDF_Attribute )
16 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyHandle, TDF_Attribute )
17
18 //=======================================================================
19 //function : GetID
20 //purpose  : Get GUID of this attribute
21 //=======================================================================
22 const Standard_GUID& SALOMEDSImpl_StudyHandle::GetID()
23 {
24   static Standard_GUID SALOMEDSImpl_StudyHandleID( "050C9555-4BA8-49bf-8F1C-086F0469A40B" );
25   return SALOMEDSImpl_StudyHandleID;
26 }
27
28 //=======================================================================
29 //function : SALOMEDSImpl_StudyHandle
30 //purpose  : Empty Constructor
31 //=======================================================================
32 SALOMEDSImpl_StudyHandle::SALOMEDSImpl_StudyHandle()
33 {
34   myHandle.Nullify();
35 }
36
37 //=======================================================================
38 //function : Set
39 //purpose  : 
40 //=======================================================================
41 Handle(SALOMEDSImpl_StudyHandle) SALOMEDSImpl_StudyHandle::Set(const TDF_Label& theLabel, 
42                                                                const Handle(SALOMEDSImpl_Study)& theStudy)
43 {
44   Handle(SALOMEDSImpl_StudyHandle) A;
45   if (!theLabel.FindAttribute(GetID(), A)) {
46     A = new  SALOMEDSImpl_StudyHandle(); 
47     theLabel.AddAttribute(A);
48   }
49
50   A->SetHandle(theStudy);
51   return A;  
52 }
53
54
55 //=======================================================================
56 //function : ID
57 //purpose  : Get GUID of this attribute
58 //=======================================================================
59 const Standard_GUID& SALOMEDSImpl_StudyHandle::ID () const
60 {
61   return GetID();
62 }
63
64
65 //=======================================================================
66 //function : NewEmpty
67 //purpose  : Create new empty attribute
68 //=======================================================================
69 Handle(TDF_Attribute) SALOMEDSImpl_StudyHandle::NewEmpty () const
70 {
71   return new SALOMEDSImpl_StudyHandle ();
72 }
73
74
75 //=======================================================================
76 //function : Restore
77 //purpose  : Restore value of attribute with value of theWith one
78 //=======================================================================
79 void SALOMEDSImpl_StudyHandle::Restore( const Handle(TDF_Attribute)& theWith )
80 {
81   Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theWith );
82   if ( !anAttr.IsNull() ) SetHandle( anAttr->GetHandle() );
83 }
84
85 //=======================================================================
86 //function : Paste
87 //purpose  : Paste value of current attribute to the value of entry one
88 //=======================================================================
89 void SALOMEDSImpl_StudyHandle::Paste( const Handle(TDF_Attribute)& theInto,
90                                        const Handle(TDF_RelocationTable)& ) const
91 {
92   Handle(SALOMEDSImpl_StudyHandle) anAttr =  Handle(SALOMEDSImpl_StudyHandle)::DownCast( theInto );
93   if ( !anAttr.IsNull() ) anAttr->SetHandle( myHandle );
94 }
95