42cf5bc1 |
1 | // Created on: 1992-03-12 |
2 | // Created by: Philippe DAUTRY |
3 | // Copyright (c) 1992-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 _BRepPrim_Builder_HeaderFile |
18 | #define _BRepPrim_Builder_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <BRep_Builder.hxx> |
25 | #include <Standard_Real.hxx> |
26 | #include <Standard_Boolean.hxx> |
27 | class BRep_Builder; |
28 | class TopoDS_Shell; |
29 | class TopoDS_Face; |
30 | class gp_Pln; |
31 | class TopoDS_Wire; |
32 | class TopoDS_Edge; |
33 | class gp_Lin; |
34 | class gp_Circ; |
35 | class gp_Lin2d; |
36 | class gp_Circ2d; |
37 | class TopoDS_Vertex; |
38 | class gp_Pnt; |
39 | |
40 | |
41 | //! implements the abstract Builder with the BRep Builder |
42 | class BRepPrim_Builder |
43 | { |
44 | public: |
45 | |
46 | DEFINE_STANDARD_ALLOC |
47 | |
48 | |
49 | //! Creates an empty, useless Builder. Necesseray for |
50 | //! compilation. |
51 | Standard_EXPORT BRepPrim_Builder(); |
52 | |
53 | //! Creates from a Builder. |
54 | Standard_EXPORT BRepPrim_Builder(const BRep_Builder& B); |
55 | |
56 | const BRep_Builder& Builder() const; |
57 | |
58 | //! Make a empty Shell. |
59 | Standard_EXPORT void MakeShell (TopoDS_Shell& S) const; |
60 | |
61 | //! Returns in <F> a Face built with the plane |
62 | //! equation <P>. Used by all primitives. |
63 | Standard_EXPORT void MakeFace (TopoDS_Face& F, const gp_Pln& P) const; |
64 | |
65 | //! Returns in <W> an empty Wire. |
66 | Standard_EXPORT void MakeWire (TopoDS_Wire& W) const; |
67 | |
68 | //! Returns in <E> a degenerated edge. |
69 | Standard_EXPORT void MakeDegeneratedEdge (TopoDS_Edge& E) const; |
70 | |
71 | //! Returns in <E> an Edge built with the line |
72 | //! equation <L>. |
73 | Standard_EXPORT void MakeEdge (TopoDS_Edge& E, const gp_Lin& L) const; |
74 | |
75 | //! Returns in <E> an Edge built with the circle |
76 | //! equation <C>. |
77 | Standard_EXPORT void MakeEdge (TopoDS_Edge& E, const gp_Circ& C) const; |
78 | |
79 | //! Sets the line <L> to be the curve representing the |
80 | //! edge <E> in the parametric space of the surface of |
81 | //! <F>. |
82 | Standard_EXPORT void SetPCurve (TopoDS_Edge& E, const TopoDS_Face& F, const gp_Lin2d& L) const; |
83 | |
84 | //! Sets the lines <L1,L2> to be the curves |
85 | //! representing the edge <E> in the parametric space |
86 | //! of the closed surface of <F>. |
87 | Standard_EXPORT void SetPCurve (TopoDS_Edge& E, const TopoDS_Face& F, const gp_Lin2d& L1, const gp_Lin2d& L2) const; |
88 | |
89 | //! Sets the circle <C> to be the curve representing |
90 | //! the edge <E> in the parametric space of the |
91 | //! surface of <F>. |
92 | Standard_EXPORT void SetPCurve (TopoDS_Edge& E, const TopoDS_Face& F, const gp_Circ2d& C) const; |
93 | |
94 | //! Returns in <V> a Vertex built with the point <P>. |
95 | Standard_EXPORT void MakeVertex (TopoDS_Vertex& V, const gp_Pnt& P) const; |
96 | |
97 | //! Reverses the Face <F>. |
98 | Standard_EXPORT void ReverseFace (TopoDS_Face& F) const; |
99 | |
100 | //! Adds the Vertex <V> in the Edge <E>. <P> is the |
101 | //! parameter of the vertex on the edge. If direct |
102 | //! is False the Vertex is reversed. |
103 | Standard_EXPORT void AddEdgeVertex (TopoDS_Edge& E, const TopoDS_Vertex& V, const Standard_Real P, const Standard_Boolean direct) const; |
104 | |
105 | //! Adds the Vertex <V> in the Edge <E>. <P1,P2> |
106 | //! are the parameters of the vertex on the closed |
107 | //! edge. |
108 | Standard_EXPORT void AddEdgeVertex (TopoDS_Edge& E, const TopoDS_Vertex& V, const Standard_Real P1, const Standard_Real P2) const; |
109 | |
110 | //! <P1,P2> are the parameters of the vertex on the |
111 | //! edge. The edge is a closed curve. |
112 | Standard_EXPORT void SetParameters (TopoDS_Edge& E, const TopoDS_Vertex& V, const Standard_Real P1, const Standard_Real P2) const; |
113 | |
114 | //! Adds the Edge <E> in the Wire <W>, if direct is |
115 | //! False the Edge is reversed. |
116 | Standard_EXPORT void AddWireEdge (TopoDS_Wire& W, const TopoDS_Edge& E, const Standard_Boolean direct) const; |
117 | |
118 | //! Adds the Wire <W> in the Face <F>. |
119 | Standard_EXPORT void AddFaceWire (TopoDS_Face& F, const TopoDS_Wire& W) const; |
120 | |
121 | //! Adds the Face <F> in the Shell <Sh>. |
122 | Standard_EXPORT void AddShellFace (TopoDS_Shell& Sh, const TopoDS_Face& F) const; |
123 | |
124 | //! This is called once an edge is completed. It gives |
125 | //! the opportunity to perform any post treatment. |
126 | Standard_EXPORT void CompleteEdge (TopoDS_Edge& E) const; |
127 | |
128 | //! This is called once a wire is completed. It gives |
129 | //! the opportunity to perform any post treatment. |
130 | Standard_EXPORT void CompleteWire (TopoDS_Wire& W) const; |
131 | |
132 | //! This is called once a face is completed. It gives |
133 | //! the opportunity to perform any post treatment. |
134 | Standard_EXPORT void CompleteFace (TopoDS_Face& F) const; |
135 | |
136 | //! This is called once a shell is completed. It gives |
137 | //! the opportunity to perform any post treatment. |
138 | Standard_EXPORT void CompleteShell (TopoDS_Shell& S) const; |
139 | |
140 | |
141 | |
142 | |
143 | protected: |
144 | |
145 | |
146 | |
147 | |
148 | |
149 | private: |
150 | |
151 | |
152 | |
153 | BRep_Builder myBuilder; |
154 | |
155 | |
156 | }; |
157 | |
158 | |
159 | #include <BRepPrim_Builder.lxx> |
160 | |
161 | |
162 | |
163 | |
164 | |
165 | #endif // _BRepPrim_Builder_HeaderFile |