1 // Created on: 2015-08-06
2 // Created by: Ilya Novikov
3 // Copyright (c) 2004-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
17 #ifndef _XCAFDimTolObjects_GeomToleranceObject_HeaderFile
18 #define _XCAFDimTolObjects_GeomToleranceObject_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <XCAFDimTolObjects_GeomToleranceObjectSequence.hxx>
24 #include <XCAFDimTolObjects_GeomToleranceType.hxx>
25 #include <XCAFDimTolObjects_GeomToleranceTypeValue.hxx>
26 #include <Standard_Real.hxx>
27 #include <XCAFDimTolObjects_GeomToleranceMatReqModif.hxx>
28 #include <XCAFDimTolObjects_GeomToleranceZoneModif.hxx>
29 #include <XCAFDimTolObjects_GeomToleranceModifiersSequence.hxx>
30 #include <Standard_Transient.hxx>
31 #include <XCAFDimTolObjects_GeomToleranceModif.hxx>
32 #include <XCAFDimTolObjects_ToleranceZoneAffectedPlane.hxx>
35 #include <TopoDS_Shape.hxx>
36 #include <TCollection_HAsciiString.hxx>
38 class XCAFDimTolObjects_GeomToleranceObject;
39 DEFINE_STANDARD_HANDLE(XCAFDimTolObjects_GeomToleranceObject, Standard_Transient)
41 //! Access object to store dimension and tolerance
42 class XCAFDimTolObjects_GeomToleranceObject : public Standard_Transient
47 Standard_EXPORT XCAFDimTolObjects_GeomToleranceObject();
49 Standard_EXPORT XCAFDimTolObjects_GeomToleranceObject(const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObj);
51 //! Sets type of the object.
52 Standard_EXPORT void SetType (const XCAFDimTolObjects_GeomToleranceType theType);
54 //! Returns type of the object.
55 Standard_EXPORT XCAFDimTolObjects_GeomToleranceType GetType() const;
57 //! Sets type of tolerance value.
58 Standard_EXPORT void SetTypeOfValue (const XCAFDimTolObjects_GeomToleranceTypeValue theTypeOfValue);
60 //! Returns type of tolerance value.
61 Standard_EXPORT XCAFDimTolObjects_GeomToleranceTypeValue GetTypeOfValue() const;
63 //! Sets tolerance value.
64 Standard_EXPORT void SetValue (const Standard_Real theValue);
66 //! Returns tolerance value.
67 Standard_EXPORT Standard_Real GetValue() const;
69 //! Sets material requirement of the tolerance.
70 Standard_EXPORT void SetMaterialRequirementModifier (const XCAFDimTolObjects_GeomToleranceMatReqModif theMatReqModif);
72 //! Returns material requirement of the tolerance.
73 Standard_EXPORT XCAFDimTolObjects_GeomToleranceMatReqModif GetMaterialRequirementModifier() const;
75 //! Sets tolerance zone.
76 Standard_EXPORT void SetZoneModifier (const XCAFDimTolObjects_GeomToleranceZoneModif theZoneModif);
78 //! Returns tolerance zone.
79 Standard_EXPORT XCAFDimTolObjects_GeomToleranceZoneModif GetZoneModifier() const;
81 //! Sets value associated with tolerance zone.
82 Standard_EXPORT void SetValueOfZoneModifier (const Standard_Real theValue);
84 //! Returns value associated with tolerance zone.
85 Standard_EXPORT Standard_Real GetValueOfZoneModifier() const;
87 //! Sets new sequence of tolerance modifiers.
88 Standard_EXPORT void SetModifiers (const XCAFDimTolObjects_GeomToleranceModifiersSequence& theModifiers);
90 //! Adds a tolerance modifier to the sequence of modifiers.
91 Standard_EXPORT void AddModifier (const XCAFDimTolObjects_GeomToleranceModif theModifier);
93 //! Returns a sequence of modifiers of the tolerance.
94 Standard_EXPORT XCAFDimTolObjects_GeomToleranceModifiersSequence GetModifiers() const;
96 //! Sets the maximal upper tolerance value for tolerance with modifiers.
97 Standard_EXPORT void SetMaxValueModifier (const Standard_Real theModifier);
99 //! Returns the maximal upper tolerance.
100 Standard_EXPORT Standard_Real GetMaxValueModifier() const;
102 Standard_EXPORT void SetAxis (const gp_Ax2 theAxis);
104 Standard_EXPORT gp_Ax2 GetAxis() const;
106 Standard_EXPORT Standard_Boolean HasAxis () const;
108 //! Sets annotation plane.
109 void SetPlane (const gp_Ax2& thePlane)
112 myHasPlane = Standard_True;
115 //! Returns annotation plane.
116 const gp_Ax2& GetPlane() const { return myPlane; }
118 //! Sets reference point.
119 void SetPoint (const gp_Pnt& thePnt)
122 myHasPnt = Standard_True;
125 //! Returns reference point.
126 const gp_Pnt& GetPoint() const { return myPnt; }
128 //! Sets text position.
129 void SetPointTextAttach (const gp_Pnt& thePntText)
131 myPntText = thePntText;
132 myHasPntText = Standard_True;
135 //! Returns the text position.
136 const gp_Pnt& GetPointTextAttach() const
141 //! Returns True if the object has annotation plane.
142 Standard_Boolean HasPlane() const { return myHasPlane; }
144 //! Returns True if reference point is specified.
145 Standard_Boolean HasPoint() const { return myHasPnt; }
147 //! Returns True if text position is specified.
148 Standard_Boolean HasPointText() const
153 //! Set graphical presentation for object.
154 void SetPresentation(const TopoDS_Shape& thePresentation,
155 const Handle(TCollection_HAsciiString)& thePresentationName)
157 myPresentation = thePresentation;
158 myPresentationName = thePresentationName;
161 //! Returns graphical presentation of the object.
162 TopoDS_Shape GetPresentation() const
164 return myPresentation;
167 //! Returns graphical presentation of the object.
168 Handle(TCollection_HAsciiString) GetPresentationName() const
170 return myPresentationName;
173 // Returns true, if affected plane is specified.
174 bool HasAffectedPlane() const
176 return (myAffectedPlaneType != XCAFDimTolObjects_ToleranceZoneAffectedPlane_None);
179 // Returns type of affected plane.
180 XCAFDimTolObjects_ToleranceZoneAffectedPlane GetAffectedPlaneType() const
182 return myAffectedPlaneType;
185 // Sets affected plane type.
186 void SetAffectedPlaneType(const XCAFDimTolObjects_ToleranceZoneAffectedPlane theType)
188 myAffectedPlaneType = theType;
191 //! Sets affected plane.
192 void SetAffectedPlane(const gp_Pln& thePlane)
194 myAffectedPlane = thePlane;
197 //! Sets affected plane.
198 void SetAffectedPlane(const gp_Pln& thePlane,
199 const XCAFDimTolObjects_ToleranceZoneAffectedPlane theType)
201 myAffectedPlaneType = theType;
202 myAffectedPlane = thePlane;
205 //! Returns affected plane.
206 const gp_Pln& GetAffectedPlane() const
208 return myAffectedPlane;
212 DEFINE_STANDARD_RTTIEXT(XCAFDimTolObjects_GeomToleranceObject,Standard_Transient)
216 XCAFDimTolObjects_GeomToleranceType myType;
217 XCAFDimTolObjects_GeomToleranceTypeValue myTypeOfValue;
218 Standard_Real myValue;
219 XCAFDimTolObjects_GeomToleranceMatReqModif myMatReqModif;
220 XCAFDimTolObjects_GeomToleranceZoneModif myZoneModif;
221 Standard_Real myValueOfZoneModif;
222 XCAFDimTolObjects_GeomToleranceModifiersSequence myModifiers;
223 Standard_Real myMaxValueModif;
225 Standard_Boolean myHasAxis;
229 Standard_Boolean myHasPlane;
230 Standard_Boolean myHasPnt;
231 Standard_Boolean myHasPntText;
232 TopoDS_Shape myPresentation;
233 Handle(TCollection_HAsciiString) myPresentationName;
234 XCAFDimTolObjects_ToleranceZoneAffectedPlane myAffectedPlaneType;
235 gp_Pln myAffectedPlane;
239 #endif // _XCAFDimTolObjects_GeomToleranceObject_HeaderFile