b311480e |
1 | // Created on: 1996-02-16 |
2 | // Created by: Philippe MANGIN |
3 | // Copyright (c) 1996-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 | // |
973c2be1 |
8 | // This library is free software; you can redistribute it and / or modify it |
9 | // under the terms of the GNU Lesser General Public version 2.1 as published |
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 | #include <DrawFairCurve_Batten.ixx> |
18 | |
19 | #include <FairCurve_Batten.hxx> |
20 | #include <FairCurve_AnalysisCode.hxx> |
21 | #include <GeomTools_Curve2dSet.hxx> |
22 | |
23 | DrawFairCurve_Batten::DrawFairCurve_Batten(const Standard_Address TheBatten) |
24 | : DrawTrSurf_BSplineCurve2d( ((FairCurve_Batten*)TheBatten)->Curve()), |
25 | MyBatten( TheBatten) |
26 | |
27 | { |
28 | Compute(); |
29 | ShowCurvature(); |
30 | } |
31 | |
32 | void DrawFairCurve_Batten::Compute() |
33 | { |
34 | FairCurve_AnalysisCode Iana; |
6e6cd5d9 |
35 | ((FairCurve_Batten*)MyBatten)->Compute(Iana, 50, 1.0e-2); |
7fd59977 |
36 | curv = ((FairCurve_Batten*)MyBatten)->Curve(); |
37 | } |
38 | void DrawFairCurve_Batten::SetPoint(const Standard_Integer Side, const gp_Pnt2d& Point) |
39 | { |
40 | if (Side == 1) { |
41 | ((FairCurve_Batten*)MyBatten)->SetP1(Point); |
42 | } |
43 | else { |
44 | ((FairCurve_Batten*)MyBatten)-> SetP2(Point); |
45 | } |
46 | Compute(); |
47 | } |
48 | |
49 | void DrawFairCurve_Batten::SetAngle(const Standard_Integer Side, const Standard_Real Angle) |
50 | { |
51 | if (Side == 1) { |
c6541a0c |
52 | ((FairCurve_Batten*)MyBatten)->SetAngle1(Angle*M_PI/180); |
7fd59977 |
53 | if ( ((FairCurve_Batten*)MyBatten)->GetConstraintOrder1() == 0 ) |
54 | { |
55 | ((FairCurve_Batten*)MyBatten)->SetConstraintOrder1(1); |
56 | } |
57 | } |
58 | else { |
c6541a0c |
59 | ((FairCurve_Batten*)MyBatten)->SetAngle2(Angle*M_PI/180); |
7fd59977 |
60 | if ( ((FairCurve_Batten*)MyBatten)->GetConstraintOrder2() == 0 ) |
61 | { |
62 | ((FairCurve_Batten*)MyBatten)->SetConstraintOrder2(1); |
63 | } |
64 | } |
65 | Compute(); |
66 | } |
67 | |
68 | void DrawFairCurve_Batten::SetSliding(const Standard_Real Length) |
69 | { |
70 | ((FairCurve_Batten*)MyBatten)-> SetFreeSliding(Standard_False); |
71 | ((FairCurve_Batten*)MyBatten)->SetSlidingFactor(Length); |
72 | Compute(); |
73 | } |
74 | |
75 | void DrawFairCurve_Batten::SetHeight(const Standard_Real Height) |
76 | { |
77 | ((FairCurve_Batten*)MyBatten)->SetHeight(Height); |
78 | Compute(); |
79 | } |
80 | |
81 | void DrawFairCurve_Batten::SetSlope(const Standard_Real Slope) |
82 | { |
83 | ((FairCurve_Batten*)MyBatten)->SetSlope(Slope); |
84 | Compute(); |
85 | } |
86 | |
87 | Standard_Real DrawFairCurve_Batten::GetAngle(const Standard_Integer Side) const |
88 | { |
89 | if (Side == 1) return ((FairCurve_Batten*)MyBatten)->GetAngle1(); |
90 | else return ((FairCurve_Batten*)MyBatten)->GetAngle2(); |
91 | } |
92 | |
93 | Standard_Real DrawFairCurve_Batten::GetSliding() const |
94 | { |
95 | return ((FairCurve_Batten*)MyBatten)->GetSlidingFactor(); |
96 | } |
97 | |
98 | |
99 | void DrawFairCurve_Batten::FreeSliding() |
100 | { |
101 | ((FairCurve_Batten*)MyBatten)->SetFreeSliding(Standard_True); |
102 | Compute(); |
103 | } |
104 | |
105 | void DrawFairCurve_Batten::FreeAngle(const Standard_Integer Side) |
106 | { |
107 | if (Side == 1) ((FairCurve_Batten*)MyBatten)->SetConstraintOrder1(0); |
108 | else ((FairCurve_Batten*)MyBatten)->SetConstraintOrder2(0); |
109 | |
110 | Compute(); |
111 | } |
112 | |
113 | void DrawFairCurve_Batten::Dump(Standard_OStream& S)const |
114 | { |
115 | GeomTools_Curve2dSet::PrintCurve2d(curv,S); |
116 | ((FairCurve_Batten*)MyBatten)->Dump(S); |
117 | } |