1 // Created on: 1993-06-23
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1993-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.
18 #include <Geom2d_Curve.hxx>
19 #include <Geom_Curve.hxx>
20 #include <Precision.hxx>
21 #include <TopOpeBRepDS_Curve.hxx>
22 #include <TopOpeBRepDS_Dumper.hxx>
23 #include <TopOpeBRepDS_Interference.hxx>
24 #include <TopOpeBRepDS_SurfaceCurveInterference.hxx>
26 //=======================================================================
27 //function : TopOpeBRepDS_Curve
29 //=======================================================================
30 TopOpeBRepDS_Curve::TopOpeBRepDS_Curve() :
31 myFirst(0.0), myLast(0.0),
32 myRangeDefined(Standard_False),
33 myTolerance(Precision::Confusion()),
34 myIsWalk(Standard_False),
35 myKeep(Standard_True),
41 //=======================================================================
42 //function : TopOpeBRepDS_Curve
44 //=======================================================================
46 TopOpeBRepDS_Curve::TopOpeBRepDS_Curve
47 (const Handle(Geom_Curve)& C,
48 const Standard_Real T,
49 const Standard_Boolean IsWalk) :
50 myFirst(0.0), myLast(0.0),
51 myRangeDefined(Standard_False),
52 myKeep(Standard_True),
56 DefineCurve(C,T,IsWalk);
59 //=======================================================================
60 //function : DefineCurve
62 //=======================================================================
64 void TopOpeBRepDS_Curve::DefineCurve
65 (const Handle(Geom_Curve)& C,
66 const Standard_Real T,
67 const Standard_Boolean IsWalk)
74 //=======================================================================
75 //function : Tolerance
77 //=======================================================================
79 void TopOpeBRepDS_Curve::Tolerance(const Standard_Real T)
84 //=======================================================================
87 //=======================================================================
89 void TopOpeBRepDS_Curve::SetSCI(const Handle(TopOpeBRepDS_Interference)& SCI1,
90 const Handle(TopOpeBRepDS_Interference)& SCI2)
96 //=======================================================================
99 //=======================================================================
101 void TopOpeBRepDS_Curve::GetSCI(Handle(TopOpeBRepDS_Interference)& SCI1,
102 Handle(TopOpeBRepDS_Interference)& SCI2) const
108 //=======================================================================
111 //=======================================================================
113 const Handle(TopOpeBRepDS_Interference)& TopOpeBRepDS_Curve::GetSCI1() const
118 //=======================================================================
121 //=======================================================================
123 const Handle(TopOpeBRepDS_Interference)& TopOpeBRepDS_Curve::GetSCI2() const
128 //=======================================================================
129 //function : SetShapes
131 //=======================================================================
133 void TopOpeBRepDS_Curve::SetShapes(const TopoDS_Shape& S1,
134 const TopoDS_Shape& S2)
140 //=======================================================================
141 //function : GetShapes
143 //=======================================================================
145 void TopOpeBRepDS_Curve::GetShapes(TopoDS_Shape& S1,
146 TopoDS_Shape& S2) const
152 //=======================================================================
155 //=======================================================================
157 const TopoDS_Shape& TopOpeBRepDS_Curve::Shape1() const
162 //=======================================================================
163 //function : ChangeShape1
165 //=======================================================================
167 TopoDS_Shape& TopOpeBRepDS_Curve::ChangeShape1()
172 //=======================================================================
175 //=======================================================================
177 const TopoDS_Shape& TopOpeBRepDS_Curve::Shape2() const
182 //=======================================================================
183 //function : ChangeShape2
185 //=======================================================================
187 TopoDS_Shape& TopOpeBRepDS_Curve::ChangeShape2()
192 //=======================================================================
193 //function : ChangeCurve
195 //=======================================================================
197 Handle(Geom_Curve)& TopOpeBRepDS_Curve::ChangeCurve()
202 //=======================================================================
205 //=======================================================================
207 const Handle(Geom_Curve)& TopOpeBRepDS_Curve::Curve()const
212 //=======================================================================
213 //function : SetRange
215 //=======================================================================
217 void TopOpeBRepDS_Curve::SetRange(const Standard_Real First,
218 const Standard_Real Last)
222 myRangeDefined = Standard_True;
226 //=======================================================================
229 //=======================================================================
231 Standard_Boolean TopOpeBRepDS_Curve::Range(Standard_Real& First,
232 Standard_Real& Last) const
234 if (myRangeDefined) {
238 return myRangeDefined;
242 //=======================================================================
243 //function : Tolerance
245 //=======================================================================
247 Standard_Real TopOpeBRepDS_Curve::Tolerance()const
252 //=======================================================================
255 //=======================================================================
257 void TopOpeBRepDS_Curve::Curve(const Handle(Geom_Curve)& C3D,
258 const Standard_Real Tol)
265 //=======================================================================
268 //=======================================================================
270 const Handle(Geom2d_Curve)& TopOpeBRepDS_Curve::Curve1()const
272 if ( ! mySCI1.IsNull() ) {
274 Handle(TopOpeBRepDS_SurfaceCurveInterference)::DownCast (mySCI1)->PCurve();
277 static Handle(Geom2d_Curve) STALOC_Geom2dCurveNull1;
278 return STALOC_Geom2dCurveNull1;
282 //=======================================================================
285 //=======================================================================
287 void TopOpeBRepDS_Curve::Curve1(const Handle(Geom2d_Curve)& PC1)
289 if ( ! mySCI1.IsNull() ) {
290 Handle(TopOpeBRepDS_SurfaceCurveInterference)::DownCast (mySCI1)->PCurve(PC1);
295 //=======================================================================
298 //=======================================================================
300 const Handle(Geom2d_Curve)& TopOpeBRepDS_Curve::Curve2()const
302 if ( ! mySCI2.IsNull() ) {
304 Handle(TopOpeBRepDS_SurfaceCurveInterference)::DownCast (mySCI2)->PCurve();
307 static Handle(Geom2d_Curve) STALOC_Geom2dCurveNull2;
308 return STALOC_Geom2dCurveNull2;
312 //=======================================================================
315 //=======================================================================
317 void TopOpeBRepDS_Curve::Curve2(const Handle(Geom2d_Curve)& PC2)
319 if ( ! mySCI2.IsNull() ) {
320 Handle(TopOpeBRepDS_SurfaceCurveInterference)::DownCast (mySCI2)->PCurve(PC2);
325 //=======================================================================
328 //=======================================================================
330 Standard_Boolean TopOpeBRepDS_Curve::IsWalk() const
335 //=======================================================================
336 //function : ChangeIsWalk
338 //=======================================================================
340 void TopOpeBRepDS_Curve::ChangeIsWalk(const Standard_Boolean B)
345 //=======================================================================
348 //=======================================================================
350 Standard_Boolean TopOpeBRepDS_Curve::Keep() const
356 //=======================================================================
357 //function : ChangeKeep
359 //=======================================================================
361 void TopOpeBRepDS_Curve::ChangeKeep(const Standard_Boolean b)
367 //=======================================================================
370 //=======================================================================
372 Standard_Integer TopOpeBRepDS_Curve::Mother() const
378 //=======================================================================
379 //function : ChangeMother
381 //=======================================================================
383 void TopOpeBRepDS_Curve::ChangeMother(const Standard_Integer b)
388 //=======================================================================
391 //=======================================================================
393 Standard_Integer TopOpeBRepDS_Curve::DSIndex() const
399 //=======================================================================
400 //function : ChangeDSIndex
402 //=======================================================================
404 void TopOpeBRepDS_Curve::ChangeDSIndex(const Standard_Integer b)