EgtInterface 1.5j4 :

- ora si imposta un context corrente anche per le API come per LUA
- il context corrente di LUA coincide con quello delle API.
This commit is contained in:
Dario Sassi
2014-10-15 15:31:00 +00:00
parent 3b1e139286
commit 46c5fce044
29 changed files with 594 additions and 528 deletions
+37 -13
View File
@@ -29,6 +29,7 @@ __stdcall EgtInitGeomDB( void)
// creo e recupero un contesto libero
int nGseCtx = CreateGseContext() ;
if ( nGseCtx == 0) {
ResetCurrGseContext() ;
LOG_ERROR( GetLogger(), "Error in CreateGseContext (" __FUNCTION__ ")")
return 0 ;
}
@@ -40,6 +41,8 @@ __stdcall EgtInitGeomDB( void)
pGseCtx->m_pGeomDB = Release( pGeomDB) ;
pGseCtx->m_pGeomDB->Init() ;
pGseCtx->m_pGeomDB->SetDefaultMaterial( pGseCtx->m_colDef) ;
// rendo corrente il contesto
SetCurrGseContext( nGseCtx) ;
// log avvio DB geometrico
string sLog = "GeomDB started " + ToString( nGseCtx) ;
LOG_INFO( GetLogger(), sLog.c_str())
@@ -49,9 +52,30 @@ __stdcall EgtInitGeomDB( void)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetDefaultMaterial( int nGseCtx, int nRed, int nGreen, int nBlue)
__stdcall EgtSetCurrentContext( int nGseCtx)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
return ( SetCurrGseContext( nGseCtx) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResetCurrentContext( void)
{
return ( ResetCurrGseContext() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetCurrentContext( void)
{
return GetIndCurrGseContext() ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetDefaultMaterial( int nRed, int nGreen, int nBlue)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, FALSE)
// imposto il materiale di default
pGseCtx->m_colDef.Set( nRed, nGreen, nBlue) ;
@@ -61,9 +85,9 @@ __stdcall EgtSetDefaultMaterial( int nGseCtx, int nRed, int nGreen, int nBlue)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtNewFile( int nGseCtx)
__stdcall EgtNewFile( void)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, FALSE)
// reinizializzazione (con pulizia) del DB geometrico
pGseCtx->m_pGeomDB->Init() ;
@@ -73,34 +97,34 @@ __stdcall EgtNewFile( int nGseCtx)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtOpenFile( int nGseCtx, const wchar_t* wsFilePath)
__stdcall EgtOpenFile( const wchar_t* wsFilePath)
{
return EgtOpenFile( nGseCtx, wstrztoA( wsFilePath)) ;
return EgtOpenFile( wstrztoA( wsFilePath)) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtOpenFile( int nGseCtx, const string& sFilePath)
__stdcall EgtOpenFile( const string& sFilePath)
{
// reinizializzazione (con pulizia) del DB geometrico
if ( ! EgtNewFile( nGseCtx))
if ( ! EgtNewFile())
return FALSE ;
// carico il file
return ( GetGeomDB( nGseCtx)->Load( sFilePath) ? TRUE : FALSE) ;
return ( GetCurrGeomDB()->Load( sFilePath) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSaveFile( int nGseCtx, const wchar_t* wsFilePath, int nFlag)
__stdcall EgtSaveFile( const wchar_t* wsFilePath, int nFlag)
{
return EgtSaveFile( nGseCtx, wstrztoA( wsFilePath), nFlag) ;
return EgtSaveFile( wstrztoA( wsFilePath), nFlag) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSaveFile( int nGseCtx, const string& sFilePath, int nFlag)
__stdcall EgtSaveFile( const string& sFilePath, int nFlag)
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
// salvo il file
return ( pGeomDB->Save( sFilePath, nFlag) ? TRUE : FALSE) ;