EgtInterface 1.5i1 :
- profondo riordinamento e modifica.
This commit is contained in:
+91
-34
@@ -34,20 +34,17 @@ static Color s_colDef = BLACK ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtSetLog( int nDebug, const wchar_t* sLogFile)
|
||||
__stdcall EgtInitGeomDB( void)
|
||||
{
|
||||
// creo il logger generale
|
||||
s_pLogGen = new Logger( ( nDebug > 0 ? LL_DEBUG : LL_INFO), "EgtInterface") ;
|
||||
if ( s_pLogGen == nullptr)
|
||||
// inizializzazioni DB geometrico
|
||||
s_pGeomDB = CreateGeomDB() ;
|
||||
if ( s_pGeomDB == nullptr)
|
||||
return 0 ;
|
||||
// assegno il file
|
||||
s_pLogGen->AddOutputStream( new ofstream( sLogFile), true) ;
|
||||
// lo passo alle DLL
|
||||
SetEGnLogger( s_pLogGen) ;
|
||||
SetENkLogger( s_pLogGen) ;
|
||||
SetEGkLogger( s_pLogGen) ;
|
||||
SetEExLogger( s_pLogGen) ;
|
||||
SetEGrLogger( s_pLogGen) ;
|
||||
s_pGeomDB->Init() ;
|
||||
s_pGeomDB->SetDefaultMaterial( s_colDef) ;
|
||||
|
||||
// log avvio DB geometrico
|
||||
LOG_INFO( s_pLogGen, "GeomDB started")
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
@@ -63,26 +60,13 @@ __stdcall EgtSetFont( const wchar_t* sNfeFontDir, const wchar_t* sDefaultFont)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtInit( HWND hWnd, int nDriver, int b2Buff, int nColorBits, int nDepthBits)
|
||||
__stdcall EgtInitScene( HWND hWnd, int nDriver, int b2Buff, int nColorBits, int nDepthBits)
|
||||
{
|
||||
// inizio programma
|
||||
LOG_DATETIME( s_pLogGen, " Init")
|
||||
// versione dell'interfaccia
|
||||
LOG_INFO( s_pLogGen, GetEInVersion())
|
||||
// versione delle librerie
|
||||
LOG_INFO( s_pLogGen, GetEGnVersion())
|
||||
LOG_INFO( s_pLogGen, GetENkVersion())
|
||||
LOG_INFO( s_pLogGen, GetEGkVersion())
|
||||
LOG_INFO( s_pLogGen, GetEExVersion())
|
||||
LOG_INFO( s_pLogGen, GetEGrVersion())
|
||||
|
||||
// inizializzazioni DB geometrico
|
||||
s_pGeomDB = CreateGeomDB() ;
|
||||
if ( s_pGeomDB == nullptr)
|
||||
// verifico GeomDB
|
||||
if ( s_pGeomDB == nullptr) {
|
||||
LOG_ERROR( s_pLogGen, "GeomDB invalid (EgtInitScene)")
|
||||
return 0 ;
|
||||
s_pGeomDB->Init() ;
|
||||
s_pGeomDB->SetDefaultMaterial( s_colDef) ;
|
||||
|
||||
}
|
||||
// inizializzazione scena OpenGL
|
||||
s_pScene = CreateEGrScene() ;
|
||||
if ( s_pScene == nullptr)
|
||||
@@ -108,6 +92,13 @@ __stdcall EgtInit( HWND hWnd, int nDriver, int b2Buff, int nColorBits, int nDept
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtInitTscExec( void)
|
||||
{
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtExit( void)
|
||||
@@ -197,7 +188,23 @@ __stdcall EgtOpenFile( const wchar_t* sFilePath)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtTestImportExt( const wchar_t* sFilePath)
|
||||
__stdcall EgtSaveFile( const wchar_t* sFilePath, int nFlag)
|
||||
{
|
||||
// verifico GeomDB
|
||||
if ( s_pGeomDB == nullptr) {
|
||||
LOG_ERROR( s_pLogGen, "GeomDB invalid (EgtSaveFile)")
|
||||
return 0 ;
|
||||
}
|
||||
// salvo il file
|
||||
if ( s_pGeomDB->Save( LPSTR( WtoA( sFilePath)), nFlag))
|
||||
return 1 ;
|
||||
else
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtGetFileType( const wchar_t* sFilePath)
|
||||
{
|
||||
// divido in nome e direttorio
|
||||
string sFileDir, sFileName ;
|
||||
@@ -208,10 +215,14 @@ __stdcall EgtTestImportExt( const wchar_t* sFilePath)
|
||||
SplitLast( sFileName, ".", sFileTitle, sFileExt) ;
|
||||
ToUpper( sFileExt) ;
|
||||
|
||||
if ( sFileExt == "DXF")
|
||||
if ( sFileExt == "NGE")
|
||||
return 1 ;
|
||||
else if ( sFileExt == "STL")
|
||||
else if ( sFileExt == "NFE")
|
||||
return 2 ;
|
||||
else if ( sFileExt == "DXF")
|
||||
return 11 ;
|
||||
else if ( sFileExt == "STL")
|
||||
return 12 ;
|
||||
else {
|
||||
// emetto info
|
||||
string sInfo = "File type (" + sFileExt + ") not recognized" ;
|
||||
@@ -271,6 +282,52 @@ __stdcall EgtImportStl( const wchar_t* sFilePath)
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtExportDxf( int nId, const wchar_t* sFilePath)
|
||||
{
|
||||
// verifico GeomDB
|
||||
if ( s_pGeomDB == nullptr) {
|
||||
LOG_ERROR( s_pLogGen, "GeomDB invalid (ImportFile)")
|
||||
return 0 ;
|
||||
}
|
||||
// esporto il file DXF
|
||||
// preparo l'esportatore
|
||||
PtrOwner<IExportDxf> pExpDxf( CreateExportDxf()) ;
|
||||
if ( IsNull( pExpDxf)) {
|
||||
LOG_ERROR( s_pLogGen, "Error : CreateExportDxf")
|
||||
return 0 ;
|
||||
}
|
||||
// eseguo l'esportazione
|
||||
if ( pExpDxf->Export( s_pGeomDB, nId, LPSTR( WtoA( sFilePath))))
|
||||
return 1 ;
|
||||
else
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtExportStl( int nId, const wchar_t* sFilePath)
|
||||
{
|
||||
// verifico GeomDB
|
||||
if ( s_pGeomDB == nullptr) {
|
||||
LOG_ERROR( s_pLogGen, "GeomDB invalid (ImportFile)")
|
||||
return 0 ;
|
||||
}
|
||||
// esporto il file STL
|
||||
// preparo l'esportatore
|
||||
PtrOwner<IExportStl> pExpStl( CreateExportStl()) ;
|
||||
if ( IsNull( pExpStl)) {
|
||||
LOG_ERROR( s_pLogGen, "Error : CreateExportStl")
|
||||
return 0 ;
|
||||
}
|
||||
// eseguo l'esportazione
|
||||
if ( pExpStl->Export( s_pGeomDB, nId, LPSTR( WtoA( sFilePath))))
|
||||
return 1 ;
|
||||
else
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtDraw( void)
|
||||
@@ -500,4 +557,4 @@ __stdcall EgtUnProject( int nWinX, int nWinY, double ptP[3])
|
||||
ptP[1] = ptWorld.y ;
|
||||
ptP[2] = ptWorld.z ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user