1 // Copyright (c) 2021 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 #include <StepData_GlobalFactors.hxx>
15 
16 // ============================================================================
17 // Method : Consturctor
18 // Purpose:
19 // ============================================================================
StepData_GlobalFactors()20 StepData_GlobalFactors::StepData_GlobalFactors()
21   :myLengthFactor(1.), myPlaneAngleFactor(1.),
22    mySolidAngleFactor(1.), myFactRD(1.),
23    myFactDR(1.), myCascadeUnit(1.)
24 {}
25 
26 // ============================================================================
27 // Method : Intance
28 // Purpose:
29 // ============================================================================
Intance()30 StepData_GlobalFactors& StepData_GlobalFactors::Intance()
31 {
32   static StepData_GlobalFactors THE_FACTORS;
33   return THE_FACTORS;
34 }
35 
36 // ============================================================================
37 // Method : InitializeFactors
38 // Purpose:
39 // ============================================================================
InitializeFactors(const Standard_Real theLengthFactor,const Standard_Real thePlaneAngleFactor,const Standard_Real theSolidAngleFactor)40 void StepData_GlobalFactors::InitializeFactors(
41   const Standard_Real theLengthFactor,
42   const Standard_Real thePlaneAngleFactor,
43   const Standard_Real theSolidAngleFactor)
44 {
45   myLengthFactor = theLengthFactor;
46   myPlaneAngleFactor = thePlaneAngleFactor;
47   mySolidAngleFactor = theSolidAngleFactor;
48   myFactRD = 1. / thePlaneAngleFactor;
49   myFactDR = thePlaneAngleFactor;
50 }
51 
52 // ============================================================================
53 // Method : LengthFactor
54 // Purpose:
55 // ============================================================================
LengthFactor()56 Standard_Real StepData_GlobalFactors::LengthFactor()
57 {
58   return myLengthFactor;
59 }
60 
61 // ============================================================================
62 // Method : PlaneAngleFactor
63 // Purpose:
64 // ============================================================================
PlaneAngleFactor()65 Standard_Real StepData_GlobalFactors::PlaneAngleFactor()
66 {
67   return myPlaneAngleFactor;
68 }
69 
70 // ============================================================================
71 // Method : SolidAngleFactor
72 // Purpose:
73 // ============================================================================
SolidAngleFactor()74 Standard_Real StepData_GlobalFactors::SolidAngleFactor()
75 {
76   return mySolidAngleFactor;
77 }
78 
79 // ============================================================================
80 // Method : FactorRadianDegree
81 // Purpose:
82 // ============================================================================
FactorRadianDegree()83 Standard_Real StepData_GlobalFactors::FactorRadianDegree()
84 {
85   return myFactRD;
86 }
87 
88 // ============================================================================
89 // Method : FactorDegreeRadian
90 // Purpose:
91 // ============================================================================
FactorDegreeRadian()92 Standard_Real StepData_GlobalFactors::FactorDegreeRadian()
93 {
94   return myFactDR;
95 }
96 
97 // ============================================================================
98 // Method : SetCascadeUnit
99 // Purpose:
100 // ============================================================================
SetCascadeUnit(const Standard_Real theUnit)101 void StepData_GlobalFactors::SetCascadeUnit(const Standard_Real theUnit)
102 {
103   myCascadeUnit = theUnit;
104 }
105 
106 // ============================================================================
107 // Method : CascadeUnit
108 // Purpose:
109 // ============================================================================
CascadeUnit()110 Standard_Real StepData_GlobalFactors::CascadeUnit()
111 {
112   return myCascadeUnit;
113 }
114