0024428: Implementation of LGPL license
[occt.git] / src / BRep / BRep_CurveOnClosedSurface.cxx
1 // Created on: 1993-07-06
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1993-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
9 // under the terms of the GNU Lesser General Public 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 #include <BRep_CurveOnClosedSurface.ixx>
18 #include <Precision.hxx>
19
20
21
22 //=======================================================================
23 //function : BRep_CurveOnClosedSurface
24 //purpose  : 
25 //=======================================================================
26
27 BRep_CurveOnClosedSurface::BRep_CurveOnClosedSurface
28   (const Handle(Geom2d_Curve)& PC1, 
29    const Handle(Geom2d_Curve)& PC2,
30    const Handle(Geom_Surface)& S, 
31    const TopLoc_Location& L, 
32    const GeomAbs_Shape C) :
33   BRep_CurveOnSurface(PC1,S,L),
34   myPCurve2(PC2),
35   myContinuity(C)
36 {
37 }
38
39
40 //=======================================================================
41 //function : IsCurveOnClosedSurface
42 //purpose  : 
43 //=======================================================================
44
45 Standard_Boolean  BRep_CurveOnClosedSurface::IsCurveOnClosedSurface()const 
46 {
47   return Standard_True;
48 }
49
50 //=======================================================================
51 //function : IsRegularity
52 //purpose  : 
53 //=======================================================================
54
55 Standard_Boolean  BRep_CurveOnClosedSurface::IsRegularity()const 
56 {
57   return Standard_True;
58 }
59
60
61 //=======================================================================
62 //function : IsRegularity
63 //purpose  : 
64 //=======================================================================
65
66 Standard_Boolean  BRep_CurveOnClosedSurface::IsRegularity
67   (const Handle(Geom_Surface)& S1, 
68    const Handle(Geom_Surface)& S2, 
69    const TopLoc_Location& L1, 
70    const TopLoc_Location& L2)const 
71 {
72   return ((Surface()  == S1) &&
73           (Surface()  == S2) &&
74           (Location() == L1) &&
75           (Location() == L2));
76 }
77
78
79
80 //=======================================================================
81 //function : PCurve2
82 //purpose  : 
83 //=======================================================================
84
85 const Handle(Geom2d_Curve)&  BRep_CurveOnClosedSurface::PCurve2()const 
86 {
87   return myPCurve2;
88 }
89
90
91 //=======================================================================
92 //function : Continuity
93 //purpose  : 
94 //=======================================================================
95
96 const GeomAbs_Shape&  BRep_CurveOnClosedSurface::Continuity()const 
97 {
98   return myContinuity;
99 }
100
101 //=======================================================================
102 //function : Surface2
103 //purpose  : 
104 //=======================================================================
105
106 const Handle(Geom_Surface)&  BRep_CurveOnClosedSurface::Surface2()const 
107 {
108   return Surface();
109 }
110
111
112 //=======================================================================
113 //function : Location2
114 //purpose  : 
115 //=======================================================================
116
117 const TopLoc_Location&  BRep_CurveOnClosedSurface::Location2()const 
118 {
119   return Location();
120 }
121
122 //=======================================================================
123 //function : PCurve2
124 //purpose  : 
125 //=======================================================================
126
127 void  BRep_CurveOnClosedSurface::PCurve2(const Handle(Geom2d_Curve)& C)
128 {
129   myPCurve2 = C;
130 }
131
132
133 //=======================================================================
134 //function : Continuity
135 //purpose  : 
136 //=======================================================================
137
138 void BRep_CurveOnClosedSurface::Continuity(const GeomAbs_Shape C)
139 {
140   myContinuity = C;
141 }
142
143
144 //=======================================================================
145 //function : Copy
146 //purpose  : 
147 //=======================================================================
148
149 Handle(BRep_CurveRepresentation) BRep_CurveOnClosedSurface::Copy() const
150 {
151   Handle(BRep_CurveOnClosedSurface) C =
152     new BRep_CurveOnClosedSurface(PCurve(),PCurve2(),
153                                   Surface(),Location(),myContinuity);
154
155   C->SetRange(First(), Last());
156   C->SetUVPoints(myUV1,myUV2);
157   C->SetUVPoints2(myUV21,myUV22);
158
159   return C;
160 }
161
162
163 //=======================================================================
164 //function : Update
165 //purpose  : 
166 //=======================================================================
167
168 void  BRep_CurveOnClosedSurface::Update()
169 {
170   if (!Precision::IsNegativeInfinite(First()))
171     myPCurve2->D0(First(),myUV21);
172   if (!Precision::IsPositiveInfinite(Last()))
173     myPCurve2->D0(Last(),myUV22);
174   BRep_CurveOnSurface::Update();
175 }
176
177