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 | |
92efcf78 |
27 | IMPLEMENT_STANDARD_RTTIEXT(BRep_CurveOnClosedSurface,BRep_CurveOnSurface) |
28 | |
7fd59977 |
29 | //======================================================================= |
30 | //function : BRep_CurveOnClosedSurface |
31 | //purpose : |
32 | //======================================================================= |
7fd59977 |
33 | BRep_CurveOnClosedSurface::BRep_CurveOnClosedSurface |
34 | (const Handle(Geom2d_Curve)& PC1, |
35 | const Handle(Geom2d_Curve)& PC2, |
36 | const Handle(Geom_Surface)& S, |
37 | const TopLoc_Location& L, |
38 | const GeomAbs_Shape C) : |
39 | BRep_CurveOnSurface(PC1,S,L), |
40 | myPCurve2(PC2), |
41 | myContinuity(C) |
42 | { |
43 | } |
44 | |
45 | |
46 | //======================================================================= |
47 | //function : IsCurveOnClosedSurface |
48 | //purpose : |
49 | //======================================================================= |
50 | |
51 | Standard_Boolean BRep_CurveOnClosedSurface::IsCurveOnClosedSurface()const |
52 | { |
53 | return Standard_True; |
54 | } |
55 | |
56 | //======================================================================= |
57 | //function : IsRegularity |
58 | //purpose : |
59 | //======================================================================= |
60 | |
61 | Standard_Boolean BRep_CurveOnClosedSurface::IsRegularity()const |
62 | { |
63 | return Standard_True; |
64 | } |
65 | |
66 | |
67 | //======================================================================= |
68 | //function : IsRegularity |
69 | //purpose : |
70 | //======================================================================= |
71 | |
72 | Standard_Boolean BRep_CurveOnClosedSurface::IsRegularity |
73 | (const Handle(Geom_Surface)& S1, |
74 | const Handle(Geom_Surface)& S2, |
75 | const TopLoc_Location& L1, |
76 | const TopLoc_Location& L2)const |
77 | { |
78 | return ((Surface() == S1) && |
79 | (Surface() == S2) && |
80 | (Location() == L1) && |
81 | (Location() == L2)); |
82 | } |
83 | |
84 | |
85 | |
86 | //======================================================================= |
87 | //function : PCurve2 |
88 | //purpose : |
89 | //======================================================================= |
90 | |
91 | const Handle(Geom2d_Curve)& BRep_CurveOnClosedSurface::PCurve2()const |
92 | { |
93 | return myPCurve2; |
94 | } |
95 | |
96 | |
97 | //======================================================================= |
98 | //function : Continuity |
99 | //purpose : |
100 | //======================================================================= |
101 | |
102 | const GeomAbs_Shape& BRep_CurveOnClosedSurface::Continuity()const |
103 | { |
104 | return myContinuity; |
105 | } |
106 | |
107 | //======================================================================= |
108 | //function : Surface2 |
109 | //purpose : |
110 | //======================================================================= |
111 | |
112 | const Handle(Geom_Surface)& BRep_CurveOnClosedSurface::Surface2()const |
113 | { |
114 | return Surface(); |
115 | } |
116 | |
117 | |
118 | //======================================================================= |
119 | //function : Location2 |
120 | //purpose : |
121 | //======================================================================= |
122 | |
123 | const TopLoc_Location& BRep_CurveOnClosedSurface::Location2()const |
124 | { |
125 | return Location(); |
126 | } |
127 | |
128 | //======================================================================= |
129 | //function : PCurve2 |
130 | //purpose : |
131 | //======================================================================= |
132 | |
133 | void BRep_CurveOnClosedSurface::PCurve2(const Handle(Geom2d_Curve)& C) |
134 | { |
135 | myPCurve2 = C; |
136 | } |
137 | |
138 | |
139 | //======================================================================= |
140 | //function : Continuity |
141 | //purpose : |
142 | //======================================================================= |
143 | |
144 | void BRep_CurveOnClosedSurface::Continuity(const GeomAbs_Shape C) |
145 | { |
146 | myContinuity = C; |
147 | } |
148 | |
149 | |
150 | //======================================================================= |
151 | //function : Copy |
152 | //purpose : |
153 | //======================================================================= |
154 | |
155 | Handle(BRep_CurveRepresentation) BRep_CurveOnClosedSurface::Copy() const |
156 | { |
157 | Handle(BRep_CurveOnClosedSurface) C = |
158 | new BRep_CurveOnClosedSurface(PCurve(),PCurve2(), |
159 | Surface(),Location(),myContinuity); |
160 | |
161 | C->SetRange(First(), Last()); |
162 | C->SetUVPoints(myUV1,myUV2); |
163 | C->SetUVPoints2(myUV21,myUV22); |
164 | |
165 | return C; |
166 | } |
167 | |
168 | |
169 | //======================================================================= |
170 | //function : Update |
171 | //purpose : |
172 | //======================================================================= |
173 | |
174 | void BRep_CurveOnClosedSurface::Update() |
175 | { |
176 | if (!Precision::IsNegativeInfinite(First())) |
177 | myPCurve2->D0(First(),myUV21); |
178 | if (!Precision::IsPositiveInfinite(Last())) |
179 | myPCurve2->D0(Last(),myUV22); |
180 | BRep_CurveOnSurface::Update(); |
181 | } |
182 | |
bc73b006 |
183 | //======================================================================= |
184 | //function : DumpJson |
185 | //purpose : |
186 | //======================================================================= |
187 | void BRep_CurveOnClosedSurface::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const |
188 | { |
189 | OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) |
190 | |
191 | OCCT_DUMP_BASE_CLASS (theOStream, theDepth, BRep_CurveOnSurface) |
192 | |
193 | OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPCurve2.get()) |
194 | OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myContinuity) |
195 | |
196 | OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUV21) |
197 | OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUV22) |
198 | } |
7fd59977 |
199 | |