9ebaae37 |
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_DatumObject_HeaderFile |
18 | #define _XCAFDimTolObjects_DatumObject_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <XCAFDimTolObjects_DatumObjectSequence.hxx> |
1c9d3225 |
24 | #include <XCAFDimTolObjects_DatumTargetType.hxx> |
9ebaae37 |
25 | #include <TCollection_HAsciiString.hxx> |
26 | #include <XCAFDimTolObjects_DatumModifiersSequence.hxx> |
27 | #include <XCAFDimTolObjects_DatumModifWithValue.hxx> |
28 | #include <Standard_Real.hxx> |
29 | #include <TopoDS_Shape.hxx> |
30 | #include <Standard_Transient.hxx> |
31 | #include <XCAFDimTolObjects_DatumSingleModif.hxx> |
32 | #include <Standard_Boolean.hxx> |
1c9d3225 |
33 | #include <gp_Ax2.hxx> |
9ebaae37 |
34 | |
35 | class XCAFDimTolObjects_DatumObject; |
36 | DEFINE_STANDARD_HANDLE(XCAFDimTolObjects_DatumObject, Standard_Transient) |
37 | |
a8a3b37c |
38 | //! Access object to store datum |
9ebaae37 |
39 | class XCAFDimTolObjects_DatumObject : public Standard_Transient |
40 | { |
41 | |
42 | public: |
43 | |
44 | Standard_EXPORT XCAFDimTolObjects_DatumObject(); |
45 | |
46 | Standard_EXPORT XCAFDimTolObjects_DatumObject(const Handle(XCAFDimTolObjects_DatumObject)& theObj); |
eacdb38f |
47 | |
48 | //! Returns semantic name |
49 | Standard_EXPORT Handle(TCollection_HAsciiString) GetSemanticName() const; |
50 | |
51 | //! Sets semantic name |
52 | Standard_EXPORT void SetSemanticName(const Handle(TCollection_HAsciiString)& theName); |
53 | |
a8a3b37c |
54 | //! Returns datum name. |
9ebaae37 |
55 | Standard_EXPORT Handle(TCollection_HAsciiString) GetName() const; |
56 | |
a8a3b37c |
57 | //! Sets datum name. |
9ebaae37 |
58 | Standard_EXPORT void SetName (const Handle(TCollection_HAsciiString)& theTag); |
59 | |
a8a3b37c |
60 | //! Returns a sequence of modifiers of the datum. |
9ebaae37 |
61 | Standard_EXPORT XCAFDimTolObjects_DatumModifiersSequence GetModifiers() const; |
62 | |
a8a3b37c |
63 | //! Sets new sequence of datum modifiers. |
9ebaae37 |
64 | Standard_EXPORT void SetModifiers (const XCAFDimTolObjects_DatumModifiersSequence& theModifiers); |
65 | |
a8a3b37c |
66 | //! Retrieves datum modifier with value. |
67 | Standard_EXPORT void GetModifierWithValue (XCAFDimTolObjects_DatumModifWithValue& theModifier, |
68 | Standard_Real& theValue) const; |
9ebaae37 |
69 | |
a8a3b37c |
70 | //! Sets datum modifier with value. |
71 | Standard_EXPORT void SetModifierWithValue (const XCAFDimTolObjects_DatumModifWithValue theModifier, |
72 | const Standard_Real theValue); |
9ebaae37 |
73 | |
a8a3b37c |
74 | //! Adds a modifier to the datum sequence of modifiers. |
9ebaae37 |
75 | Standard_EXPORT void AddModifier (const XCAFDimTolObjects_DatumSingleModif theModifier); |
76 | |
a8a3b37c |
77 | //! Returns datum target shape. |
9ebaae37 |
78 | Standard_EXPORT TopoDS_Shape GetDatumTarget() const; |
79 | |
a8a3b37c |
80 | //! Sets datum target shape. |
9ebaae37 |
81 | Standard_EXPORT void SetDatumTarget (const TopoDS_Shape& theShape); |
1c9d3225 |
82 | |
a8a3b37c |
83 | //! Returns datum position in the related geometric tolerance object. |
1c9d3225 |
84 | Standard_EXPORT Standard_Integer GetPosition () const; |
85 | |
a8a3b37c |
86 | //! Sets datum position in the related geometric tolerance object. |
1c9d3225 |
87 | Standard_EXPORT void SetPosition (const Standard_Integer thePosition); |
9ebaae37 |
88 | |
a8a3b37c |
89 | //! Returns True if the datum target is specified. |
9ebaae37 |
90 | Standard_EXPORT Standard_Boolean IsDatumTarget() const; |
91 | |
a8a3b37c |
92 | //! Sets or drops the datum target indicator. |
1c9d3225 |
93 | Standard_EXPORT void IsDatumTarget(const Standard_Boolean theIsDT); |
94 | |
a8a3b37c |
95 | //! Returns datum target type |
1c9d3225 |
96 | Standard_EXPORT XCAFDimTolObjects_DatumTargetType GetDatumTargetType() const; |
97 | |
a8a3b37c |
98 | //! Sets datum target to point, line, rectangle, circle or area type. |
1c9d3225 |
99 | Standard_EXPORT void SetDatumTargetType (const XCAFDimTolObjects_DatumTargetType theType); |
100 | |
a8a3b37c |
101 | //! Returns datum target axis. |
102 | //! The Z axis of the datum placement denotes the normal of the surface |
103 | //! pointing away from the material. |
1c9d3225 |
104 | Standard_EXPORT gp_Ax2 GetDatumTargetAxis() const; |
105 | |
a8a3b37c |
106 | //! Sets datum target axis. |
1c9d3225 |
107 | Standard_EXPORT void SetDatumTargetAxis (const gp_Ax2& theAxis); |
108 | |
a8a3b37c |
109 | //! Returns datum target length for line and rectangle types. |
110 | //! The length along the X axis of the datum placement. |
1c9d3225 |
111 | Standard_EXPORT Standard_Real GetDatumTargetLength() const; |
112 | |
a8a3b37c |
113 | //! Sets datum target length. |
1c9d3225 |
114 | Standard_EXPORT void SetDatumTargetLength (const Standard_Real theLength); |
115 | |
a8a3b37c |
116 | //! Returns datum target width for rectangle type. |
117 | //! The width along the derived Y axis, with the placement itself positioned |
118 | //! at the centre of the rectangle. |
1c9d3225 |
119 | Standard_EXPORT Standard_Real GetDatumTargetWidth() const; |
120 | |
a8a3b37c |
121 | //! Sets datum target width. |
1c9d3225 |
122 | Standard_EXPORT void SetDatumTargetWidth (const Standard_Real theWidth); |
123 | |
a8a3b37c |
124 | //! Returns datum target number. |
6595eee7 |
125 | Standard_EXPORT Standard_Integer GetDatumTargetNumber() const; |
126 | |
a8a3b37c |
127 | //! Sets datum target number. |
6595eee7 |
128 | Standard_EXPORT void SetDatumTargetNumber (const Standard_Integer theNumber); |
129 | |
a8a3b37c |
130 | //! Sets annotation plane. |
0f57ab75 |
131 | void SetPlane (const gp_Ax2& thePlane) |
5df609e7 |
132 | { |
133 | myPlane = thePlane; |
134 | myHasPlane = Standard_True; |
135 | } |
136 | |
a8a3b37c |
137 | //! Returns annotation plane. |
0f57ab75 |
138 | const gp_Ax2& GetPlane() const { return myPlane; } |
5df609e7 |
139 | |
a8a3b37c |
140 | //! Sets a point on the datum target shape. |
0f57ab75 |
141 | void SetPoint (const gp_Pnt& thePnt) |
5df609e7 |
142 | { |
143 | myPnt = thePnt; |
144 | myHasPnt = Standard_True; |
145 | } |
146 | |
a8a3b37c |
147 | //! Gets point on the datum shape. |
0f57ab75 |
148 | const gp_Pnt& GetPoint() const |
5df609e7 |
149 | { |
150 | return myPnt; |
151 | } |
a8a3b37c |
152 | |
153 | //! Sets a position of the datum text. |
0f57ab75 |
154 | void SetPointTextAttach (const gp_Pnt& thePntText) |
5df609e7 |
155 | { |
156 | myPntText = thePntText; |
157 | myHasPntText = Standard_True; |
158 | } |
159 | |
a8a3b37c |
160 | //! Gets datum text position. |
0f57ab75 |
161 | const gp_Pnt& GetPointTextAttach() const |
5df609e7 |
162 | { |
163 | return myPntText; |
164 | } |
165 | |
a8a3b37c |
166 | //! Returns True if the datum has annotation plane. |
5df609e7 |
167 | Standard_Boolean HasPlane() const { return myHasPlane; } |
168 | |
a8a3b37c |
169 | //! Returns True if point on the datum target is specified. |
5df609e7 |
170 | Standard_Boolean HasPoint() const { return myHasPnt; } |
171 | |
a8a3b37c |
172 | //! Returns True if the datum text position is specified. |
0f57ab75 |
173 | Standard_Boolean HasPointText() const |
5df609e7 |
174 | { |
175 | return myHasPntText; |
176 | } |
177 | |
a8a3b37c |
178 | //! Set graphical presentation for object. |
0f57ab75 |
179 | void SetPresentation(const TopoDS_Shape& thePresentation, |
5df609e7 |
180 | const Handle(TCollection_HAsciiString)& thePresentationName) |
181 | { |
182 | myPresentation = thePresentation; |
183 | myPresentationName = thePresentationName; |
184 | } |
185 | |
a8a3b37c |
186 | //! Returns graphical presentation of the object. |
0f57ab75 |
187 | TopoDS_Shape GetPresentation() const |
5df609e7 |
188 | { |
189 | return myPresentation; |
190 | } |
191 | |
0f57ab75 |
192 | //! Returns graphical presentation of the object. |
193 | Handle(TCollection_HAsciiString) GetPresentationName() const |
5df609e7 |
194 | { |
195 | return myPresentationName; |
196 | } |
197 | |
a8a3b37c |
198 | //! Returns True if the datum has valid parameters for datum target (width, length, circle radius etc) |
0f57ab75 |
199 | Standard_Boolean HasDatumTargetParams() |
400af1bc |
200 | { |
201 | return myIsValidDT; |
202 | } |
9ebaae37 |
203 | |
92efcf78 |
204 | DEFINE_STANDARD_RTTIEXT(XCAFDimTolObjects_DatumObject,Standard_Transient) |
9ebaae37 |
205 | |
206 | private: |
207 | |
208 | Handle(TCollection_HAsciiString) myName; |
209 | XCAFDimTolObjects_DatumModifiersSequence myModifiers; |
210 | XCAFDimTolObjects_DatumModifWithValue myModifierWithValue; |
211 | Standard_Real myValueOfModifier; |
212 | TopoDS_Shape myDatumTarget; |
1c9d3225 |
213 | Standard_Integer myPosition; |
214 | Standard_Boolean myIsDTarget; |
400af1bc |
215 | Standard_Boolean myIsValidDT; |
1c9d3225 |
216 | XCAFDimTolObjects_DatumTargetType myDTargetType; |
217 | gp_Ax2 myAxis; |
218 | Standard_Real myLength; |
219 | Standard_Real myWidth; |
6595eee7 |
220 | Standard_Integer myDatumTargetNumber; |
5df609e7 |
221 | gp_Ax2 myPlane; |
222 | gp_Pnt myPnt; |
223 | gp_Pnt myPntText; |
224 | Standard_Boolean myHasPlane; |
225 | Standard_Boolean myHasPnt; |
226 | Standard_Boolean myHasPntText; |
227 | TopoDS_Shape myPresentation; |
eacdb38f |
228 | Handle(TCollection_HAsciiString) mySemanticName; |
a8a3b37c |
229 | Handle(TCollection_HAsciiString) myPresentationName; |
9ebaae37 |
230 | }; |
231 | |
232 | #endif // _XCAFDimTolObjects_DatumObject_HeaderFile |