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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _BRepLib_MakePolygon_HeaderFile
18 #define _BRepLib_MakePolygon_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <TopoDS_Vertex.hxx>
25 #include <TopoDS_Edge.hxx>
26 #include <BRepLib_MakeShape.hxx>
27 #include <Standard_Boolean.hxx>
28 class StdFail_NotDone;
35 //! Class to build polygonal wires.
37 //! A polygonal wire may be build from
43 //! - any number of points.
45 //! - any number of vertices.
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
57 //! Creates an empty MakePolygon.
58 Standard_EXPORT BRepLib_MakePolygon();
60 Standard_EXPORT BRepLib_MakePolygon(const gp_Pnt& P1, const gp_Pnt& P2);
62 Standard_EXPORT BRepLib_MakePolygon(const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3, const Standard_Boolean Close = Standard_False);
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);
66 Standard_EXPORT BRepLib_MakePolygon(const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
68 Standard_EXPORT BRepLib_MakePolygon(const TopoDS_Vertex& V1, const TopoDS_Vertex& V2, const TopoDS_Vertex& V3, const Standard_Boolean Close = Standard_False);
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);
72 Standard_EXPORT void Add (const gp_Pnt& P);
74 Standard_EXPORT void Add (const TopoDS_Vertex& V);
76 //! Returns True if the last vertex or point was
77 //! succesfully added.
78 Standard_EXPORT Standard_Boolean Added() const;
80 Standard_EXPORT void Close();
82 Standard_EXPORT const TopoDS_Vertex& FirstVertex() const;
84 Standard_EXPORT const TopoDS_Vertex& LastVertex() const;
86 //! Returns the last edge added to the polygon.
87 Standard_EXPORT const TopoDS_Edge& Edge() const;
88 Standard_EXPORT operator TopoDS_Edge() const;
90 Standard_EXPORT const TopoDS_Wire& Wire() const;
91 Standard_EXPORT operator TopoDS_Wire() const;
106 TopoDS_Vertex myFirstVertex;
107 TopoDS_Vertex myLastVertex;
119 #endif // _BRepLib_MakePolygon_HeaderFile