EgtInterface 1.6a6 :

- sistemate funzioni su Project (New, Open, Insert, Save, SaveAs, Import, Export) e Exec.
This commit is contained in:
Dario Sassi
2015-01-28 11:58:50 +00:00
parent 1bea531b4f
commit f039e22297
8 changed files with 169 additions and 31 deletions
+56 -11
View File
@@ -15,6 +15,7 @@
#include "stdafx.h"
#include "API.h"
#include "API_Macro.h"
#include "AuxTools.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGnStringConverter.h"
@@ -179,10 +180,18 @@ __stdcall EgtNewFile( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, FALSE)
bool bOk = true ;
// reinizializzazione (con pulizia) del DB geometrico
pGseCtx->m_pGeomDB->Init() ;
pGseCtx->m_pGeomDB->SetDefaultMaterial( pGseCtx->m_colDef) ;
return TRUE ;
bOk = bOk && pGseCtx->m_pGeomDB->Init() ;
bOk = bOk && pGseCtx->m_pGeomDB->SetDefaultMaterial( pGseCtx->m_colDef) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtNewFile()"
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return ( bOk ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
@@ -196,26 +205,51 @@ __stdcall EgtOpenFile( const wchar_t* wsFilePath)
bool
EgtOpenFile( const string& sFilePath)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// reinizializzazione (con pulizia) del DB geometrico
if ( ! EgtNewFile())
return false ;
bOk = bOk && pGseCtx->m_pGeomDB->Init() ;
bOk = bOk && pGseCtx->m_pGeomDB->SetDefaultMaterial( pGseCtx->m_colDef) ;
// carico il file
return GetCurrGeomDB()->Load( sFilePath) ;
bOk = bOk && GetCurrGeomDB()->Load( sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLuaPath = sFilePath ;
ReplaceString( sLuaPath, "\\", "\\\\") ;
string sLua = "EgtOpenFile('" + sLuaPath + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtImportFile( const wchar_t* wsFilePath)
__stdcall EgtInsertFile( const wchar_t* wsFilePath)
{
return ( EgtImportFile( wstrztoA( wsFilePath)) ? TRUE : FALSE) ;
return ( EgtInsertFile( wstrztoA( wsFilePath)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
bool
EgtImportFile( const string& sFilePath)
EgtInsertFile( const string& sFilePath)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// carico il file
return GetCurrGeomDB()->Load( sFilePath) ;
bool bOk = pGeomDB->Load( sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLuaPath = sFilePath ;
ReplaceString( sLuaPath, "\\", "\\\\") ;
string sLua = "EgtInsertFile('" + sLuaPath + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
@@ -232,5 +266,16 @@ EgtSaveFile( const string& sFilePath, int nFlag)
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// salvo il file
return pGeomDB->Save( sFilePath, nFlag) ;
bool bOk = pGeomDB->Save( sFilePath, nFlag) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLuaPath = sFilePath ;
ReplaceString( sLuaPath, "\\", "\\\\") ;
string sLua = "EgtSaveFile('" + sLuaPath + "'," +
NgeTypeToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}