1 // Created on: 1993-08-24
2 // Created by: Bruno DUMORTIER
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.
17 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272
20 #include <ProjLib_Projector.ixx>
25 //=======================================================================
26 //function : ProjLib_Projector
28 //=======================================================================
30 ProjLib_Projector::ProjLib_Projector()
34 //=======================================================================
35 void ProjLib_Projector::Delete()
40 //=======================================================================
43 //=======================================================================
45 Standard_Boolean ProjLib_Projector::IsDone() const
51 //=======================================================================
54 //=======================================================================
56 void ProjLib_Projector::Done()
58 isDone = Standard_True;
62 //=======================================================================
65 //=======================================================================
67 GeomAbs_CurveType ProjLib_Projector::GetType() const
73 //=======================================================================
76 //=======================================================================
78 void ProjLib_Projector::SetType( const GeomAbs_CurveType Type)
84 //=======================================================================
85 //function : IsPeriodic
87 //=======================================================================
89 Standard_Boolean ProjLib_Projector::IsPeriodic() const
95 //=======================================================================
96 //function : SetPeriodic
98 //=======================================================================
100 void ProjLib_Projector::SetPeriodic()
102 myIsPeriodic = Standard_True;
106 //=======================================================================
109 //=======================================================================
111 const gp_Lin2d& ProjLib_Projector::Line()const
113 if (myType != GeomAbs_Line)
114 Standard_NoSuchObject::Raise("ProjLib_Projector::Line");
119 //=======================================================================
122 //=======================================================================
124 const gp_Circ2d& ProjLib_Projector::Circle()const
126 if (myType != GeomAbs_Circle)
127 Standard_NoSuchObject::Raise("ProjLib_Projector::Circle");
132 //=======================================================================
135 //=======================================================================
137 const gp_Elips2d& ProjLib_Projector::Ellipse()const
139 if (myType != GeomAbs_Ellipse)
140 Standard_NoSuchObject::Raise("ProjLib_Projector::Ellipse");
145 //=======================================================================
146 //function : Hyperbola
148 //=======================================================================
150 const gp_Hypr2d& ProjLib_Projector::Hyperbola()const
152 if (myType != GeomAbs_Hyperbola)
153 Standard_NoSuchObject::Raise("ProjLib_Projector::Hyperbola");
158 //=======================================================================
159 //function : Parabola
161 //=======================================================================
163 const gp_Parab2d& ProjLib_Projector::Parabola()const
165 if (myType != GeomAbs_Parabola)
166 Standard_NoSuchObject::Raise("ProjLib_Projector::Parabola");
173 //=======================================================================
176 //=======================================================================
178 void ProjLib_Projector::Project(const gp_Lin& )
180 myType = GeomAbs_OtherCurve;
184 //=======================================================================
187 //=======================================================================
189 void ProjLib_Projector::Project(const gp_Circ& )
191 myType = GeomAbs_OtherCurve;
195 //=======================================================================
198 //=======================================================================
200 void ProjLib_Projector::Project(const gp_Elips& )
202 myType = GeomAbs_OtherCurve;
206 //=======================================================================
209 //=======================================================================
211 void ProjLib_Projector::Project(const gp_Parab& )
213 myType = GeomAbs_OtherCurve;
217 //=======================================================================
220 //=======================================================================
222 void ProjLib_Projector::Project(const gp_Hypr& )
224 myType = GeomAbs_OtherCurve;
228 //=======================================================================
231 //=======================================================================
233 void ProjLib_Projector::UFrame(const Standard_Real CFirst,
234 // const Standard_Real CLast,
235 const Standard_Real ,
236 const Standard_Real UFirst,
237 const Standard_Real Period)
239 if (myType == GeomAbs_Line) {
240 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 Begin
241 // if ( myLin.Direction().Y() == 0.) {
242 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 End
243 // gp_Pnt2d PFirst, PLast;
245 PFirst = ElCLib::Value(CFirst,myLin);
246 //PLast = ElCLib::Value(CLast ,myLin);
247 //Standard_Real U = Min( PFirst.X(), PLast.X());
248 Standard_Real U = PFirst.X();
249 Standard_Real NewU = ElCLib::InPeriod(U,UFirst, UFirst + Period);
250 myLin.Translate(gp_Vec2d(NewU-U,0.));
254 //=======================================================================
257 //=======================================================================
259 void ProjLib_Projector::VFrame(const Standard_Real CFirst,
260 // const Standard_Real CLast,
261 const Standard_Real ,
262 const Standard_Real VFirst,
263 const Standard_Real Period)
265 if (myType == GeomAbs_Line) {
266 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 Begin
267 // if ( myLin.Direction().X() == 0.) {
268 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 End
269 // gp_Pnt2d PFirst, PLast;
271 PFirst = ElCLib::Value(CFirst,myLin);
272 //PLast = ElCLib::Value(CLast ,myLin);
273 //Standard_Real V = Min( PFirst.Y(), PLast.Y());
274 Standard_Real V = PFirst.Y();
275 Standard_Real NewV = ElCLib::InPeriod(V,VFirst, VFirst + Period);
276 myLin.Translate(gp_Vec2d(0.,NewV-V));
280 //=======================================================================
281 //function : SetBezier
283 //=======================================================================
285 void ProjLib_Projector::SetBezier(const Handle(Geom2d_BezierCurve)& C)
289 //=======================================================================
292 //=======================================================================
294 Handle(Geom2d_BezierCurve)ProjLib_Projector::Bezier() const
298 //=======================================================================
299 //function : SetBSpline
301 //=======================================================================
303 void ProjLib_Projector::SetBSpline(const Handle(Geom2d_BSplineCurve)& C)
307 //=======================================================================
310 //=======================================================================
312 Handle(Geom2d_BSplineCurve) ProjLib_Projector::BSpline() const