1 // Created on: 1993-08-24
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
22 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272
25 #include <ProjLib_Projector.ixx>
30 //=======================================================================
31 //function : ProjLib_Projector
33 //=======================================================================
35 ProjLib_Projector::ProjLib_Projector()
39 //=======================================================================
40 void ProjLib_Projector::Delete()
45 //=======================================================================
48 //=======================================================================
50 Standard_Boolean ProjLib_Projector::IsDone() const
56 //=======================================================================
59 //=======================================================================
61 void ProjLib_Projector::Done()
63 isDone = Standard_True;
67 //=======================================================================
70 //=======================================================================
72 GeomAbs_CurveType ProjLib_Projector::GetType() const
78 //=======================================================================
81 //=======================================================================
83 void ProjLib_Projector::SetType( const GeomAbs_CurveType Type)
89 //=======================================================================
90 //function : IsPeriodic
92 //=======================================================================
94 Standard_Boolean ProjLib_Projector::IsPeriodic() const
100 //=======================================================================
101 //function : SetPeriodic
103 //=======================================================================
105 void ProjLib_Projector::SetPeriodic()
107 myIsPeriodic = Standard_True;
111 //=======================================================================
114 //=======================================================================
116 const gp_Lin2d& ProjLib_Projector::Line()const
118 if (myType != GeomAbs_Line)
119 Standard_NoSuchObject::Raise("ProjLib_Projector::Line");
124 //=======================================================================
127 //=======================================================================
129 const gp_Circ2d& ProjLib_Projector::Circle()const
131 if (myType != GeomAbs_Circle)
132 Standard_NoSuchObject::Raise("ProjLib_Projector::Circle");
137 //=======================================================================
140 //=======================================================================
142 const gp_Elips2d& ProjLib_Projector::Ellipse()const
144 if (myType != GeomAbs_Ellipse)
145 Standard_NoSuchObject::Raise("ProjLib_Projector::Ellipse");
150 //=======================================================================
151 //function : Hyperbola
153 //=======================================================================
155 const gp_Hypr2d& ProjLib_Projector::Hyperbola()const
157 if (myType != GeomAbs_Hyperbola)
158 Standard_NoSuchObject::Raise("ProjLib_Projector::Hyperbola");
163 //=======================================================================
164 //function : Parabola
166 //=======================================================================
168 const gp_Parab2d& ProjLib_Projector::Parabola()const
170 if (myType != GeomAbs_Parabola)
171 Standard_NoSuchObject::Raise("ProjLib_Projector::Parabola");
178 //=======================================================================
181 //=======================================================================
183 void ProjLib_Projector::Project(const gp_Lin& )
185 myType = GeomAbs_OtherCurve;
189 //=======================================================================
192 //=======================================================================
194 void ProjLib_Projector::Project(const gp_Circ& )
196 myType = GeomAbs_OtherCurve;
200 //=======================================================================
203 //=======================================================================
205 void ProjLib_Projector::Project(const gp_Elips& )
207 myType = GeomAbs_OtherCurve;
211 //=======================================================================
214 //=======================================================================
216 void ProjLib_Projector::Project(const gp_Parab& )
218 myType = GeomAbs_OtherCurve;
222 //=======================================================================
225 //=======================================================================
227 void ProjLib_Projector::Project(const gp_Hypr& )
229 myType = GeomAbs_OtherCurve;
233 //=======================================================================
236 //=======================================================================
238 void ProjLib_Projector::UFrame(const Standard_Real CFirst,
239 // const Standard_Real CLast,
240 const Standard_Real ,
241 const Standard_Real UFirst,
242 const Standard_Real Period)
244 if (myType == GeomAbs_Line) {
245 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 Begin
246 // if ( myLin.Direction().Y() == 0.) {
247 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 End
248 // gp_Pnt2d PFirst, PLast;
250 PFirst = ElCLib::Value(CFirst,myLin);
251 //PLast = ElCLib::Value(CLast ,myLin);
252 //Standard_Real U = Min( PFirst.X(), PLast.X());
253 Standard_Real U = PFirst.X();
254 Standard_Real NewU = ElCLib::InPeriod(U,UFirst, UFirst + Period);
255 myLin.Translate(gp_Vec2d(NewU-U,0.));
259 //=======================================================================
262 //=======================================================================
264 void ProjLib_Projector::VFrame(const Standard_Real CFirst,
265 // const Standard_Real CLast,
266 const Standard_Real ,
267 const Standard_Real VFirst,
268 const Standard_Real Period)
270 if (myType == GeomAbs_Line) {
271 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 Begin
272 // if ( myLin.Direction().X() == 0.) {
273 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 End
274 // gp_Pnt2d PFirst, PLast;
276 PFirst = ElCLib::Value(CFirst,myLin);
277 //PLast = ElCLib::Value(CLast ,myLin);
278 //Standard_Real V = Min( PFirst.Y(), PLast.Y());
279 Standard_Real V = PFirst.Y();
280 Standard_Real NewV = ElCLib::InPeriod(V,VFirst, VFirst + Period);
281 myLin.Translate(gp_Vec2d(0.,NewV-V));
285 //=======================================================================
286 //function : SetBezier
288 //=======================================================================
290 void ProjLib_Projector::SetBezier(const Handle(Geom2d_BezierCurve)& C)
294 //=======================================================================
297 //=======================================================================
299 Handle(Geom2d_BezierCurve)ProjLib_Projector::Bezier() const
303 //=======================================================================
304 //function : SetBSpline
306 //=======================================================================
308 void ProjLib_Projector::SetBSpline(const Handle(Geom2d_BSplineCurve)& C)
312 //=======================================================================
315 //=======================================================================
317 Handle(Geom2d_BSplineCurve) ProjLib_Projector::BSpline() const