0029338: Data Exchange - Add Planes for Tolerance zones in Geometric tolerances
[occt.git] / src / XCAFDimTolObjects / XCAFDimTolObjects_DatumObject.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #include <XCAFDimTolObjects_DatumObject.hxx>
15
16
17 IMPLEMENT_STANDARD_RTTIEXT(XCAFDimTolObjects_DatumObject,Standard_Transient)
18
19 //=======================================================================
20 //function : XCAFDimTolObjects_DatumObject
21 //purpose  : 
22 //=======================================================================
23
24 XCAFDimTolObjects_DatumObject::XCAFDimTolObjects_DatumObject()
25 {
26   myIsDTarget = Standard_False;
27   myIsValidDT = Standard_False;
28   myHasPlane = Standard_False;
29   myHasPnt = Standard_False;
30   myHasPntText = Standard_False;
31 }
32
33 //=======================================================================
34 //function : XCAFDimTolObjects_DatumObject
35 //purpose  : 
36 //=======================================================================
37
38 XCAFDimTolObjects_DatumObject::XCAFDimTolObjects_DatumObject(const Handle(XCAFDimTolObjects_DatumObject)& theObj)
39 {
40   myName = theObj->myName;
41   myModifiers = theObj->myModifiers;
42   myModifierWithValue = theObj->myModifierWithValue;
43   myValueOfModifier = theObj->myValueOfModifier;
44   myDatumTarget = theObj->myDatumTarget;
45   myIsDTarget = theObj->myIsDTarget;
46   myIsValidDT = theObj->myIsValidDT;
47   myAxis = theObj->myAxis;
48   myDTargetType = theObj->myDTargetType;
49   myPlane = theObj->myPlane;
50   myPnt= theObj->myPnt;
51   myPntText= theObj->myPntText;
52   myHasPlane = theObj->myHasPlane;
53   myHasPnt = theObj->myHasPnt;
54   myHasPntText = theObj->myHasPntText;
55 }
56
57 //=======================================================================
58 //function : GetName
59 //purpose  : 
60 //=======================================================================
61
62 Handle(TCollection_HAsciiString) XCAFDimTolObjects_DatumObject::GetName() const
63 {
64   if(myName.IsNull())
65     return new TCollection_HAsciiString();
66   return myName;
67 }
68
69 //=======================================================================
70 //function : SetName
71 //purpose  : 
72 //=======================================================================
73
74 void XCAFDimTolObjects_DatumObject::SetName(const Handle(TCollection_HAsciiString)& theName)
75 {
76   myName = theName;
77 }
78
79 //=======================================================================
80 //function : GetModifiers
81 //purpose  : 
82 //=======================================================================
83
84 XCAFDimTolObjects_DatumModifiersSequence XCAFDimTolObjects_DatumObject::GetModifiers() const
85 {
86   return myModifiers;
87 }
88
89 //=======================================================================
90 //function : SetModifiers
91 //purpose  : 
92 //=======================================================================
93
94 void XCAFDimTolObjects_DatumObject::SetModifiers(const XCAFDimTolObjects_DatumModifiersSequence& theModifiers)
95 {
96   myModifiers = theModifiers;
97 }
98
99 //=======================================================================
100 //function : SetModifierWithValue
101 //purpose  : 
102 //=======================================================================
103
104 void XCAFDimTolObjects_DatumObject::SetModifierWithValue(const XCAFDimTolObjects_DatumModifWithValue theModifier, const Standard_Real theValue)
105 {
106   myModifierWithValue = theModifier;
107   myValueOfModifier = theValue;
108 }
109
110 //=======================================================================
111 //function : GetModifierWithValue
112 //purpose  : 
113 //=======================================================================
114
115 void XCAFDimTolObjects_DatumObject::GetModifierWithValue(XCAFDimTolObjects_DatumModifWithValue& theModifier, Standard_Real& theValue) const
116 {
117   theModifier = myModifierWithValue;
118   theValue = myValueOfModifier;
119 }
120   
121 //=======================================================================
122 //function : AddModifier
123 //purpose  : 
124 //=======================================================================
125
126 void XCAFDimTolObjects_DatumObject::AddModifier(const XCAFDimTolObjects_DatumSingleModif theModifier)
127 {
128   myModifiers.Append(theModifier);
129 }
130
131 //=======================================================================
132 //function : GetDatumTarget
133 //purpose  : 
134 //=======================================================================
135
136 TopoDS_Shape XCAFDimTolObjects_DatumObject::GetDatumTarget()  const
137 {
138   return myDatumTarget;
139 }
140
141 //=======================================================================
142 //function : SetDatumTarget
143 //purpose  : 
144 //=======================================================================
145
146 void XCAFDimTolObjects_DatumObject::SetDatumTarget (const TopoDS_Shape& theShape) 
147 {
148   myDatumTarget = theShape;
149 }
150   
151 //=======================================================================
152 //function : GetPosition
153 //purpose  : 
154 //=======================================================================
155
156 Standard_Integer XCAFDimTolObjects_DatumObject::GetPosition() const
157 {
158   return myPosition;
159 }
160
161 //=======================================================================
162 //function : SetName
163 //purpose  : 
164 //=======================================================================
165
166 void XCAFDimTolObjects_DatumObject::SetPosition(const Standard_Integer thePosition)
167 {
168   myPosition = thePosition;
169 }
170
171 //=======================================================================
172 //function : IsDatumTarget
173 //purpose  : 
174 //=======================================================================
175
176 Standard_Boolean XCAFDimTolObjects_DatumObject::IsDatumTarget() const
177 {
178   return myIsDTarget;
179 }
180
181 //=======================================================================
182 //function : IsDatumTarget
183 //purpose  : 
184 //=======================================================================
185
186 void XCAFDimTolObjects_DatumObject::IsDatumTarget(const Standard_Boolean theIsDT)
187 {
188   myIsDTarget = theIsDT;
189 }
190
191 //=======================================================================
192 //function : GetDatumTargetType
193 //purpose  : 
194 //=======================================================================
195
196 XCAFDimTolObjects_DatumTargetType XCAFDimTolObjects_DatumObject::GetDatumTargetType() const
197 {
198   return myDTargetType;
199 }
200
201 //=======================================================================
202 //function : SetDatumTargetType
203 //purpose  : 
204 //=======================================================================
205
206 void XCAFDimTolObjects_DatumObject::SetDatumTargetType(const XCAFDimTolObjects_DatumTargetType theType)
207 {
208   myDTargetType = theType;
209 }
210
211 //=======================================================================
212 //function : GetDatumTargetAxis
213 //purpose  : 
214 //=======================================================================
215
216 gp_Ax2 XCAFDimTolObjects_DatumObject::GetDatumTargetAxis() const
217 {
218   return myAxis;
219 }
220
221 //=======================================================================
222 //function : SetDatumTargetAxis
223 //purpose  : 
224 //=======================================================================
225
226 void XCAFDimTolObjects_DatumObject::SetDatumTargetAxis(const gp_Ax2& theAxis)
227 {
228   myAxis = theAxis;
229   myIsValidDT = Standard_True;
230 }
231
232 //=======================================================================
233 //function : GetDatumTargetLength
234 //purpose  : 
235 //=======================================================================
236
237 Standard_Real XCAFDimTolObjects_DatumObject::GetDatumTargetLength() const
238 {
239   return myLength;
240 }
241
242 //=======================================================================
243 //function : SetDatumTargetLength
244 //purpose  : 
245 //=======================================================================
246
247 void XCAFDimTolObjects_DatumObject::SetDatumTargetLength(const Standard_Real theLength)
248 {
249   myLength = theLength;
250   myIsValidDT = Standard_True;
251 }
252
253
254 //=======================================================================
255 //function : GetDatumTargetWidth
256 //purpose  : 
257 //=======================================================================
258
259 Standard_Real XCAFDimTolObjects_DatumObject::GetDatumTargetWidth() const
260 {
261   return myWidth;
262 }
263
264 //=======================================================================
265 //function : SetDatumTargetWidth
266 //purpose  : 
267 //=======================================================================
268
269 void XCAFDimTolObjects_DatumObject::SetDatumTargetWidth(const Standard_Real theWidth)
270 {
271   myWidth = theWidth;
272   myIsValidDT = Standard_True;
273 }
274
275 //=======================================================================
276 //function : GetDatumTargetNumber
277 //purpose  : 
278 //=======================================================================
279
280 Standard_Integer XCAFDimTolObjects_DatumObject::GetDatumTargetNumber() const
281 {
282   return myDatumTargetNumber;
283 }
284
285 //=======================================================================
286 //function : SetDatumTargetNumber
287 //purpose  : 
288 //=======================================================================
289
290 void XCAFDimTolObjects_DatumObject::SetDatumTargetNumber(const Standard_Integer theNumber)
291 {
292   myDatumTargetNumber = theNumber;
293 }