0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / Poly / Poly_PolygonOnTriangulation.cxx
1 // Created on: 1996-02-20
2 // Created by: Laurent PAINNOT
3 // Copyright (c) 1996-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
18 #include <Poly_PolygonOnTriangulation.hxx>
19 #include <Standard_NullObject.hxx>
20 #include <Standard_Type.hxx>
21
22 IMPLEMENT_STANDARD_RTTIEXT(Poly_PolygonOnTriangulation,Standard_Transient)
23
24 //=======================================================================
25 //function : Poly_PolygonOnTriangulation
26 //purpose  : 
27 //=======================================================================
28 Poly_PolygonOnTriangulation::Poly_PolygonOnTriangulation
29 (const TColStd_Array1OfInteger&    Nodes) :
30     myDeflection(0.0),
31     myNodes(1, Nodes.Length())
32 {
33   myNodes = Nodes;
34 }
35
36 //=======================================================================
37 //function : Poly_PolygonOnTriangulation
38 //purpose  : 
39 //=======================================================================
40
41 Poly_PolygonOnTriangulation::Poly_PolygonOnTriangulation
42    (const TColStd_Array1OfInteger&    Nodes, 
43     const TColStd_Array1OfReal&       Parameters):
44     myDeflection(0.0),
45     myNodes(1, Nodes.Length())
46 {
47   myNodes = Nodes;
48   myParameters = new TColStd_HArray1OfReal(1, Parameters.Length());
49   myParameters->ChangeArray1() = Parameters;
50 }
51
52 //=======================================================================
53 //function : Copy
54 //purpose  : 
55 //=======================================================================
56
57 Handle(Poly_PolygonOnTriangulation) Poly_PolygonOnTriangulation::Copy() const
58 {
59   Handle(Poly_PolygonOnTriangulation) aCopy;
60   if (myParameters.IsNull())
61     aCopy = new Poly_PolygonOnTriangulation(myNodes);
62   else
63     aCopy = new Poly_PolygonOnTriangulation(myNodes, myParameters->Array1());
64   aCopy->Deflection(myDeflection);
65   return aCopy;
66 }
67
68 //=======================================================================
69 //function : Deflection
70 //purpose  : 
71 //=======================================================================
72
73 Standard_Real Poly_PolygonOnTriangulation::Deflection() const 
74 {
75   return myDeflection;
76 }
77
78 //=======================================================================
79 //function : Deflection
80 //purpose  : 
81 //=======================================================================
82
83 void Poly_PolygonOnTriangulation::Deflection(const Standard_Real D)
84 {
85   myDeflection  = D;
86 }
87
88 //=======================================================================
89 //function : Nodes
90 //purpose  : 
91 //=======================================================================
92
93 const TColStd_Array1OfInteger& Poly_PolygonOnTriangulation::Nodes() const 
94 {
95   return myNodes;
96 }
97
98
99 //=======================================================================
100 //function : HasParameters
101 //purpose  : 
102 //=======================================================================
103
104 Standard_Boolean Poly_PolygonOnTriangulation::HasParameters() const 
105 {
106   return (!myParameters.IsNull());
107 }
108
109 //=======================================================================
110 //function : Parameters
111 //purpose  : 
112 //=======================================================================
113
114 Handle(TColStd_HArray1OfReal) Poly_PolygonOnTriangulation::Parameters() const 
115 {
116   return myParameters;
117 }
118