0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / Poly / Poly_Polygon3D.hxx
1 // Created on: 1995-03-07
2 // Created by: Laurent PAINNOT
3 // Copyright (c) 1995-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 _Poly_Polygon3D_HeaderFile
18 #define _Poly_Polygon3D_HeaderFile
19
20 #include <Standard_Transient.hxx>
21 #include <TColgp_Array1OfPnt.hxx>
22 #include <TColStd_HArray1OfReal.hxx>
23
24 DEFINE_STANDARD_HANDLE(Poly_Polygon3D, Standard_Transient)
25
26 //! This class Provides a polygon in 3D space. It is generally an approximate representation of a curve.
27 //! A Polygon3D is defined by a table of nodes. Each node is
28 //! a 3D point. If the polygon is closed, the point of closure is
29 //! repeated at the end of the table of nodes.
30 //! If the polygon is an approximate representation of a curve,
31 //! you can associate with each of its nodes the value of the
32 //! parameter of the corresponding point on the curve.
33 class Poly_Polygon3D : public Standard_Transient
34 {
35 public:
36
37   //! Constructs a 3D polygon with specific number of nodes.
38   Standard_EXPORT Poly_Polygon3D (const Standard_Integer theNbNodes,
39                                   const Standard_Boolean theHasParams);
40
41   //! Constructs a 3D polygon defined by the table of points, Nodes.
42   Standard_EXPORT Poly_Polygon3D(const TColgp_Array1OfPnt& Nodes);
43   
44   //! Constructs a 3D polygon defined by
45   //! the table of points, Nodes, and the parallel table of
46   //! parameters, Parameters, where each value of the table
47   //! Parameters is the parameter of the corresponding point
48   //! on the curve approximated by the constructed polygon.
49   //! Warning
50   //! Both the Nodes and Parameters tables must have the
51   //! same bounds. This property is not checked at construction time.
52   Standard_EXPORT Poly_Polygon3D(const TColgp_Array1OfPnt& Nodes, const TColStd_Array1OfReal& Parameters);
53
54   //! Creates a copy of current polygon
55   Standard_EXPORT virtual Handle(Poly_Polygon3D) Copy() const;
56   
57   //! Returns the deflection of this polygon
58   Standard_Real Deflection() const { return myDeflection; }
59
60   //! Sets the deflection of this polygon. See more on deflection in Poly_Polygon2D
61   void Deflection (const Standard_Real theDefl) { myDeflection = theDefl; }
62   
63   //! Returns the number of nodes in this polygon.
64   //! Note: If the polygon is closed, the point of closure is
65   //! repeated at the end of its table of nodes. Thus, on a closed
66   //! triangle the function NbNodes returns 4.
67   Standard_Integer NbNodes() const { return myNodes.Length(); }
68
69   //! Returns the table of nodes for this polygon.
70   const TColgp_Array1OfPnt& Nodes() const { return myNodes; }
71
72   //! Returns the table of nodes for this polygon.
73   TColgp_Array1OfPnt& ChangeNodes() { return myNodes; }
74
75   //! Returns the table of the parameters associated with each node in this polygon.
76   //! HasParameters function checks if   parameters are associated with the nodes of this polygon.
77   Standard_Boolean HasParameters() const { return !myParameters.IsNull(); }
78   
79   //! Returns true if parameters are associated with the nodes
80   //! in this polygon.
81   const TColStd_Array1OfReal& Parameters() const { return myParameters->Array1(); }
82
83   //! Returns the table of the parameters associated with each node in this polygon.
84   //! ChangeParameters function returns the array as shared.
85   //! Therefore if the table is selected by reference you can, by simply modifying it,
86   //! directly modify the data structure of this polygon.
87   TColStd_Array1OfReal& ChangeParameters() const { return myParameters->ChangeArray1(); }
88
89   //! Dumps the content of me into the stream
90   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
91
92   DEFINE_STANDARD_RTTIEXT(Poly_Polygon3D,Standard_Transient)
93
94 private:
95
96   Standard_Real myDeflection;
97   TColgp_Array1OfPnt myNodes;
98   Handle(TColStd_HArray1OfReal) myParameters;
99
100 };
101
102 #endif // _Poly_Polygon3D_HeaderFile