Files
EgtInterface/API_GeomDB.cpp
T
Dario Sassi 4eb99ab283 EgtInterface 2.2k6 :
- aggiunta interfaccia per funzione EgtSaveMachGroupToFile.
2020-11-30 08:27:31 +00:00

198 lines
5.9 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : API_GeomDB.cpp Data : 01.09.14 Versione : 1.5i1
// Contenuto : Funzioni DB geometrico per API.
//
//
//
// Modifiche : 01.09.14 DS Creazione modulo.
// 09.07.15 DS EgtInitGeomDB diventa EgtInitContext, aggiunta EgtDeleteContext.
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "API.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EgtStringConverter.h"
using namespace std ;
//-----------------------------------------------------------------------------
int
__stdcall EgtInitContext( void)
{
return ExeInitContext() ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtDeleteContext( int nGseCtx)
{
return ( ExeDeleteContext( nGseCtx) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetCurrentContext( int nGseCtx)
{
return ( ExeSetCurrentContext( nGseCtx) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResetCurrentContext( void)
{
return ( ExeResetCurrentContext() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetCurrentContext( void)
{
return ExeGetCurrentContext() ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetDefaultMaterial( const int vCol[4])
{
return ( ExeSetDefaultMaterial( vCol) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGridFrame( const double ptOrig[3], const double vX[3], const double vY[3], const double vZ[3])
{
// costruisco il riferimento
Frame3d frFrame ;
if ( ! frFrame.Set( ptOrig, vX, vY, vZ))
return FALSE ;
// imposto il riferimento della griglia
return ( ExeSetGridFrame( frFrame) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetGridFrame( double ptOrig[3], double vX[3], double vY[3], double vZ[3])
{
// recupero il riferimento della griglia
Frame3d frGrid ;
if ( ExeGetGridFrame( GDB_ID_ROOT, frGrid)) {
// assegno i valori di ritorno
VEC_FROM_3D( ptOrig, frGrid.Orig())
VEC_FROM_3D( vX, frGrid.VersX())
VEC_FROM_3D( vY, frGrid.VersY())
VEC_FROM_3D( vZ, frGrid.VersZ())
return TRUE ;
}
else
return FALSE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetCurrFilePath( const wchar_t* wsFilePath)
{
return ( ExeSetCurrFilePath( wstrztoA( wsFilePath)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCurrFilePath( wchar_t*& wsFilePath)
{
if ( &wsFilePath == nullptr)
return FALSE ;
string sFilePath ;
if ( ! ExeGetCurrFilePath( sFilePath))
return FALSE ;
wsFilePath = _wcsdup( stringtoW( sFilePath)) ;
return (( wsFilePath == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtEnableModified( void)
{
return ( ExeEnableModified() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtDisableModified( void)
{
return ( ExeDisableModified() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetEnableModified( void)
{
return ( ExeGetEnableModified() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetModified( void)
{
return ( ExeSetModified() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResetModified( void)
{
return ( ExeResetModified() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetModified( void)
{
return ( ExeGetModified() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtNewFile( void)
{
return ( ExeNewFile() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtOpenFile( const wchar_t* wsFilePath)
{
return ( ExeOpenFile( wstrztoA( wsFilePath)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtInsertFile( const wchar_t* wsFilePath)
{
return ( ExeInsertFile( wstrztoA( wsFilePath)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSaveFile( const wchar_t* wsFilePath, int nFlag)
{
return ( ExeSaveFile( wstrztoA( wsFilePath), nFlag) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSaveObjToFile( int nId, const wchar_t* wsFilePath, int nFlag)
{
return ( ExeSaveObjToFile( nId, wstrztoA( wsFilePath), nFlag) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSaveMachGroupToFile( int nMGroupId, const wchar_t* wsFilePath, int nFlag)
{
return ( ExeSaveMachGroupToFile( nMGroupId, wstrztoA( wsFilePath), nFlag) ? TRUE : FALSE) ;
}