Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-06 08:35:41

0001 // Created on: 1993-07-29
0002 // Created by: Remi LEQUETTE
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BRepLib_MakePolygon_HeaderFile
0018 #define _BRepLib_MakePolygon_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <TopoDS_Vertex.hxx>
0024 #include <TopoDS_Edge.hxx>
0025 #include <BRepLib_MakeShape.hxx>
0026 class gp_Pnt;
0027 class TopoDS_Wire;
0028 
0029 //! Class to build polygonal wires.
0030 //!
0031 //! A polygonal wire may be build from
0032 //!
0033 //! - 2,4,3 points.
0034 //!
0035 //! - 2,3,4 vertices.
0036 //!
0037 //! - any number of points.
0038 //!
0039 //! - any number of vertices.
0040 //!
0041 //! When a point or vertex is added to the  polygon if
0042 //! it is identic  to the previous  point no  edge  is
0043 //! built. The method added can be used to test it.
0044 class BRepLib_MakePolygon : public BRepLib_MakeShape
0045 {
0046 public:
0047   DEFINE_STANDARD_ALLOC
0048 
0049   //! Creates an empty MakePolygon.
0050   Standard_EXPORT BRepLib_MakePolygon();
0051 
0052   Standard_EXPORT BRepLib_MakePolygon(const gp_Pnt& P1, const gp_Pnt& P2);
0053 
0054   Standard_EXPORT BRepLib_MakePolygon(const gp_Pnt&          P1,
0055                                       const gp_Pnt&          P2,
0056                                       const gp_Pnt&          P3,
0057                                       const Standard_Boolean Close = Standard_False);
0058 
0059   Standard_EXPORT BRepLib_MakePolygon(const gp_Pnt&          P1,
0060                                       const gp_Pnt&          P2,
0061                                       const gp_Pnt&          P3,
0062                                       const gp_Pnt&          P4,
0063                                       const Standard_Boolean Close = Standard_False);
0064 
0065   Standard_EXPORT BRepLib_MakePolygon(const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
0066 
0067   Standard_EXPORT BRepLib_MakePolygon(const TopoDS_Vertex&   V1,
0068                                       const TopoDS_Vertex&   V2,
0069                                       const TopoDS_Vertex&   V3,
0070                                       const Standard_Boolean Close = Standard_False);
0071 
0072   Standard_EXPORT BRepLib_MakePolygon(const TopoDS_Vertex&   V1,
0073                                       const TopoDS_Vertex&   V2,
0074                                       const TopoDS_Vertex&   V3,
0075                                       const TopoDS_Vertex&   V4,
0076                                       const Standard_Boolean Close = Standard_False);
0077 
0078   Standard_EXPORT void Add(const gp_Pnt& P);
0079 
0080   Standard_EXPORT void Add(const TopoDS_Vertex& V);
0081 
0082   //! Returns  True if  the last   vertex  or point  was
0083   //! successfully added.
0084   Standard_EXPORT Standard_Boolean Added() const;
0085 
0086   Standard_EXPORT void Close();
0087 
0088   Standard_EXPORT const TopoDS_Vertex& FirstVertex() const;
0089 
0090   Standard_EXPORT const TopoDS_Vertex& LastVertex() const;
0091 
0092   //! Returns the last edge added to the polygon.
0093   Standard_EXPORT const TopoDS_Edge& Edge() const;
0094   Standard_EXPORT                    operator TopoDS_Edge() const;
0095 
0096   Standard_EXPORT const TopoDS_Wire& Wire();
0097   Standard_EXPORT                    operator TopoDS_Wire();
0098 
0099 protected:
0100 private:
0101   TopoDS_Vertex myFirstVertex;
0102   TopoDS_Vertex myLastVertex;
0103   TopoDS_Edge   myEdge;
0104 };
0105 
0106 #endif // _BRepLib_MakePolygon_HeaderFile