46eb9c7c8b09e6a1348515a20110b6b520dcc612
[occt.git] / src / BRep / BRep_Builder.hxx
1 // Created on: 1991-07-01
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1991-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 _BRep_Builder_HeaderFile
18 #define _BRep_Builder_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <TopoDS_Builder.hxx>
25 #include <Standard_Real.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <GeomAbs_Shape.hxx>
28 class Standard_NullObject;
29 class Standard_DomainError;
30 class TopoDS_Face;
31 class Geom_Surface;
32 class TopLoc_Location;
33 class Poly_Triangulation;
34 class TopoDS_Edge;
35 class Geom_Curve;
36 class Poly_Polygon3D;
37 class Poly_PolygonOnTriangulation;
38 class Geom2d_Curve;
39 class gp_Pnt2d;
40 class Poly_Polygon2D;
41 class TopoDS_Vertex;
42 class gp_Pnt;
43
44
45 //! A framework providing advanced tolerance control.
46 //! It is used to build Shapes.
47 //! If tolerance control is required, you are advised to:
48 //! 1. build a default precision for topology, using the
49 //! classes provided in the BRepAPI package
50 //! 2. update the tolerance of the resulting shape.
51 //! Note that only vertices, edges and faces have
52 //! meaningful tolerance control. The tolerance value
53 //! must always comply with the condition that face
54 //! tolerances are more restrictive than edge tolerances
55 //! which are more restrictive than vertex tolerances. In
56 //! other words: Tol(Vertex) >= Tol(Edge) >= Tol(Face).
57 //! Other rules in setting tolerance include:
58 //! - you can open up tolerance but should never restrict it
59 //! - an edge cannot be included within the fusion of the
60 //! tolerance spheres of two vertices
61 class BRep_Builder  : public TopoDS_Builder
62 {
63 public:
64
65   DEFINE_STANDARD_ALLOC
66
67   
68   //! Makes an undefined Face.
69     void MakeFace (TopoDS_Face& F) const;
70   
71   //! Makes a Face with a surface.
72   Standard_EXPORT void MakeFace (TopoDS_Face& F, const Handle(Geom_Surface)& S, const Standard_Real Tol) const;
73   
74   //! Makes a Face with a surface and a location.
75   Standard_EXPORT void MakeFace (TopoDS_Face& F, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol) const;
76   
77   //! Makes a Face with a triangulation. The triangulation
78   //! is in the same reference system than the TFace.
79   Standard_EXPORT void MakeFace (TopoDS_Face& F, const Handle(Poly_Triangulation)& T) const;
80   
81   //! Updates the face F using the tolerance value Tol,
82   //! surface S and location Location.
83   Standard_EXPORT void UpdateFace (const TopoDS_Face& F, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol) const;
84   
85   //! Changes a  face triangulation.
86   //!
87   //! A null Triangulation removes the triangulation.
88   Standard_EXPORT void UpdateFace (const TopoDS_Face& F, const Handle(Poly_Triangulation)& T) const;
89   
90   //! Updates the face Tolerance.
91   Standard_EXPORT void UpdateFace (const TopoDS_Face& F, const Standard_Real Tol) const;
92   
93   //! Sets the  NaturalRestriction flag of  the face.
94   Standard_EXPORT void NaturalRestriction (const TopoDS_Face& F, const Standard_Boolean N) const;
95   
96   //! Makes an undefined Edge (no geometry).
97   Standard_EXPORT void MakeEdge (TopoDS_Edge& E) const;
98   
99   //! Makes an Edge with a curve.
100     void MakeEdge (TopoDS_Edge& E, const Handle(Geom_Curve)& C, const Standard_Real Tol) const;
101   
102   //! Makes an Edge with a curve and a location.
103     void MakeEdge (TopoDS_Edge& E, const Handle(Geom_Curve)& C, const TopLoc_Location& L, const Standard_Real Tol) const;
104   
105   //! Makes an Edge with a polygon 3d.
106     void MakeEdge (TopoDS_Edge& E, const Handle(Poly_Polygon3D)& P) const;
107   
108   //! makes an Edge polygon on Triangulation.
109     void MakeEdge (TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N, const Handle(Poly_Triangulation)& T) const;
110   
111   //! makes an Edge polygon on Triangulation.
112     void MakeEdge (TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N, const Handle(Poly_Triangulation)& T, const TopLoc_Location& L) const;
113   
114   //! Sets a 3D curve for the edge.
115   //! If <C> is a null handle, remove any existing 3d curve.
116     void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom_Curve)& C, const Standard_Real Tol) const;
117   
118   //! Sets a 3D curve for the edge.
119   //! If <C> is a null handle, remove any existing 3d curve.
120   Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom_Curve)& C, const TopLoc_Location& L, const Standard_Real Tol) const;
121   
122   //! Sets a pcurve for the edge on the face.
123   //! If <C> is a null handle, remove any existing pcurve.
124     void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom2d_Curve)& C, const TopoDS_Face& F, const Standard_Real Tol) const;
125   
126   //! Sets pcurves for the edge on the  closed face.  If
127   //! <C1> or <C2> is a null handle, remove any existing
128   //! pcurve.
129     void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2, const TopoDS_Face& F, const Standard_Real Tol) const;
130   
131   //! Sets a pcurve for the edge on the face.
132   //! If <C> is a null handle, remove any existing pcurve.
133   Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom2d_Curve)& C, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol) const;
134   
135   //! Sets a pcurve for the edge on the face.
136   //! If <C> is a null handle, remove any existing pcurve.
137   //! Sets UV bounds for curve repsentation
138   Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom2d_Curve)& C, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol, const gp_Pnt2d& Pf, const gp_Pnt2d& Pl) const;
139   
140   //! Sets pcurves for the edge on the closed surface.
141   //! <C1> or <C2> is a null handle, remove any existing
142   //! pcurve.
143   Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol) const;
144   
145   //! Sets pcurves for the edge on the closed surface.
146   //! <C1> or <C2> is a null handle, remove any existing
147   //! pcurve.
148   //! Sets UV bounds for curve repsentation
149   Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol, const gp_Pnt2d& Pf, const gp_Pnt2d& Pl) const;
150   
151   //! Changes an Edge 3D polygon.
152   //! A null Polygon removes the 3d Polygon.
153     void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon3D)& P) const;
154   
155   //! Changes an Edge 3D polygon.
156   //! A null Polygon removes the 3d Polygon.
157   Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon3D)& P, const TopLoc_Location& L) const;
158   
159   //! Changes an Edge polygon on Triangulation.
160     void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N, const Handle(Poly_Triangulation)& T) const;
161   
162   //! Changes an Edge polygon on Triangulation.
163   Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N, const Handle(Poly_Triangulation)& T, const TopLoc_Location& L) const;
164   
165   //! Changes an Edge polygon on Triangulation.
166     void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N1, const Handle(Poly_PolygonOnTriangulation)& N2, const Handle(Poly_Triangulation)& T) const;
167   
168   //! Changes an Edge polygon on Triangulation.
169   Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N1, const Handle(Poly_PolygonOnTriangulation)& N2, const Handle(Poly_Triangulation)& T, const TopLoc_Location& L) const;
170   
171   //! Changes Edge polygon on a face.
172   Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon2D)& P, const TopoDS_Face& S) const;
173   
174   //! Changes Edge polygon on a face.
175   Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon2D)& P, const Handle(Geom_Surface)& S, const TopLoc_Location& T) const;
176   
177   //! Changes Edge polygons on a face.
178   //!
179   //! A null Polygon removes the 2d Polygon.
180   Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon2D)& P1, const Handle(Poly_Polygon2D)& P2, const TopoDS_Face& S) const;
181   
182   //! Changes Edge polygons on a face.
183   //!
184   //! A null Polygon removes the 2d Polygon.
185   Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon2D)& P1, const Handle(Poly_Polygon2D)& P2, const Handle(Geom_Surface)& S, const TopLoc_Location& L) const;
186   
187   //! Updates the edge tolerance.
188   Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Standard_Real Tol) const;
189   
190   //! Sets the geometric continuity on the edge.
191   Standard_EXPORT void Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, const GeomAbs_Shape C) const;
192   
193   //! Sets the geometric continuity on the edge.
194   Standard_EXPORT void Continuity (const TopoDS_Edge& E, const Handle(Geom_Surface)& S1, const Handle(Geom_Surface)& S2, const TopLoc_Location& L1, const TopLoc_Location& L2, const GeomAbs_Shape C) const;
195   
196   //! Sets the same parameter flag for the edge <E>.
197   Standard_EXPORT void SameParameter (const TopoDS_Edge& E, const Standard_Boolean S) const;
198   
199   //! Sets the same range flag for the edge <E>.
200   Standard_EXPORT void SameRange (const TopoDS_Edge& E, const Standard_Boolean S) const;
201   
202   //! Sets the degenerated flag for the edge <E>.
203   Standard_EXPORT void Degenerated (const TopoDS_Edge& E, const Standard_Boolean D) const;
204   
205   //! Sets the range of the 3d curve if Only3d=TRUE,
206   //! otherwise sets the range to all the representations
207   Standard_EXPORT void Range (const TopoDS_Edge& E, const Standard_Real First, const Standard_Real Last, const Standard_Boolean Only3d = Standard_False) const;
208   
209   //! Sets the range  of the edge  on the pcurve on  the
210   //! surface.
211   Standard_EXPORT void Range (const TopoDS_Edge& E, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real First, const Standard_Real Last) const;
212   
213   //! Sets the range of the edge on the pcurve on the face.
214     void Range (const TopoDS_Edge& E, const TopoDS_Face& F, const Standard_Real First, const Standard_Real Last) const;
215   
216   //! Add  to <Eout>  the  geometric representations  of
217   //! <Ein>.
218   Standard_EXPORT void Transfert (const TopoDS_Edge& Ein, const TopoDS_Edge& Eout) const;
219   
220   //! Makes an udefined vertex without geometry.
221     void MakeVertex (TopoDS_Vertex& V) const;
222   
223   //! Makes a vertex from a 3D point.
224     void MakeVertex (TopoDS_Vertex& V, const gp_Pnt& P, const Standard_Real Tol) const;
225   
226   //! Sets a 3D point on the vertex.
227   Standard_EXPORT void UpdateVertex (const TopoDS_Vertex& V, const gp_Pnt& P, const Standard_Real Tol) const;
228   
229   //! Sets  the parameter  for the   vertex on the  edge
230   //! curves.
231   Standard_EXPORT void UpdateVertex (const TopoDS_Vertex& V, const Standard_Real P, const TopoDS_Edge& E, const Standard_Real Tol) const;
232   
233   //! Sets  the parameter  for the  vertex  on the  edge
234   //! pcurve  on the face.
235     void UpdateVertex (const TopoDS_Vertex& V, const Standard_Real P, const TopoDS_Edge& E, const TopoDS_Face& F, const Standard_Real Tol) const;
236   
237   //! Sets  the parameter  for the  vertex  on the  edge
238   //! pcurve  on the surface.
239   Standard_EXPORT void UpdateVertex (const TopoDS_Vertex& V, const Standard_Real P, const TopoDS_Edge& E, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol) const;
240   
241   //! Sets the parameters for the vertex on the face.
242   Standard_EXPORT void UpdateVertex (const TopoDS_Vertex& Ve, const Standard_Real U, const Standard_Real V, const TopoDS_Face& F, const Standard_Real Tol) const;
243   
244   //! Updates the vertex tolerance.
245   Standard_EXPORT void UpdateVertex (const TopoDS_Vertex& V, const Standard_Real Tol) const;
246   
247   //! Transfert the parameters  of   Vin on  Ein as  the
248   //! parameter of Vout on Eout.
249   Standard_EXPORT void Transfert (const TopoDS_Edge& Ein, const TopoDS_Edge& Eout, const TopoDS_Vertex& Vin, const TopoDS_Vertex& Vout) const;
250
251
252
253
254 protected:
255
256
257
258
259
260 private:
261
262
263
264
265
266 };
267
268
269 #include <BRep_Builder.lxx>
270
271
272
273
274
275 #endif // _BRep_Builder_HeaderFile