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>
22 #include <XCAFDimTolObjects_GeomToleranceType.hxx>
23 #include <XCAFDimTolObjects_GeomToleranceTypeValue.hxx>
24 #include <Standard_Real.hxx>
25 #include <XCAFDimTolObjects_GeomToleranceMatReqModif.hxx>
26 #include <XCAFDimTolObjects_GeomToleranceZoneModif.hxx>
27 #include <XCAFDimTolObjects_GeomToleranceModifiersSequence.hxx>
28 #include <Standard_Transient.hxx>
29 #include <XCAFDimTolObjects_GeomToleranceModif.hxx>
30 #include <XCAFDimTolObjects_ToleranceZoneAffectedPlane.hxx>
32 #include <TopoDS_Shape.hxx>
33 #include <TCollection_HAsciiString.hxx>
35 class XCAFDimTolObjects_GeomToleranceObject;
36 DEFINE_STANDARD_HANDLE(XCAFDimTolObjects_GeomToleranceObject, Standard_Transient)
38 //! Access object to store dimension and tolerance
39 class XCAFDimTolObjects_GeomToleranceObject : public Standard_Transient
44 Standard_EXPORT XCAFDimTolObjects_GeomToleranceObject();
46 Standard_EXPORT XCAFDimTolObjects_GeomToleranceObject(const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObj);
48 //! Returns semantic name
49 Standard_EXPORT Handle(TCollection_HAsciiString) GetSemanticName() const;
51 //! Sets semantic name
52 Standard_EXPORT void SetSemanticName(const Handle(TCollection_HAsciiString)& theName);
54 //! Sets type of the object.
55 Standard_EXPORT void SetType (const XCAFDimTolObjects_GeomToleranceType theType);
57 //! Returns type of the object.
58 Standard_EXPORT XCAFDimTolObjects_GeomToleranceType GetType() const;
60 //! Sets type of tolerance value.
61 Standard_EXPORT void SetTypeOfValue (const XCAFDimTolObjects_GeomToleranceTypeValue theTypeOfValue);
63 //! Returns type of tolerance value.
64 Standard_EXPORT XCAFDimTolObjects_GeomToleranceTypeValue GetTypeOfValue() const;
66 //! Sets tolerance value.
67 Standard_EXPORT void SetValue (const Standard_Real theValue);
69 //! Returns tolerance value.
70 Standard_EXPORT Standard_Real GetValue() const;
72 //! Sets material requirement of the tolerance.
73 Standard_EXPORT void SetMaterialRequirementModifier (const XCAFDimTolObjects_GeomToleranceMatReqModif theMatReqModif);
75 //! Returns material requirement of the tolerance.
76 Standard_EXPORT XCAFDimTolObjects_GeomToleranceMatReqModif GetMaterialRequirementModifier() const;
78 //! Sets tolerance zone.
79 Standard_EXPORT void SetZoneModifier (const XCAFDimTolObjects_GeomToleranceZoneModif theZoneModif);
81 //! Returns tolerance zone.
82 Standard_EXPORT XCAFDimTolObjects_GeomToleranceZoneModif GetZoneModifier() const;
84 //! Sets value associated with tolerance zone.
85 Standard_EXPORT void SetValueOfZoneModifier (const Standard_Real theValue);
87 //! Returns value associated with tolerance zone.
88 Standard_EXPORT Standard_Real GetValueOfZoneModifier() const;
90 //! Sets new sequence of tolerance modifiers.
91 Standard_EXPORT void SetModifiers (const XCAFDimTolObjects_GeomToleranceModifiersSequence& theModifiers);
93 //! Adds a tolerance modifier to the sequence of modifiers.
94 Standard_EXPORT void AddModifier (const XCAFDimTolObjects_GeomToleranceModif theModifier);
96 //! Returns a sequence of modifiers of the tolerance.
97 Standard_EXPORT XCAFDimTolObjects_GeomToleranceModifiersSequence GetModifiers() const;
99 //! Sets the maximal upper tolerance value for tolerance with modifiers.
100 Standard_EXPORT void SetMaxValueModifier (const Standard_Real theModifier);
102 //! Returns the maximal upper tolerance.
103 Standard_EXPORT Standard_Real GetMaxValueModifier() const;
105 Standard_EXPORT void SetAxis (const gp_Ax2& theAxis);
107 Standard_EXPORT gp_Ax2 GetAxis() const;
109 Standard_EXPORT Standard_Boolean HasAxis () const;
111 //! Sets annotation plane.
112 void SetPlane (const gp_Ax2& thePlane)
115 myHasPlane = Standard_True;
118 //! Returns annotation plane.
119 const gp_Ax2& GetPlane() const { return myPlane; }
121 //! Sets reference point.
122 void SetPoint (const gp_Pnt& thePnt)
125 myHasPnt = Standard_True;
128 //! Returns reference point.
129 const gp_Pnt& GetPoint() const { return myPnt; }
131 //! Sets text position.
132 void SetPointTextAttach (const gp_Pnt& thePntText)
134 myPntText = thePntText;
135 myHasPntText = Standard_True;
138 //! Returns the text position.
139 const gp_Pnt& GetPointTextAttach() const
144 //! Returns True if the object has annotation plane.
145 Standard_Boolean HasPlane() const { return myHasPlane; }
147 //! Returns True if reference point is specified.
148 Standard_Boolean HasPoint() const { return myHasPnt; }
150 //! Returns True if text position is specified.
151 Standard_Boolean HasPointText() const
156 //! Set graphical presentation for object.
157 void SetPresentation(const TopoDS_Shape& thePresentation,
158 const Handle(TCollection_HAsciiString)& thePresentationName)
160 myPresentation = thePresentation;
161 myPresentationName = thePresentationName;
164 //! Returns graphical presentation of the object.
165 TopoDS_Shape GetPresentation() const
167 return myPresentation;
170 //! Returns graphical presentation of the object.
171 Handle(TCollection_HAsciiString) GetPresentationName() const
173 return myPresentationName;
176 // Returns true, if affected plane is specified.
177 bool HasAffectedPlane() const
179 return (myAffectedPlaneType != XCAFDimTolObjects_ToleranceZoneAffectedPlane_None);
182 // Returns type of affected plane.
183 XCAFDimTolObjects_ToleranceZoneAffectedPlane GetAffectedPlaneType() const
185 return myAffectedPlaneType;
188 // Sets affected plane type.
189 void SetAffectedPlaneType(const XCAFDimTolObjects_ToleranceZoneAffectedPlane theType)
191 myAffectedPlaneType = theType;
194 //! Sets affected plane.
195 void SetAffectedPlane(const gp_Pln& thePlane)
197 myAffectedPlane = thePlane;
200 //! Sets affected plane.
201 void SetAffectedPlane(const gp_Pln& thePlane,
202 const XCAFDimTolObjects_ToleranceZoneAffectedPlane theType)
204 myAffectedPlaneType = theType;
205 myAffectedPlane = thePlane;
208 //! Returns affected plane.
209 const gp_Pln& GetAffectedPlane() const
211 return myAffectedPlane;
214 //! Dumps the content of me into the stream
215 Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
217 DEFINE_STANDARD_RTTIEXT(XCAFDimTolObjects_GeomToleranceObject,Standard_Transient)
221 XCAFDimTolObjects_GeomToleranceType myType;
222 XCAFDimTolObjects_GeomToleranceTypeValue myTypeOfValue;
223 Standard_Real myValue;
224 XCAFDimTolObjects_GeomToleranceMatReqModif myMatReqModif;
225 XCAFDimTolObjects_GeomToleranceZoneModif myZoneModif;
226 Standard_Real myValueOfZoneModif;
227 XCAFDimTolObjects_GeomToleranceModifiersSequence myModifiers;
228 Standard_Real myMaxValueModif;
230 Standard_Boolean myHasAxis;
234 Standard_Boolean myHasPlane;
235 Standard_Boolean myHasPnt;
236 Standard_Boolean myHasPntText;
237 TopoDS_Shape myPresentation;
238 Handle(TCollection_HAsciiString) mySemanticName;
239 Handle(TCollection_HAsciiString) myPresentationName;
240 XCAFDimTolObjects_ToleranceZoneAffectedPlane myAffectedPlaneType;
241 gp_Pln myAffectedPlane;
245 #endif // _XCAFDimTolObjects_GeomToleranceObject_HeaderFile