0031035: Coding - uninitialized class fields reported by Visual Studio Code Analysis
[occt.git] / src / ProjLib / ProjLib_Projector.cxx
CommitLineData
b311480e 1// Created on: 1993-08-24
2// Created by: Bruno DUMORTIER
3// Copyright (c) 1993-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
17// Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272
18
7fd59977 19#include <ElCLib.hxx>
42cf5bc1 20#include <Geom2d_BezierCurve.hxx>
21#include <Geom2d_BSplineCurve.hxx>
22#include <gp_Circ.hxx>
23#include <gp_Circ2d.hxx>
24#include <gp_Elips.hxx>
25#include <gp_Elips2d.hxx>
26#include <gp_Hypr.hxx>
27#include <gp_Hypr2d.hxx>
28#include <gp_Lin.hxx>
29#include <gp_Lin2d.hxx>
30#include <gp_Parab.hxx>
31#include <gp_Parab2d.hxx>
32#include <ProjLib_Projector.hxx>
33#include <Standard_NoSuchObject.hxx>
34#include <Standard_NotImplemented.hxx>
7fd59977 35
36//=======================================================================
37//function : ProjLib_Projector
38//purpose :
39//=======================================================================
7fd59977 40ProjLib_Projector::ProjLib_Projector()
d533dafb 41: myIsPeriodic(Standard_False)
6da30ff1 42{
1cdee2a6 43 isDone = Standard_False;
44 myType = GeomAbs_BSplineCurve;
6da30ff1 45}
7fd59977 46
47
48//=======================================================================
6da30ff1 49//function : ~ProjLib_Projector
50//purpose : Destructor
51//=======================================================================
7fd59977 52
6da30ff1 53ProjLib_Projector::~ProjLib_Projector()
54{
55}
7fd59977 56
57
58//=======================================================================
59//function : IsDone
60//purpose :
61//=======================================================================
62
63Standard_Boolean ProjLib_Projector::IsDone() const
64{
65 return isDone;
66}
67
68
69//=======================================================================
70//function : Done
71//purpose :
72//=======================================================================
73
74void ProjLib_Projector::Done()
75{
76 isDone = Standard_True;
77}
78
79
80//=======================================================================
81//function : GetType
82//purpose :
83//=======================================================================
84
85GeomAbs_CurveType ProjLib_Projector::GetType() const
86{
87 return myType;
88}
89
90
91//=======================================================================
92//function : SetType
93//purpose :
94//=======================================================================
95
96void ProjLib_Projector::SetType( const GeomAbs_CurveType Type)
97{
98 myType = Type;
99}
100
101
102//=======================================================================
103//function : IsPeriodic
104//purpose :
105//=======================================================================
106
107Standard_Boolean ProjLib_Projector::IsPeriodic() const
108{
109 return myIsPeriodic;
110}
111
112
113//=======================================================================
114//function : SetPeriodic
115//purpose :
116//=======================================================================
117
118void ProjLib_Projector::SetPeriodic()
119{
120 myIsPeriodic = Standard_True;
121}
122
123
124//=======================================================================
125//function : Line
126//purpose :
127//=======================================================================
128
129const gp_Lin2d& ProjLib_Projector::Line()const
130{
131 if (myType != GeomAbs_Line)
9775fa61 132 throw Standard_NoSuchObject("ProjLib_Projector::Line");
7fd59977 133 return myLin;
134}
135
136
137//=======================================================================
138//function : Circle
139//purpose :
140//=======================================================================
141
142const gp_Circ2d& ProjLib_Projector::Circle()const
143{
144 if (myType != GeomAbs_Circle)
9775fa61 145 throw Standard_NoSuchObject("ProjLib_Projector::Circle");
7fd59977 146 return myCirc;
147}
148
149
150//=======================================================================
151//function : Ellipse
152//purpose :
153//=======================================================================
154
155const gp_Elips2d& ProjLib_Projector::Ellipse()const
156{
157 if (myType != GeomAbs_Ellipse)
9775fa61 158 throw Standard_NoSuchObject("ProjLib_Projector::Ellipse");
7fd59977 159 return myElips;
160}
161
162
163//=======================================================================
164//function : Hyperbola
165//purpose :
166//=======================================================================
167
168const gp_Hypr2d& ProjLib_Projector::Hyperbola()const
169{
170 if (myType != GeomAbs_Hyperbola)
9775fa61 171 throw Standard_NoSuchObject("ProjLib_Projector::Hyperbola");
7fd59977 172 return myHypr;
173}
174
175
176//=======================================================================
177//function : Parabola
178//purpose :
179//=======================================================================
180
181const gp_Parab2d& ProjLib_Projector::Parabola()const
182{
183 if (myType != GeomAbs_Parabola)
9775fa61 184 throw Standard_NoSuchObject("ProjLib_Projector::Parabola");
7fd59977 185 return myParab;
186}
187
188
189
190
191//=======================================================================
192//function : Project
193//purpose :
194//=======================================================================
195
196void ProjLib_Projector::Project(const gp_Lin& )
197{
198 myType = GeomAbs_OtherCurve;
199}
200
201
202//=======================================================================
203//function : Project
204//purpose :
205//=======================================================================
206
207void ProjLib_Projector::Project(const gp_Circ& )
208{
209 myType = GeomAbs_OtherCurve;
210}
211
212
213//=======================================================================
214//function : Project
215//purpose :
216//=======================================================================
217
218void ProjLib_Projector::Project(const gp_Elips& )
219{
220 myType = GeomAbs_OtherCurve;
221}
222
223
224//=======================================================================
225//function : Project
226//purpose :
227//=======================================================================
228
229void ProjLib_Projector::Project(const gp_Parab& )
230{
231 myType = GeomAbs_OtherCurve;
232}
233
234
235//=======================================================================
236//function : Project
237//purpose :
238//=======================================================================
239
240void ProjLib_Projector::Project(const gp_Hypr& )
241{
242 myType = GeomAbs_OtherCurve;
243}
244
245
246//=======================================================================
247//function : UFrame
248//purpose :
249//=======================================================================
250
251void ProjLib_Projector::UFrame(const Standard_Real CFirst,
252// const Standard_Real CLast,
253 const Standard_Real ,
254 const Standard_Real UFirst,
255 const Standard_Real Period)
256{
257 if (myType == GeomAbs_Line) {
258// Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 Begin
259// if ( myLin.Direction().Y() == 0.) {
260// Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 End
261// gp_Pnt2d PFirst, PLast;
262 gp_Pnt2d PFirst;
263 PFirst = ElCLib::Value(CFirst,myLin);
264 //PLast = ElCLib::Value(CLast ,myLin);
265 //Standard_Real U = Min( PFirst.X(), PLast.X());
266 Standard_Real U = PFirst.X();
267 Standard_Real NewU = ElCLib::InPeriod(U,UFirst, UFirst + Period);
268 myLin.Translate(gp_Vec2d(NewU-U,0.));
269 }
270}
271
272//=======================================================================
273//function : VFrame
274//purpose :
275//=======================================================================
276
277void ProjLib_Projector::VFrame(const Standard_Real CFirst,
278// const Standard_Real CLast,
279 const Standard_Real ,
280 const Standard_Real VFirst,
281 const Standard_Real Period)
282{
283 if (myType == GeomAbs_Line) {
284// Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 Begin
285// if ( myLin.Direction().X() == 0.) {
286// Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 End
287// gp_Pnt2d PFirst, PLast;
288 gp_Pnt2d PFirst;
289 PFirst = ElCLib::Value(CFirst,myLin);
290 //PLast = ElCLib::Value(CLast ,myLin);
291 //Standard_Real V = Min( PFirst.Y(), PLast.Y());
292 Standard_Real V = PFirst.Y();
293 Standard_Real NewV = ElCLib::InPeriod(V,VFirst, VFirst + Period);
294 myLin.Translate(gp_Vec2d(0.,NewV-V));
295 }
296}
297
298//=======================================================================
299//function : SetBezier
300//purpose :
301//=======================================================================
302
303void ProjLib_Projector::SetBezier(const Handle(Geom2d_BezierCurve)& C)
304{
305 myBezier = C ;
306}
307//=======================================================================
308//function : Bezier
309//purpose :
310//=======================================================================
311
312Handle(Geom2d_BezierCurve)ProjLib_Projector::Bezier() const
313{
314 return myBezier ;
315}
316//=======================================================================
317//function : SetBSpline
318//purpose :
319//=======================================================================
320
321void ProjLib_Projector::SetBSpline(const Handle(Geom2d_BSplineCurve)& C)
322{
323 myBSpline = C ;
324}
325//=======================================================================
326//function : BSpline
327//purpose :
328//=======================================================================
329
330Handle(Geom2d_BSplineCurve) ProjLib_Projector::BSpline() const
331{
332 return myBSpline ;
333}