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