Test for 0022778: Bug in BRepMesh
[occt.git] / src / XCAFDoc / XCAFDoc_DimTol.cxx
1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
2 //
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
7 //
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10 //
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
17
18 #include <XCAFDoc_DimTol.ixx>
19
20 #include <TDF_RelocationTable.hxx>
21
22
23 //=======================================================================
24 //function : XCAFDoc_DimTol
25 //purpose  : 
26 //=======================================================================
27
28 XCAFDoc_DimTol::XCAFDoc_DimTol()
29 {
30 }
31
32
33 //=======================================================================
34 //function : GetID
35 //purpose  : 
36 //=======================================================================
37
38 const Standard_GUID& XCAFDoc_DimTol::GetID() 
39 {
40   static Standard_GUID DGTID ("58ed092d-44de-11d8-8776-001083004c77");
41   //static Standard_GUID ID("efd212e9-6dfd-11d4-b9c8-0060b0ee281b");
42   return DGTID; 
43   //return ID;
44 }
45
46
47 //=======================================================================
48 //function : Set
49 //purpose  : 
50 //=======================================================================
51
52 Handle(XCAFDoc_DimTol) XCAFDoc_DimTol::Set(const TDF_Label& label,
53                                            const Standard_Integer kind,
54                                            const Handle(TColStd_HArray1OfReal)& aVal,
55                                            const Handle(TCollection_HAsciiString)& aName,
56                                            const Handle(TCollection_HAsciiString)& aDescription) 
57 {
58   Handle(XCAFDoc_DimTol) A;
59   if (!label.FindAttribute(XCAFDoc_DimTol::GetID(), A)) {
60     A = new XCAFDoc_DimTol();
61     label.AddAttribute(A);
62   }
63   A->Set(kind,aVal,aName,aDescription); 
64   return A;
65 }
66
67
68 //=======================================================================
69 //function : Set
70 //purpose  : 
71 //=======================================================================
72
73 void XCAFDoc_DimTol::Set(const Standard_Integer kind,
74                          const Handle(TColStd_HArray1OfReal)& aVal,
75                          const Handle(TCollection_HAsciiString)& aName,
76                          const Handle(TCollection_HAsciiString)& aDescription) 
77 {
78   myKind = kind;
79   myVal = aVal;
80   myName = aName;
81   myDescription = aDescription;
82 }
83
84
85 //=======================================================================
86 //function : GetKind
87 //purpose  : 
88 //=======================================================================
89
90 Standard_Integer XCAFDoc_DimTol::GetKind() const
91 {
92   return myKind;
93 }
94
95
96 //=======================================================================
97 //function : GetVal
98 //purpose  : 
99 //=======================================================================
100
101 Handle(TColStd_HArray1OfReal) XCAFDoc_DimTol::GetVal() const
102 {
103   return myVal;
104 }
105
106
107 //=======================================================================
108 //function : GetName
109 //purpose  : 
110 //=======================================================================
111
112 Handle(TCollection_HAsciiString) XCAFDoc_DimTol::GetName() const
113 {
114   return myName;
115 }
116
117
118 //=======================================================================
119 //function : GetDescription
120 //purpose  : 
121 //=======================================================================
122
123 Handle(TCollection_HAsciiString) XCAFDoc_DimTol::GetDescription() const
124 {
125   return myDescription;
126 }
127
128
129 //=======================================================================
130 //function : ID
131 //purpose  : 
132 //=======================================================================
133
134 const Standard_GUID& XCAFDoc_DimTol::ID() const
135 {
136   return GetID();
137 }
138
139
140 //=======================================================================
141 //function : Restore
142 //purpose  : 
143 //=======================================================================
144
145 void XCAFDoc_DimTol::Restore(const Handle(TDF_Attribute)& With) 
146 {
147   myKind = Handle(XCAFDoc_DimTol)::DownCast(With)->GetKind();
148   myVal = Handle(XCAFDoc_DimTol)::DownCast(With)->GetVal();
149   myName = Handle(XCAFDoc_DimTol)::DownCast(With)->GetName();
150   myDescription = Handle(XCAFDoc_DimTol)::DownCast(With)->GetDescription();
151 }
152
153
154 //=======================================================================
155 //function : NewEmpty
156 //purpose  : 
157 //=======================================================================
158
159 Handle(TDF_Attribute) XCAFDoc_DimTol::NewEmpty() const
160 {
161   return new XCAFDoc_DimTol();
162 }
163
164
165 //=======================================================================
166 //function : Paste
167 //purpose  : 
168 //=======================================================================
169
170 void XCAFDoc_DimTol::Paste(const Handle(TDF_Attribute)& Into,
171                            const Handle(TDF_RelocationTable)& /*RT*/) const
172 {
173   Handle(XCAFDoc_DimTol)::DownCast(Into)->Set(myKind,myVal,myName,myDescription);
174 }
175