Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:30

0001 // Copyright (c) 2021 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _UnitsMethods_HeaderFile
0015 #define _UnitsMethods_HeaderFile
0016 
0017 #include <Standard.hxx>
0018 #include <Standard_DefineAlloc.hxx>
0019 #include <Standard_Handle.hxx>
0020 #include <UnitsMethods_LengthUnit.hxx>
0021 
0022 //! Class for using global units variables
0023 class UnitsMethods
0024 {
0025 public:
0026 
0027   DEFINE_STANDARD_ALLOC
0028 
0029 
0030   //! Returns value of unit encoded by parameter theUnit
0031   //! (integer value denoting unit, as described in IGES
0032   //! standard) in millimeters by default
0033   Standard_EXPORT static Standard_Real GetLengthFactorValue(const Standard_Integer theUnit);
0034 
0035   //! Returns value of current internal unit for CASCADE
0036   //! in millemeters by default
0037   Standard_EXPORT static Standard_Real GetCasCadeLengthUnit(const UnitsMethods_LengthUnit theBaseUnit = UnitsMethods_LengthUnit_Millimeter);
0038 
0039   //! Sets value of current internal unit for CASCADE
0040   Standard_EXPORT static void SetCasCadeLengthUnit(const Standard_Real theUnitValue,
0041     const UnitsMethods_LengthUnit theBaseUnit = UnitsMethods_LengthUnit_Millimeter);
0042 
0043   //! Sets value of current internal unit for CASCADE
0044   //! by parameter theUnit (integer value denoting unit,
0045   //! as described in IGES standard)
0046   Standard_EXPORT static void SetCasCadeLengthUnit(const Standard_Integer theUnit);
0047 
0048   //! Returns the scale factor for switch from first given unit to second given unit
0049   Standard_EXPORT static Standard_Real GetLengthUnitScale(const UnitsMethods_LengthUnit theFromUnit,
0050                                                           const UnitsMethods_LengthUnit theToUnit);
0051 
0052   //! Returns the enumeration corresponding to the given scale factor
0053   Standard_EXPORT static UnitsMethods_LengthUnit GetLengthUnitByFactorValue(const Standard_Real theFactorValue,
0054     const UnitsMethods_LengthUnit theBaseUnit = UnitsMethods_LengthUnit_Millimeter);
0055 
0056   //! Returns string name for the given scale factor
0057   Standard_EXPORT static Standard_CString DumpLengthUnit(const Standard_Real theScaleFactor,
0058     const UnitsMethods_LengthUnit theBaseUnit = UnitsMethods_LengthUnit_Millimeter);
0059 
0060   //! Returns string for the given value of LengthUnit
0061   Standard_EXPORT static Standard_CString DumpLengthUnit(const UnitsMethods_LengthUnit theUnit);
0062 
0063   //! Make conversion of given string to value of LengthUnit
0064   Standard_EXPORT static UnitsMethods_LengthUnit LengthUnitFromString(Standard_CString theStr,
0065                                                                       const Standard_Boolean theCaseSensitive);
0066 
0067 };
0068 
0069 #endif // _UnitsMethods_HeaderFile