1 // File: ProjLib_Projector.cxx
2 // Created: Tue Aug 24 12:05:40 1993
3 // Author: Bruno DUMORTIER
6 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272
9 #include <ProjLib_Projector.ixx>
14 //=======================================================================
15 //function : ProjLib_Projector
17 //=======================================================================
19 ProjLib_Projector::ProjLib_Projector()
23 //=======================================================================
24 void ProjLib_Projector::Delete()
29 //=======================================================================
32 //=======================================================================
34 Standard_Boolean ProjLib_Projector::IsDone() const
40 //=======================================================================
43 //=======================================================================
45 void ProjLib_Projector::Done()
47 isDone = Standard_True;
51 //=======================================================================
54 //=======================================================================
56 GeomAbs_CurveType ProjLib_Projector::GetType() const
62 //=======================================================================
65 //=======================================================================
67 void ProjLib_Projector::SetType( const GeomAbs_CurveType Type)
73 //=======================================================================
74 //function : IsPeriodic
76 //=======================================================================
78 Standard_Boolean ProjLib_Projector::IsPeriodic() const
84 //=======================================================================
85 //function : SetPeriodic
87 //=======================================================================
89 void ProjLib_Projector::SetPeriodic()
91 myIsPeriodic = Standard_True;
95 //=======================================================================
98 //=======================================================================
100 const gp_Lin2d& ProjLib_Projector::Line()const
102 if (myType != GeomAbs_Line)
103 Standard_NoSuchObject::Raise("ProjLib_Projector::Line");
108 //=======================================================================
111 //=======================================================================
113 const gp_Circ2d& ProjLib_Projector::Circle()const
115 if (myType != GeomAbs_Circle)
116 Standard_NoSuchObject::Raise("ProjLib_Projector::Circle");
121 //=======================================================================
124 //=======================================================================
126 const gp_Elips2d& ProjLib_Projector::Ellipse()const
128 if (myType != GeomAbs_Ellipse)
129 Standard_NoSuchObject::Raise("ProjLib_Projector::Ellipse");
134 //=======================================================================
135 //function : Hyperbola
137 //=======================================================================
139 const gp_Hypr2d& ProjLib_Projector::Hyperbola()const
141 if (myType != GeomAbs_Hyperbola)
142 Standard_NoSuchObject::Raise("ProjLib_Projector::Hyperbola");
147 //=======================================================================
148 //function : Parabola
150 //=======================================================================
152 const gp_Parab2d& ProjLib_Projector::Parabola()const
154 if (myType != GeomAbs_Parabola)
155 Standard_NoSuchObject::Raise("ProjLib_Projector::Parabola");
162 //=======================================================================
165 //=======================================================================
167 void ProjLib_Projector::Project(const gp_Lin& )
169 myType = GeomAbs_OtherCurve;
173 //=======================================================================
176 //=======================================================================
178 void ProjLib_Projector::Project(const gp_Circ& )
180 myType = GeomAbs_OtherCurve;
184 //=======================================================================
187 //=======================================================================
189 void ProjLib_Projector::Project(const gp_Elips& )
191 myType = GeomAbs_OtherCurve;
195 //=======================================================================
198 //=======================================================================
200 void ProjLib_Projector::Project(const gp_Parab& )
202 myType = GeomAbs_OtherCurve;
206 //=======================================================================
209 //=======================================================================
211 void ProjLib_Projector::Project(const gp_Hypr& )
213 myType = GeomAbs_OtherCurve;
217 //=======================================================================
220 //=======================================================================
222 void ProjLib_Projector::UFrame(const Standard_Real CFirst,
223 // const Standard_Real CLast,
224 const Standard_Real ,
225 const Standard_Real UFirst,
226 const Standard_Real Period)
228 if (myType == GeomAbs_Line) {
229 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 Begin
230 // if ( myLin.Direction().Y() == 0.) {
231 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 End
232 // gp_Pnt2d PFirst, PLast;
234 PFirst = ElCLib::Value(CFirst,myLin);
235 //PLast = ElCLib::Value(CLast ,myLin);
236 //Standard_Real U = Min( PFirst.X(), PLast.X());
237 Standard_Real U = PFirst.X();
238 Standard_Real NewU = ElCLib::InPeriod(U,UFirst, UFirst + Period);
239 myLin.Translate(gp_Vec2d(NewU-U,0.));
243 //=======================================================================
246 //=======================================================================
248 void ProjLib_Projector::VFrame(const Standard_Real CFirst,
249 // const Standard_Real CLast,
250 const Standard_Real ,
251 const Standard_Real VFirst,
252 const Standard_Real Period)
254 if (myType == GeomAbs_Line) {
255 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 Begin
256 // if ( myLin.Direction().X() == 0.) {
257 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 End
258 // gp_Pnt2d PFirst, PLast;
260 PFirst = ElCLib::Value(CFirst,myLin);
261 //PLast = ElCLib::Value(CLast ,myLin);
262 //Standard_Real V = Min( PFirst.Y(), PLast.Y());
263 Standard_Real V = PFirst.Y();
264 Standard_Real NewV = ElCLib::InPeriod(V,VFirst, VFirst + Period);
265 myLin.Translate(gp_Vec2d(0.,NewV-V));
269 //=======================================================================
270 //function : SetBezier
272 //=======================================================================
274 void ProjLib_Projector::SetBezier(const Handle(Geom2d_BezierCurve)& C)
278 //=======================================================================
281 //=======================================================================
283 Handle(Geom2d_BezierCurve)ProjLib_Projector::Bezier() const
287 //=======================================================================
288 //function : SetBSpline
290 //=======================================================================
292 void ProjLib_Projector::SetBSpline(const Handle(Geom2d_BSplineCurve)& C)
296 //=======================================================================
299 //=======================================================================
301 Handle(Geom2d_BSplineCurve) ProjLib_Projector::BSpline() const