/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// // IfcUnitConverter.h: interface for the OdIfcUnitConverter class. // ////////////////////////////////////////////////////////////////////// #if !defined(ODA_ODIFCUNITCONVERTER_H_INCLUDED_) #define ODA_ODIFCUNITCONVERTER_H_INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "IfcBuildOptions.h" #include "daiUnitConverter.h" #include "TD_PackPush.h" class OdIfcFile; /** \details A class that implements conversion of different units to the SI units. */ class IFCCORE_EXPORT OdIfcUnitConverter : public OdDAI::OdUnitConverter { public: /** \details Performs an attempt to convert a specified unit to the SI unit. \param unitType [in] A string that contains the type of the unit to be converted. \param val [in] A unit value. \returns A double value that contains the converted value of the specified unit type. \remarks The unit type value must belong to the IfcUnitEnum of the current schema. */ double convertToSIUnit(const OdAnsiString& unitType, double val) const override; /** \details Appends a new convertible unit. \param unitType [in] A string that contains the type of the convertible unit. \param unitId [in] An identifier of the corresponding IfcConversionBasedUnit object. \remarks The unit type value must belong to the IfcUnitEnum of the current schema. */ void appendUnit(const OdAnsiString& unitType, const OdDAIObjectId& unitId) override; /** \details Appends a new convertible unit. \param unitId [in] An identifier of the corresponding IfcConversionBasedUnit object. */ void appendUnit(const OdDAIObjectId& unitId) override; /** \details Gets name and prefix of convertion type. \param unitType [in] A string that contains the type of the unit to be returned. \param unitName [out] A unit name. \param unitPrefix [out] A unit prefix name. If no prefix then the value is empty. \returns True if the attributes are retrieved successfully, false otherwise. */ bool getConversionUnitName(const OdAnsiString& unitType, OdAnsiString& unitName, OdAnsiString& unitPrefix) override; /** \details Removes all convertible units. */ void clearUnits() override; /** \details Performs an attempt to convert a local unit to the SI unit. \param localUnitId [in] An id of local unit entity. \param val [in] A unit value. \returns A double value that contains the converted value of the specified unit type. */ double convertFromLocalUnit(const OdDAIObjectId& localUnitId, double val) const override; //DOM-IGNORE-BEGIN private: std::map m_units; double convertIfcConversionBasedUnit (const OdDAIObjectId& unitId, double val) const; double convertIfcConversionBasedUnitWithOffset(const OdDAIObjectId& unitId, double val) const; double convertIfcSIUnit (const OdDAIObjectId& unitId, double val) const; friend class OdIfcFile; //DOM-IGNORE-END }; /** \details A data type that represents a smart pointer to an OdIfcUnitConverter object. */ typedef OdSharedPtr OdIfcUnitConverterPtr; #include "TD_PackPop.h" #endif // !defined(ODA_ODIFCUNITCONVERTER_H_INCLUDED_)