0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / ChFi2d / ChFi2d_Builder.hxx
1 // Created on: 1995-06-12
2 // Created by: Joelle CHAUVET
3 // Copyright (c) 1995-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 _ChFi2d_Builder_HeaderFile
18 #define _ChFi2d_Builder_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22
23 #include <ChFi2d_ConstructionError.hxx>
24 #include <TopoDS_Face.hxx>
25 #include <TopTools_SequenceOfShape.hxx>
26 #include <TopTools_DataMapOfShapeShape.hxx>
27 #include <Standard_Integer.hxx>
28
29 class TopoDS_Edge;
30 class TopoDS_Vertex;
31
32 // resolve name collisions with X11 headers
33 #ifdef Status
34   #undef Status
35 #endif
36
37 //! This  class contains  the algorithm  used to build
38 //! fillet on planar wire.
39 class ChFi2d_Builder 
40 {
41 public:
42
43   DEFINE_STANDARD_ALLOC
44
45   
46   Standard_EXPORT ChFi2d_Builder();
47   
48   //! The face  <F> can be build  on a closed or an open
49   //! wire.
50   Standard_EXPORT ChFi2d_Builder(const TopoDS_Face& F);
51   
52   Standard_EXPORT void Init (const TopoDS_Face& F);
53   
54   Standard_EXPORT void Init (const TopoDS_Face& RefFace, const TopoDS_Face& ModFace);
55   
56   //! Add  a fillet  of   radius  <Radius> on  the  wire
57   //! between the two edges connected to the vertex <V>.
58   //! <AddFillet> returns the  fillet edge. The returned
59   //! edge has  sense only   if the status   <status> is
60   //! <IsDone>
61   Standard_EXPORT TopoDS_Edge AddFillet (const TopoDS_Vertex& V, const Standard_Real Radius);
62   
63   //! modify the fillet radius and return the new fillet
64   //! edge. this    edge has sense  only if   the status
65   //! <status> is <IsDone>.
66   Standard_EXPORT TopoDS_Edge ModifyFillet (const TopoDS_Edge& Fillet, const Standard_Real Radius);
67   
68   //! removes the fillet <Fillet> and returns the vertex
69   //! connecting the two adjacent edges to  this fillet.
70   Standard_EXPORT TopoDS_Vertex RemoveFillet (const TopoDS_Edge& Fillet);
71   
72   //! Add a chamfer on  the  wire between the two  edges
73   //! connected <E1> and  <E2>. <AddChamfer> returns the
74   //! chamfer  edge. This  edge  has  sense only if  the
75   //! status <status> is <IsDone>.
76   Standard_EXPORT TopoDS_Edge AddChamfer (const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2);
77   
78   //! Add  a chamfer on the   wire between the two edges
79   //! connected to the vertex <V>. The chamfer will make
80   //! an  angle <Ang> with the edge  <E>, and one of its
81   //! extremities  will be on  <E>  at distance <D>. The
82   //! returned   edge has sense   only   if the   status
83   //! <status> is <IsDone>.
84   //! Warning: The value of <Ang> must be expressed in Radian.
85   Standard_EXPORT TopoDS_Edge AddChamfer (const TopoDS_Edge& E, const TopoDS_Vertex& V, const Standard_Real D, const Standard_Real Ang);
86   
87   //! modify the chamfer <Chamfer>  and returns  the new
88   //! chamfer edge.
89   //! This edge as sense only  if the status <status> is
90   //! <IsDone>.
91   Standard_EXPORT TopoDS_Edge ModifyChamfer (const TopoDS_Edge& Chamfer, const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2);
92   
93   //! modify the  chamfer <Chamfer>  and returns the new
94   //! chamfer edge. This    edge as sense  only   if the
95   //! status <status>   is  <IsDone>.
96   //! Warning: The value of <Ang> must be expressed in Radian.
97   Standard_EXPORT TopoDS_Edge ModifyChamfer (const TopoDS_Edge& Chamfer, const TopoDS_Edge& E, const Standard_Real D, const Standard_Real Ang);
98   
99   //! removes   the chamfer  <Chamfer>   and returns the
100   //! vertex connecting  the two adjacent  edges to this
101   //! chamfer.
102   Standard_EXPORT TopoDS_Vertex RemoveChamfer (const TopoDS_Edge& Chamfer);
103   
104   //! returns the modified face
105     TopoDS_Face Result() const;
106   
107     Standard_Boolean IsModified (const TopoDS_Edge& E) const;
108   
109   //! returns the list of new edges
110     const TopTools_SequenceOfShape& FilletEdges() const;
111   
112     Standard_Integer NbFillet() const;
113   
114   //! returns the list of new edges
115     const TopTools_SequenceOfShape& ChamferEdges() const;
116   
117     Standard_Integer NbChamfer() const;
118   
119     Standard_Boolean HasDescendant (const TopoDS_Edge& E) const;
120   
121   //! returns the modified edge if <E> has descendant or
122   //! <E> in the other case.
123     const TopoDS_Edge& DescendantEdge (const TopoDS_Edge& E) const;
124   
125   //! Returns the parent edge of  <E>
126   //! Warning: If <E>is a basis edge,  the returned edge would be
127   //! equal to <E>
128   Standard_EXPORT const TopoDS_Edge& BasisEdge (const TopoDS_Edge& E) const;
129   
130     ChFi2d_ConstructionError Status() const;
131
132
133
134
135 protected:
136
137
138
139
140
141 private:
142
143   
144   //! Is internally used by <AddFillet>.
145   //! Warning: <TrimE1>, <TrimE2>, <Fillet> has sense only if the
146   //! status <status> is equal to <IsDone>
147   Standard_EXPORT void ComputeFillet (const TopoDS_Vertex& V, const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real Radius, TopoDS_Edge& TrimE1, TopoDS_Edge& TrimE2, TopoDS_Edge& Fillet);
148   
149   //! Is internally used by  <AddChamfer>. The chamfer is
150   //! computed  from  a  vertex,   two  edges   and  two
151   //! distances
152   //! Warning: <TrimE1>, <TrimE2> and <Chamfer> has sense only if
153   //! if the status <status> is equal to <IsDone>
154   Standard_EXPORT void ComputeChamfer (const TopoDS_Vertex& V, const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2, TopoDS_Edge& TrimE1, TopoDS_Edge& TrimE2, TopoDS_Edge& Chamfer);
155   
156   //! Is internally used by <AddChamfer>.  The chamfer is
157   //! computed from   an  edge,  a  vertex,   a distance
158   //! and an angle
159   //! Warning: <TrimE1>,  <TrimE2>, and <Chamfer> has
160   //! sense only   if  the status <status> is   equal to
161   //! <IsDone>
162   Standard_EXPORT void ComputeChamfer (const TopoDS_Vertex& V, const TopoDS_Edge& E1, const Standard_Real D, const Standard_Real Ang, const TopoDS_Edge& E2, TopoDS_Edge& TrimE1, TopoDS_Edge& TrimE2, TopoDS_Edge& Chamfer);
163   
164   //! Is   internally  used     by  <ComputeFillet>.
165   //! <NewExtr1> and  <NewExtr2>  will  contains the new
166   //! extremities of <AdjEdge1> and <AdjEdge2>
167   //! Warning: The  returned  edge has sense   only if the status
168   //! <status> is equal to <IsDone>
169   //! or to one of those specific cases :
170   //! <FirstEdgeDegenerated>
171   //! <LastEdgeDegenerated>
172   //! <BothEdgesDegenerated>
173   Standard_EXPORT TopoDS_Edge BuildFilletEdge (const TopoDS_Vertex& V, const TopoDS_Edge& AdjEdge1, const TopoDS_Edge& AdjEdge2, const Standard_Real Radius, TopoDS_Vertex& NewExtr1, TopoDS_Vertex& NewExtr2);
174   
175   //! Is   internally  used     by  <ComputeFillet>.
176   //! <NewExtr1> and  <NewExtr2>  will  contains the new
177   //! extremities of <AdjEdge1> and <AdjEdge2>
178   //! Warning: The  returned  edge has sense   only if the status
179   //! <status> is equal to <IsDone>
180   Standard_EXPORT TopoDS_Edge BuildChamferEdge (const TopoDS_Vertex& V, const TopoDS_Edge& AdjEdge1, const TopoDS_Edge& AdjEdge2, const Standard_Real D1, const Standard_Real D2, TopoDS_Vertex& NewExtr1, TopoDS_Vertex& NewExtr2);
181   
182   //! Is   internally  used     by  <ComputeFillet>.
183   //! <NewExtr1> and  <NewExtr2>  will  contains the new
184   //! extremities of <AdjEdge1> and <AdjEdge2>
185   //! Warning: The  returned  edge has sense   only if the status
186   //! <status> is equal to <IsDone>
187   Standard_EXPORT TopoDS_Edge BuildChamferEdge (const TopoDS_Vertex& V, const TopoDS_Edge& AdjEdge2, const Standard_Real D, const Standard_Real Ang, const TopoDS_Edge& AdjEdge1, TopoDS_Vertex& NewExtr1, TopoDS_Vertex& NewExtr2);
188   
189   //! replaces in  the  new face  <newFace> <OldE1>  and
190   //! <OldE2>  by <E1>, <Fillet> and <E2>
191   //! or by <Fillet> and <E2> if <E1> is degenerated
192   //! or by <E1> and <Fillet> if <E2> is degenerated
193   //! or by <Fillet> if <E1> and <E2> are degenerated .
194   Standard_EXPORT void BuildNewWire (const TopoDS_Edge& OldE1, const TopoDS_Edge& OldE2, const TopoDS_Edge& E1, const TopoDS_Edge& Fillet, const TopoDS_Edge& E2);
195   
196   //! Changes <OldExtr> of <E1> by <NewExtr>
197   Standard_EXPORT TopoDS_Edge BuildNewEdge (const TopoDS_Edge& E1, const TopoDS_Vertex& OldExtr, const TopoDS_Vertex& NewExtr) const;
198   
199   //! Changes <OldExtr> of <E1> by <NewExtr>
200   //! returns E1 and IsDegenerated = Standard_True
201   //! if the new edge is degenerated
202   Standard_EXPORT TopoDS_Edge BuildNewEdge (const TopoDS_Edge& E1, const TopoDS_Vertex& OldExtr, const TopoDS_Vertex& NewExtr, Standard_Boolean& IsDegenerated) const;
203   
204   //! Writes <NewEdge> in  <fillets> if <Id> is equal to
205   //! 1, or in <chamfers> if <Id> is Equal to 2.
206   //! Writes  the  modifications  in  <history> :
207   //! <TrimE1> is given by <E1>, <TrimE2> by <E2>
208   //! if <TrimE1> and <TrimE2> are not degenerated.
209   Standard_EXPORT void UpDateHistory (const TopoDS_Edge& E1, const TopoDS_Edge& E2, const TopoDS_Edge& TrimE1, const TopoDS_Edge& TrimE2, const TopoDS_Edge& NewEdge, const Standard_Integer Id);
210   
211   //! Writes the  modifications in  <history> . <TrimE1>
212   //! is given by <E1>, <TrimE2> by <E2>.
213   Standard_EXPORT void UpDateHistory (const TopoDS_Edge& E1, const TopoDS_Edge& E2, const TopoDS_Edge& TrimE1, const TopoDS_Edge& TrimE2);
214   
215   Standard_EXPORT Standard_Boolean IsAFillet (const TopoDS_Edge& E) const;
216   
217   Standard_EXPORT Standard_Boolean IsAChamfer (const TopoDS_Edge& E) const;
218
219
220   ChFi2d_ConstructionError status;
221   TopoDS_Face refFace;
222   TopoDS_Face newFace;
223   TopTools_SequenceOfShape fillets;
224   TopTools_SequenceOfShape chamfers;
225   TopTools_DataMapOfShapeShape history;
226
227
228 };
229
230
231 #include <ChFi2d_Builder.lxx>
232
233
234
235
236
237 #endif // _ChFi2d_Builder_HeaderFile