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
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 <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>
27 IMPLEMENT_STANDARD_RTTIEXT(BRep_CurveOnClosedSurface,BRep_CurveOnSurface)
29 //=======================================================================
30 //function : BRep_CurveOnClosedSurface
32 //=======================================================================
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),
46 //=======================================================================
47 //function : IsCurveOnClosedSurface
49 //=======================================================================
51 Standard_Boolean BRep_CurveOnClosedSurface::IsCurveOnClosedSurface()const
56 //=======================================================================
57 //function : IsRegularity
59 //=======================================================================
61 Standard_Boolean BRep_CurveOnClosedSurface::IsRegularity()const
67 //=======================================================================
68 //function : IsRegularity
70 //=======================================================================
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
78 return ((Surface() == S1) &&
86 //=======================================================================
89 //=======================================================================
91 const Handle(Geom2d_Curve)& BRep_CurveOnClosedSurface::PCurve2()const
97 //=======================================================================
98 //function : Continuity
100 //=======================================================================
102 const GeomAbs_Shape& BRep_CurveOnClosedSurface::Continuity()const
107 //=======================================================================
108 //function : Surface2
110 //=======================================================================
112 const Handle(Geom_Surface)& BRep_CurveOnClosedSurface::Surface2()const
118 //=======================================================================
119 //function : Location2
121 //=======================================================================
123 const TopLoc_Location& BRep_CurveOnClosedSurface::Location2()const
128 //=======================================================================
131 //=======================================================================
133 void BRep_CurveOnClosedSurface::PCurve2(const Handle(Geom2d_Curve)& C)
139 //=======================================================================
140 //function : Continuity
142 //=======================================================================
144 void BRep_CurveOnClosedSurface::Continuity(const GeomAbs_Shape C)
150 //=======================================================================
153 //=======================================================================
155 Handle(BRep_CurveRepresentation) BRep_CurveOnClosedSurface::Copy() const
157 Handle(BRep_CurveOnClosedSurface) C =
158 new BRep_CurveOnClosedSurface(PCurve(),PCurve2(),
159 Surface(),Location(),myContinuity);
161 C->SetRange(First(), Last());
162 C->SetUVPoints(myUV1,myUV2);
163 C->SetUVPoints2(myUV21,myUV22);
169 //=======================================================================
172 //=======================================================================
174 void BRep_CurveOnClosedSurface::Update()
176 if (!Precision::IsNegativeInfinite(First()))
177 myPCurve2->D0(First(),myUV21);
178 if (!Precision::IsPositiveInfinite(Last()))
179 myPCurve2->D0(Last(),myUV22);
180 BRep_CurveOnSurface::Update();
183 //=======================================================================
184 //function : DumpJson
186 //=======================================================================
187 void BRep_CurveOnClosedSurface::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
189 OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
191 OCCT_DUMP_BASE_CLASS (theOStream, theDepth, BRep_CurveOnSurface)
193 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPCurve2.get())
194 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myContinuity)
196 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUV21)
197 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUV22)