1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SALOMEDSImpl_StudyHandle.cxx
21 // Author : Sergey LITONIN
24 #include "SALOMEDSImpl_StudyHandle.hxx"
25 #include <TDF_Attribute.hxx>
26 #include <Standard_GUID.hxx>
29 Class : SALOMEDSImpl_StudyHandle
30 Description : This class is intended for storing information about
31 graphic representation of objects in dirrent views
34 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyHandle, TDF_Attribute )
35 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyHandle, TDF_Attribute )
37 //=======================================================================
39 //purpose : Get GUID of this attribute
40 //=======================================================================
41 const Standard_GUID& SALOMEDSImpl_StudyHandle::GetID()
43 static Standard_GUID SALOMEDSImpl_StudyHandleID( "050C9555-4BA8-49bf-8F1C-086F0469A40B" );
44 return SALOMEDSImpl_StudyHandleID;
47 //=======================================================================
48 //function : SALOMEDSImpl_StudyHandle
49 //purpose : Empty Constructor
50 //=======================================================================
51 SALOMEDSImpl_StudyHandle::SALOMEDSImpl_StudyHandle()
56 //=======================================================================
59 //=======================================================================
60 Handle(SALOMEDSImpl_StudyHandle) SALOMEDSImpl_StudyHandle::Set(const TDF_Label& theLabel,
61 const Handle(SALOMEDSImpl_Study)& theStudy)
63 Handle(SALOMEDSImpl_StudyHandle) A;
64 if (!theLabel.FindAttribute(GetID(), A)) {
65 A = new SALOMEDSImpl_StudyHandle();
66 theLabel.AddAttribute(A);
69 A->SetHandle(theStudy);
74 //=======================================================================
76 //purpose : Get GUID of this attribute
77 //=======================================================================
78 const Standard_GUID& SALOMEDSImpl_StudyHandle::ID () const
84 //=======================================================================
86 //purpose : Create new empty attribute
87 //=======================================================================
88 Handle(TDF_Attribute) SALOMEDSImpl_StudyHandle::NewEmpty () const
90 return new SALOMEDSImpl_StudyHandle ();
94 //=======================================================================
96 //purpose : Restore value of attribute with value of theWith one
97 //=======================================================================
98 void SALOMEDSImpl_StudyHandle::Restore( const Handle(TDF_Attribute)& theWith )
100 Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theWith );
101 if ( !anAttr.IsNull() ) SetHandle( anAttr->GetHandle() );
104 //=======================================================================
106 //purpose : Paste value of current attribute to the value of entry one
107 //=======================================================================
108 void SALOMEDSImpl_StudyHandle::Paste( const Handle(TDF_Attribute)& theInto,
109 const Handle(TDF_RelocationTable)& ) const
111 Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theInto );
112 if ( !anAttr.IsNull() ) anAttr->SetHandle( myHandle );