42cf5bc1 |
1 | // Created on: 1993-07-29 |
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 _BRepLib_MakePolygon_HeaderFile |
18 | #define _BRepLib_MakePolygon_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <TopoDS_Vertex.hxx> |
25 | #include <TopoDS_Edge.hxx> |
26 | #include <BRepLib_MakeShape.hxx> |
27 | #include <Standard_Boolean.hxx> |
28 | class StdFail_NotDone; |
29 | class gp_Pnt; |
30 | class TopoDS_Vertex; |
31 | class TopoDS_Edge; |
32 | class TopoDS_Wire; |
33 | |
34 | |
35 | //! Class to build polygonal wires. |
36 | //! |
37 | //! A polygonal wire may be build from |
38 | //! |
39 | //! - 2,4,3 points. |
40 | //! |
41 | //! - 2,3,4 vertices. |
42 | //! |
43 | //! - any number of points. |
44 | //! |
45 | //! - any number of vertices. |
46 | //! |
47 | //! When a point or vertex is added to the polygon if |
48 | //! it is identic to the previous point no edge is |
49 | //! built. The method added can be used to test it. |
50 | class BRepLib_MakePolygon : public BRepLib_MakeShape |
51 | { |
52 | public: |
53 | |
54 | DEFINE_STANDARD_ALLOC |
55 | |
56 | |
57 | //! Creates an empty MakePolygon. |
58 | Standard_EXPORT BRepLib_MakePolygon(); |
59 | |
60 | Standard_EXPORT BRepLib_MakePolygon(const gp_Pnt& P1, const gp_Pnt& P2); |
61 | |
62 | Standard_EXPORT BRepLib_MakePolygon(const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3, const Standard_Boolean Close = Standard_False); |
63 | |
64 | Standard_EXPORT BRepLib_MakePolygon(const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3, const gp_Pnt& P4, const Standard_Boolean Close = Standard_False); |
65 | |
66 | Standard_EXPORT BRepLib_MakePolygon(const TopoDS_Vertex& V1, const TopoDS_Vertex& V2); |
67 | |
68 | Standard_EXPORT BRepLib_MakePolygon(const TopoDS_Vertex& V1, const TopoDS_Vertex& V2, const TopoDS_Vertex& V3, const Standard_Boolean Close = Standard_False); |
69 | |
70 | Standard_EXPORT BRepLib_MakePolygon(const TopoDS_Vertex& V1, const TopoDS_Vertex& V2, const TopoDS_Vertex& V3, const TopoDS_Vertex& V4, const Standard_Boolean Close = Standard_False); |
71 | |
72 | Standard_EXPORT void Add (const gp_Pnt& P); |
73 | |
74 | Standard_EXPORT void Add (const TopoDS_Vertex& V); |
75 | |
76 | //! Returns True if the last vertex or point was |
77 | //! succesfully added. |
78 | Standard_EXPORT Standard_Boolean Added() const; |
79 | |
80 | Standard_EXPORT void Close(); |
81 | |
82 | Standard_EXPORT const TopoDS_Vertex& FirstVertex() const; |
83 | |
84 | Standard_EXPORT const TopoDS_Vertex& LastVertex() const; |
85 | |
86 | //! Returns the last edge added to the polygon. |
87 | Standard_EXPORT const TopoDS_Edge& Edge() const; |
88 | Standard_EXPORT operator TopoDS_Edge() const; |
89 | |
ecac41a9 |
90 | Standard_EXPORT const TopoDS_Wire& Wire(); |
91 | Standard_EXPORT operator TopoDS_Wire(); |
42cf5bc1 |
92 | |
93 | |
94 | |
95 | |
96 | protected: |
97 | |
98 | |
99 | |
100 | |
101 | |
102 | private: |
103 | |
104 | |
105 | |
106 | TopoDS_Vertex myFirstVertex; |
107 | TopoDS_Vertex myLastVertex; |
108 | TopoDS_Edge myEdge; |
109 | |
110 | |
111 | }; |
112 | |
113 | |
114 | |
115 | |
116 | |
117 | |
118 | |
119 | #endif // _BRepLib_MakePolygon_HeaderFile |