0026460: Implicit cast to TopoDS_Shape compilation error due to ambiguous conversion
[occt.git] / src / BRepBuilderAPI / BRepBuilderAPI_MakeWire.hxx
1 // Created on: 1993-07-08
2 // Created by: Remi LEQUETTE
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 _BRepBuilderAPI_MakeWire_HeaderFile
18 #define _BRepBuilderAPI_MakeWire_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <BRepLib_MakeWire.hxx>
25 #include <BRepBuilderAPI_MakeShape.hxx>
26 #include <TopTools_ListOfShape.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <BRepBuilderAPI_WireError.hxx>
29 class StdFail_NotDone;
30 class TopoDS_Edge;
31 class TopoDS_Wire;
32 class TopoDS_Vertex;
33
34
35 //! Describes functions to build wires from edges. A wire can
36 //! be built from any number of edges.
37 //! To build a wire you first initialize the construction, then
38 //! add edges in sequence. An unlimited number of edges
39 //! can be added. The initialization of construction is done with:
40 //! -   no edge (an empty wire), or
41 //! -   edges of an existing wire, or
42 //! -   up to four connectable edges.
43 //! In order to be added to a wire under construction, an
44 //! edge (unless it is the first one) must satisfy the following
45 //! condition: one of its vertices must be geometrically
46 //! coincident with one of the vertices of the wire (provided
47 //! that the highest tolerance factor is assigned to the two
48 //! vertices). It could also be the same vertex.
49 //! -   The given edge is shared by the wire if it contains:
50 //! -   two vertices, identical to two vertices of the wire
51 //! under construction (a general case of the wire closure), or
52 //! -   one vertex, identical to a vertex of the wire under
53 //! construction; the other vertex not being
54 //! geometrically coincident with another vertex of the wire.
55 //! -   In other cases, when one of the vertices of the edge
56 //! is simply geometrically coincident with a vertex of the
57 //! wire under construction (provided that the highest
58 //! tolerance factor is assigned to the two vertices), the
59 //! given edge is first copied and the coincident vertex is
60 //! replaced in this new edge, by the coincident vertex of the wire.
61 //! Note: it is possible to build non manifold wires using this construction tool.
62 //! A MakeWire object provides a framework for:
63 //! -   initializing the construction of a wire,
64 //! -   adding edges to the wire under construction, and
65 //! -   consulting the result.
66 class BRepBuilderAPI_MakeWire  : public BRepBuilderAPI_MakeShape
67 {
68 public:
69
70   DEFINE_STANDARD_ALLOC
71
72   
73   //! Constructs an empty wire framework, to which edges
74   //! are added using the Add function.
75   //! As soon as the wire contains one edge, it can return
76   //! with the use of the function Wire.
77   //! Warning
78   //! The function Error will return
79   //! BRepBuilderAPI_EmptyWire if it is called before at
80   //! least one edge is added to the wire under construction.
81   Standard_EXPORT BRepBuilderAPI_MakeWire();
82   
83   //! Make a Wire from an edge.
84   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Edge& E);
85   
86   //! Make a Wire from two edges.
87   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Edge& E1, const TopoDS_Edge& E2);
88   
89   //! Make a Wire from three edges.
90   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Edge& E1, const TopoDS_Edge& E2, const TopoDS_Edge& E3);
91   
92   //! Make a Wire from four edges.
93   //! Constructs a wire
94   //! -   from the TopoDS_Wire W composed of the edge E, or
95   //! -   from edge E, or
96   //! -   from two edges E1 and E2, or
97   //! -   from three edges E1, E2 and E3, or
98   //! -   from four edges E1, E2, E3 and E4.
99   //! Further edges can be added using the function Add.
100   //! Given edges are added in a sequence. Each of them
101   //! must be connectable to the wire under construction,
102   //! and so must satisfy the following condition (unless it is
103   //! the first edge of the wire): one of its vertices must be
104   //! geometrically coincident with one of the vertices of the
105   //! wire (provided that the highest tolerance factor is
106   //! assigned to the two vertices). It could also be the same vertex.
107   //! Warning
108   //! If an edge is not connectable to the wire under
109   //! construction it is not added. The function Error will
110   //! return BRepBuilderAPI_DisconnectedWire, the
111   //! function IsDone will return false and the function Wire
112   //! will raise an error, until a new connectable edge is added.
113   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Edge& E1, const TopoDS_Edge& E2, const TopoDS_Edge& E3, const TopoDS_Edge& E4);
114   
115   //! Make a Wire from a Wire. Usefull for adding later.
116   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Wire& W);
117   
118   //! Add an edge to a wire.
119   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Wire& W, const TopoDS_Edge& E);
120   
121   //! Adds the edge E to the wire under construction.
122   //! E must be connectable to the wire under construction, and, unless it
123   //! is the first edge of the wire, must satisfy the following
124   //! condition: one of its vertices must be geometrically coincident
125   //! with one of the vertices of the wire (provided that the highest
126   //! tolerance factor is assigned to the two vertices). It could also
127   //! be the same vertex.
128   //! Warning
129   //! If E is not connectable to the wire under construction it is not
130   //! added. The function Error will return
131   //! BRepBuilderAPI_DisconnectedWire, the function IsDone will return
132   //! false and the function Wire will raise an error, until a new
133   //! connectable edge is added.
134   Standard_EXPORT void Add (const TopoDS_Edge& E);
135   
136   //! Add the edges of <W> to the current wire.
137   Standard_EXPORT void Add (const TopoDS_Wire& W);
138   
139   //! Adds  the edges of <L>   to the current  wire.  The
140   //! edges are not to be consecutive.   But they are to
141   //! be  all  connected geometrically or topologically.
142   //! If some of them are  not connected the Status give
143   //! DisconnectedWire but the "Maker" is Done() and you
144   //! can get the  partial result. (ie connected to  the
145   //! first edgeof the list <L>)
146   Standard_EXPORT void Add (const TopTools_ListOfShape& L);
147   
148   //! Returns true if this algorithm contains a valid wire.
149   //! IsDone returns false if:
150   //! -   there are no edges in the wire, or
151   //! -   the last edge which you tried to add was not connectable.
152   Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE;
153   
154   //! Returns the construction status
155   //! -   BRepBuilderAPI_WireDone if the wire is built, or
156   //! -   another value of the BRepBuilderAPI_WireError
157   //! enumeration indicating why the construction failed.
158   Standard_EXPORT BRepBuilderAPI_WireError Error() const;
159   
160   //! Returns the constructed wire; or the part of the wire
161   //! under construction already built.
162   //! Exceptions StdFail_NotDone if a wire is not built.
163   Standard_EXPORT const TopoDS_Wire& Wire();
164   Standard_EXPORT operator TopoDS_Wire();
165   
166   //! Returns the last edge added to the wire under construction.
167   //! Warning
168   //! -   This edge can be different from the original one (the
169   //! argument of the function Add, for instance,)
170   //! -   A null edge is returned if there are no edges in the
171   //! wire under construction, or if the last edge which you
172   //! tried to add was not connectable..
173   Standard_EXPORT const TopoDS_Edge& Edge() const;
174   
175   //! Returns the last vertex of the last edge added to the
176   //! wire under construction.
177   //! Warning
178   //! A null vertex is returned if there are no edges in the wire
179   //! under construction, or if the last edge which you tried to
180   //! add was not connectableR
181   Standard_EXPORT const TopoDS_Vertex& Vertex() const;
182
183
184
185
186 protected:
187
188
189
190
191
192 private:
193
194
195
196   BRepLib_MakeWire myMakeWire;
197
198
199 };
200
201
202
203
204
205
206
207 #endif // _BRepBuilderAPI_MakeWire_HeaderFile