EgtExecutor 1.6g6 :
- aggiunta gestione unità di misura di interfaccia (mm o inch) - aggiunta ExeGetLanguage e EgtGetLanguage (lua) per avere sigla della lingua utilizzata.
This commit is contained in:
+13
-8
@@ -18,6 +18,7 @@
|
||||
#include "AuxTools.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkUiUnits.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
@@ -469,12 +470,14 @@ ExeGroupDump( int nId, string& sDump)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// flag per unità di misura di uscita
|
||||
bool bMM = ExeUiUnitsAreMM() ;
|
||||
// preparo l'intestazione
|
||||
sDump = "Group " + ToString( nId) + "\r\n" ;
|
||||
// preparo gli attributi
|
||||
pGeomDB->DumpAttributes( nId, sDump, "\r\n") ;
|
||||
pGeomDB->DumpAttributes( nId, sDump, bMM, "\r\n") ;
|
||||
// preparo UserObj
|
||||
pGeomDB->DumpUserObj( nId, sDump, "\r\n") ;
|
||||
pGeomDB->DumpUserObj( nId, sDump, bMM, "\r\n") ;
|
||||
// numero di nodi (figli)
|
||||
int nNodes = pGeomDB->GetGroupObjs( nId) ;
|
||||
sDump += "Nodes : " + ToString( nNodes) + "\r\n" ;
|
||||
@@ -482,7 +485,7 @@ ExeGroupDump( int nId, string& sDump)
|
||||
Frame3d frGlob ;
|
||||
if ( pGeomDB->GetGroupGlobFrame( nId, frGlob)) {
|
||||
sDump += "GlobFrame :\r\n" ;
|
||||
sDump += " O(" + ToString( frGlob.Orig()) + ")\r\n" ;
|
||||
sDump += " O(" + ToString( GetInUiUnits( frGlob.Orig(), bMM)) + ")\r\n" ;
|
||||
sDump += " X(" + ToString( frGlob.VersX()) + ")\r\n" ;
|
||||
sDump += " Y(" + ToString( frGlob.VersY()) + ")\r\n" ;
|
||||
sDump += " Z(" + ToString( frGlob.VersZ()) + ")\r\n" ;
|
||||
@@ -493,8 +496,8 @@ ExeGroupDump( int nId, string& sDump)
|
||||
sDump += "GlobBBox :\r\n" ;
|
||||
Point3d ptMin, ptMax ;
|
||||
if ( b3Glob.GetMinMax( ptMin, ptMax)) {
|
||||
sDump += " m(" + ToString( ptMin) + ")\r\n" ;
|
||||
sDump += " M(" + ToString( ptMax) + ")\r\n" ;
|
||||
sDump += " m(" + ToString( GetInUiUnits( ptMin, bMM)) + ")\r\n" ;
|
||||
sDump += " M(" + ToString( GetInUiUnits( ptMax, bMM)) + ")\r\n" ;
|
||||
}
|
||||
else {
|
||||
sDump += " Empty\r\n" ;
|
||||
@@ -509,6 +512,8 @@ ExeGeoObjDump( int nId, string& sDump)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// flag per unità di misura di uscita
|
||||
bool bMM = ExeUiUnitsAreMM() ;
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nId) ;
|
||||
if ( pGeoObj == nullptr)
|
||||
@@ -516,11 +521,11 @@ ExeGeoObjDump( int nId, string& sDump)
|
||||
// preparo l'intestazione
|
||||
sDump = pGeoObj->GetTitle() + " " + ToString( nId) + "\r\n" ;
|
||||
// preparo gli attributi
|
||||
pGeomDB->DumpAttributes( nId, sDump, "\r\n") ;
|
||||
pGeomDB->DumpAttributes( nId, sDump, bMM, "\r\n") ;
|
||||
// preparo UserObj
|
||||
pGeomDB->DumpUserObj( nId, sDump, "\r\n") ;
|
||||
pGeomDB->DumpUserObj( nId, sDump, bMM, "\r\n") ;
|
||||
// recupero i dati geometrici
|
||||
if ( ! pGeoObj->Dump( sDump, "\r\n"))
|
||||
if ( ! pGeoObj->Dump( sDump, bMM, "\r\n"))
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : API_General.cpp Data : 01.09.14 Versione : 1.5i1
|
||||
// Contenuto : Funzioni generali per API.
|
||||
// File : EXE_General.cpp Data : 01.09.14 Versione : 1.5i1
|
||||
// Contenuto : Funzioni generali per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
+13
-3
@@ -26,6 +26,7 @@ using namespace std ;
|
||||
//----------------------------------------------------------------------------
|
||||
typedef unordered_map< int, string> INTSTR_UMAP ;
|
||||
static INTSTR_UMAP s_IdStringMap ;
|
||||
static string s_sLanguage ;
|
||||
static string s_sMsg ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -74,21 +75,30 @@ ExeLoadMessages( const string& sMsgFilePath)
|
||||
// inserisco il messaggio in tabella
|
||||
if ( ! s_IdStringMap.emplace( nNum, sMsg).second)
|
||||
return false ;
|
||||
// se messaggio 0 è la lingua
|
||||
if ( nNum == 0)
|
||||
s_sLanguage = sMsg ;
|
||||
}
|
||||
|
||||
// termino lo scanner
|
||||
return scan.Terminate() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const string&
|
||||
ExeGetLanguage( void)
|
||||
{
|
||||
return s_sLanguage ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const string&
|
||||
ExeGetMsg( int nMsg)
|
||||
{
|
||||
// recupero il messaggio
|
||||
INTSTR_UMAP::iterator Iter = s_IdStringMap.find( nMsg) ;
|
||||
auto Iter = s_IdStringMap.find( nMsg) ;
|
||||
if ( Iter != s_IdStringMap.end())
|
||||
s_sMsg = Iter->second ;
|
||||
else
|
||||
s_sMsg = "Msg" + ToString( nMsg) ;
|
||||
return s_sMsg ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_UiUnits.cpp Data : 21.07.15 Versione : 1.6g6
|
||||
// Contenuto : Funzioni per gestione unità di misura per interfaccia utente.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 21.07.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "/EgtDev/Include/EGkGeoConst.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool s_bMmUiUnits = true ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetUiUnits( bool bMM)
|
||||
{
|
||||
s_bMmUiUnits = bMM ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeUiUnitsAreMM( void)
|
||||
{
|
||||
return s_bMmUiUnits ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
double
|
||||
ExeFromUiUnits( double dVal)
|
||||
{
|
||||
if ( s_bMmUiUnits)
|
||||
return dVal ;
|
||||
else
|
||||
return ONEINCH * dVal ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
double
|
||||
ExeToUiUnits( double dVal)
|
||||
{
|
||||
if ( s_bMmUiUnits)
|
||||
return dVal ;
|
||||
else
|
||||
return dVal / ONEINCH ;
|
||||
}
|
||||
Binary file not shown.
@@ -247,6 +247,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="DllGraphics.cpp" />
|
||||
<ClCompile Include="DllMachKernel.cpp" />
|
||||
<ClCompile Include="EXeDllMain.cpp" />
|
||||
<ClCompile Include="EXE_UiUnits.cpp" />
|
||||
<ClCompile Include="GeoTools.cpp" />
|
||||
<ClCompile Include="GseContext.cpp" />
|
||||
<ClCompile Include="LUA_Base.cpp" />
|
||||
@@ -268,6 +269,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="LUA_GeoTransform.cpp" />
|
||||
<ClCompile Include="LUA_MachMgr.cpp" />
|
||||
<ClCompile Include="LUA_Scene.cpp" />
|
||||
<ClCompile Include="LUA_UiUnits.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
|
||||
@@ -227,6 +227,12 @@
|
||||
<ClCompile Include="EXE_MachMgr.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_UiUnits.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LUA_UiUnits.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtExecutor.rc">
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
//-------------------------- General -----------------------------------------
|
||||
bool LuaInstallGeneral( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- UiUnits -----------------------------------------
|
||||
bool LuaInstallUiUnits( LuaMgr& luaMgr) ;
|
||||
|
||||
//-------------------------- GeoBase -----------------------------------------
|
||||
bool LuaInstallGeoBase( LuaMgr& luaMgr) ;
|
||||
|
||||
|
||||
+6
-2
@@ -1,8 +1,8 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_General.cpp Data : 27.09.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni generali per LUA.
|
||||
// File : LUA_Base.cpp Data : 27.09.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni di base per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -30,6 +30,10 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGeneral (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallUiUnits( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallUiUnits (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
}
|
||||
if ( ! LuaInstallGeoBase( LuaMgr)) {
|
||||
LOG_ERROR( GetLogger(), "Error in LuaInstallGeoBase (" __FUNCTION__ ")")
|
||||
return false ;
|
||||
|
||||
@@ -299,6 +299,18 @@ LuaIs64bit( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetLanguage( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero il nome della lingua corrente
|
||||
string sLang = ExeGetLanguage() ;
|
||||
LuaSetParam( L, sLang) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGeneral( LuaMgr& luaMgr)
|
||||
@@ -320,5 +332,6 @@ LuaInstallGeneral( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtBinaryFileCompare", LuaBinaryFileCompare) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetVersion", LuaGetVersion) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtIs64bit", LuaIs64bit) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLanguage", LuaGetLanguage) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_UiUnits.cpp Data : 21.07.15 Versione : 1.6g6
|
||||
// Contenuto : Funzioni gestione unità di misura in interfaccia utente per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 21.07.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaUiUnitsAreMM( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero il tipo di unità di misura in interfaccia utente
|
||||
bool bOk = ExeUiUnitsAreMM() ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaFromUiUnits( lua_State* L)
|
||||
{
|
||||
// 1 parametro : dVal
|
||||
double dVal ;
|
||||
LuaCheckParam( L, 1, dVal)
|
||||
LuaClearStack( L) ;
|
||||
// converto da unità di misura interfaccia a unità interne
|
||||
double dVal2 = ExeFromUiUnits( dVal) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, dVal2) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaToUiUnits( lua_State* L)
|
||||
{
|
||||
// 1 parametro : dVal
|
||||
double dVal ;
|
||||
LuaCheckParam( L, 1, dVal)
|
||||
LuaClearStack( L) ;
|
||||
// converto da unità di misura interne a unità interfaccia
|
||||
double dVal2 = ExeToUiUnits( dVal) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, dVal2) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallUiUnits( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtUiUnitsAreMM", LuaUiUnitsAreMM) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtFromUiUnits", LuaFromUiUnits) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtToUiUnits", LuaToUiUnits) ;
|
||||
return bOk ;
|
||||
}
|
||||
Reference in New Issue
Block a user