42cf5bc1 |
1 | // Created on: 1993-11-09 |
2 | // Created by: Laurent BOURESCHE |
3 | // Copyright (c) 1993-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _ChFiDS_Spine_HeaderFile |
18 | #define _ChFiDS_Spine_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <BRepAdaptor_Curve.hxx> |
24 | #include <Standard_Integer.hxx> |
25 | #include <ChFiDS_State.hxx> |
26 | #include <TopTools_SequenceOfShape.hxx> |
27 | #include <TColStd_HArray1OfReal.hxx> |
28 | #include <Standard_Boolean.hxx> |
29 | #include <ChFiDS_ListOfHElSpine.hxx> |
30 | #include <Standard_Real.hxx> |
31 | #include <gp_Pnt.hxx> |
32 | #include <gp_Vec.hxx> |
33 | #include <ChFiDS_ErrorStatus.hxx> |
34 | #include <MMgt_TShared.hxx> |
35 | #include <GeomAbs_CurveType.hxx> |
36 | class TopoDS_Edge; |
37 | class ChFiDS_HElSpine; |
38 | class gp_Pnt; |
39 | class gp_Vec; |
40 | class BRepAdaptor_Curve; |
41 | class gp_Lin; |
42 | class gp_Circ; |
43 | class TopoDS_Vertex; |
44 | |
45 | |
46 | class ChFiDS_Spine; |
47 | DEFINE_STANDARD_HANDLE(ChFiDS_Spine, MMgt_TShared) |
48 | |
49 | //! Contains information necessary for construction of |
50 | //! a 3D fillet or chamfer: |
51 | //! |
52 | //! - guideline composed of edges of the solid, tangents |
53 | //! between them, and borders by faces tangents |
54 | //! between them. |
55 | //! |
56 | //! Tools for construction of the Sp |
57 | //! by propagation from an edge of solid |
58 | //! are provided in the Builder of Fil3d. |
59 | //! |
60 | //! The Spine contains among others the |
61 | //! information about the nature of extremities |
62 | //! of the fillet ( on free border , on section or closed ). |
63 | //! |
64 | //! IMPORTANT NOTE : the guideline |
65 | //! represented in this way is not C2, although the path |
66 | //! claims it. Several palliative workarounds |
67 | //! (see the methods at the end) are planned, |
68 | //! but they are not enough. It is necessary to change |
69 | //! the approach and double the Spine of line C2 with |
70 | //! the known consequences for management of |
71 | //! interactions between KPart Blend in Fil3d. |
72 | class ChFiDS_Spine : public MMgt_TShared |
73 | { |
74 | |
75 | public: |
76 | |
77 | |
78 | Standard_EXPORT ChFiDS_Spine(); |
79 | |
80 | Standard_EXPORT ChFiDS_Spine(const Standard_Real Tol); |
81 | |
82 | //! store edges composing the guideline |
83 | void SetEdges (const TopoDS_Edge& E); |
84 | |
85 | //! store the edge at the first position before all others |
86 | void PutInFirst (const TopoDS_Edge& E); |
87 | |
88 | Standard_Integer NbEdges() const; |
89 | |
90 | const TopoDS_Edge& Edges (const Standard_Integer I) const; |
91 | |
92 | //! stores if the start of a set of edges starts on a |
93 | //! section of free border or forms a closed contour |
94 | void SetFirstStatus (const ChFiDS_State S); |
95 | |
96 | //! stores if the end of a set of edges starts on a |
97 | //! section of free border or forms a closed contour |
98 | void SetLastStatus (const ChFiDS_State S); |
99 | |
100 | Standard_EXPORT virtual void AppendElSpine (const Handle(ChFiDS_HElSpine)& Els); |
101 | |
102 | Standard_EXPORT Handle(ChFiDS_HElSpine) ElSpine (const Standard_Integer IE) const; |
103 | |
104 | Standard_EXPORT Handle(ChFiDS_HElSpine) ElSpine (const TopoDS_Edge& E) const; |
105 | |
106 | Standard_EXPORT Handle(ChFiDS_HElSpine) ElSpine (const Standard_Real W) const; |
107 | |
108 | Standard_EXPORT ChFiDS_ListOfHElSpine& ChangeElSpines(); |
109 | |
110 | Standard_EXPORT virtual void Reset (const Standard_Boolean AllData = Standard_False); |
111 | |
112 | Standard_EXPORT Standard_Boolean SplitDone() const; |
113 | |
114 | Standard_EXPORT void SplitDone (const Standard_Boolean B); |
115 | |
116 | //! prepare the guideline depending on the edges that |
117 | //! are elementary arks (take parameters from |
118 | //! a single curvilinear abscissa); to be able to call |
119 | //! methods on the geometry (first,last,value,d1,d2) |
120 | //! it is necessary to start with preparation otherwise an |
121 | //! exception will be raised |
122 | Standard_EXPORT void Load(); |
123 | |
124 | Standard_EXPORT Standard_Real Resolution (const Standard_Real R3d) const; |
125 | |
126 | Standard_EXPORT Standard_Boolean IsClosed() const; |
127 | |
128 | Standard_EXPORT Standard_Real FirstParameter() const; |
129 | |
130 | Standard_EXPORT Standard_Real LastParameter() const; |
131 | |
132 | Standard_EXPORT void SetFirstParameter (const Standard_Real Par); |
133 | |
134 | Standard_EXPORT void SetLastParameter (const Standard_Real Par); |
135 | |
136 | //! gives the total length of all arcs before the |
137 | //! number IndexSp |
138 | Standard_EXPORT Standard_Real FirstParameter (const Standard_Integer IndexSpine) const; |
139 | |
140 | //! gives the total length till the ark with number |
141 | //! IndexSpine (inclus) |
142 | Standard_EXPORT Standard_Real LastParameter (const Standard_Integer IndexSpine) const; |
143 | |
144 | //! gives the length of ark with number IndexSp |
145 | Standard_EXPORT Standard_Real Length (const Standard_Integer IndexSpine) const; |
146 | |
147 | Standard_EXPORT Standard_Boolean IsPeriodic() const; |
148 | |
149 | Standard_EXPORT Standard_Real Period() const; |
150 | |
151 | Standard_EXPORT Standard_Real Absc (const Standard_Real U); |
152 | |
153 | Standard_EXPORT Standard_Real Absc (const Standard_Real U, const Standard_Integer I); |
154 | |
155 | Standard_EXPORT void Parameter (const Standard_Real AbsC, Standard_Real& U, const Standard_Boolean Oriented = Standard_True); |
156 | |
157 | Standard_EXPORT void Parameter (const Standard_Integer Index, const Standard_Real AbsC, Standard_Real& U, const Standard_Boolean Oriented = Standard_True); |
158 | |
159 | Standard_EXPORT gp_Pnt Value (const Standard_Real AbsC); |
160 | |
161 | Standard_EXPORT void D0 (const Standard_Real AbsC, gp_Pnt& P); |
162 | |
163 | Standard_EXPORT void D1 (const Standard_Real AbsC, gp_Pnt& P, gp_Vec& V1); |
164 | |
165 | Standard_EXPORT void D2 (const Standard_Real AbsC, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2); |
166 | |
167 | Standard_EXPORT void SetCurrent (const Standard_Integer Index); |
168 | |
169 | //! sets the current curve and returns it |
170 | Standard_EXPORT const BRepAdaptor_Curve& CurrentElementarySpine (const Standard_Integer Index); |
171 | |
172 | Standard_Integer CurrentIndexOfElementarySpine() const; |
173 | |
174 | Standard_EXPORT GeomAbs_CurveType GetType() const; |
175 | |
176 | Standard_EXPORT gp_Lin Line() const; |
177 | |
178 | Standard_EXPORT gp_Circ Circle() const; |
179 | |
180 | //! returns if the set of edges starts on a free boundary |
181 | //! or if the first vertex is a breakpoint or if the set is |
182 | //! closed |
183 | ChFiDS_State FirstStatus() const; |
184 | |
185 | //! returns the state at the end of the set |
186 | ChFiDS_State LastStatus() const; |
187 | |
188 | ChFiDS_State Status (const Standard_Boolean IsFirst) const; |
189 | |
190 | void SetStatus (const ChFiDS_State S, const Standard_Boolean IsFirst); |
191 | |
192 | //! returns if the set of edges starts (or end) on |
193 | //! Tangency point. |
194 | Standard_Boolean IsTangencyExtremity (const Standard_Boolean IsFirst) const; |
195 | |
196 | void SetTangencyExtremity (const Standard_Boolean IsTangency, const Standard_Boolean IsFirst); |
197 | |
198 | Standard_EXPORT Standard_Real Absc (const TopoDS_Vertex& V) const; |
199 | |
200 | Standard_EXPORT TopoDS_Vertex FirstVertex() const; |
201 | |
202 | Standard_EXPORT TopoDS_Vertex LastVertex() const; |
203 | |
204 | Standard_EXPORT void SetFirstTgt (const Standard_Real W); |
205 | |
206 | Standard_EXPORT void SetLastTgt (const Standard_Real W); |
207 | |
208 | Standard_EXPORT Standard_Boolean HasFirstTgt() const; |
209 | |
210 | Standard_EXPORT Standard_Boolean HasLastTgt() const; |
211 | |
212 | //! set a parameter reference for the approx. |
213 | Standard_EXPORT void SetReference (const Standard_Real W); |
214 | |
215 | //! set a parameter reference for the approx, at the |
216 | //! middle of edge I. |
217 | Standard_EXPORT void SetReference (const Standard_Integer I); |
218 | |
219 | Standard_EXPORT Standard_Integer Index (const Standard_Real W, const Standard_Boolean Forward = Standard_True) const; |
220 | |
221 | Standard_EXPORT Standard_Integer Index (const TopoDS_Edge& E) const; |
222 | |
223 | Standard_EXPORT void UnsetReference(); |
224 | |
225 | Standard_EXPORT void SetErrorStatus (const ChFiDS_ErrorStatus state); |
226 | |
227 | Standard_EXPORT ChFiDS_ErrorStatus ErrorStatus() const; |
228 | |
229 | |
230 | |
231 | |
232 | DEFINE_STANDARD_RTTI(ChFiDS_Spine,MMgt_TShared) |
233 | |
234 | protected: |
235 | |
236 | |
237 | Standard_Boolean splitdone; |
238 | ChFiDS_ListOfHElSpine elspines; |
239 | |
240 | |
241 | private: |
242 | |
243 | |
244 | Standard_EXPORT void Prepare (Standard_Real& L, Standard_Integer& Index) const; |
245 | |
246 | BRepAdaptor_Curve myCurve; |
247 | Standard_Integer indexofcurve; |
248 | ChFiDS_State firstState; |
249 | ChFiDS_State lastState; |
250 | TopTools_SequenceOfShape spine; |
251 | Handle(TColStd_HArray1OfReal) abscissa; |
252 | Standard_Real tolesp; |
253 | Standard_Real firstparam; |
254 | Standard_Real lastparam; |
255 | Standard_Boolean firstprolon; |
256 | Standard_Boolean lastprolon; |
257 | Standard_Boolean firstistgt; |
258 | Standard_Boolean lastistgt; |
259 | Standard_Real firsttgtpar; |
260 | Standard_Real lasttgtpar; |
261 | Standard_Boolean hasfirsttgt; |
262 | Standard_Boolean haslasttgt; |
263 | gp_Pnt firstori; |
264 | gp_Pnt lastori; |
265 | gp_Vec firsttgt; |
266 | gp_Vec lasttgt; |
267 | Standard_Real valref; |
268 | Standard_Boolean hasref; |
269 | ChFiDS_ErrorStatus errorstate; |
270 | |
271 | |
272 | }; |
273 | |
274 | |
275 | #include <ChFiDS_Spine.lxx> |
276 | |
277 | |
278 | |
279 | |
280 | |
281 | #endif // _ChFiDS_Spine_HeaderFile |