0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / Adaptor2d / Adaptor2d_Line2d.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 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
973c2be1 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.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
7fd59977 14
42cf5bc1 15#include <Adaptor2d_HCurve2d.hxx>
16#include <Adaptor2d_HLine2d.hxx>
17#include <Adaptor2d_Line2d.hxx>
7fd59977 18#include <ElCLib.hxx>
42cf5bc1 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>
7fd59977 31#include <Standard_NoSuchObject.hxx>
42cf5bc1 32#include <Standard_OutOfRange.hxx>
7fd59977 33
34//=======================================================================
35//function : Adaptor2d_Line2d
36//purpose :
37//=======================================================================
b311480e 38Adaptor2d_Line2d::Adaptor2d_Line2d()
cbff1e55 39: myUfirst(0.0), myUlast (0.0)
7fd59977 40{
41}
42
43//=======================================================================
44//function : Adaptor_Line2d
45//purpose :
46//=======================================================================
47
cbff1e55 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)
7fd59977 53{
54}
55
56//=======================================================================
57//function : Load
58//purpose :
59//=======================================================================
60
61void 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
73void 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
85Standard_Real Adaptor2d_Line2d::FirstParameter() const
86{
87 return myUfirst;
88}
89
90//=======================================================================
91//function : LastParameter
92//purpose :
93//=======================================================================
94
95Standard_Real Adaptor2d_Line2d::LastParameter() const
96{
97 return myUlast;
98}
99
100//=======================================================================
101//function : Continuity
102//purpose :
103//=======================================================================
104
105GeomAbs_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
116Standard_Integer Adaptor2d_Line2d::NbIntervals(const GeomAbs_Shape ) const
117{
118 return 1;
119}
120
121//=======================================================================
122//function : Interval
123//purpose :
124//=======================================================================
125
126void 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
139Handle(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
154Standard_Boolean Adaptor2d_Line2d::IsClosed() const
155{
156 return Standard_False;
157}
158
159//=======================================================================
160//function : IsPeriodic
161//purpose :
162//=======================================================================
163
164Standard_Boolean Adaptor2d_Line2d::IsPeriodic() const
165{
166 return Standard_False;
167}
168
169//=======================================================================
170//function : Period
171//purpose :
172//=======================================================================
173
174Standard_Real Adaptor2d_Line2d::Period() const
175{
9775fa61 176 throw Standard_NoSuchObject();
7fd59977 177}
178
179//=======================================================================
180//function : Value
181//purpose :
182//=======================================================================
183
184gp_Pnt2d Adaptor2d_Line2d::Value(const Standard_Real X) const
185{
186 return ElCLib::LineValue(X,myAx2d);
187}
188
189//=======================================================================
190//function : D0
191//purpose :
192//=======================================================================
193
194void Adaptor2d_Line2d::D0(const Standard_Real X, gp_Pnt2d& P) const
195{
196 P = ElCLib::LineValue(X,myAx2d);
197}
198
199//=======================================================================
200//function : D1
201//purpose :
202//=======================================================================
203
204void Adaptor2d_Line2d::D1(const Standard_Real X, gp_Pnt2d& P, gp_Vec2d& V) const
205{
206 ElCLib::LineD1(X,myAx2d,P,V);
207}
208
209//=======================================================================
210//function : D2
211//purpose :
212//=======================================================================
213
214void Adaptor2d_Line2d::D2(const Standard_Real X, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const
215{
216 ElCLib::LineD1(X,myAx2d,P,V1);
217 V2.SetCoord(0.,0.);
218}
219
220//=======================================================================
221//function : D3
222//purpose :
223//=======================================================================
224
225void Adaptor2d_Line2d::D3(const Standard_Real X, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const
226{
227 ElCLib::LineD1(X,myAx2d,P,V1);
228 V2.SetCoord(0.,0.);
229 V3.SetCoord(0.,0.);
230}
231
232//=======================================================================
233//function : DN
234//purpose :
235//=======================================================================
236
237//gp_Vec2d Adaptor2d_Line2d::DN(const Standard_Real U, const Standard_Integer N) const
238gp_Vec2d Adaptor2d_Line2d::DN(const Standard_Real , const Standard_Integer N) const
239{
9775fa61 240 if (N<=0) {throw Standard_OutOfRange();}
7fd59977 241 if (N==1) {
242 return myAx2d.Direction();
243 }
244 return gp_Vec2d(0.,0.);
245}
246
247//=======================================================================
248//function : Resolution
249//purpose :
250//=======================================================================
251
252Standard_Real Adaptor2d_Line2d::Resolution(const Standard_Real R3d) const
253{
254 return R3d; // nul !!!!
255}
256
257//=======================================================================
258//function : GetType
259//purpose :
260//=======================================================================
261
262GeomAbs_CurveType Adaptor2d_Line2d::GetType() const
263{
264 return GeomAbs_Line;
265}
266
267//=======================================================================
268//function : Line
269//purpose :
270//=======================================================================
271
272gp_Lin2d Adaptor2d_Line2d::Line() const
273{
274 return gp_Lin2d(myAx2d);
275}
276
277//=======================================================================
278//function : Circle
279//purpose :
280//=======================================================================
281
282gp_Circ2d Adaptor2d_Line2d::Circle() const
283{
9775fa61 284 throw Standard_NoSuchObject();
7fd59977 285}
286
287//=======================================================================
288//function : Ellipse
289//purpose :
290//=======================================================================
291
292gp_Elips2d Adaptor2d_Line2d::Ellipse() const
293{
9775fa61 294 throw Standard_NoSuchObject();
7fd59977 295}
296
297//=======================================================================
298//function : Hyperbola
299//purpose :
300//=======================================================================
301
302gp_Hypr2d Adaptor2d_Line2d::Hyperbola() const
303{
9775fa61 304 throw Standard_NoSuchObject();
7fd59977 305}
306
307//=======================================================================
308//function : Parabola
309//purpose :
310//=======================================================================
311
312gp_Parab2d Adaptor2d_Line2d::Parabola() const
313{
9775fa61 314 throw Standard_NoSuchObject();
7fd59977 315}
316
317//=======================================================================
318//function : Degree
319//purpose :
320//=======================================================================
321
322Standard_Integer Adaptor2d_Line2d::Degree() const
323 {
9775fa61 324 throw Standard_NoSuchObject();
7fd59977 325}
326//=======================================================================
327//function : IsRational
328//purpose :
329//=======================================================================
330
331Standard_Boolean Adaptor2d_Line2d::IsRational() const
332 {
9775fa61 333 throw Standard_NoSuchObject();
7fd59977 334}
335//=======================================================================
336//function : NbPoles
337//purpose :
338//=======================================================================
339
340Standard_Integer Adaptor2d_Line2d::NbPoles() const
341 {
9775fa61 342 throw Standard_NoSuchObject();
7fd59977 343}
344//=======================================================================
345//function : NbKnots
346//purpose :
347//=======================================================================
348
349Standard_Integer Adaptor2d_Line2d::NbKnots() const
350 {
9775fa61 351 throw Standard_NoSuchObject();
7fd59977 352}
353//=======================================================================
354//function : Bezier
355//purpose :
356//=======================================================================
357
358Handle(Geom2d_BezierCurve) Adaptor2d_Line2d::Bezier() const
359{
9775fa61 360 throw Standard_NoSuchObject();
7fd59977 361}
362
363//=======================================================================
364//function : BSpline
365//purpose :
366//=======================================================================
367
368Handle(Geom2d_BSplineCurve) Adaptor2d_Line2d::BSpline() const
369{
9775fa61 370 throw Standard_NoSuchObject();
7fd59977 371}
372