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_GeomToleranceObject.hxx>
15
IMPLEMENT_STANDARD_RTTIEXT(XCAFDimTolObjects_GeomToleranceObject,Standard_Transient)16 IMPLEMENT_STANDARD_RTTIEXT(XCAFDimTolObjects_GeomToleranceObject,Standard_Transient)
17
18 //=======================================================================
19 //function : XCAFDimTolObjects_GeomTolerance
20 //purpose :
21 //=======================================================================
22
23 XCAFDimTolObjects_GeomToleranceObject::XCAFDimTolObjects_GeomToleranceObject()
24 {
25 myHasAxis = Standard_False;
26 myHasPlane = Standard_False;
27 myHasPnt = Standard_False;
28 myHasPntText = Standard_False;
29 myAffectedPlaneType = XCAFDimTolObjects_ToleranceZoneAffectedPlane_None;
30 }
31
32 //=======================================================================
33 //function : XCAFDimTolObjects_GeomTolerance
34 //purpose :
35 //=======================================================================
36
XCAFDimTolObjects_GeomToleranceObject(const Handle (XCAFDimTolObjects_GeomToleranceObject)& theObj)37 XCAFDimTolObjects_GeomToleranceObject::XCAFDimTolObjects_GeomToleranceObject(const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObj)
38 {
39 myType = theObj->myType;
40 myTypeOfValue = theObj->myTypeOfValue;
41 myValue = theObj->myValue;
42 myMatReqModif = theObj->myMatReqModif;
43 myZoneModif = theObj->myZoneModif;
44 myValueOfZoneModif = theObj->myValueOfZoneModif;
45 myModifiers = theObj->myModifiers;
46 myMaxValueModif = theObj->myMaxValueModif;
47 myAxis = theObj->myAxis;
48 myHasAxis = theObj->myHasAxis;
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 mySemanticName = theObj->mySemanticName;
56 myAffectedPlaneType = theObj->myAffectedPlaneType;
57 myAffectedPlane = theObj->myAffectedPlane;
58 myPresentation = theObj->myPresentation;
59 myPresentationName = theObj->myPresentationName;
60 }
61
62 //=======================================================================
63 //function :
64 //purpose :
65 //=======================================================================
66
Handle(TCollection_HAsciiString)67 Handle(TCollection_HAsciiString) XCAFDimTolObjects_GeomToleranceObject::GetSemanticName() const
68 {
69 return mySemanticName;
70 }
71
72 //=======================================================================
73 //function :
74 //purpose :
75 //=======================================================================
76
SetSemanticName(const Handle (TCollection_HAsciiString)& theName)77 void XCAFDimTolObjects_GeomToleranceObject::SetSemanticName(const Handle(TCollection_HAsciiString)& theName)
78 {
79 mySemanticName = theName;
80 }
81
82 //=======================================================================
83 //function :
84 //purpose :
85 //=======================================================================
86
SetType(const XCAFDimTolObjects_GeomToleranceType theType)87 void XCAFDimTolObjects_GeomToleranceObject::SetType (const XCAFDimTolObjects_GeomToleranceType theType)
88 {
89 myType = theType;
90 }
91
92 //=======================================================================
93 //function :
94 //purpose :
95 //=======================================================================
96
GetType() const97 XCAFDimTolObjects_GeomToleranceType XCAFDimTolObjects_GeomToleranceObject::GetType() const
98 {
99 return myType;
100 }
101
102 //=======================================================================
103 //function :
104 //purpose :
105 //=======================================================================
106
SetTypeOfValue(const XCAFDimTolObjects_GeomToleranceTypeValue theTypeOfValue)107 void XCAFDimTolObjects_GeomToleranceObject::SetTypeOfValue (const XCAFDimTolObjects_GeomToleranceTypeValue theTypeOfValue)
108 {
109 myTypeOfValue = theTypeOfValue;
110 }
111
112 //=======================================================================
113 //function :
114 //purpose :
115 //=======================================================================
116
GetTypeOfValue() const117 XCAFDimTolObjects_GeomToleranceTypeValue XCAFDimTolObjects_GeomToleranceObject::GetTypeOfValue() const
118 {
119 return myTypeOfValue;
120 }
121
122 //=======================================================================
123 //function :
124 //purpose :
125 //=======================================================================
126
SetValue(const Standard_Real theValue)127 void XCAFDimTolObjects_GeomToleranceObject::SetValue (const Standard_Real theValue)
128 {
129 myValue = theValue;
130 }
131
132 //=======================================================================
133 //function :
134 //purpose :
135 //=======================================================================
136
GetValue() const137 Standard_Real XCAFDimTolObjects_GeomToleranceObject::GetValue() const
138 {
139 return myValue;
140 }
141
142 //=======================================================================
143 //function :
144 //purpose :
145 //=======================================================================
146
SetMaterialRequirementModifier(const XCAFDimTolObjects_GeomToleranceMatReqModif theMatReqModif)147 void XCAFDimTolObjects_GeomToleranceObject::SetMaterialRequirementModifier (const XCAFDimTolObjects_GeomToleranceMatReqModif theMatReqModif)
148 {
149 myMatReqModif = theMatReqModif;
150 }
151
152 //=======================================================================
153 //function :
154 //purpose :
155 //=======================================================================
156
GetMaterialRequirementModifier() const157 XCAFDimTolObjects_GeomToleranceMatReqModif XCAFDimTolObjects_GeomToleranceObject::GetMaterialRequirementModifier() const
158 {
159 return myMatReqModif;
160 }
161
162 //=======================================================================
163 //function :
164 //purpose :
165 //=======================================================================
166
SetZoneModifier(const XCAFDimTolObjects_GeomToleranceZoneModif theZoneModif)167 void XCAFDimTolObjects_GeomToleranceObject::SetZoneModifier (const XCAFDimTolObjects_GeomToleranceZoneModif theZoneModif)
168 {
169 myZoneModif = theZoneModif;
170 }
171
172 //=======================================================================
173 //function :
174 //purpose :
175 //=======================================================================
176
GetZoneModifier() const177 XCAFDimTolObjects_GeomToleranceZoneModif XCAFDimTolObjects_GeomToleranceObject::GetZoneModifier() const
178 {
179 return myZoneModif;
180 }
181
182 //=======================================================================
183 //function :
184 //purpose :
185 //=======================================================================
186
SetValueOfZoneModifier(const Standard_Real theValue)187 void XCAFDimTolObjects_GeomToleranceObject::SetValueOfZoneModifier (const Standard_Real theValue)
188 {
189 myValueOfZoneModif = theValue;
190 }
191
192 //=======================================================================
193 //function :
194 //purpose :
195 //=======================================================================
196
GetValueOfZoneModifier() const197 Standard_Real XCAFDimTolObjects_GeomToleranceObject::GetValueOfZoneModifier() const
198 {
199 return myValueOfZoneModif;
200 }
201
202 //=======================================================================
203 //function :
204 //purpose :
205 //=======================================================================
206
SetModifiers(const XCAFDimTolObjects_GeomToleranceModifiersSequence & theModifiers)207 void XCAFDimTolObjects_GeomToleranceObject::SetModifiers (const XCAFDimTolObjects_GeomToleranceModifiersSequence& theModifiers)
208 {
209 myModifiers = theModifiers;
210 }
211
212 //=======================================================================
213 //function :
214 //purpose :
215 //=======================================================================
216
AddModifier(const XCAFDimTolObjects_GeomToleranceModif theModifier)217 void XCAFDimTolObjects_GeomToleranceObject::AddModifier (const XCAFDimTolObjects_GeomToleranceModif theModifier)
218 {
219 myModifiers.Append(theModifier);
220 }
221
222 //=======================================================================
223 //function :
224 //purpose :
225 //=======================================================================
226
GetModifiers() const227 XCAFDimTolObjects_GeomToleranceModifiersSequence XCAFDimTolObjects_GeomToleranceObject::GetModifiers() const
228 {
229 return myModifiers;
230 }
231
232 //=======================================================================
233 //function :
234 //purpose :
235 //=======================================================================
236
SetMaxValueModifier(const Standard_Real theModifier)237 void XCAFDimTolObjects_GeomToleranceObject::SetMaxValueModifier (const Standard_Real theModifier)
238 {
239 myMaxValueModif = theModifier;
240 }
241
242 //=======================================================================
243 //function :
244 //purpose :
245 //=======================================================================
246
GetMaxValueModifier() const247 Standard_Real XCAFDimTolObjects_GeomToleranceObject::GetMaxValueModifier() const
248 {
249 return myMaxValueModif;
250 }
251
252 //=======================================================================
253 //function :
254 //purpose :
255 //=======================================================================
256
SetAxis(const gp_Ax2 theAxis)257 void XCAFDimTolObjects_GeomToleranceObject::SetAxis (const gp_Ax2 theAxis)
258 {
259 myAxis = theAxis;
260 myHasAxis = Standard_True;
261 }
262
263 //=======================================================================
264 //function :
265 //purpose :
266 //=======================================================================
267
GetAxis() const268 gp_Ax2 XCAFDimTolObjects_GeomToleranceObject::GetAxis() const
269 {
270 return myAxis;
271 }
272
273 //=======================================================================
274 //function :
275 //purpose :
276 //=======================================================================
277
HasAxis() const278 Standard_Boolean XCAFDimTolObjects_GeomToleranceObject::HasAxis () const
279 {
280 return myHasAxis;
281 }
282
283 //=======================================================================
284 //function : DumpJson
285 //purpose :
286 //=======================================================================
DumpJson(Standard_OStream & theOStream,Standard_Integer theDepth) const287 void XCAFDimTolObjects_GeomToleranceObject::DumpJson (Standard_OStream& theOStream,
288 Standard_Integer theDepth) const
289 {
290 OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
291
292 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myType)
293 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTypeOfValue)
294 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValue)
295
296 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMatReqModif)
297 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZoneModif)
298 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValueOfZoneModif)
299
300 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaxValueModif)
301 if (myHasAxis)
302 {
303 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myAxis)
304 }
305
306 if (myHasPlane)
307 {
308 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPlane)
309 }
310
311 if (myHasPnt)
312 {
313 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPnt)
314 }
315
316 if (myHasPntText)
317 {
318 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPntText)
319 }
320
321 if (!myPresentation.IsNull())
322 {
323 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPresentation)
324 }
325
326 if (!mySemanticName.IsNull())
327 {
328 Standard_CString aSemanticName = mySemanticName->ToCString();
329 OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aSemanticName)
330 }
331 if (!myPresentationName.IsNull())
332 {
333 Standard_CString aPresentationName = myPresentationName->ToCString();
334 OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aPresentationName)
335 }
336
337 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myAffectedPlane)
338
339 for (XCAFDimTolObjects_GeomToleranceModifiersSequence::Iterator aModifIt (myModifiers); aModifIt.More(); aModifIt.Next())
340 {
341 XCAFDimTolObjects_GeomToleranceModif aModifier = aModifIt.Value();
342 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aModifier)
343 }
344 }
345