1 // File : SALOMEDSImpl_StudyHandle.cxx
2 // Author : Sergey LITONIN
5 #include "SALOMEDSImpl_StudyHandle.hxx"
6 #include <TDF_Attribute.hxx>
7 #include <Standard_GUID.hxx>
10 Class : SALOMEDSImpl_StudyHandle
11 Description : This class is intended for storing information about
12 graphic representation of objects in dirrent views
15 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyHandle, TDF_Attribute )
16 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyHandle, TDF_Attribute )
18 //=======================================================================
20 //purpose : Get GUID of this attribute
21 //=======================================================================
22 const Standard_GUID& SALOMEDSImpl_StudyHandle::GetID()
24 static Standard_GUID SALOMEDSImpl_StudyHandleID( "050C9555-4BA8-49bf-8F1C-086F0469A40B" );
25 return SALOMEDSImpl_StudyHandleID;
28 //=======================================================================
29 //function : SALOMEDSImpl_StudyHandle
30 //purpose : Empty Constructor
31 //=======================================================================
32 SALOMEDSImpl_StudyHandle::SALOMEDSImpl_StudyHandle()
37 //=======================================================================
40 //=======================================================================
41 Handle(SALOMEDSImpl_StudyHandle) SALOMEDSImpl_StudyHandle::Set(const TDF_Label& theLabel,
42 const Handle(SALOMEDSImpl_Study)& theStudy)
44 Handle(SALOMEDSImpl_StudyHandle) A;
45 if (!theLabel.FindAttribute(GetID(), A)) {
46 A = new SALOMEDSImpl_StudyHandle();
47 theLabel.AddAttribute(A);
50 A->SetHandle(theStudy);
55 //=======================================================================
57 //purpose : Get GUID of this attribute
58 //=======================================================================
59 const Standard_GUID& SALOMEDSImpl_StudyHandle::ID () const
65 //=======================================================================
67 //purpose : Create new empty attribute
68 //=======================================================================
69 Handle(TDF_Attribute) SALOMEDSImpl_StudyHandle::NewEmpty () const
71 return new SALOMEDSImpl_StudyHandle ();
75 //=======================================================================
77 //purpose : Restore value of attribute with value of theWith one
78 //=======================================================================
79 void SALOMEDSImpl_StudyHandle::Restore( const Handle(TDF_Attribute)& theWith )
81 Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theWith );
82 if ( !anAttr.IsNull() ) SetHandle( anAttr->GetHandle() );
85 //=======================================================================
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
92 Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theInto );
93 if ( !anAttr.IsNull() ) anAttr->SetHandle( myHandle );