0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / DrawFairCurve / DrawFairCurve_MinimalVariation.cxx
1 // Copyright (c) 1996-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15
16 #include <Draw_ColorKind.hxx>
17 #include <DrawFairCurve_MinimalVariation.hxx>
18 #include <FairCurve_MinimalVariation.hxx>
19 #include <Standard_Type.hxx>
20
21 IMPLEMENT_STANDARD_RTTIEXT(DrawFairCurve_MinimalVariation,DrawFairCurve_Batten)
22
23 DrawFairCurve_MinimalVariation::DrawFairCurve_MinimalVariation(const Standard_Address TheMVC)
24                                : DrawFairCurve_Batten(TheMVC)
25                                  
26 {
27  SetColor(Draw_jaune);
28 }
29
30 void DrawFairCurve_MinimalVariation::SetCurvature(const Standard_Integer Side,
31                                                   const Standard_Real Rho)
32 {
33   if (Side == 1) {
34      ((FairCurve_MinimalVariation*)MyBatten)->SetCurvature1(Rho);
35      ((FairCurve_MinimalVariation*)MyBatten)->SetConstraintOrder1(2);
36    }
37   else {
38      ((FairCurve_MinimalVariation*)MyBatten)->SetCurvature2(Rho);
39      ((FairCurve_MinimalVariation*)MyBatten)->SetConstraintOrder2(2);
40    }
41   Compute();
42 }
43
44 void DrawFairCurve_MinimalVariation::FreeCurvature(const Standard_Integer Side)
45 {
46   if (Side == 1) {
47      if ( ((FairCurve_MinimalVariation*)MyBatten)->GetConstraintOrder1()>1) 
48        {
49          ((FairCurve_MinimalVariation*)MyBatten)->SetConstraintOrder1(1);
50        }
51    }
52   else {
53      if ( ((FairCurve_MinimalVariation*)MyBatten)->GetConstraintOrder2()>1) 
54        {
55          ((FairCurve_MinimalVariation*)MyBatten)->SetConstraintOrder2(1);
56        }
57    }
58   Compute();
59 }  
60
61
62 void DrawFairCurve_MinimalVariation::SetPhysicalRatio( const Standard_Real Ratio)
63 {
64  ((FairCurve_MinimalVariation*)MyBatten)->SetPhysicalRatio(Ratio);
65  Compute();
66 }
67
68 Standard_Real DrawFairCurve_MinimalVariation::GetCurvature(const Standard_Integer Side) const
69 {
70  if (Side == 1) {return ((FairCurve_MinimalVariation*)MyBatten)->GetCurvature1();}
71  else           {return ((FairCurve_MinimalVariation*)MyBatten)->GetCurvature2();}
72 }
73
74 Standard_Real DrawFairCurve_MinimalVariation::GetPhysicalRatio() const
75 {
76   return ((FairCurve_MinimalVariation*)MyBatten)->GetPhysicalRatio();
77 }