0026912: CLang 3.6.2 compiler warning [-Winconsistent-missing-override]
[occt.git] / src / Adaptor2d / Adaptor2d_Line2d.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <Adaptor2d_HCurve2d.hxx>
16 #include <Adaptor2d_HLine2d.hxx>
17 #include <Adaptor2d_Line2d.hxx>
18 #include <ElCLib.hxx>
19 #include <Geom2d_BezierCurve.hxx>
20 #include <Geom2d_BSplineCurve.hxx>
21 #include <gp_Circ2d.hxx>
22 #include <gp_Dir2d.hxx>
23 #include <gp_Elips2d.hxx>
24 #include <gp_Hypr2d.hxx>
25 #include <gp_Lin2d.hxx>
26 #include <gp_Parab2d.hxx>
27 #include <gp_Pnt2d.hxx>
28 #include <gp_Vec2d.hxx>
29 #include <Precision.hxx>
30 #include <Standard_DomainError.hxx>
31 #include <Standard_NoSuchObject.hxx>
32 #include <Standard_OutOfRange.hxx>
33
34 //=======================================================================
35 //function : Adaptor2d_Line2d
36 //purpose  : 
37 //=======================================================================
38 Adaptor2d_Line2d::Adaptor2d_Line2d()
39 : myUfirst(0.0), myUlast (0.0)
40 {
41 }
42
43 //=======================================================================
44 //function : Adaptor_Line2d
45 //purpose  : 
46 //=======================================================================
47
48  Adaptor2d_Line2d::Adaptor2d_Line2d(const gp_Pnt2d&     P,
49                                     const gp_Dir2d&     D,
50                                     const Standard_Real UFirst,
51                                     const Standard_Real ULast)
52 : myUfirst(UFirst), myUlast(ULast), myAx2d(P,D)
53 {
54 }
55
56 //=======================================================================
57 //function : Load
58 //purpose  : 
59 //=======================================================================
60
61 void Adaptor2d_Line2d::Load(const gp_Lin2d& L)
62 {
63   myAx2d   =  L.Position();
64   myUfirst = -Precision::Infinite();
65   myUlast  =  Precision::Infinite();
66 }
67
68 //=======================================================================
69 //function : Load
70 //purpose  : 
71 //=======================================================================
72
73 void Adaptor2d_Line2d::Load(const gp_Lin2d& L, const Standard_Real Fi, const Standard_Real La)
74 {
75   myAx2d   =  L.Position();
76   myUfirst =  Fi;
77   myUlast  =  La;
78 }
79
80 //=======================================================================
81 //function : FirstParameter
82 //purpose  : 
83 //=======================================================================
84
85 Standard_Real Adaptor2d_Line2d::FirstParameter() const 
86 {
87   return myUfirst;
88 }
89
90 //=======================================================================
91 //function : LastParameter
92 //purpose  : 
93 //=======================================================================
94
95 Standard_Real Adaptor2d_Line2d::LastParameter() const 
96 {
97   return myUlast;
98 }
99
100 //=======================================================================
101 //function : Continuity
102 //purpose  : 
103 //=======================================================================
104
105 GeomAbs_Shape Adaptor2d_Line2d::Continuity() const 
106 {
107   return GeomAbs_CN;
108 }
109
110 //=======================================================================
111 //function : NbIntervals
112 //purpose  : 
113 //=======================================================================
114
115 //Standard_Integer Adaptor2d_Line2d::NbIntervals(const GeomAbs_Shape S) const 
116 Standard_Integer Adaptor2d_Line2d::NbIntervals(const GeomAbs_Shape ) const 
117 {
118   return 1;
119 }
120
121 //=======================================================================
122 //function : Interval
123 //purpose  : 
124 //=======================================================================
125
126 void Adaptor2d_Line2d::Intervals(TColStd_Array1OfReal& T,
127 //                             const GeomAbs_Shape S) const 
128                                const GeomAbs_Shape ) const 
129 {
130   T(T.Lower())   = myUfirst;
131   T(T.Lower()+1) = myUlast;
132 }
133
134 //=======================================================================
135 //function : Trim
136 //purpose  : 
137 //=======================================================================
138
139 Handle(Adaptor2d_HCurve2d) Adaptor2d_Line2d::Trim
140 (const Standard_Real First,
141  const Standard_Real Last,
142  const Standard_Real) const 
143 {
144   Handle(Adaptor2d_HLine2d) HL = new Adaptor2d_HLine2d();
145   HL->ChangeCurve2d().Load(gp_Lin2d(myAx2d),First,Last);
146   return HL;
147 }
148
149 //=======================================================================
150 //function : IsClosed
151 //purpose  : 
152 //=======================================================================
153
154 Standard_Boolean Adaptor2d_Line2d::IsClosed() const 
155 {
156   return Standard_False;
157 }
158
159 //=======================================================================
160 //function : IsPeriodic
161 //purpose  : 
162 //=======================================================================
163
164 Standard_Boolean Adaptor2d_Line2d::IsPeriodic() const 
165 {
166   return Standard_False;
167 }
168
169 //=======================================================================
170 //function : Period
171 //purpose  : 
172 //=======================================================================
173
174 Standard_Real Adaptor2d_Line2d::Period() const 
175 {
176   Standard_NoSuchObject::Raise();
177   return 0;
178 }
179
180 //=======================================================================
181 //function : Value
182 //purpose  : 
183 //=======================================================================
184
185 gp_Pnt2d Adaptor2d_Line2d::Value(const Standard_Real X) const 
186 {
187   return ElCLib::LineValue(X,myAx2d);
188 }
189
190 //=======================================================================
191 //function : D0
192 //purpose  : 
193 //=======================================================================
194
195 void Adaptor2d_Line2d::D0(const Standard_Real X, gp_Pnt2d& P) const 
196 {
197   P = ElCLib::LineValue(X,myAx2d);
198 }
199
200 //=======================================================================
201 //function : D1
202 //purpose  : 
203 //=======================================================================
204
205 void Adaptor2d_Line2d::D1(const Standard_Real X, gp_Pnt2d& P, gp_Vec2d& V) const 
206 {
207   ElCLib::LineD1(X,myAx2d,P,V);
208 }
209
210 //=======================================================================
211 //function : D2
212 //purpose  : 
213 //=======================================================================
214
215 void Adaptor2d_Line2d::D2(const Standard_Real X, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const 
216 {
217   ElCLib::LineD1(X,myAx2d,P,V1);
218   V2.SetCoord(0.,0.);
219 }
220
221 //=======================================================================
222 //function : D3
223 //purpose  : 
224 //=======================================================================
225
226 void Adaptor2d_Line2d::D3(const Standard_Real X, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const 
227 {
228   ElCLib::LineD1(X,myAx2d,P,V1);
229   V2.SetCoord(0.,0.);
230   V3.SetCoord(0.,0.);
231 }
232
233 //=======================================================================
234 //function : DN
235 //purpose  : 
236 //=======================================================================
237
238 //gp_Vec2d Adaptor2d_Line2d::DN(const Standard_Real U, const Standard_Integer N) const 
239 gp_Vec2d Adaptor2d_Line2d::DN(const Standard_Real , const Standard_Integer N) const 
240 {
241   if (N<=0) {Standard_OutOfRange::Raise();}
242   if (N==1) {
243     return myAx2d.Direction();
244   }
245   return gp_Vec2d(0.,0.);
246 }
247
248 //=======================================================================
249 //function : Resolution
250 //purpose  : 
251 //=======================================================================
252
253 Standard_Real Adaptor2d_Line2d::Resolution(const Standard_Real R3d) const 
254 {
255   return R3d; // nul !!!!
256 }
257
258 //=======================================================================
259 //function : GetType
260 //purpose  : 
261 //=======================================================================
262
263 GeomAbs_CurveType Adaptor2d_Line2d::GetType() const 
264 {
265   return GeomAbs_Line;
266 }
267
268 //=======================================================================
269 //function : Line
270 //purpose  : 
271 //=======================================================================
272
273 gp_Lin2d Adaptor2d_Line2d::Line() const 
274 {
275   return gp_Lin2d(myAx2d);
276 }
277
278 //=======================================================================
279 //function : Circle
280 //purpose  : 
281 //=======================================================================
282
283 gp_Circ2d Adaptor2d_Line2d::Circle() const 
284 {
285   Standard_NoSuchObject::Raise();
286   return gp_Circ2d();
287 }
288
289 //=======================================================================
290 //function : Ellipse
291 //purpose  : 
292 //=======================================================================
293
294 gp_Elips2d Adaptor2d_Line2d::Ellipse() const 
295 {
296   Standard_NoSuchObject::Raise();
297   return gp_Elips2d();
298 }
299
300 //=======================================================================
301 //function : Hyperbola
302 //purpose  : 
303 //=======================================================================
304
305 gp_Hypr2d Adaptor2d_Line2d::Hyperbola() const 
306 {
307   Standard_NoSuchObject::Raise();
308   return gp_Hypr2d();
309 }
310
311 //=======================================================================
312 //function : Parabola
313 //purpose  : 
314 //=======================================================================
315
316 gp_Parab2d Adaptor2d_Line2d::Parabola() const 
317 {
318   Standard_NoSuchObject::Raise();
319   return gp_Parab2d();
320 }
321
322 //=======================================================================
323 //function : Degree
324 //purpose  : 
325 //=======================================================================
326
327 Standard_Integer Adaptor2d_Line2d::Degree()  const 
328  {
329   Standard_NoSuchObject::Raise();
330   return 0 ;
331 }
332 //=======================================================================
333 //function : IsRational
334 //purpose  : 
335 //=======================================================================
336
337 Standard_Boolean Adaptor2d_Line2d::IsRational()  const 
338  {
339   Standard_NoSuchObject::Raise();
340   return 0 ;
341 }
342 //=======================================================================
343 //function : NbPoles
344 //purpose  : 
345 //=======================================================================
346
347 Standard_Integer Adaptor2d_Line2d::NbPoles()  const 
348  {
349   Standard_NoSuchObject::Raise();
350   return 0 ;
351 }
352 //=======================================================================
353 //function : NbKnots
354 //purpose  : 
355 //=======================================================================
356
357 Standard_Integer Adaptor2d_Line2d::NbKnots()  const 
358  {
359   Standard_NoSuchObject::Raise();
360   return 0 ;
361 }
362 //=======================================================================
363 //function : Bezier
364 //purpose  : 
365 //=======================================================================
366
367 Handle(Geom2d_BezierCurve) Adaptor2d_Line2d::Bezier() const 
368 {
369   Standard_NoSuchObject::Raise();
370   Handle(Geom2d_BezierCurve) nul;
371   return nul;
372 }
373
374 //=======================================================================
375 //function : BSpline
376 //purpose  : 
377 //=======================================================================
378
379 Handle(Geom2d_BSplineCurve) Adaptor2d_Line2d::BSpline() const 
380 {
381   Standard_NoSuchObject::Raise();
382   Handle(Geom2d_BSplineCurve) nul;
383   return nul;
384 }
385