1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <Standard_GUID.hxx>
16 #include <Standard_Type.hxx>
17 #include <TCollection_HAsciiString.hxx>
18 #include <TDF_Attribute.hxx>
19 #include <TDF_Label.hxx>
20 #include <TDF_RelocationTable.hxx>
21 #include <XCAFDoc_DimTol.hxx>
23 IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_DimTol,TDF_Attribute)
25 //=======================================================================
26 //function : XCAFDoc_DimTol
28 //=======================================================================
29 XCAFDoc_DimTol::XCAFDoc_DimTol()
34 //=======================================================================
37 //=======================================================================
39 const Standard_GUID& XCAFDoc_DimTol::GetID()
41 static Standard_GUID DGTID ("58ed092d-44de-11d8-8776-001083004c77");
42 //static Standard_GUID ID("efd212e9-6dfd-11d4-b9c8-0060b0ee281b");
48 //=======================================================================
51 //=======================================================================
53 Handle(XCAFDoc_DimTol) XCAFDoc_DimTol::Set(const TDF_Label& label,
54 const Standard_Integer kind,
55 const Handle(TColStd_HArray1OfReal)& aVal,
56 const Handle(TCollection_HAsciiString)& aName,
57 const Handle(TCollection_HAsciiString)& aDescription)
59 Handle(XCAFDoc_DimTol) A;
60 if (!label.FindAttribute(XCAFDoc_DimTol::GetID(), A)) {
61 A = new XCAFDoc_DimTol();
62 label.AddAttribute(A);
64 A->Set(kind,aVal,aName,aDescription);
69 //=======================================================================
72 //=======================================================================
74 void XCAFDoc_DimTol::Set(const Standard_Integer kind,
75 const Handle(TColStd_HArray1OfReal)& aVal,
76 const Handle(TCollection_HAsciiString)& aName,
77 const Handle(TCollection_HAsciiString)& aDescription)
83 myDescription = aDescription;
87 //=======================================================================
90 //=======================================================================
92 Standard_Integer XCAFDoc_DimTol::GetKind() const
98 //=======================================================================
101 //=======================================================================
103 Handle(TColStd_HArray1OfReal) XCAFDoc_DimTol::GetVal() const
109 //=======================================================================
112 //=======================================================================
114 Handle(TCollection_HAsciiString) XCAFDoc_DimTol::GetName() const
120 //=======================================================================
121 //function : GetDescription
123 //=======================================================================
125 Handle(TCollection_HAsciiString) XCAFDoc_DimTol::GetDescription() const
127 return myDescription;
131 //=======================================================================
134 //=======================================================================
136 const Standard_GUID& XCAFDoc_DimTol::ID() const
142 //=======================================================================
145 //=======================================================================
147 void XCAFDoc_DimTol::Restore(const Handle(TDF_Attribute)& With)
149 myKind = Handle(XCAFDoc_DimTol)::DownCast(With)->GetKind();
150 myVal = Handle(XCAFDoc_DimTol)::DownCast(With)->GetVal();
151 myName = Handle(XCAFDoc_DimTol)::DownCast(With)->GetName();
152 myDescription = Handle(XCAFDoc_DimTol)::DownCast(With)->GetDescription();
156 //=======================================================================
157 //function : NewEmpty
159 //=======================================================================
161 Handle(TDF_Attribute) XCAFDoc_DimTol::NewEmpty() const
163 return new XCAFDoc_DimTol();
167 //=======================================================================
170 //=======================================================================
172 void XCAFDoc_DimTol::Paste(const Handle(TDF_Attribute)& Into,
173 const Handle(TDF_RelocationTable)& /*RT*/) const
175 Handle(XCAFDoc_DimTol)::DownCast(Into)->Set(myKind,myVal,myName,myDescription);