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
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 #include <Poly_Polygon3D.hxx>
19 IMPLEMENT_STANDARD_RTTIEXT(Poly_Polygon3D,Standard_Transient)
21 //=======================================================================
22 //function : Poly_Polygon3D
24 //=======================================================================
25 Poly_Polygon3D::Poly_Polygon3D (const Standard_Integer theNbNodes,
26 const Standard_Boolean theHasParams)
28 myNodes (1, theNbNodes)
32 myParameters = new TColStd_HArray1OfReal (1, theNbNodes);
36 //=======================================================================
37 //function : Poly_Polygon3D
39 //=======================================================================
40 Poly_Polygon3D::Poly_Polygon3D(const TColgp_Array1OfPnt& Nodes):
42 myNodes(1, Nodes.Length())
44 Standard_Integer i, j= 1;
45 for (i = Nodes.Lower(); i <= Nodes.Upper(); i++)
46 myNodes(j++) = Nodes(i);
49 //=======================================================================
50 //function : Poly_Polygon3D
52 //=======================================================================
54 Poly_Polygon3D::Poly_Polygon3D(const TColgp_Array1OfPnt& Nodes,
55 const TColStd_Array1OfReal& P):
57 myNodes(1, Nodes.Length())
60 myParameters = new TColStd_HArray1OfReal(1, P.Length());
61 Standard_Integer i, j= 1;
62 for (i = Nodes.Lower(); i <= Nodes.Upper(); i++) {
63 myNodes(j) = Nodes(i);
64 myParameters->SetValue(j, P(i));
69 //=======================================================================
72 //=======================================================================
74 Handle(Poly_Polygon3D) Poly_Polygon3D::Copy() const
76 Handle(Poly_Polygon3D) aCopy;
77 if (myParameters.IsNull())
78 aCopy = new Poly_Polygon3D(myNodes);
80 aCopy = new Poly_Polygon3D(myNodes, myParameters->Array1());
81 aCopy->Deflection(myDeflection);
85 //=======================================================================
88 //=======================================================================
89 void Poly_Polygon3D::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
91 OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
93 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDeflection)
94 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNodes.Size())
95 if (!myParameters.IsNull())
96 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myParameters->Size())