0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / XCAFDimTolObjects / XCAFDimTolObjects_GeomToleranceObject.hxx
1 // Created on: 2015-08-06
2 // Created by: Ilya Novikov
3 // Copyright (c) 2004-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16
17 #ifndef _XCAFDimTolObjects_GeomToleranceObject_HeaderFile
18 #define _XCAFDimTolObjects_GeomToleranceObject_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
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>
33 #include <gp_Ax2.hxx>
34 #include <gp_Pln.hxx>
35 #include <TopoDS_Shape.hxx>
36 #include <TCollection_HAsciiString.hxx>
37
38 class XCAFDimTolObjects_GeomToleranceObject;
39 DEFINE_STANDARD_HANDLE(XCAFDimTolObjects_GeomToleranceObject, Standard_Transient)
40
41 //! Access object to store dimension and tolerance
42 class XCAFDimTolObjects_GeomToleranceObject : public Standard_Transient
43 {
44
45 public:
46   
47   Standard_EXPORT XCAFDimTolObjects_GeomToleranceObject();
48   
49   Standard_EXPORT XCAFDimTolObjects_GeomToleranceObject(const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObj);
50   
51   //! Returns semantic name
52   Standard_EXPORT Handle(TCollection_HAsciiString) GetSemanticName() const;
53
54   //! Sets semantic name
55   Standard_EXPORT void SetSemanticName(const Handle(TCollection_HAsciiString)& theName);
56
57   //! Sets type of the object.
58   Standard_EXPORT void SetType (const XCAFDimTolObjects_GeomToleranceType theType);
59   
60   //! Returns type of the object.
61   Standard_EXPORT XCAFDimTolObjects_GeomToleranceType GetType() const;
62   
63   //! Sets type of tolerance value.
64   Standard_EXPORT void SetTypeOfValue (const XCAFDimTolObjects_GeomToleranceTypeValue theTypeOfValue);
65   
66   //! Returns type of tolerance value.
67   Standard_EXPORT XCAFDimTolObjects_GeomToleranceTypeValue GetTypeOfValue() const;
68   
69   //! Sets tolerance value.
70   Standard_EXPORT void SetValue (const Standard_Real theValue);
71   
72   //! Returns tolerance value.
73   Standard_EXPORT Standard_Real GetValue() const;
74   
75   //! Sets material requirement of the tolerance.
76   Standard_EXPORT void SetMaterialRequirementModifier (const XCAFDimTolObjects_GeomToleranceMatReqModif theMatReqModif);
77   
78   //! Returns material requirement of the tolerance.
79   Standard_EXPORT XCAFDimTolObjects_GeomToleranceMatReqModif GetMaterialRequirementModifier() const;
80   
81   //! Sets tolerance zone.
82   Standard_EXPORT void SetZoneModifier (const XCAFDimTolObjects_GeomToleranceZoneModif theZoneModif);
83   
84   //! Returns tolerance zone.
85   Standard_EXPORT XCAFDimTolObjects_GeomToleranceZoneModif GetZoneModifier() const;
86   
87   //! Sets value associated with tolerance zone.
88   Standard_EXPORT void SetValueOfZoneModifier (const Standard_Real theValue);
89   
90   //! Returns value associated with tolerance zone.
91   Standard_EXPORT Standard_Real GetValueOfZoneModifier() const;
92   
93   //! Sets new sequence of tolerance modifiers.
94   Standard_EXPORT void SetModifiers (const XCAFDimTolObjects_GeomToleranceModifiersSequence& theModifiers);
95   
96   //! Adds a tolerance modifier to the sequence of modifiers.
97   Standard_EXPORT void AddModifier (const XCAFDimTolObjects_GeomToleranceModif theModifier);
98   
99   //! Returns a sequence of modifiers of the tolerance.
100   Standard_EXPORT XCAFDimTolObjects_GeomToleranceModifiersSequence GetModifiers() const;
101   
102   //! Sets the maximal upper tolerance value for tolerance with modifiers.
103   Standard_EXPORT void SetMaxValueModifier (const Standard_Real theModifier);
104   
105   //! Returns the maximal upper tolerance.
106   Standard_EXPORT Standard_Real GetMaxValueModifier() const;
107
108   Standard_EXPORT void SetAxis (const gp_Ax2 theAxis);
109   
110   Standard_EXPORT gp_Ax2 GetAxis() const;
111    
112   Standard_EXPORT Standard_Boolean HasAxis () const;
113
114   //! Sets annotation plane.
115   void SetPlane (const gp_Ax2& thePlane)
116   {
117     myPlane = thePlane;
118     myHasPlane = Standard_True;
119   }
120
121   //! Returns annotation plane.
122   const gp_Ax2& GetPlane() const { return myPlane; }
123
124   //! Sets reference point.
125   void SetPoint (const gp_Pnt& thePnt)
126   {
127     myPnt = thePnt;
128     myHasPnt = Standard_True;
129   }
130
131   //! Returns reference point.
132   const gp_Pnt& GetPoint() const { return myPnt; }
133
134   //! Sets text position.
135   void SetPointTextAttach (const gp_Pnt& thePntText)
136   {
137     myPntText = thePntText;
138     myHasPntText = Standard_True;
139   }
140
141   //! Returns the text position.
142   const gp_Pnt& GetPointTextAttach() const 
143   { 
144     return myPntText; 
145   }
146
147   //! Returns True if the object has annotation plane.
148   Standard_Boolean HasPlane() const { return myHasPlane; }
149
150   //! Returns True if reference point is specified.
151   Standard_Boolean HasPoint() const { return myHasPnt; }
152   
153   //! Returns True if text position is specified.
154   Standard_Boolean HasPointText() const 
155   { 
156     return myHasPntText; 
157   }
158    
159   //! Set graphical presentation for object.
160   void SetPresentation(const TopoDS_Shape& thePresentation, 
161     const Handle(TCollection_HAsciiString)& thePresentationName)
162   {
163     myPresentation = thePresentation;
164     myPresentationName = thePresentationName;
165   }
166
167   //! Returns graphical presentation of the object.
168   TopoDS_Shape GetPresentation() const
169   {
170     return myPresentation;
171   }
172
173   //! Returns graphical presentation of the object.
174   Handle(TCollection_HAsciiString) GetPresentationName() const
175   {
176     return myPresentationName;
177   }
178
179   // Returns true, if affected plane is specified.
180   bool HasAffectedPlane() const
181   {
182     return (myAffectedPlaneType != XCAFDimTolObjects_ToleranceZoneAffectedPlane_None);
183   }
184
185   // Returns type of affected plane.
186   XCAFDimTolObjects_ToleranceZoneAffectedPlane GetAffectedPlaneType() const
187   {
188     return myAffectedPlaneType;
189   }
190
191   // Sets affected plane type.
192   void SetAffectedPlaneType(const XCAFDimTolObjects_ToleranceZoneAffectedPlane theType)
193   {
194     myAffectedPlaneType = theType;
195   }
196
197   //! Sets affected plane.
198   void SetAffectedPlane(const gp_Pln& thePlane)
199   {
200     myAffectedPlane = thePlane;
201   }
202
203   //! Sets affected plane.
204   void SetAffectedPlane(const gp_Pln& thePlane,
205                         const XCAFDimTolObjects_ToleranceZoneAffectedPlane theType)
206   {
207     myAffectedPlaneType = theType;
208     myAffectedPlane = thePlane;
209   }
210
211   //! Returns affected plane.
212   const gp_Pln& GetAffectedPlane() const
213   { 
214     return myAffectedPlane;
215   }
216
217
218   DEFINE_STANDARD_RTTIEXT(XCAFDimTolObjects_GeomToleranceObject,Standard_Transient)
219
220 private: 
221
222   XCAFDimTolObjects_GeomToleranceType myType;
223   XCAFDimTolObjects_GeomToleranceTypeValue myTypeOfValue;
224   Standard_Real myValue;
225   XCAFDimTolObjects_GeomToleranceMatReqModif myMatReqModif;
226   XCAFDimTolObjects_GeomToleranceZoneModif myZoneModif;
227   Standard_Real myValueOfZoneModif;
228   XCAFDimTolObjects_GeomToleranceModifiersSequence myModifiers;
229   Standard_Real myMaxValueModif;
230   gp_Ax2 myAxis;
231   Standard_Boolean myHasAxis;
232   gp_Ax2 myPlane;
233   gp_Pnt myPnt;
234   gp_Pnt myPntText;
235   Standard_Boolean myHasPlane;
236   Standard_Boolean myHasPnt;
237   Standard_Boolean myHasPntText;
238   TopoDS_Shape myPresentation;
239   Handle(TCollection_HAsciiString) mySemanticName;
240   Handle(TCollection_HAsciiString) myPresentationName;
241   XCAFDimTolObjects_ToleranceZoneAffectedPlane myAffectedPlaneType;
242   gp_Pln myAffectedPlane;
243
244 };
245
246 #endif // _XCAFDimTolObjects_GeomToleranceObject_HeaderFile