From 8f0ff2b2c261046d3f3f9d0793a2bacb5d247a01 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 22 Jul 2015 20:41:13 +0000 Subject: [PATCH] Include : - aggiornamento prototipi - aggiunte funzioni inline per UiUnits. --- EGkGeoObj.h | 2 +- EGkGeomDB.h | 4 +-- EGkUiUnits.h | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++ EGkUserObj.h | 2 +- EInAPI.h | 6 ++++ EXeExecutor.h | 7 +++++ 6 files changed, 98 insertions(+), 4 deletions(-) create mode 100644 EGkUiUnits.h diff --git a/EGkGeoObj.h b/EGkGeoObj.h index b4183ab..95b7c95 100644 --- a/EGkGeoObj.h +++ b/EGkGeoObj.h @@ -38,7 +38,7 @@ class __declspec( novtable) IGeoObj virtual GeoObjType GetType( void) const = 0 ; virtual bool IsValid( void) const = 0 ; virtual const std::string& GetTitle( void) const = 0 ; - virtual bool Dump( std::string& sOut, const char* szNewLine = "\n") const = 0 ; + virtual bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const = 0 ; virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const = 0 ; virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const = 0 ; virtual bool Translate( const Vector3d& vtMove) = 0 ; diff --git a/EGkGeomDB.h b/EGkGeomDB.h index b5a2173..ce05e12 100644 --- a/EGkGeomDB.h +++ b/EGkGeomDB.h @@ -114,7 +114,7 @@ class __declspec( novtable) IGeomDB virtual int GetPrevSelectedObj( void) const = 0 ; virtual bool ClearSelection( void) = 0 ; // Attributes - virtual bool DumpAttributes( int nId, std::string& sOut, const char* szNewLine) const = 0 ; + virtual bool DumpAttributes( int nId, std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const = 0 ; virtual bool CopyAttributes( int nIdSou, int nIdDest) = 0 ; virtual bool SetLevel( int nId, int nLevel) = 0 ; virtual bool RevertLevel( int nId) = 0 ; @@ -175,7 +175,7 @@ class __declspec( novtable) IGeomDB virtual bool SetUserObj( int nId, IUserObj* pUserObj) = 0 ; virtual IUserObj* GetUserObj( int nId) = 0 ; virtual const IUserObj* GetUserObj( int nId) const = 0 ; - virtual bool DumpUserObj( int nId, std::string& sOut, const char* szNewLine) const = 0 ; + virtual bool DumpUserObj( int nId, std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const = 0 ; virtual bool CopyUserObj( int nIdSou, int nIdDest) = 0 ; virtual bool RemoveUserObj( int nId) = 0 ; // Material library diff --git a/EGkUiUnits.h b/EGkUiUnits.h new file mode 100644 index 0000000..acf1c34 --- /dev/null +++ b/EGkUiUnits.h @@ -0,0 +1,81 @@ +//---------------------------------------------------------------------------- +// EgalTech 2015-2015 +//---------------------------------------------------------------------------- +// File : EGkUiUnits.h Data : 22.07.15 Versione : 1.6g6 +// Contenuto : Funzioni di conversione per unità di misura in interfaccia. +// +// +// +// Modifiche : 22.07.15 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include "/EgtDev/Include/EGkPoint3d.h" +#include "/EgtDev/Include/EGkGeoConst.h" + + +//----------------------------------------------------------------------------- +inline double +GetInUiUnits( double dVal, bool bMM) +{ + // interfaccia in mm, il valore va bene così + if ( bMM) + return dVal ; + // interfaccia in pollici, devo trasformarlo + return ( dVal / ONEINCH) ; +} + +//----------------------------------------------------------------------------- +inline double +GetAreaInUiUnits( double dVal, bool bMM) +{ + // interfaccia in mm, il valore va bene così + if ( bMM) + return dVal ; + // interfaccia in pollici, devo trasformarlo + return ( dVal / ( ONEINCH * ONEINCH)) ; +} + +//----------------------------------------------------------------------------- +inline double +GetVolumeInUiUnits( double dVal, bool bMM) +{ + // interfaccia in mm, il valore va bene così + if ( bMM) + return dVal ; + // interfaccia in pollici, devo trasformarlo + return ( dVal / ( ONEINCH * ONEINCH * ONEINCH)) ; +} + +//----------------------------------------------------------------------------- +inline Vector3d +GetInUiUnits( const Vector3d& vtV, bool bMM) +{ + // interfaccia in mm, il vettore va bene così + if ( bMM) + return vtV ; + // interfaccia in pollici, devo trasformarlo + Vector3d vtW = vtV ; + vtW.x /= ONEINCH ; + vtW.y /= ONEINCH ; + vtW.z /= ONEINCH ; + return vtW ; +} + +//----------------------------------------------------------------------------- +inline Point3d +GetInUiUnits( const Point3d& ptP, bool bMM) +{ + // interfaccia in mm, il punto va bene così + if ( bMM) + return ptP ; + // interfaccia in pollici, devo trasformarlo + Point3d ptQ = ptP ; + ptQ.x /= ONEINCH ; + ptQ.y /= ONEINCH ; + ptQ.z /= ONEINCH ; + return ptQ ; +} diff --git a/EGkUserObj.h b/EGkUserObj.h index feb1d0b..ee0866c 100644 --- a/EGkUserObj.h +++ b/EGkUserObj.h @@ -25,7 +25,7 @@ class __declspec( novtable) IUserObj virtual ~IUserObj( void) {} virtual IUserObj* Clone( void) const = 0 ; virtual const std::string& GetClassName( void) const = 0 ; - virtual bool Dump( std::string& sOut, const char* szNewLine = "\n") const = 0 ; + virtual bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const = 0 ; virtual bool SetOwner( int nId, IGeomDB* pGDB) = 0 ; virtual int GetOwner( void) const = 0 ; virtual IGeomDB* GetGeomDB( void) const = 0 ; diff --git a/EInAPI.h b/EInAPI.h index 447b6cb..aa97ef3 100644 --- a/EInAPI.h +++ b/EInAPI.h @@ -49,6 +49,12 @@ EIN_EXPORT BOOL __stdcall EgtGetMemoryInfo( wchar_t*& wsMem) ; EIN_EXPORT BOOL __stdcall EgtFreeMemory( void* pMem) ; EIN_EXPORT BOOL __stdcall EgtOutLog( const wchar_t* wsMsg) ; +// UiUnits +EIN_EXPORT BOOL __stdcall EgtSetUiUnits( BOOL bMM) ; +EIN_EXPORT BOOL __stdcall EgtUiUnitsAreMM( void) ; +EIN_EXPORT double __stdcall EgtFromUiUnits( double dVal) ; +EIN_EXPORT double __stdcall EgtToUiUnits( double dVal) ; + // Context (GeomDB) EIN_EXPORT int __stdcall EgtInitContext( void) ; EIN_EXPORT int __stdcall EgtDeleteContext( int nGseCtx) ; diff --git a/EXeExecutor.h b/EXeExecutor.h index 7564889..9668a7a 100644 --- a/EXeExecutor.h +++ b/EXeExecutor.h @@ -49,6 +49,12 @@ EXE_EXPORT bool ExeGetCpuInfo( std::string& sCpu) ; EXE_EXPORT bool ExeGetMemoryInfo( std::string& sMem) ; EXE_EXPORT bool ExeOutLog( const std::string& sMsg) ; +// UiUnits +EXE_EXPORT bool ExeSetUiUnits( bool bMM) ; +EXE_EXPORT bool ExeUiUnitsAreMM( void) ; +EXE_EXPORT double ExeFromUiUnits( double dVal) ; +EXE_EXPORT double ExeToUiUnits( double dVal) ; + // GeomDB EXE_EXPORT int ExeInitContext( void) ; EXE_EXPORT int ExeDeleteContext( int nGseCtx) ; @@ -517,4 +523,5 @@ EXE_EXPORT bool ExeUnProjectPoint( int nWinX, int nWinY, Point3d& ptP) ; // Messages EXE_EXPORT bool ExeLoadMessages( const std::string& sMsgFilePath) ; +EXE_EXPORT const std::string& ExeGetLanguage( void) ; EXE_EXPORT const std::string& ExeGetMsg( int nMsg) ;